Пример #1
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public string EditPREMISE(TB_PREMISEModel d)
        {
            int    k   = -1;
            string msg = "经营场所编辑失败!";

            if (HasRepetitionCode(d))
            {
                msg = "经营场所编号重复!";
            }
            else
            {
                var oldBrand = TB_PREMISEDal.Instance.Get(d.FID);
                if (oldBrand == null)
                {
                    msg = "经营场所编辑失败!";
                }
                else
                {
                    k = TB_PREMISEDal.Instance.Update(d);
                    if (k > 0)
                    {
                        msg = "编辑经营场所成功。";
                    }
                }
            }

            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
        public ActionResult Edit()
        {
            UserBll.Instance.CheckUserOnlingState();

            TB_PREMISEModel model = TB_PREMISEDal.Instance.Get(Request.QueryString["id"]);

            if (model == null)
            {
                model = new TB_PREMISEModel();
            }
            return(View(model));
        }
        public string Edit(FormCollection context)
        {
            try
            {
                UserBll.Instance.CheckUserOnlingState();

                var             rpm   = GetRpm(context);
                TB_PREMISEModel model = TB_PREMISEDal.Instance.Get(rpm.FID);
                TB_PREMISEModel d     = new TB_PREMISEModel();
                d.InjectFrom(rpm.Entity);
                d.FID = model.FID;

                return(TB_PREMISEBll.Instance.EditPREMISE(d));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(ex.Message);
            }
        }
Пример #4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string AddPREMISE(TB_PREMISEModel model)
        {
            string uid = "0";
            string msg = "经营场所添加失败!";

            if (HasRepetitionCode(model))
            {
                msg = "经营场所编号重复!";
            }
            else
            {
                uid = TB_PREMISEDal.Instance.Insert(model);
                if (uid != "")
                {
                    msg = "经营场所添加成功!";
                }
            }

            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
Пример #5
0
        /// <summary>
        /// 判断编号重复
        /// </summary>
        private bool HasRepetitionCode(TB_PREMISEModel model)
        {
            var list = TB_PREMISEDal.Instance.GetAll().ToList();

            foreach (var item in list)
            {
                if (item.FCODE == model.FCODE)
                {
                    if (model.FID != "0")//编辑
                    {
                        if (model.FID != item.FID)
                        {
                            return(true);
                        }
                    }
                    else//新增
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }