示例#1
0
 void ActionRouteListsAtDay_Activated(object sender, System.EventArgs e)
 {
     if (new BaseParametersProvider().UseOldAutorouting())
     {
         tdiMain.OpenTab(
             TdiTabBase.GenerateHashName <RoutesAtDayDlg>(),
             () => new RoutesAtDayDlg()
             );
     }
     else
     {
         tdiMain.OpenTab(
             "AutoRouting",
             () => new RouteListsOnDayViewModel(
                 ServicesConfig.CommonServices,
                 new DeliveryScheduleParametersProvider(ParametersProvider.Instance),
                 new GtkTabsOpener(),
                 new RouteListRepository(),
                 new SubdivisionRepository(),
                 OrderSingletonRepository.GetInstance(),
                 new AtWorkRepository(),
                 new CarRepository(),
                 NavigationManagerProvider.NavigationManager,
                 UserSingletonRepository.GetInstance(),
                 new BaseParametersProvider()
                 )
             );
     }
 }
示例#2
0
    void ActionSelfdeliveryOrders_Activated(object sender, System.EventArgs e)
    {
        OrderJournalFilterViewModel filter = new OrderJournalFilterViewModel();

        filter.SetAndRefilterAtOnce(
            x => x.AllowStatuses               = new OrderStatus[] { OrderStatus.WaitForPayment, OrderStatus.OnLoading, OrderStatus.Accepted, OrderStatus.Closed },
            x => x.RestrictOnlySelfDelivery    = true,
            x => x.RestrictWithoutSelfDelivery = false,
            x => x.RestrictHideService         = true,
            x => x.RestrictOnlyService         = false,
            x => x.RestrictLessThreeHours      = false
            );
        filter.HidenByDefault = true;
        var selfDeliveriesJournal = new SelfDeliveriesJournalViewModel(
            filter,
            UnitOfWorkFactory.GetDefaultFactory,
            ServicesConfig.CommonServices,
            new CallTaskWorker(CallTaskSingletonFactory.GetInstance(),
                               new CallTaskRepository(),
                               OrderSingletonRepository.GetInstance(),
                               EmployeeSingletonRepository.GetInstance(),
                               new BaseParametersProvider(),
                               ServicesConfig.CommonServices.UserService,
                               SingletonErrorReporter.Instance),
            new OrderPaymentSettings());

        tdiMain.AddTab(selfDeliveriesJournal);
    }
示例#3
0
        private void ConfigureTreeItems()
        {
            var colorWhite    = new Gdk.Color(0xff, 0xff, 0xff);
            var colorLightRed = new Gdk.Color(0xff, 0x66, 0x66);

            treeItems.ColumnsConfig = ColumnsConfigFactory.Create <OrderWithoutShipmentForAdvancePaymentItem>()
                                      .AddColumn("Номенклатура")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => node.NomenclatureString)
                                      .AddColumn("Кол-во")
                                      .SetTag("Count")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.Count)
                                      .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0)).Editing().WidthChars(10)
                                      .AddSetter((c, node) => c.Digits = node.Nomenclature.Unit == null ? 0 : (uint)node.Nomenclature.Unit.Digits)
                                      .AddColumn("Аренда")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => node.IsRentCategory ? node.RentString : string.Empty)
                                      .AddColumn("Цена")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.Price).Digits(2).WidthChars(10)
                                      .Adjustment(new Adjustment(0, 0, 1000000, 1, 100, 0)).Editing(true)
                                      .AddSetter((c, node) => c.Editable = node.CanEditPrice)
                                      .AddTextRenderer(node => CurrencyWorks.CurrencyShortName, false)
                                      .AddColumn("В т.ч. НДС")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(x => CurrencyWorks.GetShortCurrencyString(x.IncludeNDS ?? 0))
                                      .AddColumn("Сумма")
                                      .HeaderAlignment(0.5f)
                                      .AddTextRenderer(node => CurrencyWorks.GetShortCurrencyString(node.Sum))
                                      .AddColumn("Скидка")
                                      .HeaderAlignment(0.5f)
                                      .AddNumericRenderer(node => node.ManualChangingDiscount).Editing()
                                      .AddSetter(
                (c, n) => c.Adjustment = n.IsDiscountInMoney
                                                                        ? new Adjustment(0, 0, (double)(n.Price * n.Count), 1, 100, 1)
                                                                        : new Adjustment(0, 0, 100, 1, 100, 1)
                )
                                      .Digits(2)
                                      .WidthChars(10)
                                      .AddTextRenderer(n => n.IsDiscountInMoney ? CurrencyWorks.CurrencyShortName : "%", false)
                                      .AddColumn("Скидка \nв рублях?")
                                      .AddToggleRenderer(x => x.IsDiscountInMoney).Editing()
                                      .AddColumn("Основание скидки")
                                      .HeaderAlignment(0.5f)
                                      .AddComboRenderer(node => node.DiscountReason)
                                      .SetDisplayFunc(x => x.Name)
                                      .FillItems(OrderSingletonRepository.GetInstance().GetDiscountReasons(ViewModel.UoW))
                                      .AddSetter((c, n) => c.Editable = n.Discount > 0)
                                      .AddSetter(
                (c, n) => c.BackgroundGdk = n.Discount > 0 && n.DiscountReason == null
                                                ? colorLightRed
                                                : colorWhite
                )
                                      .RowCells()
                                      .XAlign(0.5f)
                                      .Finish();
            treeItems.ItemsDataSource    = ViewModel.Entity.ObservableOrderWithoutDeliveryForAdvancePaymentItems;
            treeItems.Selection.Changed += TreeItems_Selection_Changed;
        }
示例#4
0
        void UpdateAddressesOnMap()
        {
            logger.Info("Обновляем адреса на карте...");
            addressesWithoutCoordinats = 0;
            addressesWithoutRoutes     = 0;
            totalBottlesCountAtDay     = 0;
            bottlesWithoutRL           = 0;
            addressesOverlay.Clear();

            //добавляем маркеры складов
            foreach (var b in GeographicGroupRepository.GeographicGroupsWithCoordinates(ViewModel.UoW))
            {
                addressesOverlay.Markers.Add(FillBaseMarker(b));
            }

            var ordersOnDay      = ViewModel.OrdersOnDay;
            var ordersRouteLists = OrderSingletonRepository.GetInstance().GetAllRouteListsForOrders(ViewModel.UoW, ordersOnDay);

            //добавляем маркеры адресов заказов
            foreach (var order in ordersOnDay)
            {
                totalBottlesCountAtDay += order.Total19LBottlesToDeliver;

                IEnumerable <int> orderRls;
                if (!ordersRouteLists.TryGetValue(order.Id, out orderRls))
                {
                    orderRls = new List <int>();
                }

                var route = ViewModel.RoutesOnDay.FirstOrDefault(rl => rl.Addresses.Any(a => a.Order.Id == order.Id));

                if (!orderRls.Any())
                {
                    addressesWithoutRoutes++;
                    bottlesWithoutRL += order.Total19LBottlesToDeliver;
                }

                if (order.DeliveryPoint.Latitude.HasValue && order.DeliveryPoint.Longitude.HasValue)
                {
                    FillTypeAndShapeMarker(order, route, orderRls, out PointMarkerShape shape, out PointMarkerType type);

                    if (selectedMarkers.FirstOrDefault(m => (m.Tag as Order)?.Id == order.Id) != null)
                    {
                        type = PointMarkerType.white;
                    }

                    var addressMarker = FillAddressMarker(order, type, shape, addressesOverlay, route);

                    addressesOverlay.Markers.Add(addressMarker);
                }
                else
                {
                    addressesWithoutCoordinats++;
                }
            }

            UpdateOrdersInfo();
            logger.Info("Ок.");
        }
示例#5
0
        public static void StartService(IConfig serviceConfig, IConfig kassaConfig, IConfig[] cashboxesConfig)
        {
            string          serviceHostName;
            string          servicePort;
            string          baseAddress;
            IList <CashBox> cashboxes;

            try {
                cashboxes = new List <CashBox>();
                foreach (var cashboxConfig in cashboxesConfig)
                {
                    cashboxes.Add(new CashBox {
                        Id          = cashboxConfig.GetInt("cash_box_id"),
                        RetailPoint = cashboxConfig.GetString("retail_point"),
                        UserName    = new Guid(cashboxConfig.GetString("user_name")),
                        Password    = cashboxConfig.GetString("password")
                    });
                }
                serviceHostName = serviceConfig.GetString("service_host_name");
                servicePort     = serviceConfig.GetString("service_port");

                baseAddress = kassaConfig.GetString("base_address");
            }
            catch (Exception ex) {
                logger.Fatal(ex, "Ошибка чтения конфигурационного файла.");
                return;
            }

            logger.Info("Запуск службы фискализации и печати кассовых чеков...");

            var fiscalizationWorker = new FiscalizationWorker(
                OrderSingletonRepository.GetInstance(),
                new SalesReceiptSender(baseAddress),
                new OrderParametersProvider(ParametersProvider.Instance),
                new OrganizationParametersProvider(ParametersProvider.Instance),
                cashboxes
                );

            fiscalizationWorker.Start();

            logger.Info("Служба фискализации запущена");

            var salesReceiptsInstanceProvider = new SalesReceiptsInstanceProvider(
                new BaseParametersProvider(),
                OrderSingletonRepository.GetInstance(),
                new OrderParametersProvider(ParametersProvider.Instance),
                new OrganizationParametersProvider(ParametersProvider.Instance)
                );
            WebServiceHost salesReceiptsHost = new SalesReceiptsServiceHost(salesReceiptsInstanceProvider);

            salesReceiptsHost.AddServiceEndpoint(
                typeof(ISalesReceiptsService),
                new WebHttpBinding(),
                $"http://{serviceHostName}:{servicePort}/SalesReceipts"
                );
            salesReceiptsHost.Open();
            logger.Info("Запущена служба мониторинга отправки чеков");
        }
        public OrderDTO GetOrderDetailed(string authKey, int orderId)
        {
                        #if DEBUG
            logger.Debug("GetOrderDetailed called with args:\nauthKey: {0}\norderId: {1}", authKey, orderId);
                        #endif

            try
            {
                if (!CheckAuth(authKey))
                {
                    return(null);
                }

                using (var orderUoW = UnitOfWorkFactory.CreateForRoot <Order>(orderId, "[ADS]Детальная информация по заказу"))
                {
                    if (orderUoW == null || orderUoW.Root == null)
                    {
                        return(null);
                    }
                    var              routeListItem    = RouteListItemRepository.GetRouteListItemForOrder(orderUoW, orderUoW.Root);
                    OrderDTO         orderDTO         = new OrderDTO(routeListItem);
                    SmsPaymentStatus?smsPaymentStatus = OrderSingletonRepository.GetInstance().GetOrderPaymentStatus(orderUoW, orderUoW.Root.Id);
                    if (smsPaymentStatus == null)
                    {
                        orderDTO.PaymentStatus = PaymentStatus.None;
                    }
                    else
                    {
                        switch (smsPaymentStatus.Value)
                        {
                        case SmsPaymentStatus.WaitingForPayment:
                            orderDTO.PaymentStatus = PaymentStatus.WaitingForPayment;
                            break;

                        case SmsPaymentStatus.Paid:
                            orderDTO.PaymentStatus = PaymentStatus.Paid;
                            break;

                        case SmsPaymentStatus.Cancelled:
                            orderDTO.PaymentStatus = PaymentStatus.Cancelled;
                            break;
                        }
                    }

                    return(orderDTO);
                }
            }
            catch (Exception e)
            {
                logger.Error(e);
            }
            return(null);
        }
示例#7
0
        public override bool Save()
        {
            if (!Entity.CanEdit)
            {
                return(false);
            }

            var valid = new QS.Validation.QSValidator <SelfDeliveryDocument>(UoWGeneric.Root);

            if (valid.RunDlgIfNotValid((Gtk.Window) this.Toplevel))
            {
                return(false);
            }

            Entity.LastEditor     = EmployeeSingletonRepository.GetInstance().GetEmployeeForCurrentUser(UoW);
            Entity.LastEditedTime = DateTime.Now;
            if (Entity.LastEditor == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете изменять складские документы, так как некого указывать в качестве кладовщика.");
                return(false);
            }

            Entity.UpdateOperations(UoW);
            Entity.UpdateReceptions(UoW, GoodsReceptionList, new NomenclatureRepository(new NomenclatureParametersProvider()), new BottlesRepository());

            IStandartNomenclatures standartNomenclatures = new BaseParametersProvider();
            var callTaskWorker = new CallTaskWorker(
                CallTaskSingletonFactory.GetInstance(),
                new CallTaskRepository(),
                OrderSingletonRepository.GetInstance(),
                EmployeeSingletonRepository.GetInstance(),
                new BaseParametersProvider(),
                ServicesConfig.CommonServices.UserService,
                SingletonErrorReporter.Instance);

            if (Entity.FullyShiped(UoW, standartNomenclatures, new RouteListItemRepository(), new SelfDeliveryRepository(), new CashRepository(), callTaskWorker))
            {
                MessageDialogHelper.RunInfoDialog("Заказ отгружен полностью.");
            }

            logger.Info("Сохраняем документ самовывоза...");
            UoWGeneric.Save();
            //FIXME Необходимо проверить правильность этого кода, так как если заказ именялся то уведомление на его придет и без кода.
            //А если в каком то месте нужно получать уведомления об изменениях текущего объекта, то логично чтобы этот объект на него и подписался.
            //OrmMain.NotifyObjectUpdated(new object[] { Entity.Order });
            logger.Info("Ok.");
            return(true);
        }
示例#8
0
        public FirstSecondClientReport()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var reasons = OrderSingletonRepository.GetInstance().GetDiscountReasons(UoW);

            yCpecCmbDiscountReason.ItemsList = reasons;
            daterangepicker.StartDate        = DateTime.Now.AddDays(-7);
            daterangepicker.EndDate          = DateTime.Now.AddDays(1);

            var filter = new EmployeeFilterViewModel();

            filter.Status   = EmployeeStatus.IsWorking;
            filter.Category = EmployeeCategory.office;
            yentryEmployer.RepresentationModel = new EmployeesVM(filter);
        }
示例#9
0
    void ActionPaymentFromBank_Activated(object sender, System.EventArgs e)
    {
        var filter = new PaymentsJournalFilterViewModel();

        var paymentsJournalViewModel = new PaymentsJournalViewModel(
            filter,
            UnitOfWorkFactory.GetDefaultFactory,
            ServicesConfig.CommonServices,
            NavigationManagerProvider.NavigationManager,
            OrderSingletonRepository.GetInstance(),
            new OrganizationParametersProvider(ParametersProvider.Instance),
            new BaseParametersProvider()
            );

        tdiMain.AddTab(paymentsJournalViewModel);
    }
示例#10
0
        public void Run(IWorker worker)
        {
            worker.OperationName = "Подготовка данных";
            worker.ReportProgress(0, "Загрузка заказов");
            this.orders          = OrderSingletonRepository.GetInstance().GetOrdersToExport1c8(uow, orderParametersProvider, mode, start, end);
            worker.OperationName = "Выгрузка реализаций и счетов-фактур";
            worker.StepsCount    = this.orders.Count;
            Result = new ExportData(uow, mode, start, end);
            int i = 0;

            while (!worker.IsCancelled && i < orders.Count)
            {
                worker.ReportProgress(i, "Заказ");
                Result.AddOrder(orders[i]);
                i++;
            }
        }
        static ReceiptForOrderNode[] GetReceiptsForOrders(IUnitOfWork uow)
        {
            ReceiptForOrderNode[] notSelfDeliveredOrderIds = null;
            ReceiptForOrderNode[] selfDeliveredOrderIds    = null;

            notSelfDeliveredOrderIds = OrderSingletonRepository.GetInstance()
                                       .GetShippedOrdersWithReceiptsForDates(
                uow,
                DateTime.Today.AddDays(-3));

            selfDeliveredOrderIds = OrderSingletonRepository.GetInstance()
                                    .GetClosedSelfDeliveredOrdersWithReceiptsForDates(
                uow,
                PaymentType.cash,
                OrderStatus.Closed,
                DateTime.Today.AddDays(-3));

            var orderIds = notSelfDeliveredOrderIds.Union(selfDeliveredOrderIds).ToArray();

            return(orderIds);
        }
示例#12
0
        public CounterpartyOrderViewModel(Counterparty client,
                                          IUnitOfWorkFactory unitOfWorkFactory,
                                          ITdiCompatibilityNavigation tdinavigation,
                                          RouteListRepository routedListRepository,
                                          MangoManager mangoManager,
                                          int count = 5)
            : base()
        {
            this.Client               = client;
            this.tdiNavigation        = tdinavigation;
            this.routedListRepository = routedListRepository;
            this.MangoManager         = mangoManager;
            UoW = unitOfWorkFactory.CreateWithoutRoot();
            OrderSingletonRepository orderRepos = OrderSingletonRepository.GetInstance();

            LatestOrder = orderRepos.GetLatestOrdersForCounterparty(UoW, client, count).ToList();

            RefreshOrders = _RefreshOrders;
            NotifyConfiguration.Instance.BatchSubscribe(_RefreshCounterparty)
            .IfEntity <Counterparty>()
            .AndWhere(c => c.Id == client.Id)
            .Or.IfEntity <DeliveryPoint>()
            .AndWhere(d => client.DeliveryPoints.Any(cd => cd.Id == d.Id));
        }
示例#13
0
 public static OrderStatus[] GetStatusesForOrderCancelation()
 {
     return(OrderSingletonRepository.GetInstance().GetStatusesForOrderCancelation());
 }
示例#14
0
 public static QueryOver <VodovozOrder> GetSelfDeliveryOrdersForPaymentQuery()
 {
     return(OrderSingletonRepository.GetInstance().GetSelfDeliveryOrdersForPaymentQuery());
 }
示例#15
0
 public static bool IsBottleStockExists(IUnitOfWork uow, Counterparty counterparty)
 {
     return(OrderSingletonRepository.GetInstance().IsBottleStockExists(uow, counterparty));
 }
示例#16
0
 /// <summary>
 /// Оборудование заказа от клиента
 /// </summary>
 /// <returns>Список оборудования от клиенту</returns>
 /// <param name="uow">Uow.</param>
 /// <param name="order">Заказ</param>
 public static IList <ClientEquipmentNode> GetEquipmentFromClientForOrder(IUnitOfWork uow, VodovozOrder order)
 {
     return(OrderSingletonRepository.GetInstance().GetEquipmentFromClientForOrder(uow, order));
 }
示例#17
0
 public static OrderStatus[] GetOnClosingOrderStatuses()
 {
     return(OrderSingletonRepository.GetInstance().GetOnClosingOrderStatuses());
 }
示例#18
0
 public static OrderStatus[] GetValidStatusesToUseActionBottle()
 {
     return(OrderSingletonRepository.GetInstance().GetValidStatusesToUseActionBottle());
 }
示例#19
0
 public static OrderStatus[] GetGrantedStatusesToCreateSeveralOrders()
 {
     return(OrderSingletonRepository.GetInstance().GetGrantedStatusesToCreateSeveralOrders());
 }
        public static void StartService(IConfig serviceConfig, IConfig kassaConfig)
        {
            string serviceHostName;
            string servicePort;

            string baseAddress;
            string userNameForService;
            string pwdForService;

            try {
                serviceHostName = serviceConfig.GetString("service_host_name");
                servicePort     = serviceConfig.GetString("service_port");

                baseAddress        = kassaConfig.GetString("base_address");
                userNameForService = kassaConfig.GetString("user_name");
                pwdForService      = kassaConfig.GetString("password");
            }
            catch (Exception ex) {
                logger.Fatal(ex, "Ошибка чтения конфигурационного файла.");
                return;
            }
            var authentication = new AuthenticationHeaderValue(
                "Basic",
                Convert.ToBase64String(
                    Encoding.GetEncoding("ISO-8859-1")
                    .GetBytes(string.Format("{0}:{1}", userNameForService, pwdForService))
                    )
                );

            logger.Info("Запуск службы фискализации и печати кассовых чеков...");

            orderRoutineTimer          = new System.Timers.Timer(30000d);
            orderRoutineTimer.Elapsed += (sender, e) => {
                orderRoutineTimer.Interval = 120000d;                 //2 минуты
                if (DateTime.Now.Hour >= 1 && DateTime.Now.Hour < 5)
                {
                    var fiveHrsOfToday = DateTime.Today.AddHours(5);
                    orderRoutineTimer.Interval = fiveHrsOfToday.Subtract(DateTime.Now).TotalMilliseconds;                    //миллисекунд до 5 утра
                    logger.Info("Ночь. Не пытаемся отсылать чеки с 1 до 5 утра.");
                    return;
                }

                try {
                    Fiscalization.RunAsync(baseAddress, authentication).GetAwaiter().GetResult();
                }
                catch (Exception ex) {
                    logger.Error(ex, "Исключение при выполение фоновой задачи.");
                }
            };
            orderRoutineTimer.Start();
            logger.Info("Служба фискализации запущена");

            SalesReceiptsInstanceProvider salesReceiptsInstanceProvider = new SalesReceiptsInstanceProvider(
                new BaseParametersProvider(),
                OrderSingletonRepository.GetInstance()
                );
            WebServiceHost salesReceiptsHost = new SalesReceiptsServiceHost(salesReceiptsInstanceProvider);

            salesReceiptsHost.AddServiceEndpoint(
                typeof(ISalesReceiptsService),
                new WebHttpBinding(),
                String.Format("http://{0}:{1}/SalesReceipts", serviceHostName, servicePort)
                );
            salesReceiptsHost.Open();
            logger.Info("Запущена служба мониторинга отправки чеков");
        }
示例#21
0
 public static QueryOver <VodovozOrder> GetOrdersForRLEditingQuery(DateTime date, bool showShipped)
 {
     return(OrderSingletonRepository.GetInstance().GetOrdersForRLEditingQuery(date, showShipped));
 }
示例#22
0
 public static IList <VodovozOrder> GetCurrentOrders(IUnitOfWork UoW, Counterparty counterparty)
 {
     return(OrderSingletonRepository.GetInstance().GetCurrentOrders(UoW, counterparty));
 }
示例#23
0
 public static VodovozOrder GetLatestCompleteOrderForCounterparty(IUnitOfWork UoW, Counterparty counterparty)
 {
     return(OrderSingletonRepository.GetInstance().GetLatestCompleteOrderForCounterparty(UoW, counterparty));
 }
示例#24
0
 public static IList <VodovozOrder> GetAcceptedOrdersForRegion(IUnitOfWork uow, DateTime date, District district)
 {
     return(OrderSingletonRepository.GetInstance().GetAcceptedOrdersForRegion(uow, date, district));
 }
示例#25
0
        void ConfigureDlg()
        {
            callTaskWorker = new CallTaskWorker(
                CallTaskSingletonFactory.GetInstance(),
                new CallTaskRepository(),
                OrderSingletonRepository.GetInstance(),
                EmployeeSingletonRepository.GetInstance(),
                new BaseParametersProvider(),
                ServicesConfig.CommonServices.UserService,
                SingletonErrorReporter.Instance);

            if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.CarUnloadEdit, Entity.Warehouse))
            {
                FailInitialize = true;
                return;
            }

            var currentUserId = QS.Project.Services.ServicesConfig.CommonServices.UserService.CurrentUserId;
            var hasPermitionToEditDocWithClosedRL = QS.Project.Services.ServicesConfig.CommonServices.PermissionService.ValidateUserPresetPermission("can_change_car_load_and_unload_docs", currentUserId);
            var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.CarUnloadEdit, Entity.Warehouse);

            editing &= Entity.RouteList?.Status != RouteListStatus.Closed || hasPermitionToEditDocWithClosedRL;
            Entity.InitializeDefaultValues(UoW, new NomenclatureRepository(new NomenclatureParametersProvider()));
            yentryrefRouteList.IsEditable  = ySpecCmbWarehouses.Sensitive = ytextviewCommnet.Editable = editing;
            returnsreceptionview.Sensitive =
                hbxTareToReturn.Sensitive  =
                    nonserialequipmentreceptionview1.Sensitive =
                        defectiveitemsreceptionview1.Sensitive = editing;

            defectiveitemsreceptionview1.UoW =
                returnsreceptionview.UoW     = UoW;

            ylabelDate.Binding.AddFuncBinding(Entity, e => e.TimeStamp.ToString("g"), w => w.LabelProp).InitializeFromSource();
            ySpecCmbWarehouses.ItemsList = StoreDocumentHelper.GetRestrictedWarehousesList(UoW, WarehousePermissions.CarUnloadEdit);
            ySpecCmbWarehouses.Binding.AddBinding(Entity, e => e.Warehouse, w => w.SelectedItem).InitializeFromSource();
            ytextviewCommnet.Binding.AddBinding(Entity, e => e.Comment, w => w.Buffer.Text).InitializeFromSource();
            var filter = new RouteListsFilter(UoW);

            filter.SetAndRefilterAtOnce(x => x.RestrictedStatuses = new[] { RouteListStatus.EnRoute });
            yentryrefRouteList.RepresentationModel = new ViewModel.RouteListsVM(filter);
            yentryrefRouteList.Binding.AddBinding(Entity, e => e.RouteList, w => w.Subject).InitializeFromSource();
            yentryrefRouteList.CanEditReference = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_delete");

            Entity.PropertyChanged += (sender, e) => {
                if (e.PropertyName == nameof(Entity.Warehouse))
                {
                    OnWarehouseChanged();
                }
                if (e.PropertyName == nameof(Entity.RouteList))
                {
                    UpdateWidgetsVisible();
                }
            };

            lblTareReturnedBefore.Binding.AddFuncBinding(Entity, e => e.ReturnedTareBeforeText, w => w.Text).InitializeFromSource();
            spnTareToReturn.Binding.AddBinding(Entity, e => e.TareToReturn, w => w.ValueAsInt).InitializeFromSource();

            defectiveitemsreceptionview1.Warehouse = returnsreceptionview.Warehouse = Entity.Warehouse;

            UpdateWidgetsVisible();
            buttonSave.Sensitive = editing;
            if (!editing)
            {
                HasChanges = false;
            }
            if (!UoW.IsNew)
            {
                LoadReception();
            }

            var permmissionValidator = new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), EmployeeRepository);

            Entity.CanEdit = permmissionValidator.Validate(typeof(CarUnloadDocument), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission));
            if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date)
            {
                ytextviewCommnet.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                yentryrefRouteList.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                ySpecCmbWarehouses.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                ytextviewRouteListInfo.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                spnTareToReturn.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                defectiveitemsreceptionview1.Sensitive     = false;
                nonserialequipmentreceptionview1.Sensitive = false;
                returnsreceptionview.Sensitive             = false;

                buttonSave.Sensitive = false;
            }
            else
            {
                Entity.CanEdit = true;
            }
        }
示例#26
0
 public static IList <VodovozOrder> GetOrdersByCode1c(IUnitOfWork uow, string[] codes1c)
 {
     return(OrderSingletonRepository.GetInstance().GetOrdersByCode1c(uow, codes1c));
 }
示例#27
0
 /// <summary>
 /// Первый заказ контрагента, который можно считать выполненым.
 /// </summary>
 /// <returns>Первый заказ</returns>
 /// <param name="uow">UoW</param>
 /// <param name="counterparty">Контрагент</param>
 public static VodovozOrder GetFirstRealOrderForClientForActionBottle(IUnitOfWork uow, VodovozOrder order, Counterparty counterparty)
 {
     return(OrderSingletonRepository.GetInstance().GetFirstRealOrderForClientForActionBottle(uow, order, counterparty));
 }
示例#28
0
 /// <summary>
 /// Кол-во 19л. воды в заказе
 /// </summary>
 /// <returns>Кол-во 19л. воды в заказе</returns>
 /// <param name="uow">Uow.</param>
 /// <param name="order">Заказ</param>
 public static int Get19LWatterQtyForOrder(IUnitOfWork uow, VodovozOrder order)
 {
     return(OrderSingletonRepository.GetInstance().Get19LWatterQtyForOrder(uow, order));
 }
示例#29
0
 public static IList <VodovozOrder> GetOrdersBetweenDates(IUnitOfWork UoW, DateTime startDate, DateTime endDate)
 {
     return(OrderSingletonRepository.GetInstance().GetOrdersBetweenDates(UoW, startDate, endDate));
 }
示例#30
0
 public static OrderStatus[] GetStatusesForActualCount(VodovozOrder order)
 {
     return(OrderSingletonRepository.GetInstance().GetStatusesForActualCount(order));
 }