/// <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="model"></param> /// <returns></returns> public int Insert(clsProduceArea model, out string errMsg) { errMsg = string.Empty; int rtn = 0; sb.Length = 0; try { sb.Append("INSERT INTO tProduceArea"); sb.Append("(SysCode,StdCode,Name,ShortCut,DistrictIndex,CheckLevel,IsLocal,IsReadOnly,IsLock,Remark)"); 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.DistrictIndex); sb.AppendFormat("'{0}',", model.CheckLevel); sb.AppendFormat("{0},", model.IsLocal); sb.AppendFormat("{0},", model.IsReadOnly); sb.AppendFormat("{0},", model.IsLock); sb.AppendFormat("'{0}'", model.Remark); sb.Append(")"); DataBase.ExecuteCommand(sb.ToString(), out errMsg); sb.Length = 0; rtn = 1; } catch (Exception e) { //Log.WriteLog("添加clsProduceArea",e); errMsg = e.Message; } return(rtn); }