Beispiel #1
0
        void UpdateEquipmentState()
        {
            int equipmentsCounts = EquipmentRepository.GetEquipmentAtDeliveryPointQuery(Entity.Counterparty, Entity.DeliveryPoint).GetExecutableQueryOver(UoW.Session).RowCount();

            if (equipmentsCounts == 0 && Entity.Equipment == null)
            {
                enumcomboWithSerial.SelectedItem = ServiceClaimEquipmentSerialType.WithoutSerial;
            }
            ylabelEquipmentInfo.LabelProp = RusNumber.FormatCase(equipmentsCounts, "На точке числится {0} единица оборудования", "На точке числится {0} единицы оборудования", "На точке числится {0} единиц оборудования");
            enumcomboWithSerial.Sensitive = equipmentsCounts > 0;
        }
Beispiel #2
0
        void UpdateIcon()
        {
            if (UnreadNewsCount > 0)
            {
                menuLabel.Markup      = String.Format("<span foreground=\"red\" weight=\"bold\">+{0}</span>", UnreadNewsCount);
                menuLabel.TooltipText = RusNumber.FormatCase(UnreadNewsCount, "{0} непрочитанная новость", "{0} непрочитанных новости", "{0} непрочитанных новостей");
            }

            menuLabel.Visible = (UnreadNewsCount > 0);
            newsicon.Visible  = (UnreadNewsCount == 0);
        }
Beispiel #3
0
        private void UpdateInfo()
        {
            var    editingCount = editingList.Count(x => x.Fitting == null);
            string text         = RusNumber.FormatCase(editingCount, "Редактируем {0} строку", "Редактируем {0} строки", "Редактируем {0} строк");

            if (editingCount < editingList.Count)
            {
                text += "\n<span foreground=\"blue\">";
                text += RusNumber.FormatCase(editingList.Count - editingCount, "{0} не редактируется", "{0} не редактируются", "{0} не редактируются");
                text += RusNumber.FormatCase(editingList.Count, "\nВсего выбрано {0}", "\nВсего выбрано {0}", "\nВсего выбрано {0}");
                text += "</span>";
            }
            labelInfo.Markup = text;
        }
Beispiel #4
0
        protected void OnButtonUpdatePricesClicked(object sender, EventArgs e)
        {
            var newPricesList = new Dictionary <Price, int>();
            int effectedRows  = 0;

            foreach (var item in Entity.ProjectRows)
            {
                PriceItem newPriceItem = Repository.PriceRepository.GetLastPriceItem(UoW, item.Fitting, item.SelectedPriceItem?.Price.Provider);
                if (newPriceItem == null)
                {
                    continue;
                }
                if (!DomainHelper.EqualDomainObjects(newPriceItem, item.SelectedPriceItem))
                {
                    effectedRows++;
                    item.SelectedPriceItem = newPriceItem;
                    item.FittingPrice      = newPriceItem.Cost;
                    item.PriceCurrency     = newPriceItem.Currency;
                    if (newPricesList.ContainsKey(newPriceItem.Price))
                    {
                        newPricesList[newPriceItem.Price]++;
                    }
                    else
                    {
                        newPricesList.Add(newPriceItem.Price, 1);
                    }
                }
            }

            if (effectedRows == 0)
            {
                MessageDialogWorks.RunInfoDialog("Новые цены не найдены!");
            }
            else
            {
                MessageDialogWorks.RunInfoDialog(String.Format("Были обновлены цены в {0}.\n" +
                                                               "Новые цены были получены из {1}:\n" +
                                                               "{2}",
                                                               RusNumber.FormatCase(effectedRows, "{0} строке", "{0} строках", "{0} строках"),
                                                               RusNumber.FormatCase(newPricesList.Count, "{0} прайса", "{0} прайсов", "{0} прайсов"),
                                                               String.Join("\n", newPricesList.Select(x =>
                                                                                                      String.Format("{0} ({1:d}) - {2}", x.Key.Provider.Name, x.Key.Date, x.Value)
                                                                                                      ))
                                                               ));
            }
        }
Beispiel #5
0
        private void UpdateResidue()
        {
            int bottleDebt;

            if (Entity.DeliveryPoint == null)
            {
                bottleDebt = Repository.Operations.BottlesRepository.GetBottlesAtCounterparty(UoW, Entity.Customer, Entity.Date);
            }
            else
            {
                bottleDebt = Repository.Operations.BottlesRepository.GetBottlesAtDeliveryPoint(UoW, Entity.DeliveryPoint, Entity.Date);
            }
            labelCurrentBootle.LabelProp = RusNumber.FormatCase(bottleDebt, "{0} бутыль", "{0} бутыли", "{0} бутылей");

            decimal bottleDeposit;

            if (Entity.DeliveryPoint == null)
            {
                bottleDeposit = Repository.Operations.DepositRepository.GetDepositsAtCounterparty(UoW, Entity.Customer, DepositType.Bottles, Entity.Date);
            }
            else
            {
                bottleDeposit = Repository.Operations.DepositRepository.GetDepositsAtDeliveryPoint(UoW, Entity.DeliveryPoint, DepositType.Bottles, Entity.Date);
            }
            labelCurrentBottleDeposit.LabelProp = CurrencyWorks.GetShortCurrencyString(bottleDeposit);

            decimal equipmentDeposit;

            if (Entity.DeliveryPoint == null)
            {
                equipmentDeposit = Repository.Operations.DepositRepository.GetDepositsAtCounterparty(UoW, Entity.Customer, DepositType.Equipment, Entity.Date);
            }
            else
            {
                equipmentDeposit = Repository.Operations.DepositRepository.GetDepositsAtDeliveryPoint(UoW, Entity.DeliveryPoint, DepositType.Equipment, Entity.Date);
            }
            labelCurrentEquipmentDeposit.LabelProp = CurrencyWorks.GetShortCurrencyString(equipmentDeposit);

            decimal debt = Repository.Operations.MoneyRepository.GetCounterpartyDebt(UoW, Entity.Customer, Entity.Date);

            labelCurrentMoneyDebt.LabelProp = CurrencyWorks.GetShortCurrencyString(debt);
        }
Beispiel #6
0
        protected void OnButtonOkClicked(object sender, EventArgs e)
        {
            string amount = RusNumber.FormatCase(spinAmount.ValueAsInt,
                                                 "Будет зарегистрирован {0} серийный номер для оборудования ",
                                                 "Будет зарегистрировано {0} серийных номера для оборудования ",
                                                 "Будет зарегистрировано {0} серийных номеров для оборудования "
                                                 );
            string Message = amount + String.Format("({0}). Вы подтверждаете регистрацию?",
                                                    (referenceNomenclature.Subject as Nomenclature).Name);
            MessageDialog md = new MessageDialog((Window)this.Toplevel, DialogFlags.Modal,
                                                 MessageType.Question,
                                                 ButtonsType.YesNo,
                                                 Message);
            bool result = md.Run() == (int)ResponseType.Yes;

            md.Destroy();

            if (result)
            {
                RegisteredEquipment = new List <Equipment> ();
                for (int count = 0; count < spinAmount.ValueAsInt; count++)
                {
                    var newEquipment = new Equipment {
                        Nomenclature    = (referenceNomenclature.Subject as Nomenclature),
                        WarrantyEndDate = ydatepickerWarrantyEnd.DateOrNull
                    };
                    uow.Save(newEquipment);
                    RegisteredEquipment.Add(newEquipment);
                }
                uow.Commit();

                //Деактивируем создание оборудования
                referenceNomenclature.Sensitive      = spinAmount.Sensitive =
                    ydatepickerWarrantyEnd.Sensitive = buttonCreate.Sensitive = false;
                PreparedReport();
                buttonAddAndClose.Sensitive = true;
            }
        }
Beispiel #7
0
        private Gtk.Menu GetOrderWeekMoveMenu()
        {
            Gtk.Menu         jBox2 = new Gtk.Menu();
            MenuItemId <int> MenuItem2;

            for (int weeks = 5; weeks >= -5; weeks--)
            {
                if (weeks == 0)
                {
                    jBox2.Add(new SeparatorMenuItem());
                }
                else
                {
                    string text = RusNumber.FormatCase(Math.Abs(weeks), "на {0} неделю", "на {0} недели", "на {0} недель")
                                  + (weeks > 0 ? " вперед" : " назад");

                    MenuItem2    = new MenuItemId <int>(text);
                    MenuItem2.ID = weeks;
                    MenuItem2.ButtonPressEvent += OnButtonPopupMoveWeeks;
                    jBox2.Add(MenuItem2);
                }
            }
            return(jBox2);
        }
Beispiel #8
0
        void CalculateCompleteInfo()
        {
            labelTotal.LabelProp     = xlsRows.Count.ToString();
            labelFind.LabelProp      = xlsRows.Count(x => x.Status == ReadingXLSRow.RowStatus.FoundModel).ToString();
            labelManualSet.LabelProp = xlsRows.Count(x => x.Status == ReadingXLSRow.RowStatus.ManualSet).ToString();
            labelCreate.LabelProp    = xlsRows.Count(x => x.Status == ReadingXLSRow.RowStatus.WillCreated).ToString();
            var withoutPrice = xlsRows.Count(x => x.Price == null);

            if (withoutPrice > 0)
            {
                labelWithoutPrice.Markup = String.Format("<span foreground=\"red\">{0}</span>", withoutPrice);
            }
            else
            {
                labelWithoutPrice.Markup = withoutPrice.ToString();
            }

            var toAdd = xlsRows.Where(x => x.Price.HasValue).Count(x => x.Status == ReadingXLSRow.RowStatus.WillCreated ||
                                                                   x.Status == ReadingXLSRow.RowStatus.ManualSet ||
                                                                   x.Status == ReadingXLSRow.RowStatus.FoundModel
                                                                   );
            var skiped = xlsRows.Count - toAdd;

            if (skiped > 0)
            {
                labelSkiped.Markup = String.Format("<span foreground=\"red\">{0}</span>", skiped);
            }
            else
            {
                labelSkiped.Markup = skiped.ToString();
            }
            labelCurrency.LabelProp = comboCurrency.ActiveText;

            buttonFinish.Label     = RusNumber.FormatCase(toAdd, "Добавить {0} позицию в прайс", "Добавить {0} позиции в прайс", "Добавить {0} позиций в прайс");
            buttonFinish.Sensitive = toAdd > 0;
        }
Beispiel #9
0
        int FillChildOperation(IDeleteInfo currentDeletion, Operation parentOperation, TreeIter parentIter, EntityDTO masterEntity)
        {
            TreeIter  DeleteIter, ClearIter, RemoveIter;
            int       Totalcount   = 0;
            int       DelCount     = 0;
            int       ClearCount   = 0;
            int       RemoveCount  = 0;
            EntityDTO secondEntity = null;

            var secondInfo = CalculateSecondInfo(currentDeletion, masterEntity);

            if (!currentDeletion.HasDependences && !(secondInfo == null || secondInfo.HasDependences))
            {
                return(0);
            }

            CheckDlg.SetOperationName(String.Format("Проверка ссылок на: {0}", masterEntity.Title));
            logger.Debug(String.Format("Проверка ссылок на: {0}", masterEntity.Title));
            if (CheckDlg.IsCanceled)
            {
                return(0);
            }

            if (secondInfo != null)
            {
                secondEntity = new EntityDTO {
                    ClassType = secondInfo.ObjectClass,
                    Entity    = masterEntity.Entity,
                    Id        = masterEntity.Id,
                    Title     = masterEntity.Title
                };
            }

            if (currentDeletion.DeleteItems.Count > 0 || (secondInfo != null && secondInfo.DeleteItems.Count > 0))
            {
                if (!ObjectsTreeStore.IterIsValid(parentIter))
                {
                    DeleteIter = ObjectsTreeStore.AppendNode();
                }
                else
                {
                    DeleteIter = ObjectsTreeStore.AppendNode(parentIter);
                }

                DelCount = FillDeleteItemsOperation(currentDeletion, parentOperation, DeleteIter, masterEntity, ref Totalcount);

                if (secondInfo != null)
                {
                    DelCount += FillDeleteItemsOperation(secondInfo, parentOperation, DeleteIter, secondEntity, ref Totalcount);
                }

                if (DelCount > 0)
                {
                    ObjectsTreeStore.SetValues(DeleteIter, String.Format("Будет удалено ({0}/{1}) объектов:", DelCount, Totalcount));
                }
                else
                {
                    ObjectsTreeStore.Remove(ref DeleteIter);
                }
            }

            //TODO Сделать возможность журналирования очистки полей у объектов.
            if (currentDeletion.ClearItems.Count > 0 || (secondInfo != null && secondInfo.ClearItems.Count > 0))
            {
                if (!ObjectsTreeStore.IterIsValid(parentIter))
                {
                    ClearIter = ObjectsTreeStore.AppendNode();
                }
                else
                {
                    ClearIter = ObjectsTreeStore.AppendNode(parentIter);
                }

                ClearCount = FillCleanItemsOperation(currentDeletion, parentOperation, ClearIter, masterEntity, ref Totalcount);

                if (secondInfo != null)
                {
                    ClearCount += FillDeleteItemsOperation(secondInfo, parentOperation, ClearIter, secondEntity, ref Totalcount);
                }

                if (ClearCount > 0)
                {
                    ObjectsTreeStore.SetValues(ClearIter, RusNumber.FormatCase(ClearCount,
                                                                               "Будет очищено ссылок у {0} объекта:",
                                                                               "Будет очищено ссылок у {0} объектов:",
                                                                               "Будет очищено ссылок у {0} объектов:"
                                                                               ));
                }
                else
                {
                    ObjectsTreeStore.Remove(ref ClearIter);
                }
            }

            if (currentDeletion.RemoveFromItems.Count > 0 || (secondInfo != null && secondInfo.RemoveFromItems.Count > 0))
            {
                if (!ObjectsTreeStore.IterIsValid(parentIter))
                {
                    RemoveIter = ObjectsTreeStore.AppendNode();
                }
                else
                {
                    RemoveIter = ObjectsTreeStore.AppendNode(parentIter);
                }

                RemoveCount = FillRemoveFromItemsOperation(currentDeletion, parentOperation, RemoveIter, masterEntity, ref Totalcount);

                if (secondInfo != null)
                {
                    RemoveCount += FillRemoveFromItemsOperation(secondInfo, parentOperation, RemoveIter, secondEntity, ref Totalcount);
                }

                if (RemoveCount > 0)
                {
                    ObjectsTreeStore.SetValues(RemoveIter, RusNumber.FormatCase(RemoveCount,
                                                                                "Будут очищены ссылки в коллекциях у {0} объекта:",
                                                                                "Будут очищены ссылки в коллекциях у {0} объектов:",
                                                                                "Будут очищены ссылки в коллекциях у {0} объектов:"));
                }
                else
                {
                    ObjectsTreeStore.Remove(ref RemoveIter);
                }
            }

            return(Totalcount);
        }
Beispiel #10
0
 private string SubscribersCountText(int count)
 {
     return(RusNumber.FormatCase(count, "Всего {0} подписчик.", "Всего {0} подписчика.", "Всего {0} подписчиков."));
 }