/// <summary> /// 更新上传标志 /// </summary> /// <param name="model"></param> /// <param name="errMsg"></param> /// <returns></returns> public int SetUploadFlag(clsResult model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.Append("UPDATE tResult SET "); sb.Append("IsSended="); sb.Append(model.IsSended); sb.Append(",IsReSended="); sb.Append(model.IsReSended); sb.Append(",SendedDate='"); sb.Append(model.SendedDate); sb.Append("',Sender='"); sb.Append(model.Sender); sb.Append("'"); sb.Append(" WHERE SysCode='"); sb.Append(model.SysCode); sb.Append("'"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsResult",e); errMsg = e.Message; } return(rtn); }
/// <summary> /// 插入一条明细记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(clsResult model, out string errMsg) { sb.Length = 0; errMsg = string.Empty; int rtn = 0; try { sb.Append("INSERT INTO tResult"); sb.Append("(SysCode,ResultType,CheckNo,StdCode,SampleCode,CheckedCompany,"); sb.Append("CheckedCompanyName,CheckedComDis,CheckPlaceCode,FoodCode,"); if (model.ProduceDate != null) { sb.Append("ProduceDate,"); } sb.Append("ProduceCompany,ProducePlace,SentCompany,Provider,TakeDate,CheckStartDate,CheckEndDate,"); sb.Append("ImportNum,SaveNum,Unit,SampleBaseNum,SampleNum,SampleUnit,SampleLevel,SampleModel,SampleState,"); sb.Append("Standard,CheckMachine,CheckTotalItem,CheckValueInfo,StandValue,Result,ResultInfo,UpperCompany,UpperCompanyName,"); sb.Append("OrCheckNo,CheckType,CheckUnitCode,Checker,Assessor,Organizer,Remark,CheckPlanCode,SaleNum,Price,CheckederVal,"); sb.Append("IsSentCheck,CheckederRemark,Notes, HolesNum,MachineSampleNum,MachineItemName)"); sb.Append("VALUES('"); sb.Append(model.SysCode); sb.Append("','"); sb.Append(model.ResultType); sb.Append("','"); sb.Append(model.CheckNo); sb.Append("','"); sb.Append(model.StdCode); sb.Append("','"); sb.Append(model.SampleCode); sb.Append("','"); sb.Append(model.CheckedCompany); sb.Append("','"); sb.Append(model.CheckedCompanyName); sb.Append("','"); sb.Append(model.CheckedComDis); sb.Append("','"); sb.Append(model.CheckPlaceCode); sb.Append("','"); sb.Append(model.FoodCode); sb.Append("','"); if (model.ProduceDate != null) { sb.Append(model.ProduceDate); sb.Append("','"); } //else //{ // sb.Append(string.Empty); //} //sb.Append("','"); sb.Append(model.ProduceCompany); sb.Append("','"); sb.Append(model.ProducePlace); sb.Append("','"); sb.Append(model.SentCompany); sb.Append("','"); sb.Append(model.Provider); sb.Append("','"); sb.Append(model.TakeDate); sb.Append("','"); sb.Append(model.CheckStartDate); sb.Append("','"); sb.Append(model.CheckEndDate); sb.Append("','"); sb.Append(model.ImportNum); sb.Append("','"); sb.Append(model.SaveNum); sb.Append("','"); sb.Append(model.Unit); sb.Append("',"); sb.Append(model.SampleBaseNum); sb.Append(","); sb.Append(model.SampleNum); sb.Append(",'"); sb.Append(model.SampleUnit); sb.Append("','"); sb.Append(model.SampleLevel); sb.Append("','"); sb.Append(model.SampleModel); sb.Append("','"); sb.Append(model.SampleState); sb.Append("','"); sb.Append(model.Standard); sb.Append("','"); sb.Append(model.CheckMachine); sb.Append("','"); sb.Append(model.CheckTotalItem); sb.Append("','"); sb.Append(model.CheckValueInfo); sb.Append("','"); sb.Append(model.StandValue); sb.Append("','"); sb.Append(model.Result); sb.Append("','"); sb.Append(model.ResultInfo); sb.Append("','"); sb.Append(model.UpperCompany); sb.Append("','"); sb.Append(model.UpperCompanyName); sb.Append("','"); sb.Append(model.OrCheckNo); sb.Append("','"); sb.Append(model.CheckType); sb.Append("','"); sb.Append(model.CheckUnitCode); sb.Append("','"); sb.Append(model.Checker); sb.Append("','"); sb.Append(model.Assessor); sb.Append("','"); sb.Append(model.Organizer); sb.Append("','"); sb.Append(model.Remark); sb.Append("','"); sb.Append(model.CheckPlanCode); sb.Append("',"); sb.Append(model.SaleNum); sb.Append(","); sb.Append(model.Price); sb.Append(",'"); sb.Append(model.CheckederVal); sb.Append("','"); sb.Append(model.IsSentCheck); sb.Append("','"); sb.Append(model.CheckederRemark); sb.Append("','"); sb.Append(model.Notes); sb.Append("','"); sb.Append(model.HolesNum); sb.Append("','"); sb.Append(model.MachineSampleNum); sb.Append("','"); sb.Append(model.MachineItemName); //sb.Append("','"); //sb.Append(model.ParentCompanyName ); sb.Append("')"); 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">对象clsResult的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsResult model, out string errMsg) { errMsg = string.Empty; int rtn = 0; sb.Length = 0; try { sb.Append("UPDATE tResult SET "); sb.AppendFormat("CheckNo='{0}',", model.CheckNo); sb.AppendFormat("StdCode='{0}',", model.StdCode); sb.AppendFormat("SampleCode='{0}',", model.SampleCode); sb.AppendFormat("CheckedCompany='{0}',", model.CheckedCompany); sb.AppendFormat("CheckedCompanyName='{0}',", model.CheckedCompanyName); sb.AppendFormat("CheckedComDis='{0}',", model.CheckedComDis); sb.AppendFormat("CheckPlaceCode='{0}',", model.CheckPlaceCode); sb.AppendFormat("FoodCode='{0}',", model.FoodCode); if (model.ProduceDate != null) { sb.AppendFormat("ProduceDate='{0}',", model.ProduceDate); } if (model.ProduceDate == null) { sb.AppendFormat("ProduceDate=null,", string.Empty); } sb.AppendFormat("ProduceCompany='{0}',", model.ProduceCompany); sb.AppendFormat("ProducePlace='{0}',", model.ProducePlace); sb.AppendFormat("SentCompany='{0}',", model.SentCompany); sb.AppendFormat("Provider='{0}',", model.Provider); sb.AppendFormat("TakeDate='{0}',", model.TakeDate); sb.AppendFormat("CheckStartDate='{0}',", model.CheckStartDate); sb.AppendFormat("CheckEndDate='{0}',", model.CheckEndDate); sb.AppendFormat("ImportNum='{0}',", model.ImportNum); sb.AppendFormat("SaveNum='{0}',", model.SaveNum); sb.AppendFormat("Unit='{0}',", model.Unit); if (model.SampleBaseNum != "null") { sb.AppendFormat("SampleBaseNum={0},", model.SampleBaseNum); } if (model.SaleNum != "null") { sb.AppendFormat("SampleNum={0},", model.SampleNum); } sb.AppendFormat("SampleUnit='{0}',", model.SampleUnit); sb.AppendFormat("SampleLevel='{0}',", model.SampleLevel); sb.AppendFormat("SampleModel='{0}',", model.SampleModel); sb.AppendFormat("SampleState='{0}',", model.SampleState); sb.AppendFormat("Standard='{0}',", model.Standard); sb.AppendFormat("CheckMachine='{0}',", model.CheckMachine); sb.AppendFormat("CheckTotalItem='{0}',", model.CheckTotalItem); sb.AppendFormat("CheckValueInfo='{0}',", model.CheckValueInfo); sb.AppendFormat("StandValue='{0}',", model.StandValue); sb.AppendFormat("Result='{0}',", model.Result); sb.AppendFormat("ResultInfo='{0}',", model.ResultInfo); sb.AppendFormat("UpperCompany='{0}',", model.UpperCompany); sb.AppendFormat("UpperCompanyName='{0}',", model.UpperCompanyName); sb.AppendFormat("OrCheckNo='{0}',", model.OrCheckNo); sb.AppendFormat("CheckType='{0}',", model.CheckType); sb.AppendFormat("CheckUnitCode='{0}',", model.CheckUnitCode); sb.AppendFormat("Checker='{0}',", model.Checker); sb.AppendFormat("Assessor='{0}',", model.Assessor); sb.AppendFormat("Organizer='{0}',", model.Organizer); sb.AppendFormat("Remark='{0}',", model.Remark); sb.AppendFormat("CheckPlanCode='{0}',", model.CheckPlanCode); if (model.SaleNum != "null") { sb.AppendFormat("SaleNum={0},", model.SaleNum); } if (model.Price != "null") { sb.AppendFormat("Price={0},", model.Price); } sb.AppendFormat("CheckederVal='{0}',", model.CheckederVal); sb.AppendFormat("IsSentCheck='{0}',", model.IsSentCheck); sb.AppendFormat("CheckederRemark='{0}',", model.CheckederRemark); //sb.AppendFormat("ParentCompanyName='{0}',",model .ParentCompanyName ); sb.AppendFormat("Notes='{0}'", model.Notes); sb.AppendFormat(" WHERE SysCode='{0}'", model.SysCode); DataBase.ExecuteCommand(sb.ToString(), out errMsg); rtn = 1; } catch (Exception e) { //Log.WriteLog("更新clsResult",e); errMsg = e.Message; } return(rtn); }