Exemple #1
0
        public ActionResult UserEditNew(Guid userId)
        {
            MembershipUser usr = Membership.GetUser(userId);
            UserInfo nfo = db.UserInfos.Single(p => p.UserId == userId);
            EditUserModelNew model = new EditUserModelNew();
            model.UserName = nfo.aspnet_User.UserName;
            model.FullName = nfo.FullName;
            model.JobTitle = nfo.JobTitle;
            model.Email = usr.Email;
            model.IsRCP = nfo.IsRiskOwner;

            model.param = new EditUserParam();
            if (nfo.BranchId.Equals(null))
            {
                model.param.posID = 1;
                model.param.BranchID = null;
                model.param.DeptID = nfo.DeptId;
            }
            else
            {
                model.param.posID = 2;
                model.param.BranchID = nfo.BranchId;
                model.param.DeptID = 3;
            }

            model.param.DivisionID = nfo.DivisionId;
            model.param.SubDivID = nfo.SubDivId;
            model.param.SubBranchID = nfo.SubBranchId;
            model.param.BizUnitID = nfo.BizUnitId;
            model.param.IsRCP = nfo.IsRiskOwner;

            UpdateUserParam(model.param);
            GetOrgPosInfo(nfo);
            return View(model);
        }
Exemple #2
0
        public ActionResult UserEditNew(EditUserModelNew model, Guid userId, String btn="")
        {
            UserInfo nfo;

            //using (TransactionScope trans = new TransactionScope())
            //{
                if (btn.Equals("Update"))
                {
                    if (ModelState.IsValid)
                    {
                        MembershipUser usr = Membership.GetUser(userId);
                        usr.Email = model.Email;
                        if (model.Password != null)
                        {
                            usr.ChangePassword(usr.ResetPassword(), model.Password);
                        }

                        Membership.UpdateUser(usr);

                        nfo = db.UserInfos.Single(p => p.UserId == userId);

                        using (TransactionScope trans = new TransactionScope())
                        {
                            nfo.FullName = model.FullName;
                            nfo.JobTitle = model.JobTitle;
                            nfo.DeptId = model.param.DeptID;
                            nfo.BranchId = model.param.BranchID;
                            nfo.DivisionId = model.param.DivisionID;
                            nfo.SubDivId = model.param.SubDivID;
                            nfo.BranchId = model.param.BranchID;
                            nfo.SubBranchId = model.param.SubBranchID;
                            nfo.BizUnitId = model.param.BizUnitID;
                            nfo.IsRiskOwner = model.param.IsRCP;
                            db.SaveChanges();
                            trans.Complete();

                            return RedirectToAction("Index");
                        }
                    }
                }
                else
                {
                    nfo = db.UserInfos.Single(p => p.UserId == userId);
                    GetOrgPosInfo(nfo);
                    UpdateUserParam(model.param);
                }
               //}
            return View(model);
        }
Exemple #3
0
        public ActionResult UserEdit(Guid userId)
        {
            MembershipUser usr = Membership.GetUser(userId);
            UserInfo nfo = db.UserInfos.Single(p => p.UserId == userId);
            EditUserModelNew model = new EditUserModelNew();
            model.UserName = nfo.aspnet_User.UserName;
            model.FullName = nfo.FullName;
            model.JobTitle = nfo.JobTitle;
            model.Email = usr.Email;
            model.IsRCP = nfo.IsRiskOwner;

            GetOrgPosInfo(nfo);
            return View(model);
        }