예제 #1
0
        public StoresServiceReportViewModel(IStoresService storeService,
                                            IServiceZipsService serviceZipService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по ресторанскому сервису";
            MonthesList          = Monthes.GetMonthesList();
            YearList             = new List <int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
            {
                YearList.Add(i);
            }
            #endregion infrastructure

            #region stores
            StoresWithCheckList   = new ObservableCollection <StoresWithCheck>();
            SetSelectionCommand   = new DelegateCommand(SetSelection);
            ClearSelectionCommand = new DelegateCommand(ClearSelection);
            #endregion stores

            #region report
            LoadReportCommand = new DelegateCommand(LoadReport);
            #endregion report

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers

            #region services
            _storeService      = storeService;
            _serviceZipService = serviceZipService;
            #endregion services
        }
        public ServiceReportForStoreViewModel(IServiceZipsService serviceZipService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Детальный отчет по ресторанам";
            MonthesList          = Monthes.GetMonthesList();
            #endregion infrastructure

            #region report
            ServiceZipList      = new ObservableCollection <ServiceZipDetailsSet>();
            StoresWithCheckList = new ObservableCollection <StoresWithCheck>();
            StartDate           = new DateTime(2015, 1, 1);
            MinimumDate         = new DateTime(2015, 1, 1);
            MaximumDate         = new DateTime(DateTime.Now.Year, 12, 31);
            EndDate             = DateTime.Now;
            LoadReportCommand   = new DelegateCommand(LoadReport);
            StackedStoreList    = new ObservableCollection <StackedStoreInfo>();
            StoreZipList        = new ObservableCollection <StoreZip>();
            IsSelectAll         = false;
            SelectAllCommand    = new DelegateCommand(SelectAll);
            #endregion report

            #region services
            _serviceZipService = serviceZipService;
            _storeService      = storeService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadServiceZip;
            _worker.RunWorkerCompleted += LoadServiceZip_Completed;
            #endregion workers
        }
예제 #3
0
        public CapexReportViewModel(ICapexesService capexService, IAccountStatusService statusService, IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по CAPEX";
            #endregion infrastructure

            #region capex
            YearList = new List <int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
            {
                YearList.Add(i);
            }
            CapexList                = new ObservableCollection <CapexWithRest>();
            CapexAccountsList        = new ObservableCollection <AccountsWithStatus>();
            LoadCapexCommand         = new DelegateCommand(LoadCapex);
            LoadSelectedCapexCommand = new DelegateCommand(LoadSelectedCapex);
            StatusSumList            = new ObservableCollection <StatusSum>();
            _storesList              = new List <StoresSet>();
            #endregion capex

            #region services
            _capexService        = capexService;
            _statusService       = statusService;
            _accountsMainService = accountsMainService;
            _storesService       = storeService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadFullCapexInfo;
            _worker.RunWorkerCompleted += LoadFullCapexInfo_Completed;
            #endregion workers
        }
        public ServiceReportForStoreByMonthViewModel(IServiceZipsService serviceZipService, IStoresService storeService, IAccountsMainService accountsMainService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по затратам на ресторан";
            MonthesList = Monthes.GetMonthesList();
            #endregion infrastructure

            #region report
            ServiceZipList = new ObservableCollection<ServiceZipDetailsSet>();
            MonthExpList = new ObservableCollection<MonthExp>();
            StoresList = new List<StoresSet>();
            ServiceAccountsList = new List<AccountsMainSet>();
            MonthServExpList = new ObservableCollection<MonthExp>();
            #endregion report

            #region services
            _serviceZipService = serviceZipService;
            _storeService = storeService;
            _accountsMainService = accountsMainService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadServiceZip;
            _worker.RunWorkerCompleted += LoadServiceZip_Completed;
            #endregion workers
        }       
예제 #5
0
        public FAReportViewModel(IFAService faService, IAccountFAService accountFAService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по основным средствам";
            #endregion infrastructure

            #region report
            FAList                = new ObservableCollection <FASet>();
            AccountFAList         = new ObservableCollection <AccountFA>();
            FullFAList            = new List <AccountsBudgetDetailsSet>();
            LoadSelectedFACommand = new DelegateCommand(LoadSelectedFA);
            SelectedAccountFAList = new ObservableCollection <AccountsMainSet>();
            int i = 2016;
            YearList = new List <YearCheck>();
            while (i < DateTime.Now.Year + 5)
            {
                YearList.Add(new YearCheck {
                    IsSelected = i == DateTime.Now.Year ? true : false, Year = i
                });
                i++;
            }
            #endregion report

            #region services
            _faService        = faService;
            _accountFAService = accountFAService;
            _storeService     = storeService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers
        }
예제 #6
0
        public ServiceReportForStoreByMonthViewModel(IServiceZipsService serviceZipService, IStoresService storeService, IAccountsMainService accountsMainService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по затратам на ресторан";
            MonthesList          = Monthes.GetMonthesList();
            #endregion infrastructure

            #region report
            ServiceZipList      = new ObservableCollection <ServiceZipDetailsSet>();
            MonthExpList        = new ObservableCollection <MonthExp>();
            StoresList          = new List <StoresSet>();
            ServiceAccountsList = new List <AccountsMainSet>();
            MonthServExpList    = new ObservableCollection <MonthExp>();
            #endregion report

            #region services
            _serviceZipService   = serviceZipService;
            _storeService        = storeService;
            _accountsMainService = accountsMainService;
            #endregion services

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadServiceZip;
            _worker.RunWorkerCompleted += LoadServiceZip_Completed;
            #endregion workers
        }
예제 #7
0
        public JsonResult GetStoresByID(int ID)
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            Stores         stores        = storesService.GetEntity(ID);
            var            jsonData      = new
            {
                ID           = stores.ID,
                ShopId       = stores.Shops.ID,
                ShopName     = stores.Shops.ShopName,
                StoreName    = stores.StoreName,
                Phone        = stores.Phone,
                Adress       = stores.Adress,
                BankName     = stores.BankName,
                BankCard     = stores.BankCard,
                IsShare      = stores.IsShare,
                IsShowWeiXin = stores.IsShowWeiXin,
                IsMainStore  = stores.IsMainStore,
                Disabled     = stores.Disabled,
                LatitudeY    = stores.LatitudeY == null ? "" : stores.LatitudeY,
                LongitudeX   = stores.LongitudeX == null ? "" : stores.LongitudeX,
                StoresImage  = stores.StoresImage,
                ReceiptLogo  = stores.ReceiptLogo,
                PrintRemark  = stores.PrintRemark
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        public ActionResult ReDisableStores(string SID)
        {
            string[]   strIds = SID.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            List <int> list   = new List <int>();

            foreach (string id in strIds)
            {
                list.Add(int.Parse(id));
            }

            var            flag          = false;
            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            using (TransactionScope scope = TransactionScopeHelper.GetTran())
            {
                foreach (var item in list)
                {
                    var data = storesService.GetEntity(item);
                    data.Disabled = false;
                    storesService.UpdateEntity(data);
                }
                scope.Complete();
                flag = true;
            }

            return(Json(new Result(flag, ResultType.Other), JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public JsonResult AddStores(Stores storesModel)
        {
            //var stores = strStores.FromJson<Stores>();

            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            bool flage = storesService.Exists(t => t.ShopId == storesModel.ShopId && t.StoreName == storesModel.StoreName);

            if (flage)
            {
                return(Json(new Result(false, "已经存在同名门店请修改"), JsonRequestBehavior.AllowGet));
            }

            if (!string.IsNullOrWhiteSpace(storesModel.StoresImage))
            {
                storesModel.StoresImage = FileHelper.Move(storesModel.StoresImage, "/Upload/Reality/" + CurrentInfo.CurrentStore.ID + "/storeImage/");
            }
            if (!string.IsNullOrWhiteSpace(storesModel.ReceiptLogo))
            {
                string newRoute = ServiceHelper.GetCommonService.ThumbnailImage(storesModel.ReceiptLogo, CurrentInfo.CurrentStore.ID, 128, 128, "CUT", "ReceiptLogo");
                storesModel.ReceiptLogo = newRoute;
            }
            if (storesModel.LongitudeX == "NaN")
            {
                storesModel.LongitudeX = "0";
            }
            if (storesModel.LatitudeY == "NaN")
            {
                storesModel.LatitudeY = "0";
            }
            var data = storesService.AddEntity(storesModel);

            return(Json(new Result(data != null, ResultType.Add), JsonRequestBehavior.AllowGet));
        }
        public ActionResult GetRolesByStoreID(int?shopType)
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            IRoleService   roleService   = ServiceFactory.Create <IRoleService>();

            List <KeyValuePair <Stores, List <Role> > > StoresRoleKeyValueList = new List <KeyValuePair <Stores, List <Role> > >();

            //如果是商家管理员则显示所有门店的角色
            if (CurrentInfo.IsShopAdmin)
            {
                int ShopID = CurrentInfo.CurrentShop.ID;
                //这边是销售的测试账号开户,给客户分配角色所用的商家ID
                if (shopType != null)
                {
                    if (shopType == (int)ShopTypeEnum.汽车美容)
                    {
                        ShopID = 4;
                    }
                    else if (shopType == (int)ShopTypeEnum.美容美发)
                    {
                        ShopID = 66;
                    }
                }

                var storesList = storesService.GetEntities(t => t.ShopId == ShopID && t.Disabled == false);
                foreach (var item in storesList)
                {
                    var data = roleService.GetEntities(t => t.StoreID == item.ID && t.Disabled == false).ToList();
                    if (data.Count > 0)
                    {
                        KeyValuePair <Stores, List <Role> > singleKeyValue = new KeyValuePair <Stores, List <Role> >(item, data);
                        StoresRoleKeyValueList.Add(singleKeyValue);
                    }
                }
            }
            else
            {
                int StoreID = CurrentInfo.CurrentStore.ID;

                //这边是销售的测试账号开户,给客户分配角色所用的门店ID
                if (shopType != null)
                {
                    if (shopType == (int)ShopTypeEnum.汽车美容)
                    {
                        StoreID = 45;
                    }
                    else if (shopType == (int)ShopTypeEnum.美容美发)
                    {
                        StoreID = 101;
                    }
                }

                var data = roleService.GetEntities(t => t.StoreID == StoreID && t.Disabled == false).ToList();
                KeyValuePair <Stores, List <Role> > singleKeyValue = new KeyValuePair <Stores, List <Role> >(CurrentInfo.CurrentStore, data);
                StoresRoleKeyValueList.Add(singleKeyValue);
            }

            return(View(StoresRoleKeyValueList));
        }
 public CreateStoreViewModel(IAddressLocationService addressLocationService,
     IUserDialogs dialogsService,
     IStoresService storesService)
 {
     _addressLocationService = addressLocationService;
     _dialogsService = dialogsService;
     _storesService = storesService;
 }
예제 #12
0
        //public JsonResult GetNoShareStoreID(int ID)
        //{
        //    IShareStroreSettingService shareStroreSettingService = ServiceFactory.Create<IShareStroreSettingService>();

        //    List<int> ids = new List<int>();
        //    string idStrs = "";//得到共享配置表

        //    var data = shareStroreSettingService.GetEntities(t => t.CurrentStoreID == ID).FirstOrDefault();
        //    if (data != null)
        //    {
        //        idStrs = data.NoShowStoreID;
        //    }

        //    List<string> listStr = idStrs.Split(',').ToList();
        //    foreach (var i in listStr)
        //    {
        //        ids.Add(TypeHelper.ObjectToInt(i));
        //    }

        //    return Json(ids, JsonRequestBehavior.AllowGet);
        //}

        //public JsonResult AddNoShareStore(int ID, string storeIDSs)
        //{
        //    IShareStroreSettingService shareStroreSettingService = ServiceFactory.Create<IShareStroreSettingService>();
        //    var data = shareStroreSettingService.GetEntities(t => t.CurrentStoreID == ID).FirstOrDefault();
        //    if (data != null)
        //    {
        //        data.NoShowStoreID = storeIDSs;
        //        bool IsSuccess = shareStroreSettingService.UpdateEntity(data);
        //        return Json(new Result() { success = IsSuccess, msg = "设置成功" }, JsonRequestBehavior.AllowGet);
        //    }
        //    else
        //    {
        //        data = new ShareStroreSetting();
        //        data.NoShowStoreID = storeIDSs;
        //        data.OperateUser = CurrentInfo.CurrentUser.ID;
        //        data.ShopsID = CurrentInfo.CurrentShop.ID;
        //        data.CurrentStoreID = ID;
        //        data.CreateTime = DateTime.Now;
        //        data = shareStroreSettingService.AddEntity(data);
        //        return Json(new Result() { success = data.ID != 0, msg = "设置成功" }, JsonRequestBehavior.AllowGet);

        //    }


        //}

        /// <summary>
        /// 编辑门店简介
        /// </summary>
        /// <returns></returns>
        public ActionResult EditProfile(int storeID)
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            var            store         = storesService.GetEntity(storeID);

            ViewBag.Profile = store.Profile;
            return(View());
        }
예제 #13
0
        /// <summary>
        /// 共享不可见门店
        /// </summary>
        /// <returns></returns>
        public ActionResult EditNoShareStore(int storeID)
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            int            shopID        = CurrentInfo.CurrentShop.ID;
            var            storeIDList   = storesService.GetEntities(t => t.ShopId == shopID).ToList();

            ViewBag.CurrentStoreID = CurrentInfo.CurrentStore.ID;
            return(View(storeIDList));
        }
예제 #14
0
        public StoresController(IStoresService storesService, ICompaniesService companiesService, IOptions <AppSecrets> optionsAccessor)
        {
            _storesService    = storesService;
            _companiesService = companiesService;

            if (optionsAccessor == null)
            {
                throw new ArgumentNullException(nameof(optionsAccessor));
            }
            _appConfig = optionsAccessor.Value;
        }
예제 #15
0
        public JsonResult EditStores(Stores storesModel)
        {
            //var stores = strStores.FromJson<Stores>();

            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            var            dbData        = storesService.GetEntity(storesModel.ID, false);
            bool           flage         = storesService.Exists(t => t.ID != storesModel.ID && t.ShopId == storesModel.ShopId && t.StoreName == storesModel.StoreName);

            if (flage)
            {
                return(Json(new Result(false, "已经存在同名门店请修改"), JsonRequestBehavior.AllowGet));
            }

            //如果用户有传文件,并且文件和数据库中保存的不一样,则需要保存,如果和数据库中一致,无需保存
            if (!string.IsNullOrWhiteSpace(storesModel.StoresImage) && storesModel.StoresImage != dbData.StoresImage)
            {
                storesModel.StoresImage = FileHelper.Move(storesModel.StoresImage, "/Upload/Reality/" + CurrentInfo.CurrentStore.ID + "/storeImage/");
            }
            if (!string.IsNullOrWhiteSpace(storesModel.ReceiptLogo) && storesModel.ReceiptLogo != dbData.ReceiptLogo)
            {
                string newRoute = ServiceHelper.GetCommonService.ThumbnailImage(storesModel.ReceiptLogo, CurrentInfo.CurrentStore.ID, 128, 128, "CUT", "ReceiptLogo");
                storesModel.ReceiptLogo = newRoute;
            }

            if (storesModel.LongitudeX == "NaN")
            {
                storesModel.LongitudeX = "0";
            }
            if (storesModel.LatitudeY == "NaN")
            {
                storesModel.LatitudeY = "0";
            }
            dbData.StoreName    = storesModel.StoreName;
            dbData.Phone        = storesModel.Phone;
            dbData.Adress       = storesModel.Adress;
            dbData.LatitudeY    = storesModel.LatitudeY;
            dbData.LongitudeX   = storesModel.LongitudeX;
            dbData.BankName     = storesModel.BankName;
            dbData.BankCard     = storesModel.BankCard;
            dbData.IsMainStore  = storesModel.IsMainStore;
            dbData.IsShare      = storesModel.IsShare;
            dbData.IsShowWeiXin = storesModel.IsShowWeiXin;
            dbData.StoresImage  = storesModel.StoresImage;
            dbData.PrintRemark  = storesModel.PrintRemark;
            dbData.Disabled     = storesModel.Disabled;
            bool isSuccess = dbData.Update();

            return(Json(new Result(isSuccess, ResultType.Update), JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 获取一个商家的第一家门店
        /// </summary>
        /// <param name="shopID">商家</param>
        /// <returns></returns>
        public Stores GetShopFirstStore(int shopID)
        {
            Stores         firstStore = null;
            IStoresService service    = ServiceFactory.Create <IStoresService>();

            if (shopID > 0)
            {
                firstStore = service.GetEntities(o => o.ShopId == shopID && o.VirtualShopsID == null).OrderBy(t => t.ID).FirstOrDefault();
            }
            else
            {
                firstStore = service.GetEntities(o => o.VirtualShopsID == shopID).OrderBy(t => t.ID).FirstOrDefault();
            }
            return(firstStore);
        }
예제 #17
0
        public ActionResult CusRoleManage(RoleSearchModel searchModel)
        {
            var          expr        = BuildSearchCriteria(searchModel);
            IRoleService roleService = ServiceFactory.Create <IRoleService>();
            var          roles       = roleService.GetEntitiesByPage(searchModel.PageIndex, 10, expr, false, t => t.ID);

            ViewBag.SearchModel = searchModel;

            IStoresService storesService   = ServiceFactory.Create <IStoresService>();
            List <Stores>  allStores       = storesService.GetEntities(t => t.ShopId == CurrentInfo.CurrentShop.ID && t.Disabled == false).ToList();
            SelectList     allStoresSelect = new SelectList(allStores, "ID", "StoreName", CurrentInfo.CurrentStore.ID);

            ViewData["allStoresSelect"] = allStoresSelect;
            ViewData["showStores"]      = CurrentInfo.IsShopAdmin;
            return(View(roles));
        }
예제 #18
0
        public ActionResult ShowAddUser()
        {
            InitInfo.Instance.SetCurrentModule("Admin", "User", "Index");
            Entity.Users editUser = null;
            //有ID说明是编辑状态
            if (Request["ID"] != null)
            {
                IUsersService usersService = ServiceFactory.Create <IUsersService>();
                editUser = usersService.GetEntity(Convert.ToInt32(Request["ID"]));
                //如果不是管理员,并且不是店铺内部人员,禁止修改改员工信息
                if (!CurrentInfo.IsAdministrator && CurrentInfo.CurrentUser.Remark != "B4内部销售" && editUser.Stores.ShopId != CurrentInfo.CurrentShop.ID)
                {
                    return(RedirectToAction("Error403", "Home", new { area = "Admin" }));
                }
            }

            //editUser为null的时候说明是添加
            int?shopID  = editUser == null ? CurrentInfo.CurrentShop.ID : editUser.ShopsID;
            int?storeID = editUser == null ? CurrentInfo.CurrentStore.ID : editUser.DefaultStoreID;

            IStoresService storesService   = ServiceFactory.Create <IStoresService>();
            List <Stores>  allStores       = storesService.GetEntities(t => t.ShopId == shopID && t.Disabled == false).ToList(); // CurrentInfo.CurrentShop.ID
            SelectList     allStoresSelect = new SelectList(allStores, "ID", "StoreName", storeID);                              // CurrentInfo.CurrentStore.ID

            ViewData["allStoresSelect"] = allStoresSelect;

            //只有管理员才能给所有店铺添加人员
            ViewData["showStores"] = CurrentInfo.IsShopAdmin;
            ViewBag.IsIntention    = false;

            //账号版本,测试账号开户用得到,其他无用
            List <SelectListItem> listShopType = new List <SelectListItem>();

            foreach (var item in Enum.GetValues(typeof(ShopTypeEnum)))
            {
                listShopType.Add(new SelectListItem
                {
                    Text  = item.ToString(),
                    Value = ((int)item).ToString()
                });
            }
            //InventoryDetailsType.Insert(0, new SelectListItem { Text = "所有类别", Value = "0" });
            //InventoryDetailsType[6].Selected = true;
            ViewData["ListShopType"] = new SelectList(listShopType, "Value", "Text", "1");

            return(View());
        }
예제 #19
0
        public ActionResult AddTestAccount()
        {
            InitInfo.Instance.SetCurrentModule("Admin", "User", "AddTestAccount");
            Entity.Users editUser = null;
            //有ID说明是编辑状态
            if (Request["ID"] != null && !string.IsNullOrWhiteSpace(Request["ID"].ToString()))
            {
                IUsersService usersService = ServiceFactory.Create <IUsersService>();
                editUser = usersService.GetEntity(Convert.ToInt32(Request["ID"]));
                //如果不是管理员,也不是内部销售,也不是本店的员工,则无权限修改
                if (!CurrentInfo.IsAdministrator && CurrentInfo.CurrentUser.Remark != "B4内部销售" && editUser.DefaultStoreID != CurrentInfo.CurrentStore.ID)
                {
                    return(RedirectToAction("Error403", "Home", new { area = "Admin" }));
                }
            }
            //editUser为null的时候说明是添加
            int?shopID  = editUser == null ? CurrentInfo.CurrentShop.ID : editUser.ShopsID;
            int?storeID = editUser == null ? CurrentInfo.CurrentStore.ID : editUser.DefaultStoreID;

            IStoresService storesService   = ServiceFactory.Create <IStoresService>();
            List <Stores>  allStores       = storesService.GetEntities(t => t.ShopId == shopID && t.Disabled == false).ToList(); // CurrentInfo.CurrentShop.ID
            SelectList     allStoresSelect = new SelectList(allStores, "ID", "StoreName", storeID);                              // CurrentInfo.CurrentStore.ID

            ViewData["allStoresSelect"] = allStoresSelect;
            //在添加测试账号的时候则默认不显示,只允许添加到测试门店里面
            ViewData["showStores"] = false;
            ViewBag.IsIntention    = true;

            //账号版本,测试账号开户用得到,其他无用
            List <SelectListItem> listShopType = new List <SelectListItem>();

            foreach (var item in Enum.GetValues(typeof(ShopTypeEnum)))
            {
                listShopType.Add(new SelectListItem
                {
                    Text  = item.ToString(),
                    Value = ((int)item).ToString()
                });
            }
            //InventoryDetailsType.Insert(0, new SelectListItem { Text = "所有类别", Value = "0" });
            //InventoryDetailsType[6].Selected = true;
            ViewData["ListShopType"] = new SelectList(listShopType, "Value", "Text", "1");

            ViewBag.BackUrl = "/Admin/IntentionUser/Index";

            return(View("ShowAddUser"));
        }
예제 #20
0
        public ActionResult GetShopsByID(int ID)
        {
            IUsersService  usersService  = ServiceFactory.Create <IUsersService>();
            IShopsService  shopsService  = ServiceFactory.Create <IShopsService>();
            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            ShopModel shopModel = new ShopModel();
            var       shops     = shopsService.GetEntity(ID);
            var       users     = ServiceHelper.GetUsersService.GetEntity(shops.AdminUserID);// shops.Users;
            var       stores    = users.Stores;

            shopModel.ID          = shops.ID;
            shopModel.ShopName    = shops.ShopName;
            shopModel.AdminUserID = users.ID;

            shopModel.Disabled      = shops.Disabled;
            shopModel.Domain        = shops.Domain;
            shopModel.DomainName    = shops.DomainName;
            shopModel.ShopVersionID = shops.ShopVersionID == null ? 0 : Convert.ToInt32(shops.ShopVersionID);
            shopModel.DueDate       = shops.DueDate;
            shopModel.TotalMoney    = shops.TotalMoney;
            shopModel.Remark        = shops.Remark;

            shopModel.ShopType      = shops.ShopType;
            shopModel.SalespersonID = shops.SalespersonID;
            shopModel.Deposit       = shops.Deposit;
            shopModel.FinalPayment  = shops.FinalPayment;
            shopModel.Province      = shops.Province;
            shopModel.ProvinceCode  = shops.ProvinceCode;
            shopModel.City          = shops.City;
            shopModel.CityCode      = shops.CityCode;
            shopModel.County        = shops.County;
            shopModel.CountyCode    = shops.CountyCode;
            shopModel.AfterSales    = shops.AfterSales;
            shopModel.LogoUrl       = shops.LogoUrl;
            shopModel.AnnualFee     = shops.AnnualFee;
            shopModel.SiteName      = shops.SiteName;
            //shopModel.

            shopModel.RealName = users.RealName;
            shopModel.UserName = users.UserName;
            shopModel.Password = users.Password;
            shopModel.Idcard   = users.Idcard;
            shopModel.Phone    = users.Phone;

            return(Json(shopModel, JsonRequestBehavior.AllowGet));
        }
예제 #21
0
        public JsonResult SaveProfile(int storeID, string profile)
        {
            bool           result        = false;
            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            var            store         = storesService.GetEntity(storeID);

            if (store.ShopId == CurrentInfo.CurrentShop.ID)
            {
                store.Profile = profile;
                result        = storesService.UpdateEntity(store);
            }

            return(Json(new Result()
            {
                success = result, msg = ""
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult StorePermissionMenu()
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            var store = storesService.GetFirstOrDefault(t => t.ID == CurrentInfo.CurrentStore.ID);

            if (store != null)
            {
                IRelationStoresModuleService relationStoresModuleService = ServiceFactory.Create <IRelationStoresModuleService>();
                //获取门店拥有的所有菜单
                var munes = relationStoresModuleService.GetEntities(t => t.StoresID == store.ID).Select(t => t.Module);
                return(View(munes));
            }
            else
            {
                return(RedirectToAction("Error403", "Home", new { area = "Admin" }));
            }
        }
예제 #23
0
        /// <summary>
        /// 门店商家管理页面
        /// </summary>
        /// <returns></returns>
        public ActionResult CustStoreManage()
        {
            IShopsService  shopsService  = ServiceFactory.Create <IShopsService>();
            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            //判断当前用户是否是这个商家的管理员,如果不是则拒绝访问
            //var shop = shopsService.GetFirstOrDefault(t => t);
            //bool isIntention = CurrentInfo.CurrentUser.IsIntention == null ? false : Convert.ToBoolean(CurrentInfo.CurrentUser.IsIntention);
            //if (!CurrentInfo.IsShopAdmin && !isIntention)
            //{
            //    return RedirectToAction("Error403", "Home", new { area = "Admin" });
            //}

            //判断是否已经设置过主店,如果设置了,则不允许用户再次修改
            var hasMainStore = storesService.Exists(t => t.ShopId == CurrentInfo.CurrentUser.ShopsID && t.IsMainStore == true);

            ViewBag.HasMainStore = hasMainStore;

            return(View());
        }
        public ActionResult StorePermission(OneKeySearchModel searchModel)
        {
            Expression <Func <Stores, Boolean> > lbdWhere = null;

            if (searchModel.SearchStr != null)
            {
                searchModel.SearchStr = searchModel.SearchStr.Trim();
                if (!string.IsNullOrWhiteSpace(searchModel.SearchStr))
                {
                    lbdWhere = t => t.StoreName.Contains(searchModel.SearchStr) ||
                               t.Phone.Contains(searchModel.SearchStr) ||
                               t.Adress.Contains(searchModel.SearchStr) ||
                               t.Shops.ShopName.Contains(searchModel.SearchStr);
                }
            }


            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            var            stores        = storesService.GetEntitiesByPage(searchModel.PageIndex, 10, lbdWhere, false, t => t.ID);
            //转换数据模型
            var listData = stores.Models.Select(t => new StorePermissionListModel
            {
                ID           = t.ID,
                ShopName     = t.Shops.ShopName,
                StoreName    = t.StoreName,
                Phone        = t.Phone,
                Adress       = t.Adress,
                IsShowWeiXin = t.IsShowWeiXin == true ? "显示" : "不显示",
                IsMainStore  = t.IsMainStore == true ? "是" : "否"//是否总店
            });

            var listStore = new PageModel <StorePermissionListModel>
            {
                Models     = listData.ToList(),
                pagingInfo = stores.pagingInfo
            };

            ViewBag.SearchModel = searchModel;

            return(View(listStore));
        }
예제 #25
0
        public StoreAccountsViewModel(IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region services
            _accountsMainService = accountsMainService;
            _storeService        = storeService;
            #endregion services

            #region infrastructure
            AccountsTabItemHeader = "Поиск по ресторанам";
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadStoresAndAccounts;
            _worker.RunWorkerCompleted += LoadStoresAndAccounts_Completed;
            #endregion infrastructure

            #region store
            SearchStoreResultList  = new ObservableCollection <StoresSet>();
            StoreAccountsList      = new ObservableCollection <StoreAccount>();
            IsStoreAccountsBusy    = false;
            SearchStoreCommand     = new DelegateCommand(SearchStoreMethod);
            LoadResultStoreCommand = new DelegateCommand(LoadAccountsForStore);
            #endregion store
        }
예제 #26
0
        //public JsonResult GetVirtualShops(int shopID)
        //{
        //    var virtualShops = ServiceHelper.GetCommonService.GetVirtualShops(shopID);
        //    return Json(new { success = true, VirtualShops = virtualShops }, JsonRequestBehavior.AllowGet);
        //}

        //门店绑定公众号和解绑公众号操作
        public JsonResult ToggleVirtualShops(int storeID, int?virtualShopsID)
        {
            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            bool result     = false;
            var  storeModel = storesService.GetEntity(storeID);

            if (storeModel != null)
            {
                if (virtualShopsID != null)
                {
                    storeModel.VirtualShopsID = virtualShopsID;
                }
                else
                {
                    storeModel.VirtualShopsID = null;
                }
                result = storesService.UpdateEntity(storeModel);
            }
            //设置成功
            return(Json(new Result(result, result ? (virtualShopsID != null ? "绑定成功" : "解绑成功") : "操作失败"), JsonRequestBehavior.AllowGet));
        }
예제 #27
0
        public JsonResult ResetShopVersion(int shopsID, int shopVersionID)
        {
            //如果不是管理员,拒绝调用此方法
            if (!CurrentInfo.IsAdministrator)
            {
                return(Json(new Result(false, ResultType.Update), JsonRequestBehavior.AllowGet));
            }

            //这边要取出这个版本所有菜单,然后加到用户菜单关系表 和 商家菜单关系表中
            IRelationShopVersionModuleService relationShopVersionModuleService = ServiceFactory.Create <IRelationShopVersionModuleService>();
            var listModuleID = relationShopVersionModuleService.GetEntities(t => t.ShopVersionID == shopVersionID).Select(t => t.ModuleID).ToList();
            var strModuleID  = string.Join(",", listModuleID.ToArray());

            IShopsService  shopsService    = ServiceHelper.GetShopsService;
            IStoresService storesService   = ServiceHelper.GetStoresService;
            var            modelStore      = storesService.GetTopEntities(1, t => t.ID, t => t.ShopId == shopsID, true).FirstOrDefault();
            int            shopAdminUserID = shopsService.GetEntity(shopsID).AdminUserID;
            Role           roleModel       = ServiceHelper.GetRoleService.GetFirstOrDefault(t => t.StoreID == modelStore.ID);

            //添加商家和菜单的关系
            AddRelationShopModule(shopsID.ToString(), strModuleID);
            //添加门店和菜单的关系
            AddRelationStoreModule(modelStore.ID.ToString(), strModuleID);
            //添加用户和菜单的关系
            AddRelationUsersModule(shopAdminUserID.ToString(), strModuleID);

            //如果店家有添加角色
            if (roleModel != null)
            {
                //添加角色和菜单的关系
                AddRelationRoleModule(roleModel.ID.ToString(), strModuleID);
            }

            //System.Threading.Thread.Sleep(2000);

            return(Json(new Result(true, ResultType.Update), JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// //初始化配置
        /// </summary>
        protected override void InitSetting()
        {
            AdminSettings settings = CurrentInfo.Settings;

            #region 单机版配置信息
            //如果单机版字符串存在session,则读取session的,否则读取配置
            if (System.Web.HttpContext.Current.Session["SingleV"] != null && System.Web.HttpContext.Current.Session["SingleV"].ToString() == "f2e3e264c30935e101235b20b106d9e7")
            {
                settings.IsSingleVersion = false;
            }
            else if (ConfigurationManager.AppSettings["SingleV"] != null && ConfigurationManager.AppSettings["SingleV"].ToString() == "f2e3e264c30935e101235b20b106d9e7")
            {
                settings.IsSingleVersion = false;
            }
            else
            {
                settings.IsSingleVersion = true;
            }

            //读取商家电话
            settings.ShopPhone = ConfigurationManager.AppSettings["ShopPhone"];

            IStoresService storesService = ServiceFactory.Create <IStoresService>();
            //获取
            //var allStoreCount = storesService.GetEntities(t => t.Disabled == false).Count();
            ////当前的
            //settings.SingleVersion.StoreCount = allStoreCount;
            #endregion


            //settings.SiteUrl = "";
            //是否自动清除网站缓存
            settings.AutoClearCache = true;

            //网站地址
            settings.SiteUrl = ConfigurationManager.AppSettings["WebSiteUrl"];
        }
예제 #29
0
        public StoresWorkViewModel(IStoresWorkService storesWorkService, IStoresService storeService)
        {
            #region infrastructure
            AccountsTabItemHeader = "Работы в ресторанах";
            #endregion infrastructure

            #region services
            _storesWorkService = storesWorkService;
            _storeService      = storeService;
            #endregion services

            #region work
            StoresWorkList     = new ObservableCollection <StoreProvenWorkSet>();
            ChangedWorkList    = new ObservableCollection <StoreProvenWorkSet>();
            SaveChangesCommand = new DelegateCommand(SaveChanges, CanSave);
            AddNewWorkCommand  = new DelegateCommand(AddNewWork, CanAdd);
            #endregion work

            #region workers
            _worker                     = new BackgroundWorker();
            _worker.DoWork             += LoadStoresWork;
            _worker.RunWorkerCompleted += LoadStoresWork_Comleted;
            #endregion workers
        }
예제 #30
0
 public ReportsController(IStoresService storesService, IWebApiClient apiClient)
 {
     this.storesService = storesService;
     this.apiClient = apiClient;
 }
예제 #31
0
 public StoreController(IStoresService service, UserManagerExtend <ApplicationUser> userManager)
 {
     this.service     = service;
     this.userManager = userManager;
 }
예제 #32
0
        public FAReportViewModel(IFAService faService, IAccountFAService accountFAService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по основным средствам";            
            #endregion infrastructure

            #region report
            FAList = new ObservableCollection<FASet>();
            AccountFAList = new ObservableCollection<AccountFA>();
            FullFAList = new List<AccountsBudgetDetailsSet>();
            LoadSelectedFACommand = new DelegateCommand(LoadSelectedFA);
            SelectedAccountFAList = new ObservableCollection<AccountsMainSet>();
            int i = 2016;
            YearList = new List<YearCheck>();
            while(i < DateTime.Now.Year + 5)
            {
                YearList.Add(new YearCheck { IsSelected = i == DateTime.Now.Year ? true : false, Year = i });
                i++;
            }
            #endregion report

            #region services
            _faService = faService;
            _accountFAService = accountFAService;
            _storeService = storeService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers
        }        
예제 #33
0
 public BrandsController(IBrandsService brandsService, IStoresService storesService)
 {
     _brandsService = brandsService;
     _storesService = storesService;
 }
예제 #34
0
        public AddFullAccountViewModel(ICompaniesService companiesService, 
                                       ITypesService typesService, 
                                       IAccountsMainService accountsService, 
                                       IAccountStatusService accountStatusService, 
                                       IAccountStoresService accountStoresService, 
                                       IStoresService storesService, 
                                       IAccountCapexesService accountCapexService, 
                                       IExpensesService expenseService, 
                                       ICapexesService capexService, 
                                       IStoresWorkService storesWorkService,
                                       IAccountFAService accountFAService,
                                       IFAService faService)
        {


            #region account
            SaveAccountCommand = new DelegateCommand(SaveAccount, CanSave).ObservesProperty(() => Account);
            #endregion account

            #region workers

            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAccount;

            _addStoresWorker = new BackgroundWorker();
            _addStoresWorker.DoWork += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_Completed;
            #endregion workers 

            #region  capexes
            OpenAddCapexToAccountCommand = new DelegateCommand(OpenAddCapexToAccount);
            CloseAddCapexToAccountCommand = new DelegateCommand(CloseAddCapexToAccount);
            CopyAvailableSumCommand = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand = new DelegateCommand(AddCapexToAccount, CanAddCapex).ObservesProperty(() => NewCapexForAccount);
            DeleteCapexAccountCommand = new DelegateCommand(DeleteCapex);
            #endregion capexes

            #region services
            _companiesService = companiesService;
            _typesService = typesService;
            _accountsService = accountsService;
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService = storesService;
            _accountCapexService = accountCapexService;
            _expenseService = expenseService;
            _capexService = capexService;
            _storesWorkService = storesWorkService;
            _accountFAService = accountFAService;
            _faService = faService;
            #endregion services

            #region statuses
            IsChangeStatusOpen = false;
            StatusesList = Statuses.GetStatusesList();

            CancelNewStatusCommand = new DelegateCommand(CancelNew);
            ChangeStatusCommand = new DelegateCommand(ChangeStatus);
            SaveNewStatusCommand = new DelegateCommand(SaveNew, CanSaveNew);
            #endregion statuses

            #region stores
            EditAccountStoresListCommand = new DelegateCommand(EditAccountStoresList, CanEdit);
            DeleteAccountStoreCommand = new DelegateCommand(DeleteAccountStore);
            AddStoresToAccountCommand = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            CloseAddStoresToAccountCommand = new DelegateCommand(CloseAddStores);
            IsEditAccountStoresOpen = false;
            #endregion stores

            #region FA
            AddFAOpen = false;
            AddFACommand = new DelegateCommand(AddFA);
            AddFAToAccountCommand = new DelegateCommand(AddFAToAccount, CanAddFA).ObservesProperty(() => NewFA);
            CloseFACommand = new DelegateCommand(CloseFA);
            #endregion FA

        }        
예제 #35
0
 public BackupsController(IStoresService storesService, IBackupsService backupsService)
 {
     this.storesService = storesService;
     this.backupsService = backupsService;
 }
예제 #36
0
 public StoresController(IStoresService storesService)
 {
     this.storesService = storesService;
 }
예제 #37
0
        public StoresWorkViewModel(IStoresWorkService storesWorkService, IStoresService storeService)
        {
            #region infrastructure
            AccountsTabItemHeader = "Работы в ресторанах";
            #endregion infrastructure

            #region services
            _storesWorkService = storesWorkService;
            _storeService = storeService;
            #endregion services

            #region work
            StoresWorkList = new ObservableCollection<StoreProvenWorkSet>();
            ChangedWorkList = new ObservableCollection<StoreProvenWorkSet>();
            SaveChangesCommand = new DelegateCommand(SaveChanges, CanSave);
            AddNewWorkCommand = new DelegateCommand(AddNewWork, CanAdd);
            #endregion work

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadStoresWork;
            _worker.RunWorkerCompleted += LoadStoresWork_Comleted;
            #endregion workers
        }       
		public StoreMapViewModel(IStoresService storesService, IUserDialogs dservices) : base(storesService, dservices)
		{
			
		}
예제 #39
0
        /// <summary>
        /// 获取商家下的门店
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="username"></param>
        /// <param name="pageNumber"></param>
        /// <returns></returns>
        public ActionResult GetShopStores(int pageSize, string username, int pageNumber)
        {
            SearchModel <StoresParams> searchModel = new SearchModel <StoresParams>
            {
                PageIndex = pageNumber,
                PageSize  = pageSize,
                Model     = new StoresParams()
                {
                    StoreName = username
                }
            };

            //IShopsService shopsService = ServiceFactory.Create<IShopsService>();
            //var shop = shopsService.GetFirstOrDefault(t => t.AdminUserID == CurrentInfo.CurrentUser.ID);


            DynamicLambda <Stores> bulider            = new DynamicLambda <Stores>();
            Expression <Func <Stores, Boolean> > expr = null;

            //如果是店铺管理员
            if (CurrentInfo.IsShopAdmin)
            {
                Expression <Func <Stores, Boolean> > tmp = t => t.ShopId == CurrentInfo.CurrentUser.ShopsID && t.Disabled != true;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }
            else
            {
                Expression <Func <Stores, Boolean> > tmp = t => t.ID == CurrentInfo.CurrentStore.ID;
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            ////如果是商家本人的账号,则显示商家自己的门店
            //if (shop != null)
            //{
            //    Expression<Func<Stores, Boolean>> tmp = t => t.ShopId == shop.ID;
            //    expr = bulider.BuildQueryAnd(expr, tmp);
            //}

            if (!string.IsNullOrWhiteSpace(username))
            {
                username = username.Trim();
                Expression <Func <Stores, Boolean> > tmp = t => t.StoreName.Contains(username);
                expr = bulider.BuildQueryAnd(expr, tmp);
            }

            IStoresService storesService = ServiceFactory.Create <IStoresService>();

            int total;
            var data = storesService.GetEntitiesByPage(searchModel.PageIndex, searchModel.PageSize, out total, expr, false, t => t.ID).Select(t => new
            {
                ID           = t.ID,
                ShopsName    = t.Shops.ShopName,
                StoreName    = t.StoreName,
                Adress       = t.Adress,
                Phone        = t.Phone,
                IsShowWeiXin = t.IsShowWeiXin == true ? "显示" : "不显示",
                IsMainStore  = t.IsMainStore,
                Disabled     = t.Disabled,
                AdminUserID  = t.AdminUserID,
                ///  AdminName = t.AdminUserID==null?"0":t.AdminUserID.ToString() //t.Users1 != null ? t.Users1.RealName : ""
            }).ToList();

            return(Json(new { total = total, rows = data }, JsonRequestBehavior.AllowGet));
        }
예제 #40
0
 public ExcelReportService(IStoresService storeService)
 {
     _storeService = storeService;
 }
예제 #41
0
        public CapexReportViewModel(ICapexesService capexService, IAccountStatusService statusService, IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по CAPEX";
            #endregion infrastructure

            #region capex
            YearList = new List<int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
                YearList.Add(i);
            CapexList = new ObservableCollection<CapexWithRest>();
            CapexAccountsList = new ObservableCollection<AccountsWithStatus>();
            LoadCapexCommand = new DelegateCommand(LoadCapex);
            LoadSelectedCapexCommand = new DelegateCommand(LoadSelectedCapex);
            StatusSumList = new ObservableCollection<StatusSum>();
            _storesList = new List<StoresSet>();
            #endregion capex

            #region services
            _capexService = capexService;
            _statusService = statusService;
            _accountsMainService = accountsMainService;
            _storesService = storeService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadFullCapexInfo;
            _worker.RunWorkerCompleted += LoadFullCapexInfo_Completed;
            #endregion workers
        }
        public StoresServiceReportViewModel(IStoresService storeService,
                                            IServiceZipsService serviceZipService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Отчет по ресторанскому сервису";
            MonthesList = Monthes.GetMonthesList();
            YearList = new List<int>();
            for (var i = 2015; i <= DateTime.Now.Year; i++)
                YearList.Add(i);
            #endregion infrastructure

            #region stores
            StoresWithCheckList = new ObservableCollection<StoresWithCheck>();
            SetSelectionCommand = new DelegateCommand(SetSelection);
            ClearSelectionCommand = new DelegateCommand(ClearSelection);
            #endregion stores

            #region report
            LoadReportCommand = new DelegateCommand(LoadReport);
            #endregion report

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadReportData;
            _worker.RunWorkerCompleted += LoadReportData_Completed;
            #endregion workers

            #region services
            _storeService = storeService;
            _serviceZipService = serviceZipService;
            #endregion services
        }        
예제 #43
0
        public AdditionalInfoViewModel(IAccountStatusService accountStatusService, IAccountStoresService accountStoresService, IStoresService storesService, IAccountCapexesService accountCapexService, IExpensesService expenseService, ICapexesService capexService, IStoresWorkService storesWorkService)
        {
            #region infrastrcture
            ConfirmationRequest = new InteractionRequest<IConfirmation>();
            #endregion infrastructure

            #region statuses
            IsChangeStatusOpen = false;
            IsStatusHistoryOpen = false;

            StatusesList = Statuses.GetStatusesList();
            StatusHistoryList = new ObservableCollection<AccountsStatusDetailsSet>();

            ChangeStatusCommand = new DelegateCommand(ChangeStatus);
            SaveNewStatusCommand = new DelegateCommand(SaveNew, CanSaveNew);
            CancelNewStatusCommand = new DelegateCommand(CancelNew);
            OpenStatusHistoryCommand = new DelegateCommand(OpenHistory);
            #endregion statuses

            #region stores
            IsEditAccountStoresOpen = false;

            AccountStoresList = new ObservableCollection<StoresSet>();
            StoresList = new ObservableCollection<StoresSet>();

            EditAccountStoresListCommand = new DelegateCommand(EditAccountStoresList, CanEdit);
            AddStoresToAccountCommand = new DelegateCommand(() => _addStoresWorker.RunWorkerAsync(), CheckStoreErrors).ObservesProperty(() => StoresForLoad);
            DeleteAccountStoreCommand = new DelegateCommand(DeleteAccountStore);
            SearchStoreNumberByNameCommand = new DelegateCommand(SearchStoreNumberByName);
            #endregion stores

            #region  services
            _accountStatusService = accountStatusService;
            _accountStoresService = accountStoresService;
            _storesService = storesService;
            _accountCapexService = accountCapexService;
            _expenseService = expenseService;
            _capexService = capexService;
            _storesWorkService = storesWorkService;
            #endregion services

            #region capexes
            AccountCapexList = new ObservableCollection<AccountsCapexInfoSet>();
            ExpensesList = new ObservableCollection<AccountsExpenseSet>(expenseService.GetExpensesList());
            CapexesList = new ObservableCollection<CapexSet>();          
            IsAddCapexOpen = false;

            OpenAddCapexToAccountCommand = new DelegateCommand(OpenAddCapexToAccount);
            CopyAvailableSumCommand = new DelegateCommand(CopyAvailableSum);
            AddCapexToAccountCommand = new DelegateCommand(AddCapexToAccount);
            DeleteCapexAccountCommand = new DelegateCommand(DeleteCapexAccount);
            #endregion capexes

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadAccountAdditionalInfo;

            _addStoresWorker = new BackgroundWorker();
            _addStoresWorker.DoWork += LoadAddStoresToAccount;
            _addStoresWorker.RunWorkerCompleted += LoadAddStoresToAccount_Completed;            
            #endregion workers                        
        }        
        public ServiceReportForStoreViewModel(IServiceZipsService serviceZipService, IStoresService storeService)
        {
            #region infrastructure
            ReportsTabItemHeader = "Детальный отчет по ресторанам";
            MonthesList = Monthes.GetMonthesList();
            #endregion infrastructure

            #region report
            ServiceZipList = new ObservableCollection<ServiceZipDetailsSet>();
            StoresWithCheckList = new ObservableCollection<StoresWithCheck>();
            StartDate = new DateTime(2015, 1, 1);
            MinimumDate = new DateTime(2015, 1, 1);
            MaximumDate = new DateTime(DateTime.Now.Year, 12, 31);
            EndDate = DateTime.Now;
            LoadReportCommand = new DelegateCommand(LoadReport);
            StackedStoreList = new ObservableCollection<StackedStoreInfo>();
            StoreZipList = new ObservableCollection<StoreZip>();
            IsSelectAll = false;
            SelectAllCommand = new DelegateCommand(SelectAll);
            #endregion report

            #region services
            _serviceZipService = serviceZipService;
            _storeService = storeService;
            #endregion services

            #region workers
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadServiceZip;
            _worker.RunWorkerCompleted += LoadServiceZip_Completed;
            #endregion workers
        }        
예제 #45
0
        public StoreAccountsViewModel(IAccountsMainService accountsMainService, IStoresService storeService)
        {
            #region services
            _accountsMainService = accountsMainService;
            _storeService = storeService;
            #endregion services

            #region infrastructure
            AccountsTabItemHeader = "Поиск по ресторанам";
            _worker = new BackgroundWorker();
            _worker.DoWork += LoadStoresAndAccounts;
            _worker.RunWorkerCompleted += LoadStoresAndAccounts_Completed;
            #endregion infrastructure

            #region store
            SearchStoreResultList = new ObservableCollection<StoresSet>();
            StoreAccountsList = new ObservableCollection<StoreAccount>();
            IsStoreAccountsBusy = false;
            SearchStoreCommand = new DelegateCommand(SearchStoreMethod);
            LoadResultStoreCommand = new DelegateCommand(LoadAccountsForStore);
            #endregion store
        }        
 public StoreListViewModel(IStoresService storesService, IUserDialogs dialogsService)
 {
     _storesService = storesService;
     _dialogsService = dialogsService;
     Initialization = NotifyTaskCompletion.Create(RefreshList);
 }