public static UserGroupList GetList(IWhere whereClause, IOrderBy orderByClause) { SqlDataReader dataReader = GetListReader(DatabaseEnum.ORDERDB, TABLE, whereClause, orderByClause, true); UserGroupList list = new UserGroupList(); while (dataReader.Read()) { list.Add(GetDataObjectFromReader(dataReader)); } dataReader.Close(); return(list); }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <Group> lstGroup = SearchGroupList; if (lstGroup.Count == 0) { Group newGroup = new Group(); lstGroup.Add(newGroup); } CustomList <GroupRule> lstGroupSecurityRule = SearchGroupSecurityRuleList; if (lstGroupSecurityRule.Count == 0) { GroupRule newGroupSecurityRule = new GroupRule(); lstGroupSecurityRule.Add(newGroupSecurityRule); } SetDataFromControls(ref lstGroup); objUserGroupList = UserGroupList.FindAll(f => f.IsSaved); foreach (UserGroup uG in objUserGroupList) { uG.SetAdded(); } if (groupList.IsNotNull()) { CustomList <UserGroup> TempUserGroup = manager.GetAllUserGroup(lstGroup[0].GroupCode); if (TempUserGroup.Count != 0) { foreach (UserGroup uG in TempUserGroup) { uG.Delete(); } } if (!CheckUserAuthentication(lstGroup, groupSecurityRuleList, objUserGroupList)) { return; } manager.SaveGroup(ref TempUserGroup, ref lstGroup, ref groupSecurityRuleList, ref objUserGroupList); txtGroupCode.Text = manager.GroupID; this.SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } } catch (SqlException ex) { this.ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { this.ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
public UserGroupList GetUserGroupList(string userGroupId) { UserGroupList userGroup; List <UserGroupListUser> personlist; UserGroupListUser person; int id = 0; if (userGroupId != null) { id = Convert.ToInt32(userGroupId); } using (BraathenEiendomEntities entity = new BraathenEiendomEntities()) { userGroup = new UserGroupList(); var usrResult = entity.UserGroups.Where(u => u.UserGroupId == id).Select(s => s).FirstOrDefault(); if (usrResult != null) { personlist = new List <UserGroupListUser>(); userGroup.userGroupId = usrResult.UserGroupId; userGroup.name = usrResult.UserGroupName; var persons = entity.People.Join(entity.UserGroup_User, p => p.PersonID, o => o.UserId, (P, O) => new { p = P, o = O }) .Where(w => w.o.UserGroupId == usrResult.UserGroupId).Select(s => s.p).OrderBy(o => o.DisplayName).ToList(); if (persons != null) { foreach (var p in persons.Where(p => p.Custom2 == null)) { person = new UserGroupListUser(); person.id = p.PersonID; person.name = p.DisplayName; person.telephone = p.MobilePhone; person.UserEmail = p.Email; person.PositionTitle = p.Title; var comp = entity.OrganizationUnits.Join(entity.OrganizationUnit_Person, ou => ou.OrganizationUnitID, oup => oup.OrganizationUnitID, (OU, OUP) => new { ou = OU, oup = OUP }) .Where(w => w.oup.PersonID == p.PersonID).Select(s => s.ou).FirstOrDefault(); if (comp != null) { person.companyId = comp.OrganizationUnitID; person.companyName = comp.OrganizationUnitName; } personlist.Add(person); } } userGroup.personList = personlist; } } return(userGroup); }
protected void btnDelete_Click(object sender, EventArgs e) { try { objUserGroupList = new CustomList <UserGroup>(); objUserGroupList = UserGroupList.FindAll(f => f.IsSaved); groupList = SearchGroupList; groupSecurityRuleList = SearchGroupSecurityRuleList; if (groupList[0].GroupCode != StaticInfo.NewIDString && groupList.Count != 0) { foreach (UserGroup uG in objUserGroupList) { if (uG.IsDeleted.IsFalse()) { uG.Delete(); } } foreach (GroupRule gSR in groupSecurityRuleList) { if (gSR.IsDeleted.IsFalse()) { gSR.Delete(); } } foreach (Group group in groupList) { if (group.IsDeleted.IsFalse()) { group.Delete(); } } if (CheckUserAuthentication(objUserGroupList, groupSecurityRuleList, groupList).IsFalse()) { return; } manager.DeleteGroup(ref objUserGroupList, ref groupSecurityRuleList, ref groupList); ClearControls(); InitializeSession(); this.ErrorMessage = (StaticInfo.DeletedSuccessfullyMsg); EnableAllControls(false); } } catch (Exception) { throw; } }
//public string ConnString; //public UserDAL(string ConnString) //{ // this.ConnString = ConnString; //} //public ICollection<UserDTO> GetAllUsersfromDB() //{ // ICollection<UserDTO> outputList = default(ICollection<UserDTO>); // //IDbConnection con = new SqlConnection(); // //try // //{ // // con.ConnectionString = ConnString; // // con.Open(); // // if (con.State == ConnectionState.Open) // // { // // // Open DB Connection // // UserBusiness _UserBusiness = new UserBusiness(); // // UserList _UserList = _UserBusiness.SelectRows(null, null, null, null); // // con.Close(); // // if (_UserList != null && _UserList.Count > 0) // // outputList = Mapper.MapOutside(_UserList); // // } // //} // //catch (Exception) // //{ // // // Log Error Here // //} // try // { // UserBusiness _UserBusiness = new UserBusiness(); // UserList _UserList = _UserBusiness.SelectRows(null, null, null, null); // if (_UserList != null && _UserList.Count > 0) // outputList = Mapper.MapOutside(_UserList); // } // catch (Exception ex) // { // // Log Exception Here // } // return outputList; //} public ICollection <UserDTO> GetAllUsersfromDB() { ICollection <UserDTO> outputList = default(ICollection <UserDTO>); try { // 1- Select All Users From DB UserBusiness _UserBusiness = new UserBusiness(); UserList _UserList = _UserBusiness.SelectRows(null, null, null, null); if (_UserList != null && _UserList.Count > 0) //outputList = Mapper.MapUserAsOutput(); { // 2- Prepare Mapping Obects (Fill Values from DB) Mapper._GroupList = fillGroupList(); //default(List<Group>); Mapper._FunctionList = fillFunctionList(); //default(List<Function>); Mapper._UserList = _UserList; Mapper._UserGroupList = new List <UserGroup>(); //default(List<UserGroup>); Mapper._GroupFunctionList = fillGroupFunctionList(); //default(List<GroupFunction>); UserGroupBusiness _UserGroupBusiness = new UserGroupBusiness(); UserGroupList _UserGroupList = default(UserGroupList); foreach (User _User in _UserList) { _UserGroupList = _UserGroupBusiness.SelectRows(null, _User.Id, null); if (_UserGroupList != null && _UserGroupList.Count > 0) { foreach (UserGroup _UserGroup in _UserGroupList) { Mapper._UserGroupList.Add(Copier.copyUserGroup(_UserGroup)); } } } // 3- Perform Mapping to Output outputList = Mapper.MapUserAsOutput(); } } catch (Exception ex) { // Log Exception Here throw; //new Exception(ex.Message); } return(outputList); }
public questStatus Read(DbMgrTransaction trans, UserId userId, out UserGroupList userGroupList) { // Initialize questStatus status = null; userGroupList = null; // Read groupUser status = _dbGroupUsersMgr.Read(trans, userId, out userGroupList); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }
private void GroupsGridCellClick(object sender, DataGridViewCellEventArgs e) { try { //if (dgvGroups.DataSourceChanging || _refreshingGroups || _refreshingUsers || e.ColumnIndex != 0 // || !CurrentUser.HasPermission(ACICategory, ACIOptions.Modify)) if (_refreshingGroups || _refreshingUsers || e.ColumnIndex != 0 || !CurrentUser.HasPermission(ACICategory, ACIOptions.MODIFY)) { return; } var selectedGroup = GetSelectedGroup(); var selectedUser = GetSelectedUser(); if (selectedUser != null && (selectedUser.AccountType == AccountTypes.ADUser || selectedUser.AccountType == AccountTypes.ADSuperUser)) { DisplayWarning(TranslationKey.Message_UserGroup_ModifyNotAllowed, "Action not allowed", "It is not allowed to modify group assignments for domain users."); return; } if (selectedGroup != null && selectedUser != null) { var selectedUserGroupListItem = UserGroupList.Find(aci => aci.UserId == selectedUser.Id && aci.GroupId == selectedGroup.Id); if (selectedUserGroupListItem != null) { new UserGroupLists().Delete(selectedUserGroupListItem); UserGroupList.RemoveAll(aci => aci.UserId == selectedUser.Id && aci.GroupId == selectedGroup.Id); } else { selectedUserGroupListItem = new UserGroupList(selectedUser.Id, selectedGroup.Id); new UserGroupLists().Add(selectedUserGroupListItem); UserGroupList.Add(selectedUserGroupListItem); } RefreshGroupsGrid(selectedGroup); } } catch (Exception ex) { Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex); DisplayError(Trace.GetMethodName(), TranslationKey.CommonMessage_InternalError, ex); } }
private void loadUser() { ShowBusyIndicator(); userService.GetUser((res, exp) => appController.BeginInvokeOnDispatcher(() => { HideBusyIndicator(); if (exp == null) { User = res; UserGroupList.Where(allGroups => User.Groups.Select(g => g.PartyName).Contains(allGroups.PartyName)) .ToList().ForEach(g => g.IsChecked = true); } else { appController.HandleException(exp); } }), User.PartyName); }
public IEnumerable <UserGroupList> GetUserGroup() { List <UserGroupList> userGroupList; UserGroupList userGroup; using (BraathenEiendomEntities entity = new BraathenEiendomEntities()) { var usrResult = entity.UserGroups.Select(s => s).ToList(); userGroupList = new List <UserGroupList>(); foreach (var usr in usrResult) { userGroup = new UserGroupList(); userGroup.userGroupId = usr.UserGroupId; userGroup.name = usr.UserGroupName; userGroupList.Add(userGroup); } } return(userGroupList); }
public questStatus Read(UserId userId, out UserGroupList userGroupList) { // Initialize questStatus status = null; userGroupList = null; // Get user User user = null; status = _dbUsersMgr.Read(userId, out user); if (!questStatusDef.IsSuccess(status)) { return(status); } // Get user groups using (FMSEntities dbContext = new FMSEntities()) { List <Quest.Services.Dbio.FMS.GroupUsers> _groupUserList = null; status = read(dbContext, userId, out _groupUserList); if (!questStatusDef.IsSuccess(status)) { return(status); } userGroupList = new UserGroupList(); userGroupList.User = user; foreach (Quest.Services.Dbio.FMS.GroupUsers _groupUser in _groupUserList) { // Get group GroupId groupId = new GroupId(_groupUser.GroupId); Group group = null; status = _dbGroupsMgr.Read(groupId, out group); if (!questStatusDef.IsSuccess(status)) { return(status); } userGroupList.GroupList.Add(group); } } return(new questStatus(Severity.Success)); }
public IEnumerable <UserGroupList> UserWiseGroupList(int userId) { List <UserGroupList> userGroupList; UserGroupList userGroup; using (BraathenEiendomEntities entity = new BraathenEiendomEntities()) { var usrResult = entity.UserGroups.Join(entity.UserGroup_User, p => p.UserGroupId, o => o.UserGroupId, (P, O) => new { p = P, o = O }) .Where(w => w.o.UserId == userId).Select(s => s.p).OrderBy(o => o.UserGroupName).ToList(); userGroupList = new List <UserGroupList>(); foreach (var usr in usrResult) { userGroup = new UserGroupList(); userGroup.userGroupId = usr.UserGroupId; userGroup.name = usr.UserGroupName; userGroupList.Add(userGroup); } } return(userGroupList); }
public questStatus GetUserGroups(UserId userId, out List <Group> groupList) { // Initialize questStatus status = null; groupList = null; // Get all user groups. UserGroupList userGroupList = null; status = _dbGroupUsersMgr.Read(userId, out userGroupList); if (!questStatusDef.IsSuccess(status)) { return(status); } // Return groups groupList = userGroupList.GroupList; return(new questStatus(Severity.Success)); }
private void InitalPage() { if (!DataValidateManager.ValidateIsNull(Session[ConstantsManager.SESSION_USER_GROUP_ID])) { string[] strArrUserGroupID = ((string)Session[ConstantsManager.SESSION_USER_GROUP_ID]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Hashtable htUserGroup = new Hashtable(); foreach (string strUserGroupID in strArrUserGroupID) { string strUserGroupName; RICH.Common.BM.T_PM_UserGroupInfo.T_PM_UserGroupInfoBusinessEntityBase t_PM_UserGroupInfoBusinessEntityBase = new RICH.Common.BM.T_PM_UserGroupInfo.T_PM_UserGroupInfoBusinessEntityBase(); strUserGroupName = (string)t_PM_UserGroupInfoBusinessEntityBase.GetValueByFixCondition("UserGroupID", strUserGroupID, "UserGroupName"); if (!DataValidateManager.ValidateIsNull(strUserGroupName)) { htUserGroup.Add(strUserGroupID, strUserGroupName); } } UserGroupList.DataSource = htUserGroup; UserGroupList.DataBind(); GetMenu(Request.Cookies["LAST_MENU_USERGROUPID"] != null ? Server.UrlDecode(Request.Cookies["LAST_MENU_USERGROUPID"].Value) : strArrUserGroupID[0]); } }
/// <summary> /// Return list data of usergroup /// </summary> /// <param name="totalRow">total of record in db</param> /// <param name="take">Get n row</param> /// <param name="skip">skip n row</param> /// <returns></returns> public string GetDataPaging(int totalRow, int take = 1, int skip = 0) { UserGroupList model = new UserGroupList(); UserInfo usInfo = System.Web.HttpContext.Current.Session["UserInfo"] as UserInfo; model.total = _roleService.GetAllRoles(usInfo.IsTenant, false, usInfo.TenanID).Count(); model.data = _roleService.GetAllRoles(usInfo.IsTenant, false, usInfo.TenanID).Skip(skip).Take(take).ToList(); for (int i = 0; i < model.data.Count; i++) { model.data[i].RoleName = WebUtility.HtmlDecode(model.data[i].RoleName); model.data[i].Description = WebUtility.HtmlDecode(model.data[i].Description); try { model.data[i].TenantName = _tenantService.GetTenantByTenantId(model.data[i].TenantId).TenantName; } catch { model.data[i].TenantName = "#"; } } return(JsonConvert.SerializeObject(model)); }
public int SaveRows(DbTransaction pTran, UserGroupList UserGroupList) { int intRows = 0; for (int i = 0; i < UserGroupList.Count; i++) { switch (UserGroupList[i].CommonState) { case CommonState.Added: intRows += InsertRow(pTran, UserGroupList[i]); break; case CommonState.Modified: intRows += UpdateRow(pTran, UserGroupList[i]); break; case CommonState.Deleted: intRows += DeleteRow(pTran, UserGroupList[i]); break; } } return(intRows); }
public int SaveRows(DbTransaction pTran, UserGroupList UserGroupList) { return(SaveRows(pTran, UserGroupList, true)); }
public int SaveRows(UserGroupList UserGroupList) { DbTransaction Tran = null; return(SaveRows(Tran, UserGroupList, true)); }
public CustomList <UserGroupList> GetAllUserGroupWithUserCode(string userCode) { return(UserGroupList.GetAllUserGroupWithUserCode(userCode)); }
public UserDTO UpdateUserinDB(UserDTO userDTO) { BaseDataAccess _db = new BaseDataAccess(); using (DbTransaction dbTransaction = _db.CreateTransaction()) { try { // 1- Perform Mapping to Input (for Saving in DB) if (Mapper.MapUserAsInput(userDTO)) { ////User user = Mapper._User; ////List<UserGroup> userGroups = Mapper._UserGroupListInput; //UserBusiness userBusiness = new UserBusiness(); //if (userBusiness.InsertRow(dbTransaction, Mapper._User) > 0) //{ // UserGroupBusiness userGroupBusiness = new UserGroupBusiness(); // if (Mapper._UserGroupListInput != null && Mapper._UserGroupListInput.Count > 0) // { // foreach (UserGroup userGroup in Mapper._UserGroupListInput) // { // userGroup.userId = Mapper._User.Id; // userGroupBusiness = new UserGroupBusiness(); // userGroupBusiness.InsertRow(dbTransaction, userGroup); // } // dbTransaction.Commit(); // } // else // dbTransaction.Rollback(); //} //else // throw new DataException("DataBase Operation Failure"); // 2- Select User to be updated UserBusiness userBusiness = new UserBusiness(); UserList userList = userBusiness.SelectRows(Mapper._User.Id, null, null, null); if (userList != null && userList.Count > 0) { userList[0].userName = Mapper._User.userName; userList[0].fullName = Mapper._User.fullName; userList[0].Password = Mapper._User.Password; userList[0].status = Mapper._User.status; // 3- Update User Data by Input Values userBusiness = new UserBusiness(); if (userBusiness.UpdateRow(dbTransaction, userList[0]) > 0) { // 4- Remove User Groups Already Saved for that User in DB UserGroupBusiness userGroupBusiness = new UserGroupBusiness(); UserGroupList userGroupList = userGroupBusiness.SelectRows(null, Mapper._User.Id, null); if (userGroupList != null && userGroupList.Count > 0) { //foreach (UserGroup userGroup in Mapper._UserGroupList) //{ // userGroupBusiness = new UserGroupBusiness(); // userGroupBusiness.DeleteRow(dbTransaction, userGroup); //} foreach (UserGroup userGroup in userGroupList) { userGroupBusiness = new UserGroupBusiness(); userGroupBusiness.DeleteRow(dbTransaction, userGroup); } } // 5- Add New User Groups from Input if (Mapper._UserGroupListInput != null && Mapper._UserGroupListInput.Count > 0) { foreach (UserGroup userGroup in Mapper._UserGroupListInput) { userGroupBusiness = new UserGroupBusiness(); userGroupBusiness.InsertRow(dbTransaction, userGroup); } dbTransaction.Commit(); } } else { dbTransaction.Rollback(); throw new Exception("DataBase Operation Failure"); } } else { throw new Exception("User Id Not Found in DB"); } } else { throw new ArgumentNullException("userDTO"); } } catch (Exception ex) { dbTransaction.Rollback(); throw new Exception("DataBase Operation Failure"); } } return(userDTO); }
private void matchThePersona() { String currentUser = EncompassApplication.Session.UserID; Excel.Application userApp = new Excel.Application(); Excel.Workbook userWorkbook = userApp.Workbooks.Open(@"\\ftwfs02\Groups\POS\Encompass Support\New User Plugin\UserTest16.xlsx"); Excel._Worksheet userWorksheet = userWorkbook.Sheets[1]; Excel.Range userRange = userWorksheet.UsedRange; int rCnt = 1; int cCnt = 1; int rowCount = userRange.Rows.Count; int colCount = userRange.Columns.Count; string newFirst; string newLast; string userID; string stopGO = "2"; string eMail; string taskNo; string mgrID; string procTitle; string pWord = "P@ssword1"; for (rCnt = 2; rCnt <= rowCount; rCnt++) { PersName = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; userID = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; newFirst = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; newLast = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; eMail = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; taskNo = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; mgrID = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt++; procTitle = (string)(userWorksheet.Cells[rCnt, cCnt].Value2); cCnt = 1; if (userID.Length >= 17) { MessageBox.Show("User " + userID + " length is longer than 16 characters. The program will stop and all Users after this user will not be created. Please adjust."); } List <PersonaPull> pSelect = CDO.PersonaPull.ToList(); List <string> persColl = new List <string>(); List <string> mngrGroup = new List <string>(); UserGroupList userGroups = new UserGroupList(); List <string> userGroup = new List <string>(); UserGroupList mngrGroups = new UserGroupList(); PersonaList listPers = new PersonaList(); foreach (PersonaPull item in pSelect) { if (PersName != "") { if (item.PersName == PersName) { OrgFolder = item.OrgFolder; Access = item.Access; userGroup = item.Group.ToList(); persColl = item.PersonaName.ToList(); foreach (string perColl in persColl) { listPers.Add(EncompassApplication.Session.Users.Personas.GetPersonaByName(perColl)); } } } } OrganizationList orgs = EncompassApplication.Session.Organizations.GetAllOrganizations(); foreach (Organization org in orgs) { UserList orgUsers = org.GetUsers(); foreach (User useID in orgUsers) { if (useID.ID.ToString() == userID.ToLower()) { EncompassApplication.CurrentLoan.Fields["CX.ADMIN.CREATE.USERS.DUP"].Value = EncompassApplication.CurrentLoan.Fields["CX.ADMIN.CREATE.USERS.DUP"].Value + "\n" + userID + "\n"; goto stop; } } if (OrgFolder == "Processing Teams" ^ OrgFolder == "Closing Teams" ^ OrgFolder == "Underwriting Teams") { OrganizationList procOrgs = EncompassApplication.Session.Organizations.GetAllOrganizations(); foreach (Organization procOrg in procOrgs) { if (mgrID != "DavidJobes" ^ mgrID != "MichaelTrainor") { if (mgrID.ToLower() == procOrg.Description) { OrgFolder = procOrg.ToString(); } } if (mgrID == "MichaelTrainor" && OrgFolder == "Processing Teams") { if (procTitle == "Digital Risk") { OrgFolder = "Digital Risk Processors"; } else if (procTitle == "Maxwell") { OrgFolder = "Maxwell Processors"; } else if (procTitle == "Accenture") { OrgFolder = "Accenture Processors"; } else { OrgFolder = "Digital Risk Processors"; } } else if (mgrID == "DavidJobes" && OrgFolder == "Processing Teams") { OrgFolder = "CD Operations"; } else if (mgrID == "MichaelTrainor" && OrgFolder == "Closing Teams") { OrgFolder = "Sourcepoint Closers"; } } } } OrganizationList userOrgs = EncompassApplication.Session.Organizations.GetOrganizationsByName(OrgFolder); foreach (Organization userOrg in userOrgs) { User newUser = userOrg.CreateUser(userID, pWord, listPers); newUser.FirstName = newFirst; newUser.LastName = newLast; newUser.Email = eMail; newUser.WorkingFolder = "My Pipeline"; SubordinateLoanAccessRight readWrite = SubordinateLoanAccessRight.ReadWrite; SubordinateLoanAccessRight readOnly = SubordinateLoanAccessRight.ReadOnly; PeerLoanAccessRight readWritep = PeerLoanAccessRight.ReadWrite; PeerLoanAccessRight readNo = PeerLoanAccessRight.None; if (Access == "Full") { newUser.SubordinateLoanAccessRight = readWrite; newUser.PeerLoanAccessRight = readWritep; } else { newUser.SubordinateLoanAccessRight = readOnly; newUser.PeerLoanAccessRight = readNo; } CCSiteInfo ccSite = new CCSiteInfo(); ccSite.UseParentInfo = false; ccSite.UseParentInfo = true; //newUser.Refresh(); newUser.Commit(); listPers.Clear(); foreach (string uGroup in userGroup) { userGroups.Add(EncompassApplication.Session.Users.Groups.GetGroupByName(uGroup)); } foreach (UserGroup addUser in userGroups) { User idGet = EncompassApplication.Session.Users.GetUser(userID); addUser.AddUser(idGet); } string glass = "TPO Wholesale Manager - Glass"; string cullen = "TPO Wholesale Manager - Cullen"; string murphy = "TPO Wholesale Manager - Murphy"; mngrGroup.Add(glass); mngrGroup.Add(cullen); mngrGroup.Add(murphy); foreach (string mGroup in mngrGroup) { mngrGroups.Add(EncompassApplication.Session.Users.Groups.GetGroupByName(mGroup)); } foreach (UserGroup addMngr in mngrGroups) { User idMngr = EncompassApplication.Session.Users.GetUser(userID); if (mgrID == "michaelcullen") { if (addMngr == EncompassApplication.Session.Users.Groups.GetGroupByName(cullen)) { addMngr.AddUser(idMngr); } } if (mgrID == "ronaldglass") { if (addMngr == EncompassApplication.Session.Users.Groups.GetGroupByName(glass)) { addMngr.AddUser(idMngr); } } if (mgrID == "glenmurphy") { if (addMngr == EncompassApplication.Session.Users.Groups.GetGroupByName(murphy)) { addMngr.AddUser(idMngr); } } } IOrganizationManager orgMgr = EllieMae.EMLite.RemotingServices.Session.OrganizationManager; UserInfo userInfo = orgMgr.GetUser(userID); userInfo.RequirePasswordChange = true; userInfo.PersonaAccessComments = "Created via " + taskNo + " on " + DateTime.Now; orgMgr.UpdateUser(userInfo); } stop: stopGO = "1"; } userWorkbook.Close(true, null, null); userApp.Quit(); Marshal.ReleaseComObject(userWorksheet); Marshal.ReleaseComObject(userWorkbook); Marshal.ReleaseComObject(userApp); }
private void MembershipSupergridCellValueChanged(object sender, GridCellValueChangedEventArgs e) { try { if (!CurrentUser.HasPermission(ACICategory, ACIOptions.MODIFY)) { return; } if (_user != null && (_user.AccountType == AccountTypes.ADUser || _user.AccountType == AccountTypes.ADSuperUser)) { DisplayWarning(TranslationKey.Message_UserGroup_ModifyNotAllowed, "Action not allowed", "It is not allowed to modify group assignments for domain users."); return; } if (_user != null) { var row = (UMMembershipHelper.GroupHelper)e.GridCell.GridRow.GetCell(OBJECT).Value; row.Member = (bool)e.NewValue; if (!row.Member) { var userGroupList = new UserGroupList(_user.Id, row.Id); new UserGroupLists().Delete(userGroupList); AddHistoryAction(TranslationKey.History_MembershipPopupForm_Deleted, "User {0} deleted user {1} from group {2}", CurrentUser.User.Username, _user.Username, row.Name); } else { var userGroupList = new UserGroupList(_user.Id, row.Id); new UserGroupLists().Add(userGroupList); AddHistoryAction(TranslationKey.History_MembershipPopupForm_Added, "User {0} added user {1} to group {2}", CurrentUser.User.Username, _user.Username, row.Name); } } else if (_group != null) { var row = (UMMembershipHelper.UserHelper)e.GridCell.GridRow.GetCell(OBJECT).Value; row.Member = (bool)e.NewValue; if (row.AccountType == AccountTypes.ADUser || row.AccountType == AccountTypes.ADSuperUser) { DisplayWarning(TranslationKey.Message_UserGroup_ModifyNotAllowed, "Action not allowed", "It is not allowed to modify group assignments for domain users."); return; } if (!row.Member) { var userGroupList = new UserGroupList(row.Id, _group.Id); new UserGroupLists().Delete(userGroupList); AddHistoryAction(TranslationKey.History_MembershipPopupForm_Deleted, "User {0} deleted user {1} from group {2}", CurrentUser.User.Username, row.Username, _group.Name); } else { var userGroupList = new UserGroupList(row.Id, _group.Id); new UserGroupLists().Add(userGroupList); AddHistoryAction(TranslationKey.History_MembershipPopupForm_Added, "User {0} added user {1} to group {2}", CurrentUser.User.Username, row.Username, _group.Name); } } } catch (Exception ex) { Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex); DisplayError(Trace.GetMethodName(), TranslationKey.CommonMessage_InternalError, ex); } finally { Refresh(); } }