private void DisableUser(string ID) { ProcessUser _user = new ProcessUser(); try { _user.UID = int.Parse(ID); _user.disableUser(); LoadUser(Session["trkCompany"].ToString()); _lblMessage.Text = "Disable completed"; } catch (Exception ex) { ex.Message.ToString(); } finally { _user = null; } }
private void DeleteUser(string ID) { ProcessUser _user = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.DELETE); try { _user.UID = int.Parse(ID); _user.invoke(); LoadUser(Session["trkCompany"].ToString()); _lblMessage.Text = "User Deleted."; } catch (Exception ex) { ex.Message.ToString(); } finally { _user = null; } }
private void updateUser() { ProcessUser _processUser = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.UPDATE); User _userObj = new User(); try { _userObj.UID = int.Parse(_ddlUser.SelectedValue); _userObj.GroupID = int.Parse(_ddlGroup.SelectedValue); _userObj.Password = EncDec.GetEncryptedText(_txtPassword.Text); _userObj.UserName = _txtFullName.Text; _userObj.Email = _txtEmail.Text; _userObj.SecurityQuestion = int.Parse(_ddlSecurityQuestion.SelectedValue); _userObj.SecurityAnswer = _txtSecurityA.Text; _userObj.SecurityScheme = int.Parse(_ddlSecurityScheme.SelectedValue); _userObj.IsActive = _chkIsActive.Checked; _processUser.UserObj = _userObj; _processUser.invoke(); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); throw new Exception(ex.Message.ToString()); } finally { _processUser = null; _userObj = null; } }
private void saveUser() { User _user = new User(); ProcessUser _processUser = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.INSERT); string password = _txtPassword.Text; try { _user.Login = _txtLoginName.Text; _user.UserName = _txtFullName.Text; _user.ComID = int.Parse(Session["trkCompany"].ToString()); _user.GroupID = int.Parse(_ddlGroup.SelectedValue); _user.Email = _txtEmail.Text; _user.IsActive = _chkIsActive.Checked; _user.RoleID = 3; _user.Password = EncDec.GetEncryptedText(password); _user.SecurityQuestion = int.Parse(_ddlSecurityQuestion.SelectedValue); _user.SecurityScheme = int.Parse(_ddlSecurityScheme.SelectedValue); _user.SecurityAnswer = _txtSecurityA.Text; _processUser.UserObj = _user; _processUser.invoke(); uID = _processUser.UID; Mailer.SendWelcomeMail(_user.Email, _user.Login, password, Session["trkCompany"].ToString()); clearControls(); _lblMessage.Text = "User Created Successfully."; _lblMessage.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); throw new Exception(ex.Message.ToString()); } finally { _user = null; _processUser = null; } }
private void loadUserInfo(int _uID) { User _userObj = new User(); try { _userObj.UID = _uID; ProcessUser _processUser = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.SELECT); _processUser.UserObj = _userObj; _processUser.invoke(); DataSet _ds = _processUser.Ds; _txtLoginName.Text = _ds.Tables[0].Rows[0]["login"].ToString(); _txtFullName.Text = _ds.Tables[0].Rows[0]["userName"].ToString(); _txtEmail.Text = _ds.Tables[0].Rows[0]["email"].ToString(); string _pass = EncDec.GetDecryptedText(_ds.Tables[0].Rows[0]["password"].ToString()); _txtPassword.Attributes.Add("value", _pass); _txtConfirmPassword.Attributes.Add("value", _pass); _ddlGroup.SelectedValue = _ds.Tables[0].Rows[0]["groupID"].ToString(); _ddlSecurityQuestion.SelectedValue = _ds.Tables[0].Rows[0]["securityQuestion"].ToString(); _txtSecurityA.Text = _ds.Tables[0].Rows[0]["securityAnswer"].ToString(); _chkIsActive.Checked = bool.Parse(_ds.Tables[0].Rows[0]["isActive"].ToString()); if (_ds.Tables[1].Rows.Count > 0) { _ddlSecurityScheme.SelectedValue = _ds.Tables[1].Rows[0]["schemeID"].ToString(); } } catch (Exception ex) { ex.Message.ToString(); } finally { _userObj = null; } }
private void createUser(string fullName, string name, string password, string email, int unitGroupID, int userGroupID, int securityQuestion, string securityAnswer) { User _user = new User(); ProcessUser _processUser = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.INSERT); try { _user.Login = name; _user.UserName = fullName; _user.ComID = comID; _user.GroupID = userGroupID; _user.Email = email; _user.IsActive = true; _user.RoleID = 3; _user.Password = EncDec.GetEncryptedText(password); _user.SecurityQuestion = int.Parse(ddlSecurityQuestion.SelectedValue); _user.SecurityScheme = getDefaultSecurityScheme(); _user.SecurityAnswer = securityAnswer; _processUser.UserObj = _user; _processUser.invoke(); int uID = _processUser.UID; ProcessUserGroupUnits _processGroup = new ProcessUserGroupUnits(AlarmasABC.BLL.InvokeOperations.operations.INSERT); _processGroup.ComID = comID; _processGroup.GroupID = unitGroupID; _processGroup.UserID = uID; _processGroup.invoke(); Mailer.SendWelcomeMail(_user.Email, _user.Login, password, comID.ToString()); } catch (Exception ex) { throw new Exception("CreateNewAccount::createUser(): " + ex.Message.ToString()); } finally { _user = null; _processUser = null; } }