public ActionResult Edit(Tb_Pay model) { BaseResult br = new BaseResult(); Hashtable param = base.GetParameters(); Hashtable param_model = null; ParamVessel pv = new ParamVessel(); pv.Add("mc", string.Empty, HandleType.ReturnMsg); pv.Add("id", string.Empty, HandleType.ReturnMsg); pv.Add("flag_type", 0, HandleType.ReturnMsg); pv.Add("flag_stop", 0, HandleType.ReturnMsg); try { param_model = param.Trim(pv); br = BusinessFactory.Tb_Pay.Update(new Tb_Pay() { id = param_model["id"].ToString(), mc = param_model["mc"].ToString(), flag_stop = Convert.ToByte(param_model["flag_stop"].ToString()), flag_type = Convert.ToByte(param_model["flag_type"].ToString()), id_masteruser = id_user_master, id_edit = id_user }); } catch (Exception ex) { br.Message.Add(ex.Message); } return(JsonString(br, 1)); }
public ActionResult Add(Tb_Pay model) { Hashtable param = base.GetParameters(); param.Add("id_masteruser", id_user_master); Hashtable param_model = null; BaseResult br = new BaseResult(); Tb_Pay model_pay = new Tb_Pay(); //新增对象 try { ParamVessel pv = new ParamVessel(); pv.Add("mc", string.Empty, HandleType.ReturnMsg); //名称 pv.Add("id_masteruser", string.Empty, HandleType.ReturnMsg); pv.Add("flag_type", 0, HandleType.ReturnMsg); pv.Add("flag_stop", 0, HandleType.ReturnMsg); param_model = param.Trim(pv); if (TryUpdateModel(model_pay)) { model_pay.id_masteruser = id_user_master; model_pay.id_create = model_pay.id_edit = id_user; model_pay.flag_system = 0; br = BusinessFactory.Tb_Pay.Add(model_pay); } else { br.Message.Add("参数有误!"); } } catch (Exception ex) { br.Message.Add(ex.Message); } return(JsonString(br, 1)); }
public override BaseResult Update(dynamic entity) { BaseResult res = new BaseResult() { Success = true }; Tb_Pay payModel = entity as Tb_Pay; try { if (payModel == null) { res.Success = false; res.Message.Add("参数有误!"); res.Level = ErrorLevel.Warning; return(res); } Hashtable param = new Hashtable(); param.Add("id_masteruser", payModel.id_masteruser); param.Add("s_mc", payModel.mc); param.Add("not_id", payModel.id); param.Add("flag_delete", (int)Enums.FlagDelete.NoDelete); if (DAL.GetCount(typeof(Tb_Pay), param) > 0) { res.Success = false; res.Message.Add("名称已存在!"); res.Level = ErrorLevel.Warning; return(res); } Hashtable ht = new Hashtable(); ht.Add("id", payModel.id); ht.Add("id_masteruser", payModel.id_masteruser); ht.Add("new_mc", payModel.mc); ht.Add("new_bz", payModel.bz); ht.Add("new_id_edit", payModel.id_edit); ht.Add("new_rq_edit", DateTime.Now); ht.Add("new_flag_stop", payModel.flag_stop); ht.Add("new_flag_type", payModel.flag_type); if (DAL.UpdatePart(typeof(Tb_Pay), ht) <= 0) { res.Success = false; res.Message.Add("更新操作失败"); } } catch (Exception ex) { res.Success = false; res.Level = ErrorLevel.Warning; res.Message.Add("更新操作异常!"); } return(res); }
public override BaseResult Add(dynamic entity) { BaseResult res = new BaseResult() { Success = true }; Tb_Pay payModel = entity as Tb_Pay; try { if (payModel == null) { res.Success = false; res.Message.Add("参数有误!"); res.Level = ErrorLevel.Warning; return(res); } Hashtable param = new Hashtable(); param.Add("id_masteruser", payModel.id_masteruser); param.Add("s_mc", payModel.mc); param.Add("flag_delete", (int)Enums.FlagDelete.NoDelete); if (DAL.GetCount(typeof(Tb_Pay), param) > 0) { res.Success = false; res.Message.Add("名称已存在!"); res.Level = ErrorLevel.Warning; return(res); } payModel.id = Guid.NewGuid().ToString(); payModel.flag_delete = (int)Enums.FlagDelete.NoDelete; payModel.rq_create = payModel.rq_edit = DateTime.Now; DAL.Add(payModel); } catch (Exception ex) { res.Success = false; res.Level = ErrorLevel.Warning; res.Message.Add("新增操作异常!"); } return(res); }