/// <summary> /// 部分修改保存 /// </summary> /// <param name="model">对象clsTask的一个实例参数</param> /// <returns></returns> public int UpdatePart(clsTask model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; sb.AppendFormat("UPDATE tTask SET CPTITLE='{0}'", model.CPTITLE); //sb.AppendFormat(",Name='{0}'", model.Name); //sb.AppendFormat(",ShortCut='{0}'", model.ShortCut); //sb.AppendFormat(",CheckLevel='{0}'", model.CheckLevel); //sb.AppendFormat(",CheckItemCodes='{0}'", model.CheckItemCodes); //sb.AppendFormat(",CheckItemValue='{0}'", model.CheckItemValue); //sb.Append(",IsReadOnly="); //sb.Append(model.IsReadOnly); //sb.Append(",IsLock="); //sb.Append(model.IsLock); //sb.AppendFormat(",Remark='{0}'", model.Remark); //sb.AppendFormat(",FoodProperty='{0}'", model.FoodProperty); sb.AppendFormat(" WHERE CPCODE='{0}'", model.CPCODE); 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 InsertOrUpdate(clsTask model, out string errMsg) { errMsg = string.Empty; int rtn = 0; try { sb.Length = 0; DataTable dt = new clsCompanyOpr().GetAsDataTable("CPCODE='" + model.CPCODE + "'", string.Empty, 11); if (dt != null && dt.Rows.Count > 0) { sb.AppendFormat("Update tTask Set CPCODE='{0}',CPTITLE='{1}',CPSDATE='{2}',CPEDATE='{3}',CPTPROPERTY='{4}',", model.CPCODE, model.CPTITLE, model.CPSDATE, model.CPEDATE, model.CPTPROPERTY); sb.AppendFormat("CPFROM='{0}',CPEDITOR='{1}',CPPORGID='{2}',CPPORG='{3}',CPEDDATE='{4}',", model.CPFROM, model.CPEDITOR, model.CPPORGID, model.CPPORG, model.CPEDDATE); sb.AppendFormat("CPMEMO='{0}',PLANDETAIL='{1}',PLANDCOUNT='{2}',BAOJINGTIME='{3}',UDate='{4}' Where CPCODE='{5}'", model.CPMEMO, model.PLANDCOUNT, model.PLANDCOUNT, model.BAOJINGTIME, model.UDate, model.CPCODE); } else { sb.Append("Insert Into tTask"); sb.Append("(CPCODE,CPTITLE,CPSDATE,CPEDATE,CPTPROPERTY,CPFROM,CPEDITOR"); sb.Append(",CPPORGID,CPPORG,CPEDDATE,CPMEMO,PLANDETAIL,BAOJINGTIME,PLANDCOUNT,UDate)"); 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.AppendFormat("'{0}'", 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(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); }