示例#1
0
        public ActionResult GetReport(string fileName = "WIP")
        {
            Report = fileName;
            Repository   repository   = new Repository();
            var          report       = new StiReport();
            StoreService storeService = (StoreService)Ioc.Get <StoreService>();
            string       basePath     = Server.MapPath("~/");
            //string reportFolder = string.Format("{0}\\Content\\DashboardReports\\ClientId{1}", basePath, storeService.StoreId.ToString());
            string reportFolder     = string.Format("{0}Content\\DashboardReports", basePath);
            string fileNameFullPath = string.Format("{0}\\{1}.mrt", reportFolder, fileName);

            // var path = Server.MapPath("~/Reports/WIP.mrt");
            report.Load(fileNameFullPath);
            try {
                var dbConnection = (StiSqlDatabase)report.Dictionary.Databases["Connection"];
                dbConnection.ConnectionString = repository.ConnectionString;

                report.Dictionary.Variables["Clientid"].ValueObject = storeService.StoreId.ToString();
                report.Dictionary.Variables["BaseUrl"].ValueObject  = Request.Url.Scheme + "://" + Request.Url.Authority;
            }
            catch
            {
            }
            return(StiMvcViewer.GetReportResult(report));
        }
        /// <summary>
        /// Sets up HTTP methods mappings.
        /// </summary>
        /// <param name="service">Service handling requests</param>
        public StoreModule(StoreService service) : base("/v2")
        { 
            Delete["/store/order/{orderId}"] = parameters =>
            {
                var orderId = Parameters.ValueOf<string>(parameters, Context.Request, "orderId", ParameterType.Path);
                Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'DeleteOrder'");
                
                service.DeleteOrder(Context, orderId);
                return new Response { ContentType = "application/xml"};
            };

            Get["/store/inventory"] = parameters =>
            {
                
                return service.GetInventory(Context);
            };

            Get["/store/order/{orderId}"] = parameters =>
            {
                var orderId = Parameters.ValueOf<long?>(parameters, Context.Request, "orderId", ParameterType.Path);
                Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'GetOrderById'");
                
                return service.GetOrderById(Context, orderId);
            };

            Post["/store/order"] = parameters =>
            {
                var body = this.Bind<Order>();
                Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'PlaceOrder'");
                
                return service.PlaceOrder(Context, body);
            };
        }
示例#3
0
        public void UpdateCustomer(BookRepair_CustomerModel model)
        {
            // method for customer update
            var user  = new UserService(_dataContext);
            var store = new StoreService(_dataContext);
            var cust  = new CustomerService(_dataContext);
            var func  = new FunctionsController();

            model.Forename = func.UppercaseFirst(model.Forename);
            model.Surname  = func.UppercaseFirst(model.Surname);

            // Save in database
            var customerId = _reporsitory.UpdateCustomer(model, cust.GetCustomerIdFromSession(), store.GetStoreId(), user.GetUserId());

            // Fill class by info
            cust.SetGeneralCustomerInfoIntoSession(new Customer_InfoModel
            {
                Address1      = model.HouseNumber + " " + model.Addr1 + "," + model.Organization,
                Address2      = model.Addr2,
                Address3      = model.Addr3,
                CustomerName  = model.Forename + " " + model.Surname,
                PostCode      = model.Postcode,
                CustomerId    = customerId,
                ContactMethod = model.ContactMethod
            });
            // Update session holder
            //_bookStateHolder.UpdateFrom(_bookState);
        }
示例#4
0
        public void SetUp()
        {
            var store = new StoreService();

            _accountService  = new AccountService(store);
            _customerService = new CustomerService(store, _accountService);
        }
        protected virtual void EnsureThatAllOperationsHaveNumber(CustomerOrder order)
        {
            var store = StoreService.GetById(order.StoreId);

            foreach (var operation in order.GetFlatObjectsListWithInterface <Domain.Commerce.Model.IOperation>())
            {
                if (operation.Number == null)
                {
                    var objectTypeName = operation.OperationType;

                    // take uppercase chars to form operation type, or just take 2 first chars. (CustomerOrder => CO, PaymentIn => PI, Shipment => SH)
                    var opType = string.Concat(objectTypeName.Select(c => char.IsUpper(c) ? c.ToString() : ""));
                    if (opType.Length < 2)
                    {
                        opType = objectTypeName.Substring(0, 2).ToUpper();
                    }

                    var numberTemplate = opType + "{0:yyMMdd}-{1:D5}";
                    if (store != null)
                    {
                        numberTemplate = store.Settings.GetSettingValue("Order." + objectTypeName + "NewNumberTemplate", numberTemplate);
                    }

                    operation.Number = UniqueNumberGenerator.GenerateNumber(numberTemplate);
                }
            }
        }
示例#6
0
        public JsonResult AjaxSaveNavigationForm()
        {
            var             user       = UserAuthHelper.GetCurrentUser();
            StoreNavigation navigation = new StoreNavigation();

            navigation.InUserName  = user.UserDisplayName;
            navigation.InUserSysNo = user.SellerSysNo;
            navigation.SellerSysNo = user.SellerSysNo;

            navigation.LinkUrl  = Request["LinkUrl"].ToString();
            navigation.Content  = Request["Content"].ToString();
            navigation.Priority = int.Parse(Request["Priority"].ToString());
            if (Request["Status"] != null)
            {
                navigation.Status = 1;
            }
            else
            {
                navigation.Status = 0;
            }

            StoreService.SaveNavigationForm(navigation);

            return(Json(new { success = true }));
        }
示例#7
0
    public void PlayModeTestConsumePurchaseFails()
    {
        AppInfo appInfo = new AppInfo();

        StoreService.Initialize(new InitListener(), appInfo);
        StoreService.ConsumePurchase(new PurchaseInfo(), new PurchaseListener());
    }
示例#8
0
        public ActionResult AjaxAddTemplate()
        {
            var storePage       = SerializationUtility.JsonDeserialize2 <StorePage>(Request.Form["data"]);
            var pageLayouts     = StoreService.QueryAllPageLayout();
            var pageTemplateKey = storePage.StorePageTemplate.Key;
            var Temp            = StoreService.QueryStorePageTemplateByTemplateKey(pageTemplateKey);

            storePage.StorePageTemplate.PageTemplateType = Temp.PageTemplateType;
            storePage.StorePageTemplate.DataValue        = Temp.DataValue;
            storePage.StorePageTemplate.PageTypeKey      = Temp.PageTypeKey.Trim();
            storePage.StorePageTemplate.Name             = Temp.Name;
            storePage.StorePageTemplate.Desc             = Temp.Desc;
            storePage.StorePageTemplate.TemplateViewPath = Temp.TemplateViewPath;
            storePage.StorePageTemplate.MockupUrl        = Temp.MockupUrl;
            storePage.StorePageTemplate.Status           = Temp.Status;
            storePage.StorePageTemplate.Memo             = Temp.Memo;
            storePage.StorePageTemplate.Priority         = Temp.Priority;

            foreach (var storePageLayout in pageLayouts)
            {
                if (pageTemplateKey.Contains(storePageLayout.PageLayoutKey))
                {
                    storePage.StorePageTemplate.StorePageLayouts.Add(storePageLayout);
                }
            }
            return(Json(storePage));
        }
示例#9
0
        public ActionResult AjaxDelStoreAttachment()
        {
            var attachmentSysNo = int.Parse(Request.Form["data"]);

            StoreService.DelStoreAttachment(attachmentSysNo);
            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功") }));
        }
示例#10
0
 public void SetUp()
 {
     _BookService  = new BookService();
     _StoreService = new StoreService();
     _StockService = new StockService();
     InitialiseParameters();
 }
示例#11
0
        public async Task <ActionResult> Products(int take = 1, int description = 300, int imageHeight = 50, int imageWidth = 50, int isDetailLink = 0)
        {
            // var productsTask = ProductService.GetProductsAsync(StoreId, take, true);
            var productsTask = ProductService.GetProductsByProductTypeAsync(StoreId, null, null, null, StoreConstants.ProductType, 1,
                                                                            take, true, "random", null);
            var productCategoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true);
            var storeTask             = StoreService.GetStoreAsync(StoreId);

            await Task.WhenAll(storeTask, productsTask, productCategoriesTask);

            var store             = storeTask.Result;
            var products          = productsTask.Result;
            var productCategories = productCategoriesTask.Result;

            var feed = ProductHelper.GetProductsRssFeed(store, products, productCategories, description, isDetailLink);

            ProductHelper.ImageWidth  = imageWidth;
            ProductHelper.ImageHeight = imageHeight;
            ProductHelper.StoreId     = StoreId;
            var comment = new StringBuilder();

            comment.AppendLine("Take=Number of rss item; Default value is 10  ");
            comment.AppendLine("Description=The length of description text.Default value is 300  ");
            return(new FeedResult(feed, comment));
        }
示例#12
0
        /// <summary>
        /// Filter product details
        /// </summary>
        /// <param name="model">Product details</param>
        /// <returns>filtered details</returns>
        private ProductDetailsModel FilterServicesInfo(ProductDetailsModel model)
        {
            // image file
            if (!string.IsNullOrEmpty(model.ImageFileName))
            {
                model.ImageFileName = string.Format(Settings.Default.ProductImageUrlTemplate, model.ImageFileName);
            }
            else
            {
                model.ImageFileName = "/Content/Icons/photo_not_available.png";
            }

            // Call center or not
            var _store = new StoreService(_dataContext);

            model.IsCallCenter = _store.IsCallCenter();

            //filtering
            model = FilterSupporService(model);
            model = FilterCollectService(model);
            model = FilterRepairService(model);
            model = FilterFreeSparesService(model);
            model = FilterChargeSparesService(model);

            return(model);
        }
        private void SearchCommandExecute(object obj)
        {
            var searchRequest = new SearchRequestModel
            {
                Name            = purchaseName,
                TypeId          = ProductType != null ?ProductType.Id : -1,
                CostStart       = costStart,
                CostEnd         = costEnd,
                DateStart       = SearchFromDate,
                DateEnd         = SearchToDate,
                IsMonthly       = IsMonthly,
                SearchByName    = SearchByName,
                SearchByType    = SearchByType,
                SearchByDate    = SearchByDate,
                SearchByCost    = SearchByCost,
                SearchByMonthly = SearchByMonthly
            };

            Task.Factory.StartNew(async() =>
            {
                List <Purchase> results = await StoreService.LoadPurchaseList(searchRequest).ConfigureAwait(false);
                results    = results.OrderBy(p => p.Date).ToList();
                TotalCount = results.Sum(p => p.ItemsNumber).ToString();
                TotalCost  = results.Sum(p => p.TotalCost).ToString();
                BackupSearchList(results);
                SearchResultList = new BindingList <Purchase>(results);
                Status.Post("Пошук завершено, знайдено {0} записів", searchResultList.Count);
            });
        }
示例#14
0
        private StiReport GetReport()
        {
            string basePath = Server.MapPath("~/");
            //string reportFolder = string.Format("{0}\\Content\\DashboardReports\\ClientId{1}", basePath, storeService.StoreId.ToString());
            string       reportFolder     = string.Format("{0}Content\\DashboardReports", basePath);
            string       fileNameFullPath = string.Format("{0}\\{1}.mrt", reportFolder, Report);
            Repository   repository       = new Repository();
            var          report           = new StiReport();
            StoreService storeService     = (StoreService)Ioc.Get <StoreService>();

            report.Load(fileNameFullPath);
            try
            {
                var dbConnection = (StiSqlDatabase)report.Dictionary.Databases["Connection"];
                dbConnection.ConnectionString = repository.ConnectionString;

                report.Dictionary.Variables["Clientid"].ValueObject = storeService.StoreId.ToString();
                report.Dictionary.Variables["BaseUrl"].ValueObject  = Request.Url.Scheme + "://" + Request.Url.Authority;
            }
            catch
            {
            }
            //  report.RegData(data);

            return(report);
        }
示例#15
0
        public bool GetUserInfo(string userId)
        {
            var _store = new StoreService(_dataContext);
            var info   = _reporsitory.UserInfo(userId);

            return(info);
        }
示例#16
0
 public string addReliantDiscountSameProduct(int storeID, string percentage, string duration, int numOfProducts, int productID)
 {
     try
     {
         double per     = Double.Parse(percentage);
         int    session = UserService.getInstance().getUserByHash(System.Web.HttpContext.Current.Request.Cookies["HashCode"].Value);
         StoreService.getInstance().addReliantDiscountSameProduct(storeID, session, per, duration, numOfProducts, productID);
         return("");
     }
     catch (ClientException e)
     {
         SystemLogger.getEventLog().Error("Add Reliant Discount : " + e.Message.ToString());
         return(e.Message.ToString());
     }
     catch (ConnectionException e)
     {
         SystemLogger.getEventLog().Error("Database Error : " + e.Message.ToString());
         return("There has been a problem with the connection to the database. Please try again.");
     }
     catch (Exception e)
     {
         SystemLogger.getErrorLog().Error("An Error has occured. Function: Add Discount; Stack Trace: " + e.StackTrace);
         throw e;
     }
 }
        /// <summary>
        /// Sets up HTTP methods mappings.
        /// </summary>
        /// <param name="service">Service handling requests</param>
        public StoreModule(StoreService service) : base("/v2")
        {
            Delete["/store/order/{orderId}"] = parameters =>
            {
                var orderId = Parameters.ValueOf <string>(parameters, Context.Request, "orderId", ParameterType.Path);
                Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'DeleteOrder'");

                service.DeleteOrder(Context, orderId);
                return(new Response {
                    ContentType = ""
                });
            };

            Get["/store/inventory"] = parameters =>
            {
                return(service.GetInventory(Context));
            };

            Get["/store/order/{orderId}"] = parameters =>
            {
                var orderId = Parameters.ValueOf <long?>(parameters, Context.Request, "orderId", ParameterType.Path);
                Preconditions.IsNotNull(orderId, "Required parameter: 'orderId' is missing at 'GetOrderById'");

                return(service.GetOrderById(Context, orderId));
            };

            Post["/store/order"] = parameters =>
            {
                var body = this.Bind <Order>();
                Preconditions.IsNotNull(body, "Required parameter: 'body' is missing at 'PlaceOrder'");

                return(service.PlaceOrder(Context, body));
            };
        }
        public IActionResult DeleteCustomer(int id)
        {
            if (id <= 0)
            {
                return(Error(HttpStatusCode.BadRequest, "id", "invalid id"));
            }

            var customer = _customerApiService.GetCustomerEntityById(id);

            if (customer == null)
            {
                return(Error(HttpStatusCode.NotFound, "customer", "not found"));
            }

            CustomerService.DeleteCustomer(customer);

            //remove newsletter subscription (if exists)
            foreach (var store in StoreService.GetAllStores())
            {
                var subscription = _newsLetterSubscriptionService.GetNewsLetterSubscriptionByEmailAndStoreId(customer.Email, store.Id);
                if (subscription != null)
                {
                    _newsLetterSubscriptionService.DeleteNewsLetterSubscription(subscription);
                }
            }

            //activity log
            CustomerActivityService.InsertActivity("DeleteCustomer", LocalizationService.GetResource("ActivityLog.DeleteCustomer"), customer);

            return(new RawJsonActionResult("{}"));
        }
示例#19
0
        private void LoadAndDisplayData()
        {
            if (string.IsNullOrEmpty(CurrentStoreName))
            {
                this.hdivNoStoreTypeSelected.Visible = true;
                return;
            }

            var storeService = new StoreService(new ExcludedStoresService());

            Store = storeService.GetMetadata(CurrentStoreName);

            if (Store == null)
            {
                this.hdivStoreTypeDoesntExist.Visible = true;
                return;
            }

            this.hdivStoreTypeSelected.Visible = true;

            this.repColumnsHeader.DataSource = Store.Columns;
            this.repForm.DataSource          = Store.Columns;
            this.repColumnsHeader.DataBind();
            this.repForm.DataBind();
        }
示例#20
0
 public void Init()
 {
     _cacheMock    = new Mock <ICacheBase>();
     _mediatorMock = new Mock <IMediator>();
     _repository   = new Mock <IRepository <Store> >();
     _service      = new StoreService(_cacheMock.Object, _repository.Object, _mediatorMock.Object);
 }
        private void DisplayPackages()
        {
            string errorResponse = string.Empty;

            // check that the store is configured with an organization
            if (StoreService.OrganizationIsConfigured())
            {
                PackageService packageService = new PackageService();
                var            purchases      = packageService.GetPurchasedPackages(out errorResponse);

                // check errors
                ErrorCheck(errorResponse);

                if (purchases.Count == 0)
                {
                    lMessages.Text = "<div class='alert alert-warning'>No packages have been purchased for this organization.</div>";
                }

                rptPurchasedProducts.DataSource = purchases;
                rptPurchasedProducts.DataBind();
            }
            else
            {
                var queryParams = new Dictionary <string, string>();
                queryParams.Add("ReturnUrl", Request.RawUrl);

                NavigateToLinkedPage("LinkOrganizationPage", queryParams);
            }
        }
示例#22
0
 public Object setDiscountPercentage(int discountID, int percentage)
 {
     try
     {
         double p       = percentage / 100.0;
         int    session = UserService.getInstance().getUserByHash(System.Web.HttpContext.Current.Request.Cookies["HashCode"].Value);
         StoreService.getInstance().setDiscountPercentage(discountID, p);
         return("ok");
     }
     catch (ClientException e)
     {
         SystemLogger.getEventLog().Error("discount percentage :" + e.Message.ToString());
         return(e.Message);
     }
     catch (ConnectionException e)
     {
         SystemLogger.getEventLog().Error("Database Error : " + e.Message.ToString());
         return("There has been a problem with the connection to the database. Please try again.");
     }
     catch (Exception e)
     {
         SystemLogger.getErrorLog().Error("An Error has occured. Function: Set Discount Percentage; Stack Trace: " + e.StackTrace);
         throw e;
     }
 }
示例#23
0
        public string addStore(string name, string description)
        {
            try
            {
                int session = UserService.getInstance().getUserByHash(System.Web.HttpContext.Current.Request.Cookies["HashCode"].Value);
                StoreService.getInstance().addStore(name, description, session);

                return("ok");
            }
            catch (ILLArgumentException e)
            {
                return("cant open store with no name");
            }
            catch (ClientException e)
            {
                SystemLogger.getEventLog().Error("Error in adding a store : " + e.Message.ToString());
                return(e.Message.ToString());
            }
            catch (ConnectionException e)
            {
                SystemLogger.getEventLog().Error("Database Error : " + e.Message.ToString());
                return("There has been a problem with the connection to the database. Please try again.");
            }
            catch (Exception e)
            {
                SystemLogger.getErrorLog().Error("An Error has occured. Function: getStore; Stack Trace: " + e.StackTrace);
                throw e;
            }
        }
        static void Main(string[] args)
        {
            StoreService storeService = new StoreService();

            while (storeService.ExitProgram == false)
            {
                try
                {
                    storeService.ChooseCommande();
                }
                catch (FormatException ex)
                {
                    Console.WriteLine($"**{ex.Message}**");
                }
                catch (InvalidOperationException ex)
                {
                    Console.WriteLine($"**{ex.Message}**");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"**{ex.Message}**");
                }
                finally
                {
                    Console.WriteLine(new string('_', 10));
                }
            }
        }
示例#25
0
        public IHttpActionResult GetStoreList()
        {
            LogHelper.WriteLog("GetStoreList");
            SimpleResult  result   = new SimpleResult();
            IStoreService _service = new StoreService();

            try
            {
                if (UserAuthorization)
                {
                    var list = _service.GetStoreList();
                    result.Resource = list;
                    result.Status   = Result.SUCCEED;
                }
                else
                {
                    result.Status   = ResultType;
                    result.Resource = ReAccessToken;
                    result.Msg      = TokenMessage;
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetStoreList ", ex);
                result.Status = Result.FAILURE;
                result.Msg    = ex.Message;
            }
            LogHelper.WriteLog("GetStoreList result" + Json(result));
            return(Json(result));
        }
示例#26
0
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                var user = new User();
                _storeService = new StoreService();
                var userLocation = await user.CurrentLocation();

                var parameters = "latitude=" + userLocation.Latitude + "&longtitude=" + userLocation.Longitude + "&live=true";
                var asnycList  = await _storeService.GetList(parameters);

                foreach (var item in asnycList.OrderBy(a => a.Distance))
                {
                    if (item.Distance > 0)
                    {
                        item.DistanceString = LocationMonanager.MetersToString(item.Distance);
                    }
                    stores.Add(item);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private StoreService CreateStoreService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new StoreService(userId);

            return(service);
        }
示例#28
0
        public override void Load(Action <ResultCode> callback)
        {
            StoreService instance = StoreService.Instance;
            List <StoreProductFilter> productFilters = new List <StoreProductFilter>();

            productFilters.Add(StoreProductFilter.Purchased);
            Action <BackendResult <List <StockItem>, ResultCode> > callback1 = (Action <BackendResult <List <StockItem>, ResultCode> >)(result =>
            {
                ResultCode resultCode = result.ResultCode;
                if (resultCode == ResultCode.Succeeded)
                {
                    Execute.ExecuteOnUIThread((Action)(() =>
                    {
                        List <StockItem> resultData = result.ResultData;
                        this.ClearItems();
                        foreach (StockItem stockItem in resultData.Where <StockItem>((Func <StockItem, bool>)(product => product != null)))
                        {
                            StockItemHeader stockItemHeader = new StockItemHeader(stockItem, false, 0, false);
                            if (stockItemHeader.IsActive)
                            {
                                this.AddActiveStickers(stockItemHeader);
                            }
                            else
                            {
                                this.HiddenStickers.Add(stockItemHeader);
                            }
                        }
                        this.NotifyProperties();
                    }));
                }
                callback(resultCode);
            });

            instance.GetStockItems(productFilters, callback1);
        }
示例#29
0
        /// <summary>
        /// Set auth info
        /// </summary>
        /// <param name="model"></param>
        public void SetAuthInfo(User_DetailsModel model)
        {
            var _storeService = new StoreService(_dataContext);

            // This is made for clean back url from session and flag
            var  urlForback = GetUrlForBack() ?? "/";
            bool AutoSignIn = this.IsAutoSignIn();

            // Clear from Session
            SetUrlForBack(null);
            IsAutoSignIn(false);
            SetUserId(model.UserId);
            SetUserName(model.UserName);
            SetGroup(model.GroupID);

            // If no store indfo then set store in cookies
            if (model.UserStoreID.HasValue && (!_storeService.IsStoreInfoExist()))
            {
                _storeService.SetStoreInfo(model.UserStoreID.Value, model.UserStoreName);
                IsCallCenter(model.ClientPriorityBooking);
            }
            if (model.UserStoreID.HasValue && (_storeService.IsStoreInfoExist()))
            {
                IsOffshoreCallCenter(model.GroupID);
            }
            FormsAuthentication.SetAuthCookie(model.UserId, createPersistentCookie: false);

            // Add log record to database
            var log     = new Log(_dataContext);
            var browser = HttpContext.Current.Request.Browser;

            log.Database.SignIn.Add(String.Format("{0} v{1}", browser.Browser, browser["version"]));
        }
示例#30
0
        public void SortTest()
        {
            Store store     = new Store(); // TODO: инициализация подходящего значения
            Box   minBox    = new Box(1, 1, 1);
            Box   middleBox = new Box(1, 2, 1);
            Box   maxBox    = new Box(1, 2, 2);

            store.Add(maxBox);
            store.Add(minBox);
            store.Add(middleBox);


            StoreService target = new StoreService();

            target.Sort(store);

            List <Box> expected = new List <Box>()
            {
                minBox, middleBox, maxBox
            };

            List <Box> actual;

            actual = target.Sort(store);
            CollectionAssert.AreEqual(expected, actual);
        }
示例#31
0
 public string removeRole(string username, int storeId)
 {
     try
     {
         int session = UserService.getInstance().getUserByHash(System.Web.HttpContext.Current.Request.Cookies["HashCode"].Value);
         StoreService.getInstance().removeRole(storeId, username, session);
         //WebSocketController.messageClient(username, "you have no longer a role in store " + storeId);
         return("ok");
     }
     catch (ClientException e)
     {
         SystemLogger.getEventLog().Error("Remove Role Error: " + e.Message.ToString());
         return(e.Message.ToString());
     }
     catch (ConnectionException e)
     {
         SystemLogger.getEventLog().Error("Database Error : " + e.Message.ToString());
         return("There has been a problem with the connection to the database. Please try again.");
     }
     catch (Exception e)
     {
         SystemLogger.getErrorLog().Error("An Error has occured. Function: Remove Role; Stack Trace: " + e.StackTrace);
         throw e;
     }
 }
        public GivenAStoreService()
        {
            this.autoResetEventAdapter = new Mock<IAutoResetEventAdapter>();
            this.volatileStore = new Mock<IRepository>();
            this.persistentStore = new Mock<IRepository>();
            this.preferences = new Mock<IPreferences>();

            this.service = new StoreService(this.autoResetEventAdapter.Object, this.preferences.Object);
        }
 private void InitialiseStoreService()
 {
     int port;
     if (!int.TryParse(CloudConfigurationManager.GetSetting("EventStorePort"), out port))
     {
         throw new ConfigurationErrorsException("Port number will not convert to integer.");
     }
     _storeSerivce =
         StoreServiceFactory.BuildStoreService(CloudConfigurationManager.GetSetting("EventStoreUsername"),
             CloudConfigurationManager.GetSetting("EventStorePassword"),
             CloudConfigurationManager.GetSetting("IpAddress"),
             port, true);
 }
        public StoreWorldEstimateInfoBuilder(IStoreService storeservice,
                                             IStoreToWorldService storeworldservice
                                            )
        {
            if (storeservice == null)
            {
                throw new ArgumentNullException();
            }

            if (storeworldservice == null)
            {
                throw new ArgumentNullException();
            }

            _storeservice = (StoreService)storeservice;
            _storetoworldservice = (StoreToWorldService)storeworldservice;

            _personminmaxservice = (PersonMinMaxService)_storetoworldservice.PersonMinMaxService;
            _bufferhoursservice = (BufferHoursService)_storetoworldservice.BufferHoursService;
            _benchmarkservice = (BenchmarkService)_storeservice.BenchmarkService;
            _avgamountservice = (AvgAmountService)_storetoworldservice.AvgAmountService;
        }
 public StoreController(StoreService service)
 {
     _store = service;
 }
 public void TestUpdate()
 {
     var target = new StoreService();
     Assert.IsTrue(target.Update());
 }
 public void TestDelete()
 {
     var target = new StoreService();
     Assert.IsTrue(target.Delete());
 }
 public StoreController()
 {
     _storeService = new StoreService();
 }
示例#39
0
        public StoreWeekCalculater(long storeid, DateTime abegin, DateTime aend, EmployeeTimeService timeservice)
        {
            _storeid = storeid;
            _begindate = abegin;
            _enddate = aend;

            _timeservice = timeservice;
            _employeeservice = _timeservice.EmployeeService as EmployeeService;
            _storeservice = _employeeservice.StoreService as StoreService;

            CountryId = _storeservice.GetCountryByStoreId(_storeid);

            _absencemanager = new AbsenceManager(_storeservice.CountryService.AbsenceService);
            _absencemanager.CountryId = CountryId;

            _wmodelmanager = new WorkingModelManagerNew(_storeservice.CountryService.WorkingModelService);
            _wmodelmanager.CountryId = CountryId;

            Init();
        }
 public void TestRetrieve()
 {
     var target = new StoreService();
     Assert.IsTrue(target.Retrieve());
 }