public ActionResult Add(Ts_Parm model) { var res = HandleResult(() => { model.id_masteruser = id_user_master; return(BusinessFactory.Ts_Parm.Add(model)); }); return(JsonString(res, 1)); }
public override BaseResult Update(dynamic entity) { BaseResult res = new BaseResult() { Success = true }; Ts_Parm model = entity as Ts_Parm; if (model == null) { res.Success = false; res.Message.Add("参数有误!"); return(res); } Hashtable param = new Hashtable(); param.Add("id_masteruser", model.id_masteruser); param.Add("id", model.id); var oldModel = DAL.GetItem <Ts_Parm>(typeof(Ts_Parm), param); if (oldModel == null) { res.Success = false; res.Message.Add("数据已不存在!"); return(res); } if (!ParmValidation.Valid(oldModel.regex, model.parmvalue, res)) { return(res); } if (ParmValidation.NeedValidParmCode(oldModel.parmcode)) { if (!ParmValidation.ValidDigit(model.parmvalue, oldModel.parmvalue, res)) { return(res); } } param.Clear(); param.Add("id", model.id); param.Add("new_parmvalue", model.parmvalue); if (DAL.UpdatePart(typeof(Ts_Parm), param) <= 0) { res.Message.Add("操作失败!"); } return(res); }
public override BaseResult Add(dynamic entity) { BaseResult res = new BaseResult() { Success = true }; Ts_Parm model = entity as Ts_Parm; if (model == null) { res.Success = false; res.Message.Add("参数有误!"); return(res); } if (string.IsNullOrEmpty(model.parmname)) { res.Success = false; res.Message.Add("参数名称不能为空!"); return(res); } if (string.IsNullOrEmpty(model.parmcode)) { res.Success = false; res.Message.Add("参数编码不能为空!"); return(res); } Hashtable param = new Hashtable(); param.Add("parmcode", model.parmcode); param.Add("id_masteruser", model.id_masteruser); if (DAL.GetCount(typeof(Ts_Parm), param) > 0) { res.Success = false; res.Message.Add("参数编码已存在!"); return(res); } model.id = Guid.NewGuid().ToString(); DAL.Add(model); return(res); }
public ActionResult Edit(Ts_Parm model) { var res = HandleResult(() => { if (id_shop != id_shop_master) { BaseResult br = new BaseResult() { Success = false }; br.Message.Add("非主门店下员工,不能修改此数据!"); return(br); } model.id_masteruser = id_user_master; return(BusinessFactory.Ts_Parm.Update(model)); }); if (res.Success) { RemoveCache(); } return(JsonString(res, 1)); }