Ejemplo n.º 1
0
        public ActionResult Index(string key)
        {
            if (Session[SessionKeyConfig.OrganizationID] == null)
            {
                return(RedirectToAction("Index", "Account", new { OrganizationID = key }));
            }

            var loginInfo    = SessionLoginInfo.GetInstance(Session);
            var organization = OrganizationReg.GetInstance().GetOrganizationModel(loginInfo.OrganizationID);

            return(View(organization));
        }
        //
        // GET: /Organization/

        public ActionResult OrganizationEdit(string OrganizationID)
        {
            if (string.IsNullOrEmpty(OrganizationID))
            {
                var loginInfo = SessionLoginInfo.GetInstance(Session);
                OrganizationID = loginInfo.OrganizationID;
            }

            var model = OrganizationReg.GetInstance().GetOrganizationModel(OrganizationID);//SessionLoginInfo.GetInstance(Session).OrganizationID);

            Session["OrganizationEdit"] = model;
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult UserEdit(long id)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            var modelreg = new UserModelReg();
            var model    = new UserModel();

            model.DisplayFlag = true;
            if (id > 0)
            {
                if (loginInfo.SystemRoll == SystemRollEnum.SysAdmin)
                {
                    model = modelreg.GetUserModel(id);
                }
                else
                {
                    model = modelreg.GetUserModel(model.OrganizationID, id);
                }
                model.ConfirmPassword = model.Password;
            }
            else
            {
                modelreg.FillUnionOrganizations(model);
            }
            model.SetAuthrityList(loginInfo.SystemRoll);

            var reg   = OrganizationReg.GetInstance();
            var items = reg.GetOrganizationList();

            foreach (var item in items)
            {
                model.Organizations.Add(new SelectListItem()
                {
                    Value = item.OrganizationID, Text = item.OfficeName
                });
            }
            if (model.Guid == 0)
            {
                model.OrganizationID = loginInfo.OrganizationID;
                model.OfficeName     = reg.GetOrganizationModel(model.OrganizationID).OfficeName;
            }

            //var orgModelReg = new OrganizationReg();
            //orgModelReg.SetOrganizationList();
            //model.Organizations = orgModelReg.Items;

            ViewBag.DeleteCheck = modelreg.DeleteCheck(model.OrganizationID, id);
            return(View(model));
        }
        public ActionResult OrganizationEdit(OrganizationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var org = (OrganizationModel)Session["OrganizationEdit"];

            if (!string.IsNullOrEmpty(org.OrganizationID))
            {
                model.OrganizationID = org.OrganizationID;
                model.LastUserID     = SessionLoginInfo.GetInstance(Session).LoginID;
                OrganizationReg.GetInstance().UpdateOrganizationModel(model);
            }
            else
            {
                //model.OrganizationID = Guid.NewGuid().ToString();
                model.LastUserID = SessionLoginInfo.GetInstance(Session).LoginID;
                OrganizationReg.GetInstance().AddNewOrganizationModel(model);
            }

            return(RedirectToAction("Index", "Organization", new { OrganizationID = org.OrganizationID }));
        }
Ejemplo n.º 5
0
        public ActionResult Ok(UserModel model)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            var modelreg = new UserModelReg();
            //if (model.Guid == 0)
            //{
            //    model.OrganizationID = loginInfo.OrganizationID;
            //}

            //ユーザーIDのチェック
            var sameLoginName = false;
            var checkModel    = modelreg.GetUserModelByLoginName(model.OrganizationID, model.LoginName);

            if (model.Guid == 0)
            {
                if (checkModel != null && checkModel.Guid > 0)
                {
                    sameLoginName = true;
                }
            }
            else
            {
                if (checkModel.Guid > 0 && model.Guid != checkModel.Guid)
                {
                    sameLoginName = true;
                }
            }


            if (!sameLoginName && ModelState.IsValid)
            {
                modelreg.EditUser(model, loginInfo.SystemRoll);
                return(RedirectToAction("UserList", "User"));
            }

            if (sameLoginName)
            {
                ModelState.AddModelError("LoginName", LanguageResource.ItemLoginName + "が存在しています");
            }

            model.SetAuthrityList(loginInfo.SystemRoll);

            var reg   = OrganizationReg.GetInstance();
            var items = reg.GetOrganizationList();

            foreach (var item in items)
            {
                model.Organizations.Add(new SelectListItem()
                {
                    Value = item.OrganizationID, Text = item.OfficeName
                });
            }
            if (model.Guid == 0)
            {
                model.OrganizationID = loginInfo.OrganizationID;
                model.OfficeName     = reg.GetOrganizationModel(model.OrganizationID).OfficeName;
            }

            ViewBag.DeleteCheck = modelreg.DeleteCheck(model.OrganizationID, model.Guid);
            return(View(model));
        }