Esempio n. 1
0
        public IActionResult Supplement(int id)
        {
            var entity = _db.Load <Approval>(id);

            if (entity == null)
            {
                return(NotFound());
            }

            if (entity.ApproveStep == (int)ApproveStep.Close ||
                entity.ApproveStep == (int)ApproveStep.Confirmed)
            {
                return(Content("申请已关闭或已完成,禁止编辑"));
            }

            if (entity.ApplicantNo != CurrentUser.No)
            {
                return(Content("申请人与当前账户不一致,禁止编辑"));
            }

            ViewBag.Entity = entity;

            var dto = _mapper.Map <SupplementDto>(entity);

            return(View(dto));
        }
Esempio n. 2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dto"></param>
        /// <returns></returns>
        public int Update(int id, ApprovalDto dto)
        {
            if (dto.Id != id)
            {
                return(0);
            }

            var entity = _db.Load <Approval>(id);

            if (entity == null)
            {
                return(0);
            }

            entity.CustomerName        = dto.CustomerName;
            entity.CustomerJob         = dto.CustomerJob;
            entity.CustomerUnit        = dto.CustomerUnit;
            entity.ContactNumber       = dto.ContactNumber;
            entity.ProjectName         = dto.ProjectName;
            entity.ExpectedClosingCost = dto.ExpectedClosingCost;
            entity.ExpectedClosingDate = dto.ExpectedClosingDate;
            entity.ActualClosingProfit = dto.ExpectedClosingProfit;
            entity.AppliedAmount       = dto.AppliedAmount;
            entity.AppliedReason       = dto.AppliedReason;

            return(_db.Update(entity));
        }
Esempio n. 3
0
        public IActionResult Audit(int id)
        {
            var entity = _db.Load <Approval>(id);

            if (entity == null)
            {
                return(NotFound());
            }

            if (entity.ApproveStep == (int)ApproveStep.Close ||
                entity.ApproveStep == (int)ApproveStep.Confirmed ||
                entity.ApproveStep != (int)ApproveStep.Approved)
            {
                return(Content("已关闭、已完成或未审批的申请,禁止编辑"));
            }

            //if (entity.ApplicantNo != CurrentUser.No)
            //{
            //    return Content("申请人与当前账户不一致,禁止编辑");
            //}

            ViewBag.Entity = entity;

            var dto = _mapper.Map <AuditModel>(entity);

            return(View(dto));
        }
Esempio n. 4
0
        // GET: Department/Details/5
        public ActionResult Details(int id)
        {
            var entity = _db.Load <Department>(id);

            if (entity == null)
            {
                return(NotFound());
            }
            return(View(entity));
        }
Esempio n. 5
0
        // GET: Students/Edit/5
        public ActionResult Edit(int id)
        {
            var entity = _db.Load <Student>(id);

            if (entity == null)
            {
                return(HttpNotFound());
            }
            InitUi();
            return(View(entity));
        }
        public IActionResult Approve(int id)
        {
            var entity = _db.Load <Approval>(id);

            if (entity == null)
            {
                return(NotFound());
            }
            ViewBag.Entity = entity;

            var model = new ApproveModel
            {
                Id     = entity.Id,
                IsPass = entity.ApproveResult > 1,
                Remark = entity.ApproveRemark
            };

            return(View(model));
        }
Esempio n. 7
0
        // GET: AppUsers/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            var entity = _db.Load <AppUser>(id);

            if (entity == null)
            {
                return(NotFound());
            }

            await InitUi();

            return(View(entity));
        }
Esempio n. 8
0
        public IActionResult Login(string name)
        {
            var dto = new UserDto();

            if (name == "admin")
            {
                dto.No           = "admin";
                dto.Name         = "admin";
                dto.Role         = "admin";
                dto.DepartmentId = 1;
            }
            else
            {
                var user = _db.Load <AppUser>(u => u.Name == name && u.IsDelete == false);
                if (user == null)
                {
                    return(Content("用户不存在"));
                }
                else
                {
                    dto.No   = user.No;
                    dto.Name = user.Name;
                    if (user.IsFinance)
                    {
                        dto.Role = "audit";
                    }
                    else
                    {
                        dto.Role = user.IsMaster ? "master" : "user";
                    }
                    dto.DepartmentId = user.DepartmentId;
                }
            }

            var claims = new List <Claim>
            {
                new Claim(ClaimTypes.NameIdentifier, dto.No),
                new Claim(ClaimTypes.Name, dto.Name),
                new Claim(ClaimTypes.Role, dto.Role),
                new Claim("Department", dto.DepartmentId.ToString())
            };

            HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
            HttpContext.SignInAsync(new ClaimsPrincipal(new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme)));

            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 9
0
        // GET: Schools/Edit/5
        public ActionResult Edit(int id)
        {
            var entity = _db.Load <School>(id);

            return(View(entity));
        }
Esempio n. 10
0
        public IActionResult Details(int id)
        {
            var entity = _db.Load <Approval>(id);

            return(View(entity));
        }