public static int InsertDScrapInfo(DScrapInfo Scrap, ref string a_strErr) { int intInsert = 0; int intUpdate = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = GSqlSentence.GetInsertInfoByD <DScrapInfo>(Scrap, "tk_DScrapInfo"); string strUpdate = "update tk_DevicsBas set state = '-1' where ECode = '" + Scrap.StrECode + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intUpdate); }
public static int UpdateLendAptitude(UCertificatLend Lend, ref string a_strErr) { int intInsert = 0; int intupdate = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_UCertificatLend set ReturnDate = '" + Lend.StrReturnDate + "' where ID = '" + Lend.StrID + "'"; string strUpdate = "update tk_UserAptitude set State = '0' where ID = '" + Lend.StrID + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intupdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intupdate); }
public static int UpdateDRepairInfo(DRepairInfo Repair, ref string a_strErr) { int intInsert = 0; int intUpdate = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_DRepairInfo set ServiceRecord = '" + Repair.StrServiceRecord + "',ServiceResults = '" + Repair.StrServiceResults + "',ReturnTime = '" + Repair.StrReturnTime + "',Remark = '" + Repair.StrRemark + "' where ECode = '" + Repair.StrECode + "'"; string strUpdate = "update tk_DevicsBas set state = '0' where ECode = '" + Repair.StrECode + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intUpdate); }
public static int UpdateUserAptitude(string ID, UserAptitude Uap, byte[] fileByte, ref string a_strErr) { int intInsert = 0; int intUpdate = 0; int intInsertHis = 0; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@fileByte", fileByte) }; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsertHis = "insert into tk_UserAptitudeHis (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit," + "LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate" + ") select UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit,LastCertificatDate," + "CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate from tk_UserAptitude where ID = '" + ID + "'"; string strInsert = "update tk_UserAptitude set BusinessType = '" + Uap.StrBusinessType + "',TecoName = '" + Uap.StrTecoName + "',TecoClass = '" + Uap.StrTecoClass + "'," + "GetTime = '" + Uap.StrGetTime + "',CertificatCode = '" + Uap.StrCertificatCode + "',CertificateName = '" + Uap.StrCertificateName + "',CertificateUnit = '" + Uap.StrCertificateUnit + "'," + "LastCertificatDate = '" + Uap.StrLastCertificatDate + "',CertificatDate = '" + Uap.StrCertificatDate + "',Remark = '" + Uap.StrRemark + "' where ID = '" + ID + "'"; string strUpdate = ""; if (Uap.StrFileName != null) { strUpdate = "update tk_UserAptitude set FileName = '" + Uap.StrFileName + "',FileInfo = @fileByte where ID = '" + ID + "'"; } try { if (strInsertHis != "") { intInsertHis = sqlTrans.ExecuteNonQuery(strInsertHis, CommandType.Text, null); } if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, para); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertApproval(string PID, string RelevanceID, string webkey, string folderBack, ref string a_strErr) { int intInsertBas = 0; int intUpdateBas = 0; int intLog = 0; Acc_Account account = GAccount.GetAccountInfo(); string createUser = account.UserID.ToString(); SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open(); string[] arr = folderBack.Split('/'); // BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/52/tk_PID/54/tk_UserLog string strInsertBas = "insert into [" + arr[0] + "].." + arr[1] + " (PID,RelevanceID,ApprovalContent,CreateUser,CreateTime,Validate,State,Job,ApprovalPersons,ApprovalLevel,AppType)" + " select '" + PID + "','" + RelevanceID + "','" + webkey + "','" + createUser + "','" + DateTime.Now + "','v','0',Duty,UserId,[Level],AppType from [BJOI_UM]..UM_Examine where BuType = '" + webkey + "'"; string strUpdateBas = ""; if (arr[2].IndexOf("..") > 0) { strUpdateBas = "update " + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','提交" + webkey + "审批操作','提交" + webkey + "审批成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "')"; try { if (strInsertBas != "") { intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } if (strUpdateBas != "") { intUpdateBas = sqlTrans.ExecuteNonQuery(strUpdateBas, CommandType.Text, null); } if (strInsertLog != "") { intLog = sqlTrans.ExecuteNonQuery(strInsertLog, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsertBas + intUpdateBas); }
public static int InsertUserAptitude(UserAptitude Uap, byte[] fileByte, ref string a_strErr) { int intInsert = 0; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@fileByte", fileByte) }; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); //string strInsert = GSqlSentence.GetInsertInfoByD<UserAptitude>(Uaptitude, "tk_UserAptitude"); string strInsert = "insert into tk_UserAptitude (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName," + "CertificateUnit,LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate) values (" + "'" + Uap.StrUserID + "','" + Uap.StrUserName + "','" + Uap.StrBusinessType + "','" + Uap.StrTecoName + "','" + Uap.StrTecoClass + "','" + Uap.StrGetTime + "'," + "'" + Uap.StrCertificatCode + "','" + Uap.StrCertificateName + "','" + Uap.StrCertificateUnit + "','" + Uap.StrLastCertificatDate + "','" + Uap.StrCertificatDate + "'," + "'" + Uap.StrFileName + "',@fileByte,'" + Uap.StrRemark + "','" + Uap.StrUnit + "','" + Uap.StrState + "','" + Uap.StrCreateTime + "','" + Uap.StrCreateUser + "','" + Uap.StrValidate + "')"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, para); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int DeleteContent(string xid, string type, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("MainProject"); string strInsertOrder = "update tk_ConfigContent set Validate = 'i' where XID = '" + xid + "' and Type = '" + type + "'"; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int DeleteRative(string id, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_RativeSource set Validate = 'i' where ID = '" + id + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int deleteFile(string id, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_UserAptitude set FileName = NULL,FileInfo = NULL where ID = '" + id + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
// 删除小组人员 public static int DeleteGroupUser(string uid, string gid, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strUpdateOrder = "update UM_Person set Validate = 'i' "; strUpdateOrder += " where GroupID = '" + gid + "' and UserID='" + uid + "' and validate='v' "; try { if (strUpdateOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strUpdateOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int UpdateDeviceBas(DevicsBas Bas, string ecode, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_DevicsBas set ControlCode = '" + Bas.StrControlCode + "',Ename = '" + Bas.StrEname + "',Manufacturer = '" + Bas.StrManufacturer + "'," + "FactoryNumber = '" + Bas.StrFactoryNumber + "',Specification = '" + Bas.StrSpecification + "',DevicsType = '" + Bas.StrDevicsType + "'," + "FactoryDate = '" + Bas.StrFactoryDate + "',TracingType = '" + Bas.StrTracingType + "',Precision = '" + Bas.StrPrecision + "'," + "Clrange = '" + Bas.StrClrange + "',CycleType = '" + Bas.StrCycleType + "',Cycle = '" + Bas.StrCycle + "'," + "CheckCompany = '" + Bas.StrCheckCompany + "',Remark = '" + Bas.StrRemark + "'" + " where ECode = '" + ecode + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
// 确认修改 小组人员 public static int ModifyGroupUser(string UserID, string Text, string GroupID, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strInsertOrder = "update UM_Person "; strInsertOrder += " set UserName = '******' where GroupID = '" + GroupID + "' and UserID='" + UserID + "' and Validate='v' "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
// 确认修改 public static int ModifyBasic(string XID, string Type, string Text, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("FlowMeterDBCnn"); string strInsertOrder = "update tk_ConfigContent "; strInsertOrder += " set Text = '" + Text + "' where XID = '" + XID + "' and Type = '" + Type + "' and validate='v' "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertRativeSource(RativeSource Rsource, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = GSqlSentence.GetInsertInfoByD <RativeSource>(Rsource, "tk_RativeSource"); try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int UpdateRativeSource(RativeSource Rsource, string id, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_RativeSource set RID = '" + Rsource.StrRID + "',EquipID = '" + Rsource.StrEquipID + "',ProModel = '" + Rsource.StrProModel + "'," + "Source = '" + Rsource.StrSource + "',Manufacturer = '" + Rsource.StrManufacturer + "',Nominal = '" + Rsource.StrNominal + "',SourceNumber = '" + Rsource.StrSourceNumber + "' where ID = '" + id + "'"; try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertCongTime(string checkWay, string num, string unit, string TimeType, ref string a_strErr) { int intdelete = 0; int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strSql = "select * from tk_ConfigWarnTime where Unit = '" + unit + "' and Type = '" + checkWay + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string strdelete = ""; if (dt.Rows.Count > 0) { strdelete = "delete from tk_ConfigWarnTime where Unit = '" + unit + "' and Type = '" + checkWay + "'"; } string strInsert = "Insert into tk_ConfigWarnTime (num,Type,TimeType,Unit) values ('" + num + "','" + checkWay + "','" + TimeType + "','" + unit + "')"; try { if (strdelete != "") { intdelete = sqlTrans.ExecuteNonQuery(strdelete, CommandType.Text, null); } if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertExamine(string Butype, string allcontent, ref string a_strErr) { int intInsertBas = 0; int intDelete = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open(); string[] arr = allcontent.Split('@'); string strDelete = "delete from [BJOI_UM]..UM_Examine where BuType = '" + Butype + "'"; string strInsertBas = ""; for (int i = 0; i < arr.Length; i++) { string[] brr = arr[i].Split('/'); strInsertBas += "insert into [BJOI_UM]..UM_Examine (Duty,UserId,BuType,[Level],AppType) values ('" + brr[1] + "','" + brr[0] + "','" + Butype + "','" + brr[2] + "','" + brr[3] + "')"; } try { if (strDelete != "") { intDelete = sqlTrans.ExecuteNonQuery(strDelete, CommandType.Text, null); } if (strInsertBas != "") { intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsertBas); }
// 确认新增小组人员 public static int InsertGroupUser(string text, string GroupID, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strSql = "select max(UserID) UserID from UM_Person where Validate='v' "; DataTable dt = SQLBase.FillTable(strSql, "AccountCnn"); string UserID = "U"; if (dt.Rows.Count > 0) { string strID = dt.Rows[0]["UserID"].ToString(); strID = strID.Substring(1, strID.Length - 1); int IDs = Convert.ToInt32(strID) + 1; int length = 7 - IDs.ToString().Length; for (int i = 0; i < length; i++) { UserID += "0"; } UserID += IDs.ToString(); } else { UserID = "U0000001"; } string strInsertOrder = "insert into UM_Person (UserID,UserName,GroupID,Validate) "; strInsertOrder += " values ('" + UserID + "','" + text + "','" + GroupID + "','v') "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertTemporary(string ProductName, string Spc, string Pid, string Num, string RelevanceID, string dataT, ref string a_strErr) { int intInsertBas = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open(); string[] arrName = ProductName.Split(','); string[] arrSpc = Spc.Split(','); string[] arrPid = Pid.Split(','); string[] arrNum = Num.Split(','); string strInsertBas = ""; for (int i = 0; i < arrName.Length; i++) { string DID = ""; if (i <= 9) { DID = RelevanceID + "-0" + (i + 1); } else { DID = RelevanceID + "-" + (i + 1); } strInsertBas += "insert into " + dataT + " (RWID,DID,OrderContent,SpecsModels,OrderUnit,OrderNum,DeliveryTime,State,PID) values ('" + RelevanceID + "','" + DID + "','" + arrName[i] + "'," + "'" + arrSpc[i] + "','个','" + arrNum[i] + "','" + DateTime.Now + "','0','" + arrPid[i] + "')"; } try { if (strInsertBas != "") { intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsertBas); }
// 确认新增小组 public static int InsertGroup(string text, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strSql = "select top 1 GroupID,DeptId from UM_Group where Validate='v' order by GroupID desc "; DataTable dt = SQLBase.FillTable(strSql, "AccountCnn"); int GroupID = 0; string DeptID = ""; if (dt.Rows.Count > 0) { GroupID = Convert.ToInt32(dt.Rows[0]["GroupID"].ToString()) + 1; DeptID = dt.Rows[0]["DeptId"].ToString(); } else { GroupID = 1; Acc_Account acc = GAccount.GetAccountInfo(); DeptID = acc.UnitID; } string strInsertOrder = "insert into UM_Group (GroupID,GroupName,DeptId,Validate) "; strInsertOrder += " values ('" + GroupID + "','" + text + "','" + DeptID + "','v') "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
// 确认新增 public static int InsertBasic(string type, string text, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("FlowMeterDBCnn"); string XID = PreGetTaskNo(type); string strSql = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "' and validate='v' "; DataTable dt = SQLBase.FillTable(strSql, "FlowMeterDBCnn"); string SID = ""; string TypeDesc = ""; if (dt.Rows.Count > 0) { SID = dt.Rows[0]["SID"].ToString(); SID = SID.Substring(0, SID.Length - 1); SID = SID + XID; TypeDesc = dt.Rows[0]["TypeDesc"].ToString(); } string strInsertOrder = "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate) "; strInsertOrder += " values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v') "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertContent(string type, string text, ref string a_strErr) { int intInsert = 0; int intContent = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string XID = PreGetTaskNo(type); string strSql = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string SID = ""; string TypeDesc = ""; Acc_Account acc = GAccount.GetAccountInfo(); if (dt.Rows.Count > 0) { SID = dt.Rows[0]["SID"].ToString(); SID = SID.Substring(0, SID.Length - 1); SID = SID + (Convert.ToInt32(XID) - 1).ToString(); TypeDesc = dt.Rows[0]["TypeDesc"].ToString(); } string strInsertOrder = ""; string strConte = ""; //在此处判断 if (type == "BusinessDistribute") { strInsertOrder += "insert into tk_BusinessDistribute (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "BillingWay") { strInsertOrder += "insert into tk_ConfigBillWay (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "CPZLZXBZ") { strInsertOrder += "insert into tk_ConfigQualityStandard (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "Relation") { strInsertOrder += "insert into tk_ConfigReation (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "ScaleType") { strInsertOrder += "insert into tk_ConfigScalType (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else { strInsertOrder += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } if (strConte != "") { intContent = sqlTrans.ExecuteNonQuery(strConte, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intContent); }
public static int UpdateContent(string xid, string type, string text, ref string a_strErr) { int intInsert = 0; int intUP = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsertOrder = ""; string strup = ""; //判断类型 if (type == "BusinessDistribute") { strInsertOrder += "update tk_BusinessDistribute set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; strup += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } else if (type == "BillingWay") { strInsertOrder += "update tk_ConfigBillWay set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; strup += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } else if (type == "CPZLZXBZ") { strInsertOrder += "update tk_ConfigQualityStandard set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; strup += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } else if (type == "Relation") { strInsertOrder += "update tk_ConfigReation set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; strup += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } else if (type == "ScaleType") { strInsertOrder += "update tk_ConfigScalType set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; strup += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } else { strInsertOrder += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'"; } try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } if (strup != "") { intUP = sqlTrans.ExecuteNonQuery(strup, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intUP); }
public static int UpdateDCheckInfo(DCheckInfo CheckInfo, string id, string num, ref string a_strErr) { int intInsert = 0; int intUpdate = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = "update tk_DCheckInfo set CheckDate = '" + CheckInfo.StrCheckDate + "',CheckWay = '" + CheckInfo.StrCheckWay + "',CheckCompany = '" + CheckInfo.StrCheckCompany + "',Charge = '" + CheckInfo.StrCharge + "'," + "Precision = '" + CheckInfo.StrPrecision + "',CensorshipRemark = '" + CheckInfo.StrCensorshipRemark + "',Principal = '" + CheckInfo.StrPrincipal + "',CalibrationResults = '" + CheckInfo.StrCalibrationResults + "' where ID = '" + id + "'"; string strUpdate = ""; if (num == "1") { DateTime CheckDate = Convert.ToDateTime(CheckInfo.StrCheckDate); DateTime PlanDate = new DateTime(); string strSql = ""; if (CheckInfo.StrCheckWay == "CK1") { strSql = "select CalibrationCycleType,CalibrationCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string CycelType = dt.Rows[0]["CalibrationCycleType"].ToString(); int Cycel = Convert.ToInt16(dt.Rows[0]["CalibrationCycle"]); if (CycelType == "Cy1") { PlanDate = CheckDate.AddYears(Cycel); } if (CycelType == "Cy2") { PlanDate = CheckDate.AddMonths(Cycel); } if (CycelType == "Cy3") { PlanDate = CheckDate.AddDays(Cycel); } if (CheckInfo.StrPrecision != null) { strUpdate = "update tk_DevicsBas set LastCalibrationDate = '" + CheckInfo.StrCheckDate + "',PlanCalibrationDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'"; } else { strUpdate = "update tk_DevicsBas set LastCalibrationDate = '" + CheckInfo.StrCheckDate + "',PlanCalibrationDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'"; } } if (CheckInfo.StrCheckWay == "CK2") { strSql = "select CheckCycleType,CheckCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string CycelType = dt.Rows[0]["CheckCycleType"].ToString(); int Cycel = Convert.ToInt16(dt.Rows[0]["CheckCycle"]); if (CycelType == "Cy1") { PlanDate = CheckDate.AddYears(Cycel); } if (CycelType == "Cy2") { PlanDate = CheckDate.AddMonths(Cycel); } if (CycelType == "Cy3") { PlanDate = CheckDate.AddDays(Cycel); } if (CheckInfo.StrPrecision != null) { strUpdate = "update tk_DevicsBas set LastCheckDate = '" + CheckInfo.StrCheckDate + "',PlanCheckDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'"; } else { strUpdate = "update tk_DevicsBas set LastCheckDate = '" + CheckInfo.StrCheckDate + "',PlanCheckDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'"; } } if (CheckInfo.StrCheckWay == "CK3") { strSql = "select TestCycleType,TestCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string CycelType = dt.Rows[0]["TestCycleType"].ToString(); int Cycel = Convert.ToInt16(dt.Rows[0]["TestCycle"]); if (CycelType == "Cy1") { PlanDate = CheckDate.AddYears(Cycel); } if (CycelType == "Cy2") { PlanDate = CheckDate.AddMonths(Cycel); } if (CycelType == "Cy3") { PlanDate = CheckDate.AddDays(Cycel); } if (CheckInfo.StrPrecision != null) { strUpdate = "update tk_DevicsBas set LastTestDate = '" + CheckInfo.StrCheckDate + "',PlanTestDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'"; } else { strUpdate = "update tk_DevicsBas set LastTestDate = '" + CheckInfo.StrCheckDate + "',PlanTestDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'"; } } } try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static int InsertDCheckInfo(DCheckInfo CheckInfo, ref string a_strErr) { int intInsert = 0; int intUpdate = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string strInsert = GSqlSentence.GetInsertInfoByD <DCheckInfo>(CheckInfo, "tk_DCheckInfo"); string strUpdate = ""; DateTime CheckDate = Convert.ToDateTime(CheckInfo.StrCheckDate); DateTime PlanDate = new DateTime(); string strSql = ""; strSql = "select CycleType,Cycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string CycelType = dt.Rows[0]["CycleType"].ToString(); int Cycel = Convert.ToInt16(dt.Rows[0]["Cycle"]); if (CycelType == "Cy1") { PlanDate = CheckDate.AddYears(Cycel); } if (CycelType == "Cy2") { PlanDate = CheckDate.AddMonths(Cycel); } if (CycelType == "Cy3") { PlanDate = CheckDate.AddDays(Cycel); } if (CheckInfo.StrPrecision != null) { strUpdate = "update tk_DevicsBas set LastDate = '" + CheckInfo.StrCheckDate + "',PlanDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'"; } else { strUpdate = "update tk_DevicsBas set LastDate = '" + CheckInfo.StrCheckDate + "',PlanDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'"; } try { if (strInsert != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null); } if (strUpdate != "") { intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intUpdate); }