Ejemplo n.º 1
0
        public ActionResult Edit(string id)
        {
            long        idParse;
            WebDeptDuty model = new WebDeptDuty();

            if (long.TryParse(id, out idParse))
            {
                model = webDeptDutyBll.GetModelById(idParse);
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ProcResult Add(WebDeptDuty model)
        {
            ProcResult result = new ProcResult();

            try
            {
                db.WebDeptDuty.Add(model);
                result.IsSuccess = db.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                result.ProcMsg = ex.InnerException.Message;
                LogUtil.Exception("ExceptionLogger", ex);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public AjaxResult Edit(WebDeptDuty model, long @operator)
        {
            AjaxResult result     = new AjaxResult();
            var        procResult = dal.Edit(model, @operator);

            result.flag = procResult.IsSuccess;
            if (result.flag)
            {
                result.message = "修改成功!";
            }
            else
            {
                result.message = procResult.ProcMsg;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public AjaxResult Add(WebDeptDuty model)
        {
            AjaxResult result     = new AjaxResult();
            var        procResult = dal.Add(model);

            result.flag = procResult.IsSuccess;
            if (result.flag)
            {
                result.message = "新增成功!";
            }
            else
            {
                result.message = procResult.ProcMsg;
            }
            return(result);
        }
Ejemplo n.º 5
0
        public ProcResult Edit(WebDeptDuty model, long currentOperator)
        {
            ProcResult result = new ProcResult();

            try
            {
                model.Creator    = currentOperator;
                model.CreateTime = DateTime.Now;
                db.WebDeptDuty.Attach(model);
                db.Entry(model).State = System.Data.Entity.EntityState.Modified;
                result.IsSuccess      = db.SaveChanges() > 0;
                return(result);
            }
            catch (Exception ex)
            {
                result.ProcMsg = ex.InnerException.Message;
                LogUtil.Exception("ExceptionLogger", ex);
            }
            return(result);
        }
Ejemplo n.º 6
0
        public ActionResult Edit(WebDeptDuty model)
        {
            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            model.Creator    = currentUser.SysOperator.ID;
            model.CreateTime = DateTime.Now;
            model.Auditor    = null;
            model.AuditTime  = null;
            if (ModelState.IsValid)
            {
                var result = webDeptDutyBll.Edit(model, currentUser.SysOperator.ID);
                if (result.flag)
                {
                    TempData["isSuccess"]   = "true";
                    TempData["MessageInfo"] = "完善信息成功!";
                    return(View("Index"));
                }
            }
            TempData["isSuccess"]   = "false";
            TempData["MessageInfo"] = "完善信息失败!";
            return(View(model));
        }
Ejemplo n.º 7
0
        public ProcResult Auditor(WebDeptDuty model, long auditor)
        {
            ProcResult result = new ProcResult();

            try
            {
                var entity = GetModelById(model.ID);
                if (entity != null)
                {
                    entity.Auditor   = auditor;
                    entity.AuditTime = DateTime.Now;
                }
                db.Entry <WebDeptDuty>((WebDeptDuty)entity).State = System.Data.Entity.EntityState.Modified;
                result.IsSuccess = db.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                result.ProcMsg = ex.InnerException.Message;
                LogUtil.Exception("ExceptionLogger", ex);
            }
            return(result);
        }
Ejemplo n.º 8
0
        public ActionResult Add(WebDeptDuty model)
        {
            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            if (ModelState.IsValid)
            {
                model.CreateTime = DateTime.Now;
                model.Creator    = currentUser.SysOperator.ID;
                AjaxResult result = webDeptDutyBll.Add(model);
                if (result.flag)
                {
                    TempData["returnMsgType"] = "success";
                    TempData["returnMsg"]     = "添加成功";
                    return(View("Index"));
                }
                else
                {
                    TempData["returnMsgType"] = "error";
                    TempData["returnMsg"]     = result.message;
                }
            }

            return(View(model));
        }