Esempio n. 1
0
 /// <summary>
 /// Binds Referral type drop-down list
 /// </summary>
 private void BindReferral()
 {
     ZNode.Libraries.Admin.ReferralCommissionAdmin ReferralType = new ReferralCommissionAdmin();
     lstReferral.DataSource = ReferralType.GetAll();
     lstReferral.DataTextField = "Name";
     lstReferral.DataValueField = "ReferralCommissiontypeID";
     lstReferral.DataBind();
 }
Esempio n. 2
0
    /// <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;
                        }
                    }
                }
            }
        }
    }