/// <summary> /// 修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Modify(T_D_TASK_MSTModel model) { List <XMLDbHelper.Paramers> listParamters = new List <XMLDbHelper.Paramers>(); XMLDbHelper.FactoryDbHelper af = new XMLDbHelper.FactoryDbHelper(); DateTime sjc = af.GetDbDatetimestamp(); StringBuilder sBuilder = new StringBuilder(); sBuilder.Append("UPDATE T_D_TASK_MST SET "); sBuilder.Append("TASKNAME=:TASKNAME,"); sBuilder.Append("TASKNUMBER=:TASKNUMBER,"); sBuilder.Append("TASKDONUMBER=:TASKDONUMBER,"); sBuilder.Append("BEGINDATETIME=:BEGINDATETIME,"); sBuilder.Append("LASTDATETIME=:LASTDATETIME,"); sBuilder.Append("INTERVAL=:INTERVAL,"); sBuilder.Append("INTERVALTYPE=:INTERVALTYPE,"); sBuilder.Append("INTERVALADDTYPE=:INTERVALADDTYPE,"); sBuilder.Append("SFSC=:SFSC,"); sBuilder.Append("SFJY=:SFJY,"); sBuilder.Append("CJR=:CJR,"); sBuilder.Append("CJSJ=:CJSJ,"); sBuilder.Append("XGR=:XGR,"); sBuilder.Append("XGSJ=:XGSJ,"); sBuilder.Append("SJC=:SJC,"); sBuilder.Append("GROUPID=:GROUPID,"); sBuilder.Append("TASKDISCRIBE=:TASKDISCRIBE "); sBuilder.Append("WHERE ID=:ID "); OracleParameter[] oparams = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":TASKNAME", OracleType.VarChar), new OracleParameter(":TASKNUMBER", OracleType.Number), new OracleParameter(":TASKDONUMBER", OracleType.Number), new OracleParameter(":BEGINDATETIME", OracleType.VarChar), new OracleParameter(":LASTDATETIME", OracleType.VarChar), new OracleParameter(":INTERVAL", OracleType.Number), new OracleParameter(":INTERVALTYPE", OracleType.VarChar), new OracleParameter(":SFSC", OracleType.Number), new OracleParameter(":SFJY", OracleType.Number), new OracleParameter(":CJR", OracleType.VarChar), new OracleParameter(":CJSJ", OracleType.VarChar), new OracleParameter(":XGR", OracleType.VarChar), new OracleParameter(":XGSJ", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":TASKDISCRIBE", OracleType.VarChar), new OracleParameter(":INTERVALADDTYPE", OracleType.VarChar), new OracleParameter(":GROUPID", OracleType.VarChar), }; oparams[0].Value = model.ID; oparams[1].Value = model.TASKNAME; oparams[2].Value = model.TASKNUMBER; oparams[3].Value = model.TASKDONUMBER; oparams[4].Value = model.BEGINDATETIME; oparams[5].Value = model.LASTDATETIME; oparams[6].Value = model.INTERVAL; oparams[7].Value = model.INTERVALTYPE; oparams[8].Value = model.SFSC; oparams[9].Value = model.SFJY; oparams[10].Value = model.CJR; oparams[11].Value = model.CJSJ; oparams[12].Value = model.XGR; oparams[13].Value = sjc.ToString("yyyyMMddHHmmss"); //model.XGSJ; oparams[14].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); //model.SJC; oparams[15].Value = model.TASKDISCRIBE; oparams[16].Value = model.INTERVALADDTYPE; oparams[17].Value = model.GROUPID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams)); foreach (Model.T_D_TASK_SLVModel m in model.SlvList) { if (String.IsNullOrEmpty(m.ID)) { if (m.SFSC == 0) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("INSERT INTO T_D_TASK_SLV("); sBuilder.Append("ID,"); sBuilder.Append("MSTID,"); sBuilder.Append("SQLDATAID,"); sBuilder.Append("BL1,"); sBuilder.Append("BL2,"); sBuilder.Append("BL3,"); sBuilder.Append("SJC,"); sBuilder.Append("TASKTYPE,"); sBuilder.Append("OUTPUTTYPE,"); sBuilder.Append("OUTPUTPATH"); sBuilder.Append(") VALUES("); sBuilder.Append(":ID,"); sBuilder.Append(":MSTID,"); sBuilder.Append(":SQLDATAID,"); sBuilder.Append(":BL1,"); sBuilder.Append(":BL2,"); sBuilder.Append(":BL3,"); sBuilder.Append(":SJC,"); sBuilder.Append(":TASKTYPE,"); sBuilder.Append(":OUTPUTTYPE,"); sBuilder.Append(":OUTPUTPATH"); sBuilder.Append(")"); OracleParameter[] oparams1 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":MSTID", OracleType.VarChar), new OracleParameter(":SQLDATAID", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":TASKTYPE", OracleType.VarChar), new OracleParameter(":OUTPUTTYPE", OracleType.VarChar), new OracleParameter(":OUTPUTPATH", OracleType.VarChar) }; oparams1[0].Value = af.GetID(T_BASE_PUBLIC.UNITNAMEKEY, "T_D_TASK_SLV");//m.ID; oparams1[1].Value = model.ID; oparams1[2].Value = m.SQLDATAID; oparams1[3].Value = m.BL1; oparams1[4].Value = m.BL2; oparams1[5].Value = m.BL3; oparams1[6].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff");//m.SJC; oparams1[7].Value = m.TASKTYPE; oparams1[8].Value = m.OUTPUTTYPE; oparams1[9].Value = m.OUTPUTPATH; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams1)); foreach (Model.T_S_TASK_SLV_SLVModel mm in m.SlvList) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("INSERT INTO T_S_TASK_SLV_SLV("); sBuilder.Append("ID,"); sBuilder.Append("TASKSLVID,"); sBuilder.Append("SQLDATASLVID,"); sBuilder.Append("SQLDATASLVVAL,"); sBuilder.Append("BL1,"); sBuilder.Append("BL2,"); sBuilder.Append("BL3,"); sBuilder.Append("SJC,"); sBuilder.Append("SQLDARASLVNAME,"); sBuilder.Append("SQLDARASQLTYPE"); sBuilder.Append(") VALUES("); sBuilder.Append(":ID,"); sBuilder.Append(":TASKSLVID,"); sBuilder.Append(":SQLDATASLVID,"); sBuilder.Append(":SQLDATASLVVAL,"); sBuilder.Append(":BL1,"); sBuilder.Append(":BL2,"); sBuilder.Append(":BL3,"); sBuilder.Append(":SJC,"); sBuilder.Append(":SQLDARASLVNAME,"); sBuilder.Append(":SQLDARASQLTYPE"); sBuilder.Append(")"); OracleParameter[] oparams2 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":TASKSLVID", OracleType.VarChar), new OracleParameter(":SQLDATASLVID", OracleType.VarChar), new OracleParameter(":SQLDATASLVVAL", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":SQLDARASLVNAME", OracleType.VarChar), new OracleParameter(":SQLDARASQLTYPE", OracleType.VarChar) }; oparams2[0].Value = af.GetID(T_BASE_PUBLIC.UNITNAMEKEY, "T_S_TASK_SLV_SLV");//mm.ID; oparams2[1].Value = oparams1[0].Value; oparams2[2].Value = mm.SQLDATASLVID; oparams2[3].Value = mm.SQLDATASLVVAL; oparams2[4].Value = mm.BL1; oparams2[5].Value = mm.BL2; oparams2[6].Value = mm.BL3; oparams2[7].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff");//mm.SJC; oparams2[8].Value = mm.SQLDARASLVNAME; oparams2[9].Value = mm.SQLDARASQLTYPE; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams2)); } } } else { if (m.SFSC == 1) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("DELETE FROM T_D_TASK_SLV "); sBuilder.Append("WHERE ID=:ID "); OracleParameter[] oparams3 = { new OracleParameter(":ID", OracleType.VarChar) }; oparams3[0].Value = m.ID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams3)); sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("DELETE FROM T_S_TASK_SLV_SLV "); sBuilder.Append("WHERE TASKSLVID=:TASKSLVID "); OracleParameter[] oparams4 = { new OracleParameter(":TASKSLVID", OracleType.VarChar) }; oparams4[0].Value = m.ID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams4)); } else { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("UPDATE T_D_TASK_SLV SET "); sBuilder.Append("MSTID=:MSTID,"); sBuilder.Append("SQLDATAID=:SQLDATAID,"); sBuilder.Append("BL1=:BL1,"); sBuilder.Append("BL2=:BL2,"); sBuilder.Append("BL3=:BL3,"); sBuilder.Append("SJC=:SJC,"); sBuilder.Append("TASKTYPE=:TASKTYPE,"); sBuilder.Append("OUTPUTTYPE=:OUTPUTTYPE,"); sBuilder.Append("OUTPUTPATH=:OUTPUTPATH "); sBuilder.Append("WHERE ID=:ID "); OracleParameter[] oparams5 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":MSTID", OracleType.VarChar), new OracleParameter(":SQLDATAID", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":TASKTYPE", OracleType.VarChar), new OracleParameter(":OUTPUTTYPE", OracleType.VarChar), new OracleParameter(":OUTPUTPATH", OracleType.VarChar) }; oparams5[0].Value = m.ID; oparams5[1].Value = m.MSTID; oparams5[2].Value = m.SQLDATAID; oparams5[3].Value = m.BL1; oparams5[4].Value = m.BL2; oparams5[5].Value = m.BL3; oparams5[6].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff");//m.SJC; oparams5[7].Value = m.TASKTYPE; oparams5[8].Value = m.OUTPUTTYPE; oparams5[9].Value = m.OUTPUTPATH; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams5)); sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("DELETE FROM T_S_TASK_SLV_SLV "); sBuilder.Append("WHERE TASKSLVID=:TASKSLVID "); OracleParameter[] oparams6 = { new OracleParameter(":TASKSLVID", OracleType.VarChar) }; oparams6[0].Value = m.ID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams6)); foreach (Model.T_S_TASK_SLV_SLVModel mm in m.SlvList) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("INSERT INTO T_S_TASK_SLV_SLV("); sBuilder.Append("ID,"); sBuilder.Append("TASKSLVID,"); sBuilder.Append("SQLDATASLVID,"); sBuilder.Append("SQLDATASLVVAL,"); sBuilder.Append("BL1,"); sBuilder.Append("BL2,"); sBuilder.Append("BL3,"); sBuilder.Append("SJC,"); sBuilder.Append("SQLDARASLVNAME,"); sBuilder.Append("SQLDARASQLTYPE"); sBuilder.Append(") VALUES("); sBuilder.Append(":ID,"); sBuilder.Append(":TASKSLVID,"); sBuilder.Append(":SQLDATASLVID,"); sBuilder.Append(":SQLDATASLVVAL,"); sBuilder.Append(":BL1,"); sBuilder.Append(":BL2,"); sBuilder.Append(":BL3,"); sBuilder.Append(":SJC,"); sBuilder.Append(":SQLDARASLVNAME,"); sBuilder.Append(":SQLDARASQLTYPE"); sBuilder.Append(")"); OracleParameter[] oparams7 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":TASKSLVID", OracleType.VarChar), new OracleParameter(":SQLDATASLVID", OracleType.VarChar), new OracleParameter(":SQLDATASLVVAL", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":SQLDARASLVNAME", OracleType.VarChar), new OracleParameter(":SQLDARASQLTYPE", OracleType.VarChar) }; oparams7[0].Value = af.GetID(T_BASE_PUBLIC.UNITNAMEKEY, "T_S_TASK_SLV_SLV");//mm.ID; oparams7[1].Value = m.ID; oparams7[2].Value = mm.SQLDATASLVID; oparams7[3].Value = mm.SQLDATASLVVAL; oparams7[4].Value = mm.BL1; oparams7[5].Value = mm.BL2; oparams7[6].Value = mm.BL3; oparams7[7].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff");//mm.SJC; oparams7[8].Value = mm.SQLDARASLVNAME; oparams7[9].Value = mm.SQLDARASQLTYPE; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams7)); } } } } int ret = af.ExecuteNonQueryTransaction(listParamters); return(ret); }
/// <summary> /// 修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Modify(T_D_SQLDATA_MSTModel model) { List <XMLDbHelper.Paramers> listParamters = new List <XMLDbHelper.Paramers>(); XMLDbHelper.FactoryDbHelper af = new XMLDbHelper.FactoryDbHelper(); DateTime sjc = af.GetDbDatetimestamp(); StringBuilder sBuilder = new StringBuilder(); sBuilder.Append("UPDATE T_D_SQLDATA_MST SET "); sBuilder.Append("SJYID=:SJYID,"); sBuilder.Append("SQLDATANAME=:SQLDATANAME,"); sBuilder.Append("SQLDATADISCRIBE=:SQLDATADISCRIBE,"); sBuilder.Append("SQL=:SQL,"); sBuilder.Append("SQLTYPE=:SQLTYPE,"); sBuilder.Append("CJR=:CJR,"); sBuilder.Append("CJSJ=:CJSJ,"); sBuilder.Append("XGR=:XGR,"); sBuilder.Append("XGSJ=:XGSJ,"); sBuilder.Append("SJC=:SJC,"); sBuilder.Append("SFSC=:SFSC,"); sBuilder.Append("SFJY=:SFJY,"); sBuilder.Append("UNITTYPEID=:UNITTYPEID "); sBuilder.Append("WHERE ID=:ID "); OracleParameter[] oparams = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":SJYID", OracleType.VarChar), new OracleParameter(":SQLDATANAME", OracleType.VarChar), new OracleParameter(":SQLDATADISCRIBE", OracleType.VarChar), new OracleParameter(":SQL", OracleType.Clob), new OracleParameter(":SQLTYPE", OracleType.VarChar), new OracleParameter(":CJR", OracleType.VarChar), new OracleParameter(":CJSJ", OracleType.VarChar), new OracleParameter(":XGR", OracleType.VarChar), new OracleParameter(":XGSJ", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar), new OracleParameter(":SFSC", OracleType.Number), new OracleParameter(":SFJY", OracleType.Number), new OracleParameter(":UNITTYPEID", OracleType.VarChar) }; oparams[0].Value = model.ID; oparams[1].Value = model.SJYID; oparams[2].Value = model.SQLDATANAME; oparams[3].Value = model.SQLDATADISCRIBE; oparams[4].Value = model.SQL; oparams[5].Value = model.SQLTYPE; oparams[6].Value = model.CJR; oparams[7].Value = model.CJSJ; oparams[8].Value = model.XGR; oparams[9].Value = sjc.ToString("yyyyMMddHHmmss"); //model.XGSJ; oparams[10].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); //model.SJC; oparams[11].Value = model.SFSC; oparams[12].Value = model.SFJY; oparams[13].Value = model.UNITTYPEID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams)); foreach (T_D_SQLDATA_SLVModel m in model.SLVList) { if (String.IsNullOrEmpty(m.ID)) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("INSERT INTO T_D_SQLDATA_SLV("); sBuilder.Append("ID,"); sBuilder.Append("MSTID,"); sBuilder.Append("PARAMETERNAME,"); sBuilder.Append("PARAMETERTYPE,"); sBuilder.Append("PARAMETERDISC,"); sBuilder.Append("DEFAULTVALUE,"); sBuilder.Append("BL1,"); sBuilder.Append("BL2,"); sBuilder.Append("BL3,"); sBuilder.Append("SJC"); sBuilder.Append(") VALUES("); sBuilder.Append(":ID,"); sBuilder.Append(":MSTID,"); sBuilder.Append(":PARAMETERNAME,"); sBuilder.Append(":PARAMETERTYPE,"); sBuilder.Append(":PARAMETERDISC,"); sBuilder.Append(":DEFAULTVALUE,"); sBuilder.Append(":BL1,"); sBuilder.Append(":BL2,"); sBuilder.Append(":BL3,"); sBuilder.Append(":SJC"); sBuilder.Append(")"); OracleParameter[] oparams1 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":MSTID", OracleType.VarChar), new OracleParameter(":PARAMETERNAME", OracleType.VarChar), new OracleParameter(":PARAMETERTYPE", OracleType.VarChar), new OracleParameter(":PARAMETERDISC", OracleType.VarChar), new OracleParameter(":DEFAULTVALUE", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar) }; oparams1[0].Value = af.GetID(T_BASE_PUBLIC.UNITNAMEKEY, "T_D_SQLDATA_MST"); //model.ID; oparams1[1].Value = oparams[0].Value; //model.MSTID; oparams1[2].Value = m.PARAMETERNAME; //model.PARAMETERNAME; oparams1[3].Value = m.PARAMETERTYPE; //model.PARAMETERTYPE; oparams1[4].Value = m.PARAMETERDISC; //model.PARAMETERDISC; oparams1[5].Value = m.DEFAULTVALUE; //model.DEFAULTVALUE; oparams1[6].Value = m.BL1; //model.BL1; oparams1[7].Value = m.BL2; //model.BL2; oparams1[8].Value = m.BL3; //model.BL3; oparams1[9].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff"); //model.SJC; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams1)); } else { if (m.SFSC == 1) { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("DELETE FROM T_D_SQLDATA_SLV WHERE ID=:ID"); OracleParameter[] oparams2 = { new OracleParameter(":ID", OracleType.VarChar) }; oparams2[0].Value = m.ID; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams2)); } else { sBuilder.Remove(0, sBuilder.Length); sBuilder.Append("UPDATE T_D_SQLDATA_SLV SET "); sBuilder.Append("MSTID=:MSTID,"); sBuilder.Append("PARAMETERNAME=:PARAMETERNAME,"); sBuilder.Append("PARAMETERTYPE=:PARAMETERTYPE,"); sBuilder.Append("PARAMETERDISC=:PARAMETERDISC,"); sBuilder.Append("DEFAULTVALUE=:DEFAULTVALUE,"); sBuilder.Append("BL1=:BL1,"); sBuilder.Append("BL2=:BL2,"); sBuilder.Append("BL3=:BL3,"); sBuilder.Append("SJC=:SJC "); sBuilder.Append("WHERE ID=:ID "); OracleParameter[] oparams3 = { new OracleParameter(":ID", OracleType.VarChar), new OracleParameter(":MSTID", OracleType.VarChar), new OracleParameter(":PARAMETERNAME", OracleType.VarChar), new OracleParameter(":PARAMETERTYPE", OracleType.VarChar), new OracleParameter(":PARAMETERDISC", OracleType.VarChar), new OracleParameter(":DEFAULTVALUE", OracleType.VarChar), new OracleParameter(":BL1", OracleType.VarChar), new OracleParameter(":BL2", OracleType.VarChar), new OracleParameter(":BL3", OracleType.VarChar), new OracleParameter(":SJC", OracleType.VarChar) }; oparams3[0].Value = m.ID; oparams3[1].Value = m.MSTID; oparams3[2].Value = m.PARAMETERNAME; oparams3[3].Value = m.PARAMETERTYPE; oparams3[4].Value = m.PARAMETERDISC; oparams3[5].Value = m.DEFAULTVALUE; oparams3[6].Value = m.BL1; oparams3[7].Value = m.BL2; oparams3[8].Value = m.BL3; oparams3[9].Value = sjc.ToString("yyyy-MM-dd HH:mm:ss.ffffff");//m.SJC; listParamters.Add(new XMLDbHelper.Paramers(sBuilder.ToString(), oparams3)); } } } int ret = af.ExecuteNonQueryTransaction(listParamters); return(ret); }