/// <summary> /// /// </summary> protected void BindData() { AccountAdmin accountAdmin = new AccountAdmin(); AccountTypeAdmin accountTypeAdmin = new AccountTypeAdmin(); ProfileAdmin profileAdmin = new ProfileAdmin(); CustomerAdmin customerAdmin = new CustomerAdmin(); ReferralCommissionAdmin referralCommissionAdmin = new ReferralCommissionAdmin(); ZNode.Libraries.DataAccess.Entities.Account account = accountAdmin.GetByAccountID(AccountID); if (account != null) { // General Information lblAccountID.Text = account.AccountID.ToString(); lblCompanyName.Text = account.BillingCompanyName; lblExternalAccNumber.Text = account.ExternalAccountNo; lblDescription.Text = account.Description; lblLoginName.Text = customerAdmin.GetByUserID(int.Parse(AccountID.ToString())); lblCustomerDetails.Text = account.AccountID.ToString() + " - " + account.BillingFirstName + " " + account.BillingLastName; lblWebSite.Text = account.Website; lblSource.Text = account.Source; lblCreatedDate.Text = account.CreateDte.ToShortDateString(); lblCreatedUser.Text = account.CreateUser; // Referral Detail // Get Referral Type Name for a Account if (account.ReferralCommissionTypeID != null) { ReferralCommissionType referralType = referralCommissionAdmin.GetByReferralID(int.Parse(account.ReferralCommissionTypeID.ToString())); lblReferralType.Text = referralType.Name; } else { lblReferralType.Text = ""; } if (account.ReferralStatus == "A") { string affiliateLink = "http://" + ZNodeConfigManager.SiteConfig.DomainName + "/default.aspx?affiliate_id=" + account.AccountID; hlAffiliateLink.Text = affiliateLink; hlAffiliateLink.NavigateUrl = affiliateLink; } else { hlAffiliateLink.Text = "NA"; } if (account.ReferralCommission != null) { if (account.ReferralCommissionTypeID == 1) { lblReferralCommission.Text = account.ReferralCommission.Value.ToString("N"); } else { lblReferralCommission.Text = account.ReferralCommission.Value.ToString("c"); } } else { lblReferralCommission.Text = ""; } lblTaxId.Text = account.TaxID; if (account.ReferralStatus != null) { //Getting the Status Description Array values = Enum.GetValues(typeof(ZNodeApprovalStatus.ApprovalStatus)); Array names=Enum.GetNames(typeof(ZNodeApprovalStatus.ApprovalStatus)); for (int i = 0; i < names.Length; i++) { if (names.GetValue(i).ToString() == account.ReferralStatus) { lblReferralStatus.Text = ZNodeApprovalStatus.GetEnumValue(values.GetValue(i)); break; } } BindPayments(accountAdmin); } else { pnlAffiliatePayment.Visible = false; lblReferralStatus.Text = ""; } if (account.UpdateDte != null) { lblUpdatedDate.Text = account.UpdateDte.Value.ToShortDateString(); } // Email Opt-In if (account.EmailOptIn) { EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(true); } else { EmailOptin.Src = ZNode.Libraries.Framework.Business.ZNodeHelper.GetCheckMark(false); } lblUpdatedUser.Text = account.UpdateUser; lblCustom1.Text = account.Custom1; lblCustom2.Text = account.Custom2; lblCustom3.Text = account.Custom3; // Get Profile Type Name for a Account Profile _profileList = profileAdmin.GetByProfileID(int.Parse(account.ProfileID.ToString())); lblProfileTypeName.Text = _profileList.Name; // Address Information ZNodeAddress AddressFormat = new ZNodeAddress(); // Format Billing Address AddressFormat.FirstName = string.IsNullOrEmpty(account.BillingFirstName) ? string.Empty : account.BillingFirstName; AddressFormat.LastName = string.IsNullOrEmpty(account.BillingLastName) ? string.Empty : account.BillingLastName; AddressFormat.CompanyName = string.IsNullOrEmpty(account.BillingCompanyName) ? string.Empty : account.BillingCompanyName; AddressFormat.Street1 = string.IsNullOrEmpty(account.BillingStreet) ? string.Empty : account.BillingStreet; AddressFormat.Street2 = string.IsNullOrEmpty(account.BillingStreet1) ? string.Empty : account.BillingStreet1; AddressFormat.City = string.IsNullOrEmpty(account.BillingCity) ? string.Empty : account.BillingCity; AddressFormat.StateCode = string.IsNullOrEmpty(account.BillingStateCode) ? string.Empty : account.BillingStateCode; AddressFormat.PostalCode = string.IsNullOrEmpty(account.BillingPostalCode) ? string.Empty : account.BillingPostalCode; AddressFormat.CountryCode = string.IsNullOrEmpty(account.BillingCountryCode) ? string.Empty : account.BillingCountryCode; lblBillingAddress.Text = AddressFormat.ToString() + "Tel: " + account.BillingPhoneNumber + "<br>Email: " + account.BillingEmailID; // Format Shipping Address AddressFormat.FirstName = string.IsNullOrEmpty(account.ShipFirstName) ? string.Empty : account.BillingFirstName; AddressFormat.LastName = string.IsNullOrEmpty(account.ShipLastName) ? string.Empty : account.ShipLastName; AddressFormat.CompanyName = string.IsNullOrEmpty(account.ShipCompanyName) ? string.Empty : account.ShipCompanyName; AddressFormat.Street1 = string.IsNullOrEmpty(account.ShipStreet) ? string.Empty : account.ShipStreet; AddressFormat.Street2 = string.IsNullOrEmpty(account.ShipStreet1) ? string.Empty : account.ShipStreet1; AddressFormat.City = string.IsNullOrEmpty(account.ShipCity) ? string.Empty : account.ShipCity; AddressFormat.StateCode = string.IsNullOrEmpty(account.ShipStateCode) ? string.Empty : account.ShipStateCode; AddressFormat.PostalCode = string.IsNullOrEmpty(account.ShipPostalCode) ? string.Empty : account.ShipPostalCode; AddressFormat.CountryCode = string.IsNullOrEmpty(account.ShipCountryCode) ? string.Empty : account.ShipCountryCode; lblShippingAddress.Text = AddressFormat.ToString() + "Tel: " + account.ShipPhoneNumber + "<br>Email: " + account.ShipEmailID; //To get Amount owed AccountHelper helperAccess = new AccountHelper(); DataSet myDataSet = helperAccess.GetCommisionAmount(ZNodeConfigManager.SiteConfig.PortalID, account.AccountID.ToString()); lblAmountOwed.Text = "$" + myDataSet.Tables[0].Rows[0]["CommissionOwed"].ToString(); // Orders Grid this.BindGrid(); // Retrieves the Role for User using Userid if (account.UserID != null) { Guid UserKey = new Guid(); UserKey = account.UserID.Value; MembershipUser _user = Membership.GetUser(UserKey); string roleList = ""; //Get roles for this User account string[] roles = Roles.GetRolesForUser(_user.UserName); foreach (string Role in roles) { roleList += Role + "<br>"; } lblRoles.Text = roleList; string rolename = roleList; //Hide the Edit button if a NonAdmin user has entered this page if(!Roles.IsUserInRole("ADMIN")) { if (Roles.IsUserInRole(_user.UserName, "ADMIN")) { EditCustomer.Visible = false; } else if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "CUSTOMER SERVICE REP")) { if (rolename == Convert.ToString("USER<br>") || rolename == Convert.ToString("")) { EditCustomer.Visible = true; } else { EditCustomer.Visible = false; } } } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Request.Params["itemid"] != null) { ItemId = int.Parse(Request.Params["itemid"].ToString()); } else { ItemId = 0; } if (Request.Params["accId"] != null) { AccountId = int.Parse(Request.Params["accId"].ToString()); } else { // Throw error here } if (ItemId > 0) { lblTitle.Text = "Edit Payment"; } AccountHelper helperAccess = new AccountHelper(); DataSet MyDataSet = helperAccess.GetCommisionAmount(ZNodeConfigManager.SiteConfig.PortalID, AccountId.ToString()); lblAmountOwed.Text = "$" + MyDataSet.Tables[0].Rows[0]["CommissionOwed"].ToString(); }
/// <summary> /// Bind Account Details /// </summary> private void BindData() { ZNode.Libraries.Admin.AccountAdmin _UserAccountAdmin = new ZNode.Libraries.Admin.AccountAdmin(); ZNode.Libraries.DataAccess.Entities.Account _UserAccount = _UserAccountAdmin.GetByAccountID(AccountID);//new Account(); if (_UserAccount != null) { //General Information txtExternalAccNumber.Text = _UserAccount.ExternalAccountNo; txtCompanyName.Text = _UserAccount.CompanyName; if (ListProfileType.SelectedIndex != -1) { ListProfileType.SelectedValue = _UserAccount.ProfileID.ToString(); } txtWebSite.Text = _UserAccount.Website; txtSource.Text = _UserAccount.Source; //Description txtDescription.Text = _UserAccount.Description; //Login Info if (_UserAccount.UserID.HasValue) { UserID.Enabled = false; MembershipUser _user = Membership.GetUser(_UserAccount.UserID.Value); UserID.Text = _user.UserName; ddlSecretQuestions.Text = _user.PasswordQuestion; string roleList = ""; //Get roles for this User account string[] roles = Roles.GetRolesForUser(_user.UserName); foreach (string Role in roles) { roleList += Role + "<br>"; //Loop through the roles list foreach (ListItem li in RolesCheckboxList.Items) { if (li.Text == Role) { li.Selected = true; } //Admin User should not remove the Admin role from their own account. if (HttpContext.Current.User.Identity.Name.Equals(_user.UserName.ToLower()) && li.Text == "ADMIN") { li.Enabled = false; } } } string rolename = roleList; //Hide the Submit button if a NonAdmin user has entered this page if (!Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "ADMIN")) { if (Roles.IsUserInRole(_user.UserName, "ADMIN")) { btnSubmitTop.Visible = false; Submit.Visible = false; } else if (Roles.IsUserInRole(HttpContext.Current.User.Identity.Name, "CUSTOMER SERVICE REP")) { if (rolename == Convert.ToString("USER<br>") || rolename == Convert.ToString("")) { btnSubmitTop.Visible = true; Submit.Visible = true; } else { btnSubmitTop.Visible = false; Submit.Visible = false; } } } } //Billing Address //set field values txtBillingFirstName.Text = _UserAccount.BillingFirstName; txtBillingLastName.Text = _UserAccount.BillingLastName; txtBillingCompanyName.Text = _UserAccount.BillingCompanyName; txtBillingStreet1.Text = _UserAccount.BillingStreet; txtBillingStreet2.Text = _UserAccount.BillingStreet1; txtBillingCity.Text = _UserAccount.BillingCity; txtBillingState.Text = _UserAccount.BillingStateCode; txtBillingPostalCode.Text = _UserAccount.BillingPostalCode; if (_UserAccount.BillingCountryCode.Length > 0) { lstBillingCountryCode.SelectedValue = _UserAccount.BillingCountryCode; } txtBillingPhoneNumber.Text = _UserAccount.BillingPhoneNumber; txtBillingEmail.Text = _UserAccount.BillingEmailID; chkOptIn.Checked = _UserAccount.EmailOptIn; //Shipping Address //set field values txtShippingFirstName.Text = _UserAccount.ShipFirstName; txtShippingLastName.Text = _UserAccount.ShipLastName; txtShippingCompanyName.Text = _UserAccount.ShipCompanyName; txtShippingStreet1.Text = _UserAccount.ShipStreet; txtShippingStreet2.Text = _UserAccount.ShipStreet1; txtShippingCity.Text = _UserAccount.ShipCity; txtShippingState.Text = _UserAccount.ShipStateCode; txtShippingPostalCode.Text = _UserAccount.ShipPostalCode; //Referral Details if (_UserAccount.ReferralCommissionTypeID != null) { lstReferral.SelectedValue = _UserAccount.ReferralCommissionTypeID.ToString(); } if (_UserAccount.ReferralCommission != null) { Discount.Text = _UserAccount.ReferralCommission.Value.ToString("N"); discountAmount = Convert.ToDecimal(_UserAccount.ReferralCommission); } if (_UserAccount.ReferralStatus != null) lstReferralStatus.SelectedValue = _UserAccount.ReferralStatus; else lstReferralStatus.SelectedValue = _UserAccount.ReferralStatus; if (_UserAccount.ReferralStatus == "A") { string affiliateLink = "http://" + ZNodeConfigManager.SiteConfig.DomainName + "/default.aspx?affiliate_id=" + _UserAccount.AccountID; hlAffiliateLink.Text = affiliateLink; hlAffiliateLink.NavigateUrl = affiliateLink; } else { hlAffiliateLink.Text = "NA"; } ToggleDiscountValidator(); txtTaxId.Text = _UserAccount.TaxID; AccountHelper helperAccess = new AccountHelper(); DataSet MyDataSet = helperAccess.GetCommisionAmount(ZNodeConfigManager.SiteConfig.PortalID, AccountID.ToString()); lblAmountOwed.Text ="$" + MyDataSet.Tables[0].Rows[0]["CommissionOwed"].ToString(); if (_UserAccount.ShipCountryCode.Length > 0) { lstShippingCountryCode.SelectedValue = _UserAccount.ShipCountryCode; } txtShippingPhoneNumber.Text = _UserAccount.ShipPhoneNumber; txtShippingEmail.Text = _UserAccount.ShipEmailID; //Custom properties txtCustom1.Text = _UserAccount.Custom1; txtCustom2.Text = _UserAccount.Custom2; txtCustom3.Text = _UserAccount.Custom3; } }