예제 #1
0
        public OperationReturnModel <bool> UpdateSettings(List <Setting> settings)
        {
            OperationReturnModel <bool> returnValue = new OperationReturnModel <bool>();

            try
            {
                List <SettingUpdate> results = _appSettings.SaveSettings(settings);

                foreach (SettingUpdate update in results)
                {
                    LogSettingsChange(update, this.AuthenticatedUser.UserId);
                }

                returnValue.SuccessResponse = true;
                returnValue.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                returnValue.SuccessResponse = false;
                returnValue.IsSuccess       = false;
                returnValue.ErrorMessage    = ex.Message;

                _log.WriteErrorLog("AdminController Exception while updating settings", ex);
            }

            return(returnValue);
        }
예제 #2
0
        public OperationReturnModel <CustomInventoryHeaderReturnModel> Save(List <CustomInventoryItemReturnModel> items)
        {
            OperationReturnModel <CustomInventoryHeaderReturnModel> returnValue = new OperationReturnModel <CustomInventoryHeaderReturnModel>();

            returnValue.SuccessResponse = new CustomInventoryHeaderReturnModel();

            // We set the branch and customer number to the proper context because the front end
            // Does not have any concept of this link.
            foreach (CustomInventoryItemReturnModel item in items)
            {
                SetCustomerNumberAndBranch(item);
            }

            try {
                _customInventoryRepo.SaveRange(items.ToModel());
                returnValue.IsSuccess             = true;
                returnValue.SuccessResponse.Items = _customInventoryRepo.GetItemsByBranchAndCustomer(this.SelectedUserContext.BranchId, this.SelectedUserContext.CustomerId).ToReturnModelList();
            } catch (Exception ex) {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;

                _logger.WriteErrorLog("Error saving custom inventory items", ex);
            }

            return(returnValue);
        }
예제 #3
0
        public OperationReturnModel <InvoiceHeaderReturnModel> Invoice(PagingModel paging, [FromUri] string customerBranch, [FromUri] string customerNumber)
        {
            OperationReturnModel <InvoiceHeaderReturnModel> retVal = new OperationReturnModel <InvoiceHeaderReturnModel>();

            try
            {
                retVal.SuccessResponse = _invLogic.GetInvoiceHeaders(this.AuthenticatedUser,
                                                                     new UserSelectedContext()
                {
                    BranchId   = customerBranch,
                    CustomerId = customerNumber
                },
                                                                     paging,
                                                                     false);
                retVal.IsSuccess = true;
            }
            catch (Exception ex)
            {
                _log.WriteErrorLog("GetInvoiceHeaders", ex);
                retVal.ErrorMessage = ex.Message;
                retVal.IsSuccess    = false;
            }

            return(retVal);
        }
예제 #4
0
        public async Task <OperationReturnModel <OrderImportModel> > Order()
        {
            OperationReturnModel <OrderImportModel> ret = new OperationReturnModel <OrderImportModel>();

            try
            {
                if (!Request.Content.IsMimeMultipartContent())
                {
                    throw new InvalidOperationException();
                }

                OrderImportFileModel fileModel = new OrderImportFileModel();

                var provider = new MultipartMemoryStreamProvider();
                await Request.Content.ReadAsMultipartAsync(provider);

                foreach (var content in provider.Contents)
                {
                    var file      = content;
                    var paramName = file.Headers.ContentDisposition.Name.Trim('\"');
                    var buffer    = await file.ReadAsByteArrayAsync();

                    var stream = new MemoryStream(buffer);

                    using (var s = new StreamReader(stream))
                    {
                        switch (paramName)
                        {
                        case "file":
                            stream.CopyTo(fileModel.Stream);
                            fileModel.FileName = file.Headers.ContentDisposition.FileName.Trim('\"');
                            stream.Seek(0, SeekOrigin.Begin);     // Return to the start of the stream
                            fileModel.Contents = s.ReadToEnd();
                            break;

                        case "options":
                            fileModel.Options = Newtonsoft.Json.JsonConvert.DeserializeObject <OrderImportOptions>(s.ReadToEnd());
                            break;
                        }
                    }
                }

                if (string.IsNullOrEmpty(fileModel.Contents) || fileModel.Options == null)
                {
                    throw new Exception("Invalid Request");
                }
                else
                {
                    ret.SuccessResponse = importLogic.ImportOrder(this.AuthenticatedUser, this.SelectedUserContext, fileModel);
                    ret.IsSuccess       = true;
                }
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _log.WriteErrorLog("Import Order", ex);
            }
            return(ret);
        }
예제 #5
0
        public OperationReturnModel <bool> ClearCustomersLabels()
        {
            OperationReturnModel <bool> ret = new OperationReturnModel <bool>();

            try
            {
                if (AuthenticatedUser.RoleName.Equals("beksysadmin", StringComparison.CurrentCultureIgnoreCase))
                {
                    _cacheListLogic.ClearCustomersLabelsCache(SelectedUserContext);
                    ret = new OperationReturnModel <bool>()
                    {
                        SuccessResponse = true, IsSuccess = true
                    };
                }
                else
                {
                    ret.ErrorMessage = "Must be a beksysadmin user";
                    ret.IsSuccess    = false;
                }
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("ClearCustomersLists", ex);
            }
            return(ret);
        }
예제 #6
0
        public OperationReturnModel <string> DeleteList(ListType type, long listId)
        {
            OperationReturnModel <string> ret = new OperationReturnModel <string>();

            try
            {
                var list = _listService.ReadList(AuthenticatedUser, SelectedUserContext, type, listId);

                _listService.DeleteList(AuthenticatedUser, SelectedUserContext, type, list);

                _auditLogRepo.WriteToAuditLog(Common.Core.Enumerations.AuditType.ListDelete,
                                              AuthenticatedUser.Name,
                                              String.Format("List {0} ({1}) deleted for customer {2} - {3}",
                                                            list.Name,
                                                            listId,
                                                            this.SelectedUserContext.CustomerId,
                                                            this.SelectedUserContext.BranchId));

                _cacheListLogic.RemoveSpecificCachedList(list);

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret.SuccessResponse = null;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("DeleteList", ex);
            }
            return(ret);
        }
예제 #7
0
        public OperationReturnModel <bool> DeleteItemNumberFromList(ListType type, long Id, string itemNumber)
        {
            OperationReturnModel <bool> ret = new OperationReturnModel <bool>();

            try {
                _listService.DeleteItem(AuthenticatedUser, SelectedUserContext, type,
                                        Id, itemNumber);

                var list = new ListModel()
                {
                    BranchId       = SelectedUserContext.BranchId,
                    CustomerNumber = SelectedUserContext.CustomerId,
                    Type           = type,
                    ListId         = Id
                };

                _cacheListLogic.RemoveSpecificCachedList(list);

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret = new OperationReturnModel <bool>()
                {
                    SuccessResponse = true, IsSuccess = true
                };
            } catch (Exception ex) {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("DeleteItemNumberFromList", ex);
            }
            return(ret);
        }
예제 #8
0
        public OperationReturnModel <List <ListModel> > CopyList(ListCopyShareModel copyListModel)
        {
            OperationReturnModel <List <ListModel> > ret = new OperationReturnModel <List <ListModel> >();

            try
            {
                var list = _listService.CopyList(this.AuthenticatedUser, this.SelectedUserContext, copyListModel);

                foreach (ListModel l in list)
                {
                    _cacheListLogic.RemoveSpecificCachedList(l);
                }

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret.SuccessResponse = list;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("CopyList", ex);
            }
            return(ret);
        }
예제 #9
0
        public OperationReturnModel <ListModel> Put(ListModel updatedList)
        {
            OperationReturnModel <ListModel> ret = new OperationReturnModel <ListModel>();

            try {
                ret.SuccessResponse = _listService.UpdateList(this.AuthenticatedUser, this.SelectedUserContext, updatedList.Type, updatedList);

                _cacheListLogic.RemoveSpecificCachedList(new ListModel()
                {
                    BranchId       = SelectedUserContext.BranchId,
                    CustomerNumber = SelectedUserContext.CustomerId,
                    Type           = updatedList.Type,
                    ListId         = updatedList.ListId
                });

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret.IsSuccess = true;
            } catch (Exception ex) {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("PutList", ex);
            }

            return(ret);
        }
예제 #10
0
        public OperationReturnModel <bool> AddCustomInventoryItems(ListType type, long listId, List <long> customInventoryIds)
        {
            OperationReturnModel <bool> returnValue = new OperationReturnModel <bool>();

            try
            {
                List <long?> newListItems = _listService.AddCustomInventoryItems(this.AuthenticatedUser, this.SelectedUserContext, type, listId, customInventoryIds);

                var list = new ListModel()
                {
                    BranchId       = SelectedUserContext.BranchId,
                    CustomerNumber = SelectedUserContext.CustomerId,
                    Type           = type,
                    ListId         = listId
                };

                _cacheListLogic.RemoveSpecificCachedList(list);

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                returnValue.SuccessResponse = true;
                returnValue.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("Error adding custom inventory to list", ex);
            }

            return(returnValue);
        }
예제 #11
0
        public OperationReturnModel <ListModel> AddItems(ListType type, long listId, List <ListItemModel> newItems, bool allowDuplicates = false)
        {
            OperationReturnModel <ListModel> ret = new OperationReturnModel <ListModel>();

            try
            {
                _listService.SaveItems(this.AuthenticatedUser, this.SelectedUserContext, type, listId, newItems);

                var list = new ListModel()
                {
                    BranchId       = SelectedUserContext.BranchId,
                    CustomerNumber = SelectedUserContext.CustomerId,
                    Type           = type,
                    ListId         = listId
                };

                _cacheListLogic.RemoveSpecificCachedList(list);

                _cacheListLogic.ClearCustomersListCaches(this.AuthenticatedUser, this.SelectedUserContext, _listService.ReadUserList(this.AuthenticatedUser, this.SelectedUserContext, true));

                ret.SuccessResponse = list;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("AddItems", ex);
            }
            return(ret);
        }        /// <summary>
예제 #12
0
        public OperationReturnModel <ListModel> List(ListType type, long listId, bool includePrice = true)
        {
            OperationReturnModel <ListModel> ret = new OperationReturnModel <ListModel>();

            try
            {
                var list = _listService.ReadList(this.AuthenticatedUser, this.SelectedUserContext, type, listId, includePrice);

                if (list != null)
                {
                    list.ReadOnly = (!this.AuthenticatedUser.IsInternalUser && list.Type == ListType.RecommendedItems) ||
                                    (!this.AuthenticatedUser.IsInternalUser && list.Type == ListType.Mandatory);
                }

                ret.SuccessResponse = list;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("List", ex);
            }
            return(ret);
        }
예제 #13
0
        public OperationReturnModel <List <CustomerBank> > Get(string customerId = null, string branchId = null)
        {
            OperationReturnModel <List <CustomerBank> > retVal = new OperationReturnModel <List <CustomerBank> >();

            try
            {
                if (customerId != null && branchId != null)
                {
                    retVal.SuccessResponse = _invLogic.GetAllBankAccounts
                                                 (new Core.Models.SiteCatalog.UserSelectedContext()
                    {
                        CustomerId = customerId, BranchId = branchId
                    });
                }
                else
                {
                    retVal.SuccessResponse = _invLogic.GetAllBankAccounts(SelectedUserContext);
                }
                retVal.IsSuccess = true;
            }
            catch (Exception ex)
            {
                _log.WriteErrorLog("Get banks", ex);
                retVal.ErrorMessage = ex.Message;
                retVal.IsSuccess    = false;
            }

            return(retVal);
        }
예제 #14
0
        public OperationReturnModel <List <Base64Image> > GetInvoiceImages(string invoiceNumber, string customerId = null, string branchId = null)
        {
            OperationReturnModel <List <Base64Image> > retVal = new OperationReturnModel <List <Base64Image> >();

            try {
                if (customerId != null && branchId != null)
                {
                    retVal.SuccessResponse = _imgLogic.GetInvoiceImages
                                                 (new Core.Models.SiteCatalog.UserSelectedContext()
                    {
                        CustomerId = customerId, BranchId = branchId
                    }, invoiceNumber);
                }
                else
                {
                    retVal.SuccessResponse = _imgLogic.GetInvoiceImages(this.SelectedUserContext, invoiceNumber);
                }
                retVal.IsSuccess = true;
            }
            catch (Exception ex) {
                retVal.ErrorMessage = string.Format("Could not retrieve invoice images at this time.");
                _log.WriteErrorLog("GetInvoiceImages", ex);
                retVal.IsSuccess = false;
            }

            return(retVal);
        }
예제 #15
0
        public OperationReturnModel <BrandsReturn> GetHouseBrands()
        {
            OperationReturnModel <BrandsReturn> ret = new OperationReturnModel <BrandsReturn>();

            try
            {
                ret.SuccessResponse = _brandRepository.GetHouseBrands();

                // This is because it wasn't worth the effort of redesigning the system to satisfy Marketing request
                // Basically we are combinine the Markon brand control labels into one.
                var markonBrand = ret.SuccessResponse.Brands.First(x => x.BrandControlLabel.Equals("MA"));

                // Remove the brand to re-order it to the first in the list
                ret.SuccessResponse.Brands.Remove(markonBrand);

                // Set the markon brand to pull back all brand control labels
                markonBrand.BrandControlLabel = "MA ME MC MR";

                // Add the markon brand to the first item in the list
                ret.SuccessResponse.Brands.Insert(0, markonBrand);

                ret.IsSuccess = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetHouseBrands", ex);
            }
            return(ret);
        }
예제 #16
0
        public OperationReturnModel <bool> ReadFeatureFlag(string key)
        {
            OperationReturnModel <bool> retVal = new OperationReturnModel <bool>();

            try
            {
                var flag = _appSettings.ReadFeatureFlag(key);
                retVal.SuccessResponse = bool.Parse(flag.Value);
                retVal.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                retVal.IsSuccess    = false;
                retVal.ErrorMessage = ex.Message;

                _log.WriteErrorLog("Exception encountered while reading feature flag", ex);
            }
            if (AuthenticatedUser.RoleName.Equals(Constants.ROLE_NAME_GUEST, StringComparison.CurrentCultureIgnoreCase))
            {
                retVal.SuccessResponse = false;
                retVal.ErrorMessage    = "Guest users have no access to customer information";
            }

            return(retVal);
        }
예제 #17
0
        public OperationReturnModel <Product> GetProductById(string catalogType, string id)
        {
            OperationReturnModel <Product> ret = new OperationReturnModel <Product>();

            try
            {
                IEnumerable <KeyValuePair <string, string> > pairs = Request.GetQueryNameValuePairs();
                if (catalogType.Equals(Constants.CATALOG_UNFI) && this.SelectedUserContext.BranchId.Equals(Constants.BRANCH_FEL))
                {
                    catalogType = Constants.CATALOG_UNFIEAST;
                }

                Product prod = _catalogLogic.GetProductById(this.SelectedUserContext, id, this.AuthenticatedUser, catalogType);

                prod = FavoritesAndNotesHelper.GetFavoritesAndNotesFromLists(this.AuthenticatedUser, this.SelectedUserContext, prod, _listService);

                ContractInformationHelper.GetContractCategoriesFromLists(SelectedUserContext, prod, _listService);

                if (prod == null)
                {
                    prod = new Product();
                }

                ret.SuccessResponse = prod;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetProductById", ex);
            }
            return(ret);
        }
예제 #18
0
        public OperationReturnModel <ProductsReturn> GetProductsSearch(string catalogType, string searchTerms, [FromUri] SearchInputModel searchModel)
        {
            OperationReturnModel <ProductsReturn> ret = new OperationReturnModel <ProductsReturn>();

            try
            {
                if (catalogType.Equals(Constants.CATALOG_UNFI) && this.SelectedUserContext.BranchId.Equals(Constants.BRANCH_FEL))
                {
                    catalogType = Constants.CATALOG_UNFIEAST;
                }
                searchModel.CatalogType = catalogType;
                ProductsReturn prods = _catalogService.GetProductsBySearch(this.SelectedUserContext, searchTerms, searchModel, this.AuthenticatedUser);

                prods.Products = FavoritesAndNotesHelper.GetFavoritesAndNotesFromLists(this.AuthenticatedUser, this.SelectedUserContext, prods.Products, _listService);

                ContractInformationHelper.GetContractCategoriesFromLists(SelectedUserContext, prods.Products, _listService);

                ret.SuccessResponse = prods;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetProductsSearch", ex);
            }
            return(ret);
        }
예제 #19
0
        public OperationReturnModel <ProductsReturn> GetProductsSearchBrand(string catalogType, string brandName, [FromUri] SearchInputModel searchModel, [FromUri] string searchTerms = null)
        {
            OperationReturnModel <ProductsReturn> ret = new OperationReturnModel <ProductsReturn>();

            try
            {
                searchModel.CatalogType = catalogType;
                searchModel.Facets      = string.Format("brands:{0}", brandName.ToUpper());
                ProductsReturn prods = _catalogService.GetProductsBySearch(this.SelectedUserContext, searchTerms, searchModel, this.AuthenticatedUser);

                prods.Products = FavoritesAndNotesHelper.GetFavoritesAndNotesFromLists(this.AuthenticatedUser, this.SelectedUserContext, prods.Products, _listService);

                ContractInformationHelper.GetContractCategoriesFromLists(SelectedUserContext, prods.Products, _listService);

                ret.SuccessResponse = prods;
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetProductsSearch", ex);
            }
            return(ret);
        }
예제 #20
0
        public OperationReturnModel <string> SubmitUserFeedback(UserFeedback userFeedback)
        {
            var retVal = new OperationReturnModel <string>()
            {
                IsSuccess = false
            };

            try
            {
                (string Name, string EmailAddress)target = GetTarget(SelectedUserContext, AuthenticatedUser, userFeedback.Audience);

                var customer = GetCustomer(SelectedUserContext, AuthenticatedUser);

                var context = new UserFeedbackContext
                {
                    UserId             = AuthenticatedUser.UserId,
                    UserFirstName      = AuthenticatedUser.FirstName,
                    UserLastName       = AuthenticatedUser.LastName,
                    BranchId           = customer?.CustomerBranch,
                    CustomerNumber     = customer?.CustomerNumber,
                    CustomerName       = customer?.CustomerName,
                    SalesRepName       = customer?.Dsr?.Name,
                    SourceName         = AuthenticatedUser.Name,
                    TargetName         = target.Name,
                    SourceEmailAddress = AuthenticatedUser.EmailAddress,
                    TargetEmailAddress = target.EmailAddress,
                };

                var notification = new UserFeedbackNotification()
                {
                    BranchId       = customer?.CustomerBranch,
                    CustomerNumber = customer?.CustomerNumber,
                    Audience       = userFeedback.Audience,

                    Context      = context,
                    UserFeedback = userFeedback,
                };

                _userFeedbackLogic.SaveUserFeedback(context, userFeedback);
                _notificationHandler.ProcessNotification(notification);

                retVal.SuccessResponse = "Feedback processed successfully.";
                retVal.IsSuccess       = true;
            }
            catch (ApplicationException axe)
            {
                retVal.ErrorMessage = axe.Message;
                retVal.IsSuccess    = false;
                _log.WriteErrorLog("Application exception", axe);
            }
            catch (Exception ex)
            {
                retVal.ErrorMessage = "Could not complete the request. " + ex.Message;
                retVal.IsSuccess    = false;
                _log.WriteErrorLog("Unhandled exception", ex);
            }

            return(retVal);
        }
예제 #21
0
        public OperationReturnModel <CatalogCampaignsReturnModel> GetCampaignHeaders()
        {
            OperationReturnModel <CatalogCampaignsReturnModel> returnValue = new OperationReturnModel <CatalogCampaignsReturnModel>();

            try {
                returnValue.SuccessResponse = _campaignLogic.GetAllAvailableCampaigns(SelectedUserContext);
                returnValue.IsSuccess       = true;
            } catch (Exception ex) {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetAllCampaigns", ex);
            }

            return(returnValue);
        }
예제 #22
0
        public OperationReturnModel <List <Setting> > ReadAllSettings()
        {
            OperationReturnModel <List <Setting> > retVal = new OperationReturnModel <List <Setting> >();

            try {
                retVal.SuccessResponse = _appSettings.ReadAllSettings();
                retVal.IsSuccess       = true;
            } catch (Exception ex) {
                retVal.IsSuccess    = false;
                retVal.ErrorMessage = ex.Message;

                _log.WriteErrorLog("Exception encountered while reading all settings", ex);
            }

            return(retVal);
        }
예제 #23
0
        public OperationReturnModel <ExportOptionsModel> ExportProducts()
        {
            OperationReturnModel <ExportOptionsModel> ret = new OperationReturnModel <ExportOptionsModel>();

            try
            {
                ret.SuccessResponse = _exportSettingRepository.ReadCustomExportOptions(this.AuthenticatedUser.UserId, ExportType.Products, 0);
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("ExportProducts", ex);
            }
            return(ret);
        }
예제 #24
0
        public OperationReturnModel <CatalogCampaignHeader> GetCampaignHeader(string campaignUri)
        {
            OperationReturnModel <CatalogCampaignHeader> returnValue = new OperationReturnModel <CatalogCampaignHeader>();

            try
            {
                returnValue.SuccessResponse = _campaignLogic.GetCampaignByUri(campaignUri, false);
                returnValue.IsSuccess       = true;
            } catch (Exception ex)
            {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetCampaignHeader", ex);
            }

            return(returnValue);
        }
예제 #25
0
        public OperationReturnModel <CategoriesReturn> GetSubCategoriesByParentId(string id, [FromUri] SearchInputModel searchModel)
        {
            OperationReturnModel <CategoriesReturn> ret = new OperationReturnModel <CategoriesReturn>();

            try
            {
                ret.SuccessResponse = _catalogLogic.GetCategories(searchModel.From, searchModel.Size, "BEK");
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetCategories", ex);
            }
            return(ret);
        }
예제 #26
0
        public OperationReturnModel <List <ListModel> > List(ListType type, bool headerOnly = false)
        {
            OperationReturnModel <List <ListModel> > ret = new OperationReturnModel <List <ListModel> >();

            try
            {
                ret.SuccessResponse = _listService.ReadListByType(this.AuthenticatedUser, this.SelectedUserContext, type, headerOnly);
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("List", ex);
            }
            return(ret);
        }
예제 #27
0
        public OperationReturnModel <ExportOptionsModel> ExportList(ListType type)
        {
            OperationReturnModel <ExportOptionsModel> ret = new OperationReturnModel <ExportOptionsModel>();

            try
            {
                ret.SuccessResponse = _exportLogic.ReadCustomExportOptions(this.AuthenticatedUser.UserId, Core.Models.Configuration.EF.ExportType.List, type);
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("Recommended List", ex);
            }
            return(ret);
        }
예제 #28
0
        public OperationReturnModel <CategoriesReturn> GetCategoriesById(string id, [FromUri] SearchInputModel searchModel)
        {
            OperationReturnModel <CategoriesReturn> ret = new OperationReturnModel <CategoriesReturn>();

            try
            {
                //TODO: This is not actually getting a category by ID (ID is never used).
                ret.SuccessResponse = _catalogLogic.GetCategories(searchModel.From, searchModel.Size, "BEK");
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("GetCategories", ex);
            }
            return(ret);
        }
예제 #29
0
        public OperationReturnModel <ListModelIntegrationsReturnModel> List(ListType type, long listId, bool includePrice = true)
        {
            OperationReturnModel <ListModelIntegrationsReturnModel> ret = new OperationReturnModel <ListModelIntegrationsReturnModel>();

            try
            {
                var list = _listService.ReadList(SsoUser, this.SelectedUserContext, type, listId, includePrice);

                ret.SuccessResponse = list.ToListModelIntegrationsReturnModel();
                ret.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                ret.IsSuccess    = false;
                ret.ErrorMessage = ex.Message;
            }
            return(ret);
        }
예제 #30
0
        public OperationReturnModel <bool> AddOrUpdateCampaignHeader(CatalogCampaignAddOrUpdateRequestModel model)
        {
            OperationReturnModel <bool> returnValue = new OperationReturnModel <bool>();

            try
            {
                returnValue.SuccessResponse = _campaignLogic.AddOrUpdateCampaign(model);
                returnValue.IsSuccess       = true;
            }
            catch (Exception ex)
            {
                returnValue.IsSuccess    = false;
                returnValue.ErrorMessage = ex.Message;
                _elRepo.WriteErrorLog("AddOrUpdateCampaign", ex);
            }

            return(returnValue);
        }