public ActionResult UserList() { var loginInfo = SessionLoginInfo.GetInstance(Session); var modelreg = new UserModelReg(); modelreg.SetUserList(loginInfo.SystemRoll, loginInfo.OrganizationID); return(View(modelreg)); }
public ActionResult Del(long id) { var loginInfo = SessionLoginInfo.GetInstance(Session); string OrganizationID = loginInfo.OrganizationID; if (loginInfo.SystemRoll == SystemRollEnum.SysAdmin) { OrganizationID = ""; } var modelreg = new UserModelReg(); modelreg.DeleteUser(OrganizationID, id); return(RedirectToAction("UserList", "User")); }
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 Sort() { var loginInfo = SessionLoginInfo.GetInstance(Session); var modelreg = new UserModelReg(); modelreg.SetUserList(loginInfo.SystemRoll, loginInfo.OrganizationID); Session[SessionKeyConfig.SortTargetModel] = new SortTargetModel { OrganizationID = SessionLoginInfo.GetInstance(Session).OrganizationID, TableName = "M_User", IdColumn = "Guid", DisplayColumn = "UserName", DisplayNoColumn = "DisplayNo", RedirectController = "User", RedirectAction = "UserList", SortItems = modelreg.Items }; return(RedirectToAction("SortList", "Sorts")); }
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)); }
public UserModel GetUserModel(LogOnModel logOnmodel) { using (var utility = DbUtility.GetInstance()) { StringBuilder sql = new StringBuilder(); sql.Append(@" SELECT `m_user`.`Guid`, `m_user`.`OrganizationID`, `m_user`.`LoginName`, `m_user`.`Password`, `m_user`.`UserName`, `m_user`.`UserNameKana`, `m_user`.`UserNameEn`, `m_user`.`Authority`, `m_user`.`DisplayNo`, `m_user`.`DisplayFlag`, `m_user`.`LastUserID`, `m_user`.`LastUpdatetime` FROM `m_user` where LoginName=@LoginName and Password=@Password "); if (!string.IsNullOrEmpty(logOnmodel.OrganizationID)) { sql.Append(@" and OrganizationID=@OrganizationID;"); } utility.AddParameter("LoginName", logOnmodel.UserID); utility.AddParameter("Password", logOnmodel.Password); utility.AddParameter("OrganizationID", logOnmodel.OrganizationID); UserModel model = new UserModel(); utility.ExecuteReaderModel(sql.ToString(), model); if (model.Guid <= 0) { return(new UserModel()); } if (model.Authority == (int)SystemRollEnum.SysAdmin) { return(model); } else { if (string.IsNullOrEmpty(logOnmodel.OrganizationID)) { UserModelReg.GetInstance().FillUnionOrganizations(model); if (model.UnionOfficeUser) { model.Authority = (int)SystemRollEnum.UnionOfficeUser; return(model); } else { return(new UserModel()); } } else { return(model); } } } }