protected void SaveTest(Repeater repeater)
{
string connstr = BLIT.DA.Common.DataBaseConnection.GetDBConnectoinStr();
using (OracleConnection conn = new OracleConnection(connstr))
{
conn.Open();
//主表插入语句
OracleDataAdapter oda = new OracleDataAdapter();
oda.SelectCommand = new OracleCommand(" select * from fdjh_zb where 1=2 " ,conn );
oda.InsertCommand = new OracleCommand(" insert into fdjh_zb (JHGUID,JHLX,DWBM,DWMC,SJDWBM,JHRQ,BSSJ,BSR,SFCS,ZT) "+
" values (:JHGUID,:JHLX,:DWBM,:DWMC,:SJDWBM,:JHRQ,:BSSJ,:BSR,:SFCS,:ZT)", conn);
oda.InsertCommand.Parameters.Add(":JHGUID", OracleType.VarChar, 40, "JHGUID");
oda.InsertCommand.Parameters.Add(":JHLX", OracleType.VarChar, 40, "JHLX");
oda.InsertCommand.Parameters.Add(":DWBM", OracleType.VarChar, 40, "DWBM");
oda.InsertCommand.Parameters.Add(":DWMC", OracleType.VarChar, 40, "DWMC");
oda.InsertCommand.Parameters.Add(":SJDWBM", OracleType.VarChar, 40, "SJDWBM");
oda.InsertCommand.Parameters.Add(":JHRQ", OracleType.VarChar, 40, "JHRQ");
oda.InsertCommand.Parameters.Add(":BSSJ", OracleType.DateTime, 40, "BSSJ");
oda.InsertCommand.Parameters.Add(":BSR", OracleType.VarChar, 40, "BSR");
oda.InsertCommand.Parameters.Add(":SFCS", OracleType.Int32, 40, "SFCS");
oda.InsertCommand.Parameters.Add(":ZT", OracleType.Int32, 40, "ZT");
oda.InsertCommand.UpdatedRowSource = UpdateRowSource.None;
oda.UpdateBatchSize = 0;
DataSet ds = new DataSet();
oda.Fill(ds);
//主表插入语句变量声明
string JHGUID = "";
string JHZQ = "";
string JHRQ = this.tbDate.Text;
string JHLX = "";
string DWBM = "";
string DWMC = "";
string SJDWBM = "";
DateTime BSSJ = DateTime.Now;
string BSR = "";
int SFCS = 0;
int ZT = 0;
for (int i = 0; i < repeater.Items.Count; i++)
{
//插入计划主表新记录
GridView gv = repeater.Items[i].FindControl("GridView1") as GridView;
string Orgcode = getLabelControl(gv, 0, "lbORGCODE").Text;
QX_ORGANIZATION QX_ORGANIZATION = QX_ORGANIZATION_bl.getByCode(Orgcode);
JHGUID = System.Guid.NewGuid().ToString("N");
JHZQ = this.RadioButtonList1.SelectedItem.Text;
DWBM = QX_ORGANIZATION.ORGCODE;
DWMC = QX_ORGANIZATION.ORGNAME;
SJDWBM = QX_ORGANIZATION.ADMINISTRATOR_ORG_CODE;
BSR = "";
switch (JHZQ)
{
case "日":
JHLX = "ZDDC-RJH";
break;
case "月":
JHLX = "ZDDC-YJH";
break;
case "年":
JHLX = "ZDDC-NJH";
break;
default:
break;
}
object[] row_zb = { JHGUID,JHLX,DWBM,DWMC,SJDWBM,JHRQ,BSSJ,BSR,SFCS,ZT };
ds.Tables[0].Rows.Add(row_zb);
}
//插入记录,回收资源
oda.Update(ds.Tables[0]);
ds.Tables[0].Clear();
ds.Dispose();
oda.Dispose();
conn.Close();
}
}