Пример #1
0
        public static Customer GetCustomer(int customerID)
        {
            UserIdentity ident = null;

            try { ident = Identity.Current; } catch { } //null-safe for tests
            // If we are getting the report for the current user, than we will want to get it in real time
            return(ExigoDAL.GetCustomer(customerID: customerID, realtime: (ident != null && (customerID == ident.CustomerID))));
        }
Пример #2
0
        /// <summary>
        /// Create a Guest from our Existing Guests page which takes a real Retail Customer's Customer ID and creates a Guest record along with a Party Guest record, so we can manage their RSVP's per Party.
        /// </summary>
        /// <param name="customerID">Real Customer ID from actual Customer account.</param>
        /// <param name="partyID">Party the resulting Guest record needs to be associated with.</param>
        /// <returns></returns>
        public Guest CreateGuest(int customerID, int partyID)
        {
            // Get our Customer first thing and create their Guest record for this specfic party
            var customer = ExigoDAL.GetCustomer(customerID);
            var guest    = new Guest(customer, partyID);

            return(CreateGuest(guest));
        }
Пример #3
0
        public static Language GetLanguageByCustomerID(int customerID)
        {
            // Get the user's language preference based on their saved preference
            var customer = ExigoDAL.GetCustomer(customerID);
            var market   = GlobalUtilities.GetMarket(customer.MainAddress.Country);
            var language = GlobalUtilities.GetLanguage(customer.LanguageID, market);

            // Return the language
            return(language);
        }
Пример #4
0
        public static KeyValuePair <bool, List <string> > IdentityCheck(int customerID)
        {
            var nullList = new List <string>();

            var cust = ExigoDAL.GetCustomer(customerID);


            if (cust.MainAddress == null || string.IsNullOrEmpty(cust.MainAddress.Country))
            {
                nullList.Add("Main Country");
            }


            if (nullList.Count() <= 0)
            {
                return(new KeyValuePair <bool, List <string> >(true, nullList));
            }
            else
            {
                return(new KeyValuePair <bool, List <string> >(false, nullList));
            }
        }
Пример #5
0
        public void Initialize(int customerID)
        {
            dynamic upline = null;


            using (var context = ExigoDAL.Sql())
            {
                try
                {
                    upline = context.Query(@"
                        Select c.EnrollerID,
                            c.CustomerID
                        From Customers c
                        Where c.CustomerID = @customerid
", new
                    {
                        customerid = customerID
                    }).FirstOrDefault();
                }
                catch (Exception e)
                {
                    Log.Error(e, "Error Getting Customer: {Message}", e.Message);
                    return;
                }
            }
            if (upline == null)
            {
                return;
            }

            if (upline.EnrollerID != null)
            {
                this.Enroller = ExigoDAL.GetCustomer((int)upline.EnrollerID);
            }
            if (upline.SponsorID != null)
            {
                this.Sponsor = ExigoDAL.GetCustomer((int)upline.SponsorID);
            }
        }