コード例 #1
0
        public SelfDeliveryDocumentDlg()
        {
            this.Build();

            UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <SelfDeliveryDocument>();
            Entity.Author = _employeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.Author == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, так как некого указывать в качестве кладовщика.");
                FailInitialize = true;
                return;
            }

            Entity.Warehouse = StoreDocumentHelper.GetDefaultWarehouse(UoW, WarehousePermissions.SelfDeliveryEdit);
            var validationResult = CheckPermission();

            if (!validationResult.CanRead)
            {
                MessageDialogHelper.RunErrorDialog("Нет прав для доступа к документу отпуска самовывоза");
                FailInitialize = true;
                return;
            }

            if (!validationResult.CanCreate)
            {
                MessageDialogHelper.RunErrorDialog("Нет прав для создания документа отпуска самовывоза");
                FailInitialize = true;
                return;
            }

            canEditDocument = true;
            ConfigureDlg();
        }
コード例 #2
0
        public static void ShowExceptionMessage(Exception ex)
        {
            if (ex is StaleObjectStateException staleObjectStateException)
            {
                var type       = OrmConfig.FindMappingByFullClassName(staleObjectStateException.EntityName).MappedClass;
                var objectName = DomainHelper.GetSubjectNames(type);

                string message;

                switch (objectName.Gender)
                {
                case GrammaticalGender.Feminine:
                    message = "Сохраняемая <b>{0}</b> c номером <b>{1}</b> была кем то изменена.";
                    break;

                case GrammaticalGender.Neuter:
                    message = "Сохраняемое <b>{0}</b> c номером <b>{1}</b> было кем то изменено.";
                    break;

                case GrammaticalGender.Masculine:
                default:
                    message = "Сохраняемый <b>{0}</b> c номером <b>{1}</b> был кем то изменен.";
                    break;
                }
                message = String.Format(message + "\nВаши изменения не будут записаны, чтобы не потерять чужие изменения. \nПереоткройте вкладку.", objectName?.Nominative ?? type.Name, staleObjectStateException.Identifier);

                MessageDialogHelper.RunErrorDialog(message);
            }
        }
コード例 #3
0
ファイル: AdvanceReportDlg.cs プロジェクト: RoAr80/Vodovoz
        public AdvanceReportDlg(int id, IPermissionService permissionService)
        {
            this.Build();
            UoWGeneric = UnitOfWorkFactory.CreateForRoot <AdvanceReport>(id);

            if (!accessfilteredsubdivisionselectorwidget.Configure(UoW, false, typeof(Income)))
            {
                MessageDialogHelper.RunErrorDialog(accessfilteredsubdivisionselectorwidget.ValidationErrorMessage);
                FailInitialize = true;
                return;
            }
            var userPermission = permissionService.ValidateUserPermission(typeof(AdvanceReport), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id);

            if (!userPermission.CanRead)
            {
                MessageDialogHelper.RunErrorDialog("Отсутствуют права на просмотр приходного ордера");
                FailInitialize = true;
                return;
            }
            canEdit = userPermission.CanUpdate;

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

            canEditRectroactively = permmissionValidator.Validate(typeof(AdvanceReport), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission));

            //Отключаем отображение ненужных элементов.
            labelDebtTitle.Visible = labelTableTitle.Visible = hboxDebt.Visible = GtkScrolledWindow1.Visible = labelCreating.Visible = false;

            comboExpense.Sensitive = yspinMoney.Sensitive = yentryEmployee.Sensitive = specialListCmbOrganisation.Sensitive = false;

            ConfigureDlg();
        }
コード例 #4
0
        public override bool Save()
        {
            var messages = new List <string>();

            var valid = new QSValidator <TransferOperationDocument>(UoWGeneric.Root);

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

            Entity.LastEditor = _employeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.LastEditor == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете изменять складские документы, так как некого указывать в качестве кладовщика.");
                return(false);
            }
            if (spinBottles.Value == 0f && spinDepositsBottles.Value == 0f && spinDepositsEquipment.Value == 0f)
            {
                MessageDialogHelper.RunErrorDialog("Вы ничего не указали для перемещения.");
                return(false);
            }

            messages.AddRange(Entity.SaveOperations(UoWGeneric, (int)spinBottles.Value, (decimal)spinDepositsBottles.Value, (decimal)spinDepositsEquipment.Value));

            logger.Info("Сохраняем документ переноса...");
            UoWGeneric.Save();
            logger.Info("Ok.");
            return(true);
        }
コード例 #5
0
        public CashExpenseDlg(IPermissionService permissionService)
        {
            this.Build();
            UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <Expense>();
            Entity.Casher = EmployeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.Casher == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать кассовые документы, так как некого указывать в качестве кассира.");
                FailInitialize = true;
                return;
            }

            var userPermission = permissionService.ValidateUserPermission(typeof(Expense), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id);

            canCreate = userPermission.CanCreate;
            if (!userPermission.CanCreate)
            {
                MessageDialogHelper.RunErrorDialog("Отсутствуют права на создание расходного ордера");
                FailInitialize = true;
                return;
            }

            if (!accessfilteredsubdivisionselectorwidget.Configure(UoW, false, typeof(Expense)))
            {
                MessageDialogHelper.RunErrorDialog(accessfilteredsubdivisionselectorwidget.ValidationErrorMessage);
                FailInitialize = true;
                return;
            }

            Entity.Date = DateTime.Now;
            ConfigureDlg();
        }
コード例 #6
0
        private bool SendPasswordByPhone(Employee employee, string password)
        {
            SmsSender sender = new SmsSender(new BaseParametersProvider(), InstantSmsServiceSetting.GetInstantSmsService());

            #region ФормированиеТелефона

            string stringPhoneNumber = employee.GetPhoneForSmsNotification();
            if (stringPhoneNumber == null)
            {
                MessageDialogHelper.RunErrorDialog("Не найден подходящий телефон для отправки Sms", "Ошибка при отправке Sms");
                return(false);
            }
            string phoneNumber = $"+7{stringPhoneNumber}";

            #endregion

            var result = sender.SendPassword(phoneNumber, employee.LoginForNewUser, password);

            if (result.MessageStatus == SmsMessageStatus.Ok)
            {
                MessageDialogHelper.RunInfoDialog("Sms с паролем отправлена успешно");
                return(true);
            }
            else
            {
                MessageDialogHelper.RunErrorDialog(result.ErrorDescription, "Ошибка при отправке Sms");
                return(false);
            }
        }
コード例 #7
0
        public AdvanceReportDlg(int id)
        {
            Build();
            UoWGeneric = UnitOfWorkFactory.CreateForRoot <AdvanceReport>(id);

            if (!accessfilteredsubdivisionselectorwidget.Configure(UoW, false, typeof(Income)))
            {
                MessageDialogHelper.RunErrorDialog(accessfilteredsubdivisionselectorwidget.ValidationErrorMessage);
                FailInitialize = true;
                return;
            }

            _canEdit = permissionResult.CanUpdate;

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

            canEditRectroactively =
                permmissionValidator.Validate(
                    typeof(AdvanceReport), ServicesConfig.UserService.CurrentUserId, nameof(RetroactivelyClosePermission));

            //Отключаем отображение ненужных элементов.
            labelDebtTitle.Visible = labelTableTitle.Visible = hboxDebt.Visible = GtkScrolledWindow1.Visible = labelCreating.Visible = false;

            comboExpense.Sensitive = yspinMoney.Sensitive = evmeEmployee.Sensitive = specialListCmbOrganisation.Sensitive = false;

            ConfigureDlg();
        }
コード例 #8
0
        public override bool Save()
        {
            if (!Entity.CanEdit)
            {
                return(false);
            }

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

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

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

            logger.Info("Сохраняем документ пересортицы...");
            UoWGeneric.Save();
            logger.Info("Ok.");
            return(true);
        }
コード例 #9
0
ファイル: RouteListTrackDlg.cs プロジェクト: RoAr80/Vodovoz
        public RouteListTrackDlg()
        {
            this.Build();
            this.TabName = "Мониторинг";
            yTreeViewDrivers.RepresentationModel = new ViewModel.WorkingDriversVM(uow);
            yTreeViewDrivers.RepresentationModel.UpdateNodes();
            yTreeViewDrivers.Selection.Mode     = Gtk.SelectionMode.Multiple;
            yTreeViewDrivers.Selection.Changed += OnSelectionChanged;
            buttonChat.Visible = buttonSendMessage.Visible = false;
            currentEmployee    = EmployeeRepository.GetEmployeeForCurrentUser(uow);
            if (currentEmployee == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к сотруднику. Чат не будет работать.");
            }

            //Configure map
            gmapWidget.MapProvider   = GMapProviders.YandexMap;
            gmapWidget.Position      = new PointLatLng(59.93900, 30.31646);
            gmapWidget.HeightRequest = 150;
            //MapWidget.HasFrame = true;
            gmapWidget.Overlays.Add(carsOverlay);
            gmapWidget.Overlays.Add(tracksOverlay);
            gmapWidget.ExposeEvent += GmapWidget_ExposeEvent;
            UpdateCarPosition();
            timerId = GLib.Timeout.Add(carRefreshInterval, new GLib.TimeoutHandler(UpdateCarPosition));
            yenumcomboMapType.ItemsEnum    = typeof(MapProviders);
            yenumcomboMapType.SelectedItem = MapProviders.YandexMap;
        }
コード例 #10
0
        public RouteListTrackDlg(IEmployeeRepository employeeRepository, IChatRepository chatRepository, ITrackRepository trackRepository)
        {
            _employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _chatRepository     = chatRepository ?? throw new ArgumentNullException(nameof(chatRepository));
            _trackRepository    = trackRepository ?? throw new ArgumentNullException(nameof(trackRepository));

            Build();
            TabName = "Мониторинг";
            yTreeViewDrivers.RepresentationModel = new ViewModel.WorkingDriversVM(uow);
            yTreeViewDrivers.RepresentationModel.UpdateNodes();
            yTreeViewDrivers.Selection.Mode     = Gtk.SelectionMode.Multiple;
            yTreeViewDrivers.Selection.Changed += OnSelectionChanged;
            buttonChat.Visible = buttonSendMessage.Visible = false;
            _currentEmployee   = employeeRepository.GetEmployeeForCurrentUser(uow);

            if (_currentEmployee == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к сотруднику. Чат не будет работать.");
            }

            //Configure map
            gmapWidget.MapProvider   = GMapProviders.GoogleMap;
            gmapWidget.Position      = new PointLatLng(59.93900, 30.31646);
            gmapWidget.HeightRequest = 150;
            //MapWidget.HasFrame = true;
            gmapWidget.Overlays.Add(carsOverlay);
            gmapWidget.Overlays.Add(tracksOverlay);
            gmapWidget.ExposeEvent += GmapWidget_ExposeEvent;
            UpdateCarPosition();
            timerId = GLib.Timeout.Add(carRefreshInterval, new GLib.TimeoutHandler(UpdateCarPosition));
            yenumcomboMapType.ItemsEnum    = typeof(MapProviders);
            yenumcomboMapType.TooltipText  = "Если карта отображается некорректно или не отображается вовсе - смените тип карты";
            yenumcomboMapType.SelectedItem = MapProviders.GoogleMap;
        }
コード例 #11
0
        private void EmployeeAdvanceOrder(decimal cashInput)         // Метод создаёт расходник выдачи аванса из МЛ и выводит сообщение. @Дима
        {
            string message, ifAdvanceIsBigger;

            Expense cashExpense  = null;
            decimal cashToReturn = Entity.MoneyToReturn - cashInput;

            ifAdvanceIsBigger = (cashToReturn > 0) ? "Сумма для сдачи в кассу" : "Сумма для выдачи из кассы";              // Выбор варианта сообщения. @Дима

            var cashier = EmployeeRepository.GetEmployeeForCurrentUser(UoW);

            if (cashier == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете закрыть МЛ, так как некого указывать в качестве кассира.");
                return;
            }
            Entity.Cashier = cashier;

            message = Entity.EmployeeAdvanceOperation(ref cashExpense, cashInput);               // Создание расходника. @Дима

            if (cashExpense != null)
            {
                UoW.Save(cashExpense);
            }
            cashExpense.UpdateWagesOperations(UoW);
            UoW.Save();

            MessageDialogHelper.RunInfoDialog(String.Format("{0}\n\n{1}: {2:C0}", message, ifAdvanceIsBigger, Math.Abs(cashToReturn)));
        }
コード例 #12
0
        private void SendReport(string logContent, ErrorReportType reportType)
        {
            var svc = ReportWorker.GetReportService();

            if (svc == null)
            {
                MessageDialogHelper.RunErrorDialog("Не удалось установить соединение с сервером Quality Solution.");
                return;
            }

            var result = svc.SubmitErrorReport(
                new ErrorReport {
                Product     = application.ProductName,
                Edition     = application.Modification,
                Version     = application.Version.ToString(),
                DBName      = databaseInfo?.Name ?? String.Empty,
                StackTrace  = AppExceptionText,
                Description = textviewDescription.Buffer.Text,
                Email       = entryEmail.Text,
                UserName    = user?.Name,
                LogFile     = logContent,
                ReportType  = reportType
            });

            if (result)
            {
                this.Respond(ResponseType.Ok);
                reportSent = true;
            }
            else
            {
                MessageDialogHelper.RunWarningDialog("Отправка сообщения не удалась.\n" +
                                                     "Проверьте ваше интернет соединение и повторите попытку. Если отправка неудастся возможно имеются проблемы на стороне сервера.");
            }
        }
コード例 #13
0
        public void UpdateNodes()
        {
            List <string> emptyDP = new List <string>();

            items = new List <RouteListKeepingItemNode>();
            foreach (var item in Entity.Addresses.Where(x => x != null))
            {
                items.Add(new RouteListKeepingItemNode {
                    RouteListItem = item
                });
                if (item.Order.DeliveryPoint == null)
                {
                    emptyDP.Add(string.Format(
                                    "Для заказа {0} не определена точка доставки.",
                                    item.Order.Id));
                }
            }
            if (emptyDP.Any())
            {
                string message = string.Join(Environment.NewLine, emptyDP);
                message += Environment.NewLine + "Необходимо добавить точки доставки или сохранить вышеуказанные заказы снова.";
                MessageDialogHelper.RunErrorDialog(message);
                FailInitialize = true;
                return;
            }
            items.ForEach(i => i.StatusChanged += RLI_StatusChanged);

            ytreeviewAddresses.ItemsDataSource = new GenericObservableList <RouteListKeepingItemNode>(items);
        }
コード例 #14
0
        private void LoadDocument(RouteListPrintableDocuments docType)
        {
            int rlNumber = GetRouteListNumber();

            if (rlNumber == 0)
            {
                return;
            }
            ReportInfo document = null;

            using (IUnitOfWork uow = UnitOfWorkFactory.CreateWithoutRoot()) {
                RouteList rl = uow.GetById <RouteList>(rlNumber);
                if (rl == null)
                {
                    MessageDialogHelper.RunErrorDialog($"Маршрутный лист с номером {rlNumber} не найден");
                    return;
                }
                document = PrintRouteListHelper.GetRDL(rl, docType, uow);
            }

            if (document == null)
            {
                MessageDialogHelper.RunErrorDialog("Не возможно получить печатную форму документа");
                return;
            }

            if (document.Source != null)
            {
                reportViewer.LoadReport(document.Source, document.GetParametersString(), document.ConnectionString, true, document.RestrictedOutputPresentationTypes);
            }
            else
            {
                reportViewer.LoadReport(document.GetReportUri(), document.GetParametersString(), document.ConnectionString, true, document.RestrictedOutputPresentationTypes);
            }
        }
コード例 #15
0
        public AdvanceReportDlg()
        {
            Build();
            UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <AdvanceReport>();
            Entity.Casher = _employeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.Casher == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать кассовые документы, так как некого указывать в качестве кассира.");
                FailInitialize = true;
                return;
            }

            _canCreate = permissionResult.CanCreate;
            if (!_canCreate)
            {
                MessageDialogHelper.RunErrorDialog("Отсутствуют права на создание приходного ордера");
                FailInitialize = true;
                return;
            }

            if (!accessfilteredsubdivisionselectorwidget.Configure(UoW, false, typeof(AdvanceReport)))
            {
                MessageDialogHelper.RunErrorDialog(accessfilteredsubdivisionselectorwidget.ValidationErrorMessage);
                FailInitialize = true;
                return;
            }

            Entity.Date = DateTime.Now;
            ConfigureDlg();
            FillDebt();
        }
コード例 #16
0
ファイル: StoreDocumentHelper.cs プロジェクト: RoAr80/Vodovoz
        /// <summary>
        /// Проверка прав на создание документа
        /// </summary>
        /// <returns>Если <c>true</c> нет прав на создание.</returns>
        public static bool CheckCreateDocument(WarehousePermissions edit, params Warehouse[] warehouses)
        {
            warehouses = warehouses.Where(x => x != null).ToArray();
            if (warehouses.Any())
            {
                if (warehouses.Any(x => CurrentPermissions.Warehouse[edit, x]))
                {
                    return(false);
                }

                MessageDialogHelper.RunErrorDialog(
                    string.Format(
                        "У вас нет прав на создание этого документа для склада '{0}'.",
                        string.Join(";", warehouses.Distinct().Select(x => x.Name))
                        )
                    );
            }
            else
            {
                if (CurrentPermissions.Warehouse.Allowed(edit).Any())
                {
                    return(false);
                }

                MessageDialogHelper.RunErrorDialog("У вас нет прав на создание этого документа.");
            }
            return(true);
        }
コード例 #17
0
		public override bool Save ()
		{
			if(!Entity.CanEdit)
				return false;

			if(CheckWarehouseItems() == false){
				MessageDialogHelper.RunErrorDialog("На складе не хватает материалов");
				return false;
			}
				
			var valid = new QSValidator<IncomingWater> (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;
			}

			logger.Info ("Сохраняем документ производства...");
			UoWGeneric.Save ();
			logger.Info ("Ok.");
			return true;
		}
コード例 #18
0
        protected void OnButtonFillAllItemsClicked(object sender, EventArgs e)
        {
            if (DocumentUoW.Root.Items.Any() && !MessageDialogHelper.RunQuestionDialog("Список будет очищен. Продолжить?"))
            {
                return;
            }
            DocumentUoW.Root.FillFromRouteList(DocumentUoW, new RouteListRepository(), null, false);

            var    items = DocumentUoW.Root.Items;
            string errorNomenclatures = string.Empty;

            foreach (var item in items)
            {
                if (item.Nomenclature.Unit == null)
                {
                    errorNomenclatures += string.Format("{0} код {1}{2}",
                                                        item.Nomenclature.Name, item.Nomenclature.Id, Environment.NewLine);
                }
            }
            if (!string.IsNullOrEmpty(errorNomenclatures))
            {
                errorNomenclatures = "Не указаны единицы измерения для следующих номенклатур:"
                                     + Environment.NewLine + errorNomenclatures;
                MessageDialogHelper.RunErrorDialog(errorNomenclatures);
                DocumentUoW.Root.Items.Clear();
                return;
            }

            DocumentUoW.Root.UpdateAlreadyLoaded(DocumentUoW, new RouteListRepository());
            if (DocumentUoW.Root.Warehouse != null)
            {
                DocumentUoW.Root.UpdateStockAmount(DocumentUoW);
                UpdateAmounts();
            }
        }
コード例 #19
0
        protected void OnButtonInsertFromBufferClicked(object sender, EventArgs e)
        {
            bool error = true;

            string booferCoordinates = clipboard.WaitForText();

            string[] coordinates = booferCoordinates?.Split(',');
            if (coordinates?.Length == 2)
            {
                bool goodLat = decimal.TryParse(coordinates[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out decimal lat);
                bool goodLon = decimal.TryParse(coordinates[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out decimal lng);
                SetCoordinates(lat, lng);

                if (goodLat && goodLon)
                {
                    deliverypriceview.DeliveryPrice = DeliveryPriceCalculator.Calculate(latitude, longitude, yspinBottles.ValueAsInt);
                    error = false;
                }
            }
            if (error)
            {
                MessageDialogHelper.RunErrorDialog(
                    "Буфер обмена не содержит координат или содержит неправильные координаты");
            }
        }
コード例 #20
0
        public CashExpenseDlg(int id, IPermissionService permissionService)
        {
            this.Build();
            UoWGeneric = UnitOfWorkFactory.CreateForRoot <Expense>(id);

            if (!accessfilteredsubdivisionselectorwidget.Configure(UoW, false, typeof(Expense)))
            {
                MessageDialogHelper.RunErrorDialog(accessfilteredsubdivisionselectorwidget.ValidationErrorMessage);
                FailInitialize = true;
                return;
            }

            var userPermission = permissionService.ValidateUserPermission(typeof(Expense), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id);

            if (!userPermission.CanRead)
            {
                MessageDialogHelper.RunErrorDialog("Отсутствуют права на просмотр расходного ордера");
                FailInitialize = true;
                return;
            }
            canEdit = userPermission.CanUpdate;

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

            canEditRectroactively = permmissionValidator.Validate(typeof(Expense), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission));

            ConfigureDlg();
        }
コード例 #21
0
        public override bool Save()
        {
            if (!Entity.CanEdit)
            {
                return(false);
            }

            Entity.UpdateAlreadyLoaded(UoW, _routeListRepository);
            var valid = new QS.Validation.QSValidator <CarLoadDocument> (UoWGeneric.Root);

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

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

            if (Entity.Items.Any(x => x.Amount == 0))
            {
                var res = MessageDialogHelper.RunQuestionYesNoCancelDialog(
                    "<span foreground=\"red\">В списке есть нулевые позиции. Убрать нулевые позиции перед сохранением?</span>");
                switch (res)
                {
                case -4:                                                //DeleteEvent
                case -6:                                                //Cancel
                    return(false);

                case -8:                                                //Yes
                    Entity.ClearItemsFromZero();
                    break;

                case -9:                                                //No
                    break;
                }
            }

            Entity.UpdateOperations(UoW);

            logger.Info("Сохраняем погрузочный талон...");
            UoWGeneric.Save();

            logger.Info("Меняем статус маршрутного листа...");
            if (Entity.RouteList.ShipIfCan(UoW, CallTaskWorker, out _))
            {
                MessageDialogHelper.RunInfoDialog("Маршрутный лист отгружен полностью.");
            }
            UoW.Save(Entity.RouteList);
            UoW.Commit();

            logger.Info("Ok.");

            return(true);
        }
コード例 #22
0
 private void OnButtonCreateReportClicked(object sender, EventArgs e)
 {
     if (dateperiodpicker.StartDateOrNull == null)
     {
         MessageDialogHelper.RunErrorDialog("Необходимо выбрать дату");
         return;
     }
     LoadReport?.Invoke(this, new LoadReportEventArgs(GetReportInfo(), true));
 }
コード例 #23
0
 protected void OnButtonCreateReportClicked(object sender, EventArgs e)
 {
     if (dateperiodpicker.StartDateOrNull == null)
     {
         MessageDialogHelper.RunErrorDialog("Необходимо выбрать дату");
         return;
     }
     OnUpdate(true);
 }
コード例 #24
0
        private int GetRouteListNumber()
        {
            int result = 0;

            if (!int.TryParse(entryRouteListNumber.Text, out result))
            {
                MessageDialogHelper.RunErrorDialog("Неправильный номер маршрутного листа");
            }
            return(result);
        }
コード例 #25
0
 protected void OnButtonUploadClicked(object sender, EventArgs e)
 {
     if (!CheckAllCategoriesSelected())
     {
         MessageDialogHelper.RunErrorDialog("Не у всех отмеченных документов выбраны категории дохода/расхода.");
         return;
     }
     FillCounterparties();
     FillDocuments();
 }
コード例 #26
0
ファイル: FineDlg.cs プロジェクト: RoAr80/Vodovoz
 private bool GetAuthor(out Employee cashier)
 {
     cashier = EmployeeRepository.GetEmployeeForCurrentUser(UoW);
     if (cashier == null)
     {
         MessageDialogHelper.RunErrorDialog(
             "Ваш пользователь не привязан к действующему сотруднику.");
         return(false);
     }
     return(true);
 }
コード例 #27
0
 void ConfigureNewDoc()
 {
     UoWGeneric    = UnitOfWorkFactory.CreateWithNewRoot <CarUnloadDocument>();
     Entity.Author = EmployeeRepository.GetEmployeeForCurrentUser(UoW);
     if (Entity.Author == null)
     {
         MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать складские документы, так как некого указывать в качестве кладовщика.");
         FailInitialize = true;
         return;
     }
     Entity.Warehouse = StoreDocumentHelper.GetDefaultWarehouse(UoW, WarehousePermissions.CarUnloadEdit);
 }
コード例 #28
0
        protected void OnButtonAcceptClicked(object sender, EventArgs e)
        {
            var casher = EmployeeRepository.GetEmployeeForCurrentUser(UoW);

            if (casher == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете закрыть МЛ, так как некого указывать в качестве кассира.");
                return;
            }

            if (!isConsistentWithUnloadDocument())
            {
                return;
            }

            if (!checkSendToMileageCheck.Active)
            {
                Entity.ConfirmedDistance = Entity.ActualDistance;
            }

            var valid = new QSValidator <RouteList>(UoWGeneric.Root,
                                                    new Dictionary <object, object>
            {
                { "NewStatus", RouteListStatus.MileageCheck }
            });

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

            if (advanceCheckbox.Active && advanceSpinbutton.Value > 0)
            {
                EmployeeAdvanceOrder((decimal)advanceSpinbutton.Value);
            }

            Entity.Cashier = casher;
            Entity.Confirm(checkSendToMileageCheck.Active);

            if (!MessageDialogHelper.RunQuestionDialog("Перед выходом распечатать документ?"))
            {
                SaveAndClose();
            }
            else
            {
                Save();

                PrintRouteList();

                UpdateButtonState();
                this.OnCloseTab(false);
            }
        }
コード例 #29
0
ファイル: NuanceDlg.cs プロジェクト: RoAr80/Vodovoz
        public override bool Save()
        {
            Entity.Author = EmployeeRepository.GetEmployeeForCurrentUser(UoW);
            if (Entity.Author == null)
            {
                MessageDialogHelper.RunErrorDialog("Ваш пользователь не привязан к действующему сотруднику, вы не можете создавать , так как некого указывать в качестве автора документа.");
                FailInitialize = true;
            }

            UoWGeneric.Save();
            return(true);
        }
コード例 #30
0
        private void ResetPasswordForEmployee(Employee employee)
        {
            var result = authorizationService.ResetPasswordToGenerated(employee, 5);

            if (result.MessageStatus == SmsMessageStatus.Ok)
            {
                MessageDialogHelper.RunInfoDialog("Sms с паролем отправлена успешно");
            }
            else
            {
                MessageDialogHelper.RunErrorDialog(result.ErrorDescription, "Ошибка при отправке Sms");
            }
        }