private void BindAccount() { try { TextBoxUserName.Enabled = false; Account account = Account.GetAccountByAccountId(this.accountId); TextBoxUserName.Text = account.UserName; TextBoxFirstName.Text = account.FirstName; TextBoxLastName.Text = account.LastName; //TextBoxCompany.Text = account.Company; TextBoxEmail.Text = account.Email; DropDownListCompany.Items.FindByValue(account.CompanyId.ToString()).Selected = true; DropDownListStatusId.Items.FindByValue(account.StatusId.ToString()).Selected = true; BindAccountRegionList(); CheckBoxAllRegions.Checked = account.AllRegions; PanelRegion.Visible = true; MembershipUser membership = Membership.GetUser(account.UserName); if (membership.IsLockedOut == true) { ButtonAccountState.Text = "Unlock Account"; ButtonAccountState.Visible = true; } //ButtonDisableAccount.Visible = true; DropDownListStatusId.ClearSelection(); if (membership.IsApproved == true) { //ButtonDisableAccount.Text = "Disable Account"; DropDownListStatusId.Items.FindByValue("1").Selected = true; } else { //ButtonDisableAccount.Text = "Enable Account"; DropDownListStatusId.Items.FindByValue("2").Selected = true; } } catch (System.Data.SqlClient.SqlException sqlEx) { for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } catch (Exception exception) { LabelError.Text += (exception.Message + "<br />"); PanelError.Visible = true; } }
private void BindAccount() { try { TextBoxUserName.Enabled = false; Account account = Account.GetAccountByAccountId(this.accountId); //Employee employee = Employee.GetEmployeeByEmployeeId(account.EmployeeId); TextBoxUserName.Text = account.UserName; //TextBoxCompany.Text = account.Company; TextBoxEmail.Text = account.Email; //DropDownListCompany.Items.FindByValue(account.CompanyId.ToString()).Selected = true; DropDownListStatusId.Items.FindByValue(account.StatusId.ToString()).Selected = true; MembershipUser membership = Membership.GetUser(account.UserName); if (membership.IsLockedOut == true) { ButtonAccountState.Text = "Unlock Account"; ButtonAccountState.Visible = true; } //ButtonDisableAccount.Visible = true; DropDownListStatusId.ClearSelection(); if (membership.IsApproved == true) { //ButtonDisableAccount.Text = "Disable Account"; DropDownListStatusId.Items.FindByValue("1").Selected = true; } else { //ButtonDisableAccount.Text = "Enable Account"; DropDownListStatusId.Items.FindByValue("2").Selected = true; } if (Roles.IsUserInRole(TextBoxUserName.Text, "REPCLAIM")) { DropDownListRole.Items.FindByValue("REPCLAIM").Selected = true; } if (Roles.IsUserInRole(TextBoxUserName.Text, "EMPLOYEE")) { DropDownListRole.Items.FindByValue("EMPLOYEE").Selected = true; } if (Roles.IsUserInRole(TextBoxUserName.Text, "SUPPLIER")) { DropDownListRole.Items.FindByValue("SUPPLIER").Selected = true; } } catch (System.Data.SqlClient.SqlException sqlEx) { for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } catch (Exception exception) { LabelError.Text += (exception.Message + "<br />"); PanelError.Visible = true; } }