Esempio n. 1
0
        public ActionResult Edit(tblButtonName collection)
        {
            ReturnMessage RM = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    var query = BusinessContext.tblButtonName.GetModelList(String.Format("ButtonName='{0}' and TblRcdId<>{1}", collection.ButtonName, collection.TblRcdId));
                    if (query.Count > 0)
                    {
                        RM.Message = "按钮名称已被占用";
                    }
                    else
                    {
                        tblButtonName old = BusinessContext.tblButtonName.GetModel(collection.TblRcdId);
                        RM.IsSuccess = BusinessContext.tblButtonName.Update(collection);
                        if (RM.IsSuccess)
                        {
                            OperateLogHelper.Edit <tblButtonName>(collection, old);
                        }
                    }
                }
                catch (Exception ex)
                {
                    RM.Message = ex.Message;
                }
            }
            return(Json(RM));
        }
Esempio n. 2
0
        public ActionResult Edit(tblButtonName collection)
        {
            ReturnMessage RM = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    var q = Query.And(Query <tblButtonName> .EQ(t => t.ButtonName, collection.ButtonName),
                                      Query <tblButtonName> .NE(t => t.Rid, collection.Rid));
                    var query = BusinessContext.tblButtonName.GetList(q);
                    if (query.Count > 0)
                    {
                        RM.Message = "按钮名称已被占用";
                    }
                    else
                    {
                        tblButtonName old = BusinessContext.tblButtonName.Get(Query <tblButtonName> .EQ(t => t.Rid, collection.Rid));
                        RM.IsSuccess = BusinessContext.tblButtonName.Update(collection);
                        if (RM.IsSuccess)
                        {
                            OperateLogHelper.Edit <tblButtonName>(collection, old);
                        }
                    }
                }
                catch (Exception ex)
                {
                    RM.Message = ex.Message;
                }
            }
            return(Json(RM));
        }
        public ActionResult Edit(tblButtonName collection)
        {
            var rm = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    var q = Query.And(Query <tblButtonName> .EQ(t => t.ButtonName, collection.ButtonName),
                                      Query <tblButtonName> .NE(t => t.Rid, collection.Rid));
                    var query = BusinessContext.tblButtonName.GetList(q);
                    if (query.Count > 0)
                    {
                        rm.Message = "按钮名称已被占用";
                    }
                    else
                    {
                        collection.ModifyOn = DateTime.Now;
                        collection.ModifyBy = CurrentHelper.CurrentUser.User.UserName;
                        rm.IsSuccess        = BusinessContext.tblButtonName.Update(collection);
                    }
                }
                catch (Exception ex)
                {
                    rm.Message = ex.Message;
                }
            }
            return(Json(rm));
        }
Esempio n. 4
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id)
        {
            tblButtonName dpt = BusinessContext.tblButtonName.Get(Query <tblButtonName> .EQ(t => t.Rid, id));

            if (dpt == null)
            {
                return(HttpNotFound());
            }
            return(View(dpt));
        }
Esempio n. 5
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id)
        {
            tblButtonName dpt = BusinessContext.tblButtonName.GetModel(id);

            if (dpt == null)
            {
                return(HttpNotFound());
            }
            return(View(dpt));
        }
Esempio n. 6
0
        public ActionResult Create(tblButtonName collection, string IsContinue = "0")
        {
            ReturnMessage RM = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    if (!string.IsNullOrEmpty(collection.ButtonName))
                    {
                        var query =
                            BusinessContext.tblButtonName.GetList(Query <tblButtonName> .EQ(t => t.ButtonName,
                                                                                            collection.ButtonName));
                        if (query.Count > 0)
                        {
                            RM.Message = "按钮名称已被占用";
                        }
                        else
                        {
                            var res = BusinessContext.tblButtonName.Add(collection);
                            RM.IsSuccess = res;
                            if (RM.IsSuccess)
                            {
                                //collection.Rid = Rid;
                                OperateLogHelper.Create <tblButtonName>(collection);
                                if (IsContinue == "1")
                                {
                                    RM.IsContinue = true;
                                }
                                else
                                {
                                    RM.IsContinue = false;
                                }
                            }
                        }
                    }
                    else
                    {
                        RM.IsSuccess = false;
                        RM.Message   = "按钮名称不能为空!";
                    }
                }
                catch (Exception ex)
                {
                    RM.Message = ex.Message;
                }
            }
            return(Json(RM));
        }
Esempio n. 7
0
        public ActionResult Create(tblButtonName collection, string IsContinue = "0")
        {
            ReturnMessage RM = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    if (!string.IsNullOrEmpty(collection.ButtonName))
                    {
                        var query = BusinessContext.tblButtonName.GetModelList(String.Format("ButtonName='{0}'", collection.ButtonName));
                        if (query.Count > 0)
                        {
                            RM.Message = "按钮名称已被占用";
                        }
                        else
                        {
                            int tblRcdid = BusinessContext.tblButtonName.Add(collection);
                            RM.IsSuccess = tblRcdid > 0;
                            if (RM.IsSuccess)
                            {
                                collection.TblRcdId = tblRcdid;
                                OperateLogHelper.Create <tblButtonName>(collection);
                                if (IsContinue == "1")
                                {
                                    RM.IsContinue = true;
                                }
                                else
                                {
                                    RM.IsContinue = false;
                                }
                            }
                        }
                    }
                    else
                    {
                        RM.IsSuccess = false;
                        RM.Message   = "按钮名称不能为空!";
                    }
                }
                catch (Exception ex)
                {
                    RM.Message = ex.Message;
                }
            }
            return(Json(RM));
        }
        public ActionResult Create(tblButtonName collection, string isContinue = "0")
        {
            var rm = new ReturnMessage(false);

            if (ModelState.IsValid)
            {
                try
                {
                    if (!string.IsNullOrEmpty(collection.ButtonName))
                    {
                        var query =
                            BusinessContext.tblButtonName.GetList(Query <tblButtonName> .EQ(t => t.ButtonName,
                                                                                            collection.ButtonName));
                        if (query.Count > 0)
                        {
                            rm.Message = "按钮名称已被占用";
                        }
                        else
                        {
                            collection.CreateOn = DateTime.Now;
                            collection.CreateBy = CurrentHelper.CurrentUser.User.UserName;
                            var res = BusinessContext.tblButtonName.Add(collection);
                            rm.IsSuccess = res;
                            if (rm.IsSuccess)
                            {
                                rm.IsContinue = isContinue == "1";
                            }
                        }
                    }
                    else
                    {
                        rm.IsSuccess = false;
                        rm.Message   = "按钮名称不能为空!";
                    }
                }
                catch (Exception ex)
                {
                    rm.Message = ex.Message;
                }
            }
            return(Json(rm));
        }