/// <summary> /// 根据ID删除被检单位 /// </summary> /// <param name="ID"></param> /// <param name="sErrMsg"></param> /// <returns></returns> public int DeleteByID(int ID, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string deleteSql = string.Format("DELETE FROM tCompany WHERE ID={0}", ID); DataBase.ExecuteCommand(deleteSql, out sErrMsg); rtn = 1; } catch (Exception e) { sErrMsg = e.Message;; } return(rtn); }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string deleteSql = string.Format("DELETE FROM tcheckcomtype WHERE ID={0}", mainkey); DataBase.ExecuteCommand(deleteSql, out sErrMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("通过主键删除clsCheckType",e); sErrMsg = e.Message;; } return(rtn); }
public int UpdateTask(string where, string data, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.AppendFormat("UPDATE KTask SET mokuai='{0}'", data); sb.AppendFormat(" where tid='{0}'", where); DataBase.ExecuteCommand(sb.ToString(), out errMsg); rtn = 1; } catch (Exception ex) { errMsg = ex.Message; } return(rtn); }
/// <summary> /// 部分修改保存 /// </summary> /// <param name="model">对象clsUserUnit的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsUserUnit model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append(" UPDATE tUserUnit SET "); sb.AppendFormat(" StdCode='{0}'", model.StdCode); sb.AppendFormat(",CompanyID='{0}'", model.CompanyID); sb.AppendFormat(",FullName='{0}'", model.FullName); sb.AppendFormat(",ShortName='{0}'", model.ShortName); sb.AppendFormat(",DisplayName='{0}'", model.DisplayName); sb.AppendFormat(",ShortCut='{0}'", model.ShortCut); sb.AppendFormat(",DistrictCode='{0}'", model.DistrictCode); sb.AppendFormat(",PostCode='{0}'", model.PostCode); sb.AppendFormat(",Address='{0}'", model.Address); sb.AppendFormat(",LinkMan='{0}'", model.LinkMan); sb.AppendFormat(",LinkInfo='{0}'", model.LinkInfo); sb.AppendFormat(",WWWInfo='{0}'", model.WWWInfo); sb.Append(",IsReadOnly="); sb.Append(model.IsReadOnly); sb.Append(",IsLock="); sb.Append(model.IsLock); sb.AppendFormat(",Remark='{0}'", model.Remark); sb.AppendFormat(" WHERE SysCode='{0}'", model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsUserUnit",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsCheckComType model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("INSERT INTO tcheckcomtype(TypeName,NameCall,AreaCall,VerType,IsReadOnly,IsLock,ComKind,AreaTitle,NameTitle,DomainTitle,SampleTitle)VALUES('"); sb.Append(model.TypeName); sb.Append("','"); sb.Append(model.NameCall); sb.Append("','"); sb.Append(model.AreaCall); sb.Append("','"); sb.Append(model.VerType); sb.Append("',"); sb.Append(model.IsReadOnly); sb.Append(","); sb.Append(model.IsLock); sb.Append(",'"); sb.Append(model.ComKind); sb.Append("','"); sb.Append(model.AreaTitle); sb.Append("','"); sb.Append(model.NameTitle); sb.Append("','"); sb.Append(model.DomainTitle); sb.Append("','"); sb.Append(model.SampleTitle); sb.Append("')"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("添加clsCheckType",e); errMsg = e.Message; } return(rtn); }
public int UpdateSendFlag(string sOldCode, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string updateSql = "update tStockRecord set IsSended = true,SentDate='" + System.DateTime.Today.ToString() + "' Where SysCode='" + sOldCode + "'"; DataBase.ExecuteCommand(updateSql, out sErrMsg); rtn = 1; } catch (Exception e) { sErrMsg = e.Message; } return(rtn); }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { string deleteSql = "DELETE FROM TDISTRICT WHERE SYSCODE='" + mainkey + "' "; DataBase.ExecuteCommand(deleteSql, out errMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("通过主键删除clsDistrict",e); errMsg = e.Message;; } return(rtn); }
/// <summary> /// 更新重传标志 /// </summary> /// <param name="sysCode"></param> /// <param name="errMsg"></param> /// <returns></returns> public static bool ExeReSend(string sysCode, out string errMsg) { errMsg = string.Empty; bool rtn = false; try { string querySql = string.Format("UPDATE TRESULT SET ISSENDED=FALSE,SENDER=NULL,SENDEDDATE=NULL,ISRESENDED=TRUE WHERE ISSENDED=TRUE AND SYSCODE='{0}' ", sysCode); bool obj = DataBase.ExecuteCommand(querySql, out errMsg); rtn = obj; } catch (Exception e) { //Log.WriteLog("更新clsResult",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 更新IsSupport字段数据 /// </summary> /// <param name="sErrMsg"></param> /// <returns></returns> public static int UpdateIsSupport(out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string updateSql = "update tMachine set IsSupport=False"; DataBase.ExecuteCommand(updateSql, out sErrMsg); rtn = 1; } catch (Exception e) { sErrMsg = e.Message; } return(rtn); }
/// <summary> /// 部分修改保存 /// </summary> /// <param name="model">对象clsProduceArea的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsProduceArea model, int lev, out string errMsg) { sb.Length = 0; errMsg = string.Empty; int rtn = 0; try { sb.Append("UPDATE TPRODUCEAREA SET "); sb.AppendFormat("StdCode='{0}',", model.StdCode); sb.AppendFormat("Name='{0}',", model.Name); sb.AppendFormat("ShortCut='{0}',", model.ShortCut); sb.AppendFormat("DistrictIndex={0},", model.DistrictIndex); sb.AppendFormat("CheckLevel='{0}',", model.CheckLevel); sb.AppendFormat("IsLocal={0},", model.IsLocal); sb.AppendFormat("IsReadOnly={0},", model.IsReadOnly); sb.AppendFormat("IsLock={0},", model.IsLock); sb.AppendFormat("Remark='{0}'", model.Remark); sb.AppendFormat(" WHERE SysCode='{0}'", model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; if (model.IsLocal) { sb.Append("UPDATE TPRODUCEAREA SET"); sb.AppendFormat(" IsLocal={0}", model.IsLocal); sb.AppendFormat(" WHERE SYSCODE LIKE '{0}%'", model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; } rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsProduceArea",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { string deleteSql = string.Format("DELETE FROM tTask WHERE CPCODE='{0}' ", mainkey); DataBase.ExecuteCommand(deleteSql, out errMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("通过主键删除clsTask",e); errMsg = e.Message;; } return(rtn); }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.AppendFormat("DELETE FROM TPRODUCEAREA WHERE SYSCODE='{0}'", mainkey); DataBase.ExecuteCommand(sb.ToString(), out errMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("通过主键删除clsProduceArea",e); errMsg = e.Message;; } return(rtn); }
/// <summary> /// 重传 /// </summary> /// <param name="strWhere"></param> /// <param name="errMsg"></param> /// <returns></returns> public static bool ExeAllReSend(string strWhere, out string errMsg) { errMsg = string.Empty; bool rtn = false; try { StringBuilder sb = new StringBuilder(); sb.Append("SELECT A.SysCode, A.CheckNo,A.CheckPlanCode, A.CheckedCompany, A.CheckedCompanyName"); sb.Append(",A.CheckedComDis, A.UpperCompany,A.UpperCompanyName,A.FoodCode, A.FoodName, A.CheckType"); sb.Append(", A.SampleModel, A.SampleLevel, A.SampleState, A.Provider, A.StdCode, A.OrCheckNo, A.ProduceCompany"); sb.Append(", A.ProduceCompanyName,A.ProducePlace,A.ProducePlaceName, A.ProduceDate, A.ImportNum,A.SaleNum"); sb.Append(", A.SaveNum, A.Price,A.Unit, A.SampleNum, A.SampleBaseNum, A.SampleUnit, A.SentCompany"); sb.Append(", A.Remark,A.CheckederVal,A.CheckederRemark,A.Notes, A.TakeDate, A.OrganizerName, A.CheckTotalItem"); sb.Append(", A.CheckTotalItemName, A.Standard, A.StandardName, A.CheckValueInfo,A.ResultInfo,A.StandValue,A.SampleCode"); sb.Append(", A.Result,A.IsSentCheck, A.CheckStartDate, A.Checker, A.CheckerName, A.Assessor, A.AssessorName"); sb.Append(", A.CheckUnitCode, A.CheckUnitName,A.ResultType, A.MachineName,A.IsSended, A.SendedDate, A.Sender"); sb.Append(", P.Name AS SenderName,A.IsReSended, A.CheckPlaceCode, A.CheckPlace, A.CheckEndDate, A.CheckMachine"); sb.Append(", A.Organizer "); sb.Append(" FROM [SELECT T11.*,O.ItemDes AS CheckTotalItemName FROM (SELECT T10.*,S.StdDes AS StandardName FROM (SELECT T8.*,Q.Name As ProducePlaceName FROM (SELECT T6.*,N.Name AS OrganizerName FROM (SELECT T5.*,M.Name As AssessorName FROM (SELECT T4.*,L.FullName As ProduceCompanyName FROM (SELECT T3.*,K.MachineName FROM (SELECT T2.*,J.Name AS CheckPlace FROM (SELECT C.*, B.Name AS FoodName, H.FullName AS CheckUnitName, I.Name AS CheckerName FROM tResult AS C, tFoodClass AS B, tUserUnit AS H, tUserInfo AS I WHERE C.FoodCode=B.SysCode And C.CheckUnitCode=H.SysCode And C.Checker=I.UserCode) As T2 Left Join tDistrict As J On T2.CheckPlaceCode =J.SysCode) As T3 Left Join tMachine As K On T3.CheckMachine=K.SysCode) As T4 Left Join tCompany As L On T4.ProduceCompany=L.SysCode) As T5 Left Join tUserInfo As M On T5.Assessor=M.UserCode) As T6 Left Join tUserInfo As N On T6.Organizer=N.UserCode) As T8 Left Join tProduceArea As Q On T8.ProducePlace=Q.SysCode) As T10 Left Join tStandard As S On T10.Standard=S.SysCode) As T11 LEFT JOIN tCheckItem As O On T11.CheckTotalItem=O.SysCode]. AS A LEFT JOIN tUserInfo AS P ON A.Sender=P.UserCode"); if (!strWhere.Equals(string.Empty)) { sb.Append(" WHERE A.ISSENDED=TRUE AND "); sb.Append(strWhere); } string querySql = string.Format("UPDATE tResult SET ISSENDED=FALSE,SENDER=NULL,SENDEDDATE=NULL,ISRESENDED=TRUE WHERE SYSCODE IN (SELECT SysCode FROM ({0}) AS NewTable) ", sb.ToString()); bool obj = DataBase.ExecuteCommand(querySql, out errMsg); sb.Length = 0; rtn = obj; } catch (Exception e) { //Log.WriteLog("更新clsResult",e); errMsg = e.Message; } return(rtn); }
public static void DelCheckItem(string code, string checkcode, out string sErrMsg) { try { string pattern = @"({" + checkcode + @":[\S\t]*?})"; Regex r = new Regex(pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase); string strResult = string.Empty; string sql = string.Format("SELECT CheckItemCodes From tFoodClass Where SysCode='{0}'", code); Object obj = DataBase.GetOneValue(sql, out sErrMsg); if (obj != null) { strResult = r.Replace(obj.ToString(), string.Empty); sql = string.Format("UPDATE tFoodClass Set CheckItemCodes='{0}' Where SysCode='{1}'", strResult, code); DataBase.ExecuteCommand(sql, out sErrMsg); } } catch (Exception e) { sErrMsg = e.Message; } }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string deleteSql = "delete from tStockRecord" + " where SysCode='" + mainkey + "' "; DataBase.ExecuteCommand(deleteSql, out sErrMsg); rtn = 1; } catch (Exception e) { // Log.WriteLog("通过主键删除tStockRecord",e); sErrMsg = e.Message;; } return(rtn); }
/// <summary> /// 根据主键编号删除记录 /// </summary> /// <param name="%pkname%">主键编号</param> /// <returns></returns> public int DeleteByPrimaryKey(string mainkey, out string errMsg) { errMsg = string.Empty; int rtn = 0; sb.Length = 0; try { sb.AppendFormat("DELETE FROM tResult WHERE SysCode='{0}'", mainkey); DataBase.ExecuteCommand(sb.ToString(), out errMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("通过主键删除clsResult",e); errMsg = e.Message;; } return(rtn); }
/// <summary> /// 下载|更新 检测项目 /// </summary> /// <param name="model">clsCheckItem</param> /// <param name="errMsg"></param> /// <returns></returns> public int InsertOrUpdate(clsCheckItem model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; DataTable dt = this.GetAsDataTable("SysCode Like '" + model.SysCode + "'", string.Empty, 8); if (dt != null && dt.Rows.Count > 0) { sb.Length = 0; sb.AppendFormat("Update tCheckItem Set StdCode='{0}',ItemDes='{1}',CheckType='{2}',StandardCode='{3}',StandardValue='{4}',", model.StdCode, model.ItemDes, model.CheckType, model.StandardCode, model.StandardValue); sb.AppendFormat("Unit='{0}',DemarcateInfo='{1}',TestValue='{2}',OperateHelp='{3}',CheckLevel='{4}',", model.Unit, model.DemarcateInfo, model.TestValue, model.OperateHelp, model.CheckLevel); sb.AppendFormat("IsReadOnly={0},IsLock={1},Remark='{2}',UDate='{3}' Where SysCode='{4}'", model.IsReadOnly, model.IsLock, model.Remark, model.UDate, model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); } else { sb.Length = 0; sb.Append("Insert Into tCheckItem"); sb.Append(" (SysCode,StdCode,ItemDes,CheckType,StandardCode,StandardValue,Unit,DemarcateInfo,TestValue,OperateHelp,CheckLevel,IsLock,IsReadOnly,Remark,UDate) Values("); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.SysCode, model.StdCode, model.ItemDes, model.CheckType, model.StandardCode); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.StandardValue, model.Unit, model.DemarcateInfo, model.TestValue, model.OperateHelp); sb.AppendFormat("'{0}',{1},{2},'{3}','{4}'", model.CheckLevel, model.IsLock, model.IsReadOnly, model.Remark, model.UDate); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); } sb.Length = 0; rtn = 1; } catch (Exception e) { errMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsCheckItem model, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; sb.Length = 0; try { sb.Append("INSERT INTO tCheckItem"); sb.Append("(SysCode,StdCode,ItemDes,CheckType,StandardCode,StandardValue,Unit,"); sb.Append("DemarcateInfo,TestValue,OperateHelp,CheckLevel,IsReadOnly,IsLock,Remark)"); sb.Append(" VALUES("); sb.AppendFormat("'{0}',", model.SysCode); sb.AppendFormat("'{0}',", model.StdCode); sb.AppendFormat("'{0}',", model.ItemDes); sb.AppendFormat("'{0}',", model.CheckType); sb.AppendFormat("'{0}',", model.StandardCode); sb.AppendFormat("'{0}',", model.StandardValue); sb.AppendFormat("'{0}',", model.Unit); sb.AppendFormat("'{0}',", model.DemarcateInfo); sb.AppendFormat("'{0}',", model.TestValue); sb.AppendFormat("'{0}',", model.OperateHelp); sb.AppendFormat("'{0}',", model.CheckLevel); sb.AppendFormat("{0},", model.IsReadOnly); sb.AppendFormat("{0},", model.IsLock); sb.AppendFormat("'{0}'", model.Remark); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out sErrMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("添加clsCheckItem",e); sErrMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="OprObject"></param> /// <returns></returns> public int Insert(clsSaleRecord OprObject, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string insertSql = "insert into tSaleRecord(SysCode,StdCode,CompanyID,CompanyName,DisplayName,SaleDate,FoodID,FoodName,Model,SaleNumber,Price,Unit,PurchaserID,PurchaserName,LinkInfo,LinkMan,MakeMan,Remark,DistrictCode)" + " values('" + OprObject.SysCode + "','" + OprObject.StdCode + "','" + OprObject.CompanyID + "','" + OprObject.CompanyName + "','" + OprObject.DisplayName + "','" + OprObject.SaleDate + "','" + OprObject.FoodID + "','" + OprObject.FoodName + "','" + OprObject.Model + "'," + OprObject.SaleNumber + "," + OprObject.Price + ",'" + OprObject.Unit + "','" + OprObject.PurchaserID + "','" + OprObject.PurchaserName + "','" + OprObject.LinkInfo + "','" + OprObject.LinkMan + "','" + OprObject.MakeMan + "','" + OprObject.Remark + "','" + OprObject.DistrictCode + "')"; DataBase.ExecuteCommand(insertSql, out sErrMsg); rtn = 1; } catch (Exception e) { // Log.WriteLog("添加tSaleRecord",e); sErrMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsStandard model, out string errMsg) { errMsg = string.Empty; int rtn = 0; sb.Length = 0; try { sb.Append("INSERT INTO tStandard(SysCode,StdCode,StdDes,ShortCut,StdInfo,StdType,IsReadOnly,IsLock,Remark)VALUES("); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}',{6},{7},'{8}'", model.SysCode, model.StdCode, model.StdDes, model.ShortCut, model.StdInfo, model.StdType, model.IsReadOnly, model.IsLock, model.Remark); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("添加clsStandard",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 删除操作 tTask /// </summary> /// <param name="whereSql"></param> /// <param name="errMsg"></param> /// <returns></returns> public int Delete(string whereSql, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { string deleteSql = "DELETE FROM tTask"; if (!whereSql.Equals(string.Empty)) { deleteSql += string.Format(" WHERE {0} ", whereSql); } DataBase.ExecuteCommand(deleteSql, out errMsg); rtn = 1; } catch (Exception e) { errMsg = e.Message; } return(rtn); }
/// <summary> /// 部分修改保存 /// </summary> /// <param name="OprObject">对象clsSaleRecord的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsSaleRecord OprObject, string sOldCode, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string updateSql = "update tSaleRecord set " + "StdCode='" + OprObject.StdCode + "'," + "CompanyID='" + OprObject.CompanyID + "'," + "CompanyName='" + OprObject.CompanyName + "'," + "DisplayName='" + OprObject.DisplayName + "'," + "SaleDate='" + OprObject.SaleDate + "'," + "FoodID='" + OprObject.FoodID + "'," + "FoodName='" + OprObject.FoodName + "'," + "Model='" + OprObject.Model + "'," + "SaleNumber=" + OprObject.SaleNumber + "," + "Price=" + OprObject.Price + "," + "Unit='" + OprObject.Unit + "'," + "PurchaserID='" + OprObject.PurchaserID + "'," + "PurchaserName='" + OprObject.PurchaserName + "'," + "LinkInfo='" + OprObject.LinkInfo + "'," + "LinkMan='" + OprObject.LinkMan + "'," + "MakeMan='" + OprObject.MakeMan + "'," + "Remark='" + OprObject.Remark + "', " + "DistrictCode='" + OprObject.DistrictCode + "' " + " where SysCode='" + sOldCode + "' "; DataBase.ExecuteCommand(updateSql, out sErrMsg); rtn = 1; } catch (Exception e) { // Log.WriteLog("更新tSaleRecord",e); sErrMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsTask model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("Insert Into tTask"); sb.Append("(CPCODE,CPTITLE,CPSDATE,CPEDATE,CPTPROPERTY,CPFROM,CPEDITOR"); sb.Append(",CPPORGID,CPPORG,CPEDDATE,CPMEMO,PLANDETAIL,BAOJINGTIME,PLANDCOUNT)"); sb.Append("VALUES("); sb.AppendFormat("'{0}',", model.CPCODE); sb.AppendFormat("'{0}',", model.CPTITLE); sb.AppendFormat("'{0}',", model.CPSDATE); sb.AppendFormat("'{0}',", model.CPEDATE); sb.AppendFormat("'{0}',", model.CPTPROPERTY); sb.AppendFormat("'{0}',", model.CPFROM); sb.AppendFormat("'{0}',", model.CPEDITOR); sb.AppendFormat("'{0}',", model.CPPORGID); sb.AppendFormat("'{0}',", model.CPPORG); sb.AppendFormat("'{0}',", model.CPEDDATE); sb.AppendFormat("'{0}',", model.CPMEMO); sb.AppendFormat("'{0}',", model.PLANDETAIL); sb.AppendFormat("'{0}',", model.BAOJINGTIME); sb.AppendFormat("'{0}'", model.PLANDCOUNT); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { errMsg = e.Message; } return(rtn); }
/// <summary> /// 部分修改保存 /// </summary> /// <param name="model">对象clsCheckType的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsCheckType model, string sName, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("UPDATE TCHECKTYPE SET "); sb.AppendFormat("Name='{0}',", model.Name); sb.AppendFormat("IsReadOnly={0},", model.IsReadOnly); sb.AppendFormat("IsLock={0},", model.IsLock); sb.AppendFormat("Remark='{0}'", model.Remark); sb.AppendFormat(" WHERE Name='{0}'", sName); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; //更新相关表 //updateSql="update tCheckItem set " // + "CheckType='" + OprObject.Name + "'" // + " where CheckType='" + sName + "' "; //DataBase.ExecuteCommand(updateSql,out sErrMsg); //updateSql="update tresult set " // + "CheckType='" + OprObject.Name + "'" // + " where CheckType='" + sName + "' "; //DataBase.ExecuteCommand(updateSql,out sErrMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsCheckType",e); errMsg = e.Message; } return(rtn); }
public int Delete(string whereSql, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string deleteSql = "delete from tFss_Result"; if (!whereSql.Equals(string.Empty)) { deleteSql += " where " + whereSql; } DataBase.ExecuteCommand(Conncentstr, deleteSql, out sErrMsg); rtn = 1; } catch (Exception e) { sErrMsg = e.Message;; } return(rtn); }
/// <summary> /// 下载检测标准 /// </summary> /// <param name="model"></param> /// <param name="errMsg"></param> /// <returns></returns> public int InsertOrUpdate(clsStandard model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; DataTable dt = this.GetAsDataTable("SysCode Like '" + model.SysCode + "'", string.Empty, 9); if (dt != null && dt.Rows.Count > 0) { sb.Length = 0; sb.AppendFormat("Update tStandard Set StdCode='{0}',StdDes='{1}',ShortCut='{2}',StdInfo='{3}',StdType='{4}',", model.StdCode, model.StdDes, model.ShortCut, model.StdInfo, model.StdType); sb.AppendFormat("IsReadOnly={0},IsLock={1},Remark='{2}',UDate='{3}' Where SysCode='{4}'", model.IsLock, model.IsReadOnly, model.Remark, model.UDate, model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); } else { sb.Length = 0; sb.Append("Insert Into tStandard"); sb.Append(" (SysCode,StdCode,StdDes,ShortCut,StdInfo,StdType,IsLock,IsReadOnly,Remark,UDate) Values("); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}',", model.SysCode, model.StdCode, model.StdDes, model.ShortCut, model.StdInfo); sb.AppendFormat("'{0}',{1},{2},'{3}','{4}'", model.StdType, model.IsLock, model.IsReadOnly, model.Remark, model.UDate); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); } sb.Length = 0; rtn = 1; } catch (Exception e) { errMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsFoodClass model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("INSERT INTO TFOODCLASS"); sb.Append("(SysCode,StdCode,Name,ShortCut,CheckLevel,CheckItemCodes"); sb.Append(",CheckItemValue,IsReadOnly,IsLock,Remark,FoodProperty)"); sb.Append("VALUES("); sb.AppendFormat("'{0}',", model.SysCode); sb.AppendFormat("'{0}',", model.StdCode); sb.AppendFormat("'{0}',", model.Name); sb.AppendFormat("'{0}',", model.ShortCut); sb.AppendFormat("'{0}',", model.CheckLevel); sb.AppendFormat("'{0}',", model.CheckItemCodes); sb.AppendFormat("'{0}',", model.CheckItemValue); sb.AppendFormat("{0},", model.IsReadOnly); sb.AppendFormat("{0},", model.IsLock); sb.AppendFormat("'{0}',", model.Remark); sb.AppendFormat("'{0}'", model.FoodProperty); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("添加clsFoodClass",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 部分修改保存 /// </summary> /// <param name="OprObject">对象clsSysOpt的一个实例参数</param> /// <returns></returns> public int Update(string setSql, string whereSql, out string errMsg) { errMsg = string.Empty; int rtn = 0; if (string.IsNullOrEmpty(setSql)) // if (setSql == null || setSql.Equals(string.Empty)) { errMsg = "参数有误!"; return(-1); } try { sb.Length = 0; sb.Append("UPDATE tSysOpt SET "); sb.Append(setSql); //string updateSql = "update tSysOpt set " + setSql; if (!whereSql.Equals(string.Empty)) { sb.Append(" WHERE "); sb.Append(whereSql); //updateSql += " where " + whereSql; } DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsSysOpt",e); errMsg = e.Message; } return(rtn); }
public int Delete(string whereSql, out string sErrMsg) { sErrMsg = string.Empty; int rtn = 0; try { string deleteSql = "delete from tResult"; if (!whereSql.Equals(string.Empty)) { deleteSql += " where " + whereSql; } DataBase.ExecuteCommand(fullFileName, deleteSql, out sErrMsg); rtn = 1; } catch (Exception e) { // Log.WriteLog("通过删除clsResult",e); sErrMsg = e.Message;; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsUserUnit model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("INSERT INTO tUserUnit(SysCode,StdCode,FullName,ShortName,DisplayName,ShortCut,DistrictCode,PostCode,Address,LinkMan,LinkInfo,WWWInfo,IsReadOnly,IsLock,Remark,CompanyID)"); sb.Append(" VALUES("); sb.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}','{7}','{8}','{9}','{10}','{11}',{12},{13},'{14}','{15}'", model.SysCode, model.StdCode, model.FullName, model.ShortName, model.DisplayName, model.ShortCut, model.DistrictCode, model.PostCode, model.Address, model.LinkMan, model.LinkInfo, model.WWWInfo, model.IsReadOnly, model.IsLock, model.Remark, model.CompanyID); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { errMsg = e.Message; } return(rtn); }