/// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            RequireSecurePage();
            RequiresLogin(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"));

            if (!this.IsPostBack)
            {
                ((System.Web.UI.WebControls.Label)Master.FindControl("lblPageHeading")).Text = "ORDER HISTORY";
                string accountId = Request.QueryString["AccountId"];

                if (!string.IsNullOrEmpty(accountId))
                {
                    List <SFDCSoapClient.Contact> lstContact = AuthenticationSSO.GetSubordinateDealers(accountId);
                    List <int> lstCustomerId = new List <int>();

                    if (lstContact.Count > 0)
                    {
                        foreach (SFDCSoapClient.Contact contact in lstContact)
                        {
                            int customerId = GetCustomerIdbyContactId(contact.Id);
                            if (customerId != 0 && !lstCustomerId.Contains(customerId))
                            {
                                lstCustomerId.Add(customerId);
                            }
                        }
                        pnlFundsInformation.Visible = true;
                        GetAccountFunds(lstContact.FirstOrDefault());
                        ((System.Web.UI.WebControls.Label)Master.FindControl("lblPageHeading")).Text = "ORDER HISTORY FOR " + lstContact[0].Account.Name;
                    }
                    hfCustomerID.Value = string.Join(",", lstCustomerId);
                    hfAccountId.Value  = accountId;
                    GetOrders(1, hfCustomerID.Value);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// IsSubordinateDealer
        /// </summary>
        /// <param name="OrderCustomerID">OrderCustomerID</param>
        /// <returns>Status</returns>
        private bool IsSubordinateDealer(int OrderCustomerID)
        {
            if (!ThisCustomer.HasSubordinates)
            {
                return(false);
            }

            string accountId = Request.QueryString["AccountId"];
            bool   flag      = false;

            if (!string.IsNullOrEmpty(accountId))
            {
                List <SFDCSoapClient.Contact> lstContact = AuthenticationSSO.GetSubordinateDealers(accountId);
                List <int> lstCustomerId = new List <int>();

                if (lstContact.Count > 0)
                {
                    foreach (SFDCSoapClient.Contact contact in lstContact)
                    {
                        if (OrderCustomerID == GetCustomerIdbyContactId(contact.Id))
                        {
                            flag = true;
                            hplPrintReceipt.Visible = false;
                            hplReOrder.Visible      = false;
                        }
                    }
                }
            }

            return(flag);
        }