Пример #1
0
 public static bool ArchiveCustomer(int CorporateReminderId, int customerId)
 {
     try
     {
         var api      = Exigo.WebService();
         var response = api.CreateCustomerExtended(new CreateCustomerExtendedRequest
         {
             CustomerID      = customerId,
             ExtendedGroupID = (int)CustomerExtendedGroup.CorporateReminder,
             Field1          = CorporateReminderId.ToString()
         });
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #2
0
        public Event GetEventDetailsService(int eventId, bool ApiCall = false)
        {
            if (ApiCall)
            {
                return(ApiGetEventDetails(eventId));
            }
            //getting event details for selected event
            Event EventDetails = new Event();

            using (var Context = Exigo.Sql())
            {
                Context.Open();
                string sqlProcedure = string.Format("GetEventDetails {0}", eventId);
                EventDetails = Context.Query <Event>(sqlProcedure).FirstOrDefault();
                Context.Close();
            }
            return(EventDetails);
        }
        public ActionResult FeesOrdersList(int page, DateTime?StartDate, DateTime?EndDate, int?OrderID)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID                    = Identity.Current.CustomerID,
                Page                          = page,
                RowCount                      = RowCount,
                OrderID                       = OrderID,   //20161228 80967 DV.
                StartDate                     = StartDate, //20161222 80967 DV. Client requested ability to work with date range.
                EndDate                       = EndDate,   //20161222 80967 DV. Client requested ability to work with date range.
                IncludeOrderDetails           = true,
                ShowOnlyFeesAndServicesOrders = true       //20161222 80967 DV. Use this to only show orders that contain ItemID 58 or 627
            });                                            //.Where(c => !c.Other11.IsNullOrEmpty()).ToList(); //20121222 80967 DV. Per client remove this filter entirely.  If we bring it back move it inside the GetCustomerOrders method since it was not working correctly anyway

            return(View("OrderList", model));
        }
Пример #4
0
        List <WebCategory> IProductService.GetDynamicCategories(int ParentCategoryID)
        {
            //var categories = Exigo.OData().WebCategories.Where(i => i.ParentID == ParentCategoryID).OrderBy(i => i.SortOrder);
            List <Common.Api.ExigoOData.WebCategory> categories = null;

            using (var Context = Exigo.Sql())
            {
                Context.Open();
                string sqlProcedure = string.Format("GetWebCategories");
                categories = Context.Query <Common.Api.ExigoOData.WebCategory>(sqlProcedure).Where(i => i.ParentID == ParentCategoryID).OrderBy(i => i.SortOrder).ToList();
                Context.Close();
            }
            return(categories.Select(category => new WebCategory
            {
                Id = category.WebCategoryID,
                Name = category.WebCategoryDescription,
            }).ToList());
        }
        public ActionResult ReturnedOrdersList(int page)
        {
            SetCommonViewBagData();

            var model = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
            {
                CustomerID = Identity.Current.CustomerID,
                Page       = page,
                RowCount   = RowCount,
                OrderTypes = new int[] {
                    OrderTypes.ReturnOrder
                },

                IncludeOrderDetails = true
            }).Where(c => c.Other11.IsNullOrEmpty()).ToList();

            return(View("OrderList", model));
        }
Пример #6
0
        private int UplineDirector(int RankID, int CustomerID)
        {
            int DirestorId = 2;

            try
            {
                using (var context = Exigo.Sql())
                {
                    string          sqlProcedure = string.Format("UplineLeader {0},{1}", RankID, CustomerID);
                    UplineDirectors Director     = context.Query <UplineDirectors>(sqlProcedure).FirstOrDefault();
                    DirestorId = Director.UplineLeader;
                }
            }
            catch (Exception)
            {
            }
            return(DirestorId);
        }
Пример #7
0
        string IShippingService.GetShippingMethodDescription(int shipMethodId)
        {
            try
            {
                var context      = Exigo.Sql();
                var SqlProcedure = string.Format("GetShippingMethodDescription {0}", shipMethodId);
                var shipMethod   = context.Query <Common.Api.ExigoOData.ShipMethod>(SqlProcedure).FirstOrDefault();

                if (null == shipMethod)
                {
                    return("Call Customer Service");
                }

                return(shipMethod.ShipMethodDescription);
            }
            catch
            { return("Call Customer Service"); }
        }
        public ActionResult Payment()
        {
            var model = ShoppingViewModelFactory.Create <PaymentMethodsViewModel>(PropertyBag);

            model.PaymentMethods = Exigo.GetCustomerPaymentMethods(new GetCustomerPaymentMethodsRequest
            {
                CustomerID = Identity.Current.CustomerID,
                ExcludeIncompleteMethods = true,
                ExcludeInvalidMethods    = true
            });
            model.Addresses = Exigo.GetCustomerAddresses(Identity.Current.CustomerID)
                              .Where(c => c.IsComplete)
                              .Select(c => c as ShippingAddress);

            ViewBag.HasAutoOrderItems = ShoppingCart.Items.Count(c => c.Type == ShoppingCartItemType.AutoOrder) > 0;

            return(View("Payment", model));
        }
        public JsonNetResult UpdateWebsiteAddress(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                Address    = customersite.Address
            });


            var html = customersite.Address.AddressDisplay + "<br />" + customersite.Address.City + ", " + customersite.Address.State + " " + customersite.Address.Zip + ", " + customersite.Address.Country;

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteAddress",
                html = html
            }));
        }
Пример #10
0
        public int AuthenticateCustomer(string loginname, string password)
        {
            var customer = (from c in Exigo.OData().CreateQuery <Common.Api.ExigoOData.Customer>("AuthenticateLogin")
                            .AddQueryOption("loginName", "'" + loginname + "'")
                            .AddQueryOption("password", "'" + password + "'")
                            select new Common.Api.ExigoOData.Customer {
                CustomerID = c.CustomerID
            }).FirstOrDefault();

            if (customer == null)
            {
                return(0);
            }
            else
            {
                return(customer.CustomerID);
            }
        }
Пример #11
0
        public static List <PayableTypesList> PayableTypes()
        {
            List <PayableTypesList> PayableTypes = new List <PayableTypesList>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var sql = @"SELECT PayableTypeID as PayableType,PayableTypeDescription  FROM PayableTypes";
                    PayableTypes = context.Query <PayableTypesList>(sql).ToList();
                }
            }
            catch (Exception)
            {
                return(PayableTypes);
            }
            return(PayableTypes);
        }
        public JsonNetResult UpdateWebsiteName(CustomerSite customersite)
        {
            Exigo.UpdateCustomerSite(new CustomerSite
            {
                CustomerID = Identity.Current.CustomerID,
                FirstName  = customersite.FirstName,
                LastName   = customersite.LastName
            });

            var html = string.Format("{0} {1}", customersite.FirstName, customersite.LastName);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateWebsiteName",
                html = html
            }));
        }
Пример #13
0
        public static List <PriceTypesList> PriceTypesList()
        {
            List <PriceTypesList> PriceTypesList = new List <PriceTypesList>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var sql = @"SELECT PriceTypeID,PriceTypeDescription  FROM PriceTypes";
                    PriceTypesList = context.Query <PriceTypesList>(sql).ToList();
                }
            }
            catch (Exception)
            {
                return(PriceTypesList);
            }
            return(PriceTypesList);
        }
        public JsonNetResult UpdatePassword(string password)
        {
            Exigo.WebService().UpdateCustomer(new UpdateCustomerRequest
            {
                CustomerID    = Identity.Current.CustomerID,
                LoginPassword = password
            });

            var html = "********";

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdatePassword",
                message = "Your password has been updated",
                html = html
            }));
        }
        public JsonNetResult UpdateName(string firstname, string lastname)
        {
            Exigo.WebService().UpdateCustomer(new UpdateCustomerRequest
            {
                CustomerID = Identity.Current.CustomerID,
                FirstName  = firstname,
                LastName   = lastname
            });

            var html = string.Format("{0} {1}, {3}# {2}", firstname, lastname, Identity.Current.CustomerID, Resources.Common.ID);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateName",
                html = html
            }));
        }
        public JsonNetResult SetAvatarFromFile(HttpPostedFileBase file)
        {
            // Validate that the file is valid
            var isValidImage = (file != null && file.ContentLength > 0 && AllowableImageFormats.Contains(file.ContentType.ToLower()));

            if (isValidImage)
            {
                // Save the image
                var bytes = GlobalUtilities.GetBytesFromStream(file.InputStream);
                Exigo.Images().SaveUncroppedCustomerAvatar(Identity.Current.CustomerID, bytes);
            }

            return(new JsonNetResult(new
            {
                success = isValidImage,
                length = file.ContentLength
            }));
        }
Пример #17
0
        public static List <CurrenciesList> CurrenciesList()
        {
            List <CurrenciesList> CurrenciesList = new List <CurrenciesList>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var sql = @"SELECT CurrencyCode,CurrencyDescription,CurrencySymbol FROM Currencies";
                    CurrenciesList = context.Query <CurrenciesList>(sql).ToList();
                }
            }
            catch (Exception)
            {
                return(CurrenciesList);
            }
            return(CurrenciesList);
        }
Пример #18
0
        public ActionResult CommissionDetail(int runid, int periodid)
        {
            var model = new CommissionDetailViewModel();

            // View Requests
            if (!Request.IsAjaxRequest())
            {
                model.CommissionPeriods = Exigo.GetCommissionPeriodList(Identity.Current.CustomerID, true);
                return(View("CommissionDetail", model));
            }

            // AJAX requests
            else
            {
                // Real-time commissions
                if (runid == 0)
                {
                    model.Commissions = Exigo.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest
                    {
                        CustomerID       = Identity.Current.CustomerID,
                        GetPeriodVolumes = true
                    });

                    // Check Period ID
                    if (periodid > 0)
                    {
                        model.PeriodID    = periodid;
                        model.Commissions = model.Commissions.Where(c => c.Period.PeriodID == periodid);
                    }

                    return(PartialView("_RealTimeCommissionDetail", model));
                }

                // Historical Commissions
                else
                {
                    model.Commissions = new List <ICommission>()
                    {
                        Exigo.GetCustomerHistoricalCommission(Identity.Current.CustomerID, runid)
                    };
                    return(PartialView("_HistoricalCommissionDetail", model));
                }
            }
        }
        public ActionResult CreateResource(ResourceListViewModel res, HttpPostedFileBase UploadFile)
        {
            var context = Exigo.ODataResources();

            int CategoryID = 0;
            if (!string.IsNullOrEmpty(res.SelectedCategoryID))
            {
                CategoryID = Convert.ToInt32(res.SelectedCategoryID);
            }

            var resource = new ResourceContext.ResourceManager();

            resource.Description = res.Description;
            resource.CreatedDate = DateTime.Now;
            resource.ResourceCategoryID = CategoryID;

            //2015-09-10
            //Ivan S.
            //66
            //Ben wanted me to save the ResourceType, originally the Title was saving the type from a fixed list of File types
            //I now get the description from the resource types and save the right resource typeID
            resource.Title = context.ResourceTypes.Where(t => t.ResourceTypeID == res.ResourceTypeID).FirstOrDefault().ResourceTypeDescription;
            resource.ResourceTypeID = (Int32)res.ResourceTypeID; //It was missing 


            //2015-09-08
            //Ivan S.
            //66
            //Sets the initial order for the new resource to the maximum number for that category
            var lastResource = context.ResourceManagement.Where(r => r.ResourceCategoryID == resource.ResourceCategoryID).OrderByDescending(r => r.ResourceOrder).FirstOrDefault();
            int? lastResourceOrder = InitialOrderValue - 1;
            if (lastResource != null)
                lastResourceOrder = lastResource.ResourceOrder;
            resource.ResourceOrder = ++lastResourceOrder;


            resource.Url = res.Url;
            resource.UploadedThumbnailPath = res.UploadedThumbnailPath;

            context.AddToResourceManagement(resource);
            context.SaveChanges();

            return RedirectToAction("ManageResources");
        }
        public ActionResult Subscriptions()
        {
            var model = new SubscriptionsViewModel();

            // Get the calendars we are subscribed to
            var calendars = Exigo.GetCustomerCalendarSubscriptions(Identity.Current.CustomerID);


            // Get the customers for each of the calendar subscriptions
            var customerIDs  = calendars.Select(c => c.CustomerID).Distinct().ToList();
            var apiCustomers = Exigo.OData().Customers
                               .Where(customerIDs.ToOrExpression <Common.Api.ExigoOData.Customer, int>("CustomerID"))
                               .Select(c => new Common.Api.ExigoOData.Customer()
            {
                CustomerID = c.CustomerID,
                FirstName  = c.FirstName,
                LastName   = c.LastName
            })
                               .ToList();


            // Pair the data together to create our models
            var customers = new List <CalendarSubscriptionCustomer>();

            foreach (var apiCustomer in apiCustomers)
            {
                // Create the special customer first
                var customer = new CalendarSubscriptionCustomer()
                {
                    CustomerID = apiCustomer.CustomerID,
                    FirstName  = apiCustomer.FirstName,
                    LastName   = apiCustomer.LastName
                };

                // Add their calendars
                customer.Calendars = calendars.Where(c => c.CustomerID == customer.CustomerID).ToList();

                // Add our model to the collection
                model.CalendarSubscriptionCustomers.Add(customer);
            }


            return(View(model));
        }
Пример #21
0
        public static List <CustomerTypeDescriptionID> GetCustomerTypeDescriptionID()
        {
            List <CustomerTypeDescriptionID> list = new List <CustomerTypeDescriptionID>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var SqlProcedure = string.Format("GetCustomerTypes");

                    list = context.Query <CustomerTypeDescriptionID>(SqlProcedure).ToList();
                    return(list);
                }
            }
            catch (Exception)
            {
                return(list);
            }
        }
Пример #22
0
        public ActionResult UseBankAccount(BankAccount newBankAccount, bool billingSameAsShipping = false)
        {
            if (billingSameAsShipping)
            {
                var address = PropertyBag.ShippingAddress;

                newBankAccount.BillingAddress = new Address
                {
                    Address1 = address.Address1,
                    Address2 = address.Address2,
                    City     = address.City,
                    State    = address.State,
                    Zip      = address.Zip,
                    Country  = address.Country
                };
            }

            // Verify that the card is valid
            if (!newBankAccount.IsValid)
            {
                return(new JsonNetResult(new
                {
                    success = false
                }));
            }
            else
            {
                // Save the bank account to the customer's account if applicable
                var paymentMethodsOnFile = Exigo.GetCustomerPaymentMethods(new GetCustomerPaymentMethodsRequest
                {
                    CustomerID = Identity.Current.CustomerID,
                    ExcludeIncompleteMethods = true,
                    ExcludeInvalidMethods    = true,
                }).Where(c => c is BankAccount).Select(c => c as BankAccount);

                if (paymentMethodsOnFile.FirstOrDefault() == null)
                {
                    Exigo.SetCustomerBankAccount(Identity.Current.CustomerID, newBankAccount);
                }
            }

            return(UsePaymentMethod(newBankAccount));
        }
Пример #23
0
        public List <CharityModel> GetCharityName(int eventId)
        {
            List <CharityModel> CharityList = new List <CharityModel>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var SqlProcedure = string.Format("GetCharityName {0}", eventId);

                    CharityList = context.Query <CharityModel>(SqlProcedure).ToList();
                }
            }
            catch (Exception ex)
            {
                return(CharityList);
            }
            return(CharityList);
        }
Пример #24
0
        public JsonNetResult UpdateEmailAddress(Customer customer)
        {
            Exigo.WebService().UpdateCustomer(new UpdateCustomerRequest
            {
                CustomerID = Identity.Current.CustomerID,
                Email      = customer.Email
            });

            Exigo.SendEmailVerification(Identity.Current.CustomerID, customer.Email);

            var html = string.Format("{0}", customer.Email);

            return(new JsonNetResult(new
            {
                success = true,
                action = "UpdateEmailAddress",
                html = html
            }));
        }
        public ActionResult VolumeList(KendoGridRequest request = null)
        {
            if (Request.HttpMethod.ToUpper() == "GET")
            {
                return(View());
            }


            // Establish the query
            using (var context = new KendoGridDataContext(Exigo.Sql()))
            {
                return(context.Query(request, @"
                     SELECT
                 pv.PeriodID,
				 p.StartDate,
				 p.EndDate,
				 p.PeriodDescription,
				 pv.PaidRankID,
				 r.RankDescription,
				 Team1TGBV = pv.Volume55,
				 Team2TGBV = pv.Volume56,
				 Team3TGBV = pv.Volume57,
				 Team4TGBV = pv.Volume58,
				 Team5TGBV = pv.Volume59,
                 Team6TGBV = pv.Volume91
                    FROM
	                    PeriodVolumes pv
						inner join Periods p
						on p.PeriodID = pv.PeriodID
						and p.PeriodTypeID = pv.PeriodTypeID
						left join Ranks r
						on r.RankID = pv.PaidRankID
                    WHERE
	                    p.StartDate <= GetDate() + 1
                        AND pv.PeriodTypeID = @periodtypeid
						and pv.CustomerID = @id
                ", new
                {
                    id = Identity.Current.CustomerID,
                    periodtypeid = PeriodTypes.Default
                }).Tokenize("CustomerID"));
            }
        }
Пример #26
0
        public ActionResult VolumesList(int id, KendoGridRequest request = null)
        {
            if (Request.HttpMethod.ToUpper() == "GET")
            {
                return(PartialView("Partials/VolumesList"));
            }



            using (var context = new KendoGridDataContext(Exigo.Sql()))
            {
                return(context.Query(request, @"
                    SELECT  
                          p.PeriodID
                        , p.StartDate
                        , p.EndDate
                        , p.PeriodDescription
                        , r.RankDescription
                        , pv.PaidRankID
                        , pv.Volume1
                        , pv.Volume2
                        , pv.Volume3
                        , pv.Volume4
                        , pv.Volume5
                    FROM Customers c
                    INNER JOIN Periods p
                        ON p.EndDate > c.CreatedDate
                        AND p.PeriodTypeID = @periodtype
                        AND p.StartDate <= GETDATE()
                    INNER JOIN PeriodVolumes pv
                        ON pv.PeriodID = p.PeriodID
                        AND pv.PeriodTypeID = p.PeriodTypeID
                        AND pv.CustomerID = c.CustomerID
                    LEFT JOIN Ranks r 
                        ON r.RankID = pv.PaidRankID
                        WHERE c.CustomerID = @customerid
            ", new
                {
                    customerid = id,
                    periodtype = PeriodTypes.Default
                }).Tokenize("CustomerID"));
            }
        }
Пример #27
0
        /// <summary>
        /// This method returns the list of item codes which the customer has already purchased.
        /// </summary>
        protected IList <string> PurchasedItemCodes()
        {
            List <string> itemCodes = new List <string>();

            var response = Exigo.GetCustomerExtendedDetails(CustomerId, (int)CustomerExtendedGroup.NewProductsLaunchPurchase);

            foreach (var row in response)
            {
                var sku = row.Field1;

                // There shouldn't be any duplicates but it is better to perform the check just in case versus having the application crash...
                if (!itemCodes.Contains(sku))
                {
                    itemCodes.Add(sku);
                }
            }

            return(itemCodes);
        }
Пример #28
0
        /// <summary>
        /// This method calculates the points account for this reward.
        /// </summary>
        public RewardsAccount CalculatePointsAccount(IList <Product> productsInShoppingCart)
        {
            if (IsRewardPointsAccount)
            {
                var pointAccountResponse = Exigo.GetCustomerPointAccount(CustomerId, RewardPointsAccountId.Value);

                var creditsRemaining = (null != pointAccountResponse ? pointAccountResponse.Balance : 0M);

                var productWithDiscount = GetRewardProducts(productsInShoppingCart);

                var account = new RewardsAccount {
                    PointAccountID = RewardPointsAccountId.Value, Balance = creditsRemaining, AppliedAmount = productWithDiscount.Count()
                };

                return(account);
            }

            return(null);
        }
Пример #29
0
        public static string GetProducImageUrl(string ItemCode)
        {
            List <string> url = new List <string>();

            try
            {
                using (var context = Exigo.Sql())
                {
                    var SqlProcedure = string.Format("GetProducImageUrl '{0}'", ItemCode);

                    url = context.Query <string>(SqlProcedure).ToList();
                    return(url.First().ToString());
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
Пример #30
0
        public ActionResult ProductList()
        {
            var model = new EnrollmentProductListViewModel();

            model.OrderItems = Exigo.GetItems(new ExigoService.GetItemsRequest
            {
                Configuration = OrderConfiguration
            }).ToList();

            var autoOrderItems = Exigo.GetItems(new ExigoService.GetItemsRequest
            {
                Configuration = AutoOrderConfiguration
            }).ToList();

            autoOrderItems.ForEach(c => c.Type = ShoppingCartItemType.AutoOrder);
            model.AutoOrderItems = autoOrderItems;

            return(View(model));
        }
Пример #31
0
    public User(Exigo.OData.CustomerType custType, int CustomerID)
    {
        if (DoesTheAdminUserHaveSuperUserRights(CustomerID))
        {
            //Switch case to determine what wealth club benefits (if any) should appear)
            //Switch case to determine what sub level (if any) should appear)
            switch (SuperUserPermissionLevel_1) // Property ID5
            {
                case "Wealth":
                case "Gold": SetGoldLevelPermissions(); break;
                case "Silver": SetSilverLevelPermissions(); break;
                case "Bronze": SetBronzeLevelPermissions(); break; // Reference ID-4 // Override ID-3
                case "SuperUserPermissionLevel_1": SetSuperUserLevel_1_Permissions(); break; // Case ID2 // Reference ID-5
                case "SuperUserPermissionLevel_2": SetSuperUserLevel_2_Permissions(); break;
                default: SetWealthClubAllFalse(); break;
            }
        }
        else
            SetWealthClubAllFalse();

        //Switch case to determine if IBD or Customer or Administrator links should appear
        switch (custType.CustomerTypeDescription)
        {
            case "IBD": SetIBDPermissions(); break; // Case ID-1 // Reference ID-1
            case "Retail Customer": SetCustomerPermissions(); break; // Case ID-2 // Reference ID2.1
            case "Wholesale Customer": SetCustomerPermissions(); break; // Reference ID2.1
            case "Preferred Customer": SetCustomerPermissions(); break; // Reference ID2.1
            case "Administrator": SetPermissionsForCustomerTypeAdministratorWithNoSuperUserAccess(); break; // Case ID-3 // Reference ID-3
            default: break;
        }
    }