Esempio n. 1
0
 /// <summary>
 /// Delete Button Click Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ProfileAdmin profileAdmin = new ProfileAdmin();
     Profile profileEntity = profileAdmin.GetByProfileID(ItemID);
     bool status;
     string message;
     if (profileEntity.IsDefault == true)
     {
        status = false;
        message = "The profile can not be deleted because it is set to default";
     }
     else
     {
        status = profileAdmin.Delete(profileEntity);
        message ="The profile can not be deleted until all associated items are removed. Please ensure that this profile does not associated with accounts or promotions. If it does, then delete these Items first.";
     }
     if(status)
     {
         Response.Redirect(CancelLink);
     }
     else
     {
         lblErrorMessage.Text = message;
     }
 }
Esempio n. 2
0
    /// <summary>
    /// Bind fields for this Profile
    /// </summary>
    protected void BindData()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        ZNode.Libraries.DataAccess.Entities.Profile profile = profileAdmin.GetByProfileID(ItemID);

        if (profile != null)
        {
            ProfileName.Text = profile.Name;
            chkDefaultInd.Checked = profile.IsDefault;
            chkIsAnonymous.Checked = profile.IsAnonymous;
            chkShowPrice.Checked = profile.ShowPricing;
            chkShowOnPartner.Checked = profile.ShowOnPartnerSignup;
            if (profile.UseWholesalePricing.HasValue)
                chkUseWholesalePrice.Checked = profile.UseWholesalePricing.Value;

            chkTaxExempt.Checked = profile.TaxExempt;
            ExternalAccountNum.Text = profile.DefaultExternalAccountNo;

            // Set Page Title
            lblTitle.Text += profile.Name;
        }
        else
        {
            //throw error
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Bind the data for a Product id
    /// </summary>
    public void BindData()
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        Profile profileEntity = profileAdmin.GetByProfileID(ItemID);

        if (profileEntity != null)
        {
            ProfileName = profileEntity.Name;
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Submit Button Click Event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ProfileAdmin profileAdmin = new ProfileAdmin();
        ZNode.Libraries.DataAccess.Entities.Profile profile = new Profile();

        if (ItemID > 0) //Edit Mode
        {
            //get profile by Id
            profile = profileAdmin.GetByProfileID(ItemID);
        }

        if (ExternalAccountNum.Text.Trim().Length > 0)
        {
            profile.DefaultExternalAccountNo = ExternalAccountNum.Text.Trim();
        }
        else if (ItemID > 0)
        {
            profile.DefaultExternalAccountNo = ExternalAccountNum.Text.Trim();
        }

        profile.Name = ProfileName.Text.Trim();
        profile.IsDefault = chkDefaultInd.Checked;
        profile.IsAnonymous = chkIsAnonymous.Checked;
        profile.ShowPricing = chkShowPrice.Checked;
        profile.ShowOnPartnerSignup = chkShowOnPartner.Checked;
        profile.UseWholesalePricing = chkUseWholesalePrice.Checked;
        profile.TaxExempt = chkTaxExempt.Checked;
        profile.PortalID = ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.PortalID;

        bool Status = false;

        if (ItemID > 0)
        {
            Status = profileAdmin.Update(profile);
        }
        else
        {
            Status = profileAdmin.Add(profile);
        }

        if (Status)
        {
            Response.Redirect(ListPageLink);
        }
        else
        {
            lblErrorMsg.Text = "Unable to update profile. Please try again.";
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Gets the Name of the Profile for this ProfileID
    /// </summary>
    /// <param name="ProfileID"></param>
    /// <returns></returns>
    public string GetProfileName(object ProfileID)
    {
        ProfileAdmin AdminAccess = new ProfileAdmin();
        if (ProfileID == null)
        {
            return "All Profile";
        }
        else
        {
            Profile profile = AdminAccess.GetByProfileID(int.Parse(ProfileID.ToString()));

            if (profile != null)
            {
                return profile.Name;
            }
        }
        return "";
    }
Esempio n. 6
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;
                        }
                    }
                }
            }
        }
    }
Esempio n. 7
0
    /// <summary>
    /// Binds Account Type drop-down list
    /// </summary>
    private void BindProfile()
    {
        ZNode.Libraries.Admin.ProfileAdmin _Profileadmin = new ProfileAdmin();
        ListProfileType.DataSource = _Profileadmin.GetAll();
        ListProfileType.DataTextField = "name";
        ListProfileType.DataValueField = "profileID";
        ListProfileType.DataBind();

        if (AccountID == 0)
        {
            ProfileAdmin AdminAccess = new ProfileAdmin();
            Profile entity = AdminAccess.GetByProfileID(int.Parse(ListProfileType.SelectedValue));

            if (entity != null)
            { txtExternalAccNumber.Text = entity.DefaultExternalAccountNo; }
        }
    }
Esempio n. 8
0
    /// <summary>
    /// Event is raised when the selection from the profile type list control changes between posts to the server
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ListProfileType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (AccountID == 0)
        {
            ProfileAdmin AdminAccess = new ProfileAdmin();
            Profile entity = AdminAccess.GetByProfileID(int.Parse(ListProfileType.SelectedValue));

            if (entity != null)
                txtExternalAccNumber.Text = entity.DefaultExternalAccountNo;
        }
    }