Beispiel #1
0
        public ActionResult UpdatePosFun()
        {
            var res = HandleResult(() =>
            {
                BaseResult result = new BaseResult();
                var param         = base.GetParameters();
                ParamVessel p     = new ParamVessel();
                p.Add("name", String.Empty, HandleType.ReturnMsg);
                p.Add("flag_system", 0, HandleType.ReturnMsg);
                p.Add("functiondescribe", String.Empty, HandleType.DefaultValue);
                p.Add("flag_type", 0, HandleType.ReturnMsg);
                p.Add("maxvalue", String.Empty, HandleType.DefaultValue);
                p.Add("minvalue", String.Empty, HandleType.DefaultValue);
                p.Add("sort_id", 0, HandleType.DefaultValue);
                p.Add("bm", String.Empty, HandleType.ReturnMsg);
                p.Add("id", 0, HandleType.ReturnMsg);
                param = param.Trim(p);
                Tb_Pos_Function entity = new Tb_Pos_Function();
                if (TryUpdateModel(entity))
                {
                    result = BusinessFactory.Tb_Post_Function.Update(entity);
                }
                else
                {
                    result.Message.Add("参数有误!");
                }
                return(result);
            });

            return(JsonString(res));
        }
Beispiel #2
0
        public ActionResult Add(Tb_Pos_Function model)
        {
            BaseResult res = HandleResult(() =>
            {
                return(BusinessFactory.Tb_Post_Function.Add(model));
            });

            return(JsonString(res, 1));
        }
Beispiel #3
0
        public override BaseResult Update(dynamic entity)
        {
            BaseResult res = new BaseResult()
            {
                Success = true
            };

            try
            {
                Tb_Pos_Function model = entity as Tb_Pos_Function;
                if (model == null)
                {
                    res.Success = false;
                    res.Message.Add("参数有误!");
                    res.Level = ErrorLevel.Warning;
                    return(res);
                }
                Hashtable param = new Hashtable();
                param.Add("bm", model.bm);
                param.Add("not_id", model.id);
                if (DAL.GetCount(typeof(Tb_Pos_Function), param) > 0)
                {
                    res.Success = false;
                    res.Message.Add("功能编码已存在,请重新输入!");
                    return(res);
                }
                param.Clear();
                param.Add("new_mc", model.mc);
                param.Add("new_flag_system", model.flag_system);
                param.Add("new_functiondescribe", model.functiondescribe);
                param.Add("new_flag_type", model.flag_type);
                param.Add("new_sort_id", model.sort_id);
                param.Add("new_flag_stop", model.flag_stop);
                param.Add("new_bm", model.bm);
                param.Add("new_regex", model.regex);
                param.Add("id", model.id);
                if (DAL.UpdatePart(typeof(Tb_Pos_Function), param) <= 0)
                {
                    res.Success = false;
                    res.Level   = ErrorLevel.Warning;
                    res.Message.Add("更新操作失败!");
                }
            }
            catch (Exception ex)
            {
                res.Success = false;
                res.Level   = ErrorLevel.Error;
                res.Message.Add("更新操作异常!");
            }
            return(res);
        }
Beispiel #4
0
        public override BaseResult Add(dynamic entity)
        {
            BaseResult res = new BaseResult()
            {
                Success = true
            };

            try
            {
                Tb_Pos_Function model = entity as Tb_Pos_Function;
                if (model == null)
                {
                    res.Success = false;
                    res.Message.Add("参数有误!");
                    res.Level = ErrorLevel.Warning;
                    return(res);
                }
                model.rq_create = DateTime.Now;
                model.id        = Guid.NewGuid().ToString();
                model.flag_stop = (int)Enums.FlagStop.Start;
                Hashtable ht = new Hashtable();
                ht.Add("bm", model.bm);
                if (DAL.GetCount(typeof(Tb_Pos_Function), ht) > 0)
                {
                    res.Success = false;
                    res.Message.Add("功能编码已存在,请重新输入!");
                    return(res);
                }
                DAL.Add(model);
            }
            catch (Exception ex)
            {
                res.Success = false;
                res.Level   = ErrorLevel.Error;
                res.Message.Add("新增操作异常!");
            }
            return(res);
        }