protected void OnButtonAddClicked(object sender, EventArgs e)
 {
     var nomenclatureSelectDlg = new OrmReference(Repository.NomenclatureRepository.NomenclatureOfGoodsOnlyQuery());
     nomenclatureSelectDlg.Mode = OrmReferenceMode.Select;
     nomenclatureSelectDlg.ObjectSelected += NomenclatureSelectDlg_ObjectSelected;
     MyTab.TabParent.AddSlaveTab(MyTab, nomenclatureSelectDlg);
 }
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = TdiHelper.FindMyTab (this);
            if (mytab == null) {
                logger.Warn ("Родительская вкладка не найдена.");
                return;
            }

            OrmReference SelectDialog = new OrmReference (typeof(Nomenclature),
                SpecificationUoW,
                Repository.NomenclatureRepository.NomenclatureForProductMaterialsQuery ()
                .GetExecutableQueryOver (SpecificationUoW.Session).RootCriteria
            );
            SelectDialog.Mode = OrmReferenceMode.Select;
            SelectDialog.ObjectSelected += NomenclatureSelected;

            mytab.TabParent.AddSlaveTab (mytab, SelectDialog);
        }
Esempio n. 3
0
        /// <summary>
        /// Открывает диалог выбора объекта
        /// </summary>
        public void OpenSelectDialog()
        {
            if (!OnBeforeChangeByUser())
            {
                return;
            }

            var          dlg = DialogHelper.FindParentUowDialog(this);
            IUnitOfWork  localUoW;
            OrmReference SelectDialog;

            if (dlg != null)
            {
                localUoW = dlg.UoW;
            }
            else
            {
                localUoW = UnitOfWorkFactory.CreateWithoutRoot();
            }

            if (ItemsQuery != null)
            {
                SelectDialog = new OrmReference(localUoW, ItemsQuery);
            }
            else
            {
                if (ItemsCriteria == null)
                {
                    ItemsCriteria = localUoW.Session.CreateCriteria(subjectType);
                }

                SelectDialog = new OrmReference(subjectType, localUoW, ItemsCriteria);
            }

            SelectDialog.Mode = OrmReferenceMode.Select;
            if (!CanEditReference)
            {
                SelectDialog.ButtonMode &= ~(ReferenceButtonMode.CanAdd | ReferenceButtonMode.CanDelete);
            }
            SelectDialog.ObjectSelected += OnSelectDialogObjectSelected;
            MyTab.TabParent.AddSlaveTab(MyTab, SelectDialog);
        }
Esempio n. 4
0
 protected void OnActionManufacturersActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Manufacturer));
     tdiMain.AddTab (refWin);
 }
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = TdiHelper.FindMyTab (this);
            if (mytab == null) {
                logger.Warn ("Родительская вкладка не найдена.");
                return;
            }

            OrmReference SelectDialog = new OrmReference (DocumentUoW, Repository.NomenclatureRepository.NomenclatureOfGoodsOnlyQuery ());
            SelectDialog.Mode = OrmReferenceMode.Select;
            SelectDialog.ButtonMode = ReferenceButtonMode.CanAdd;
            SelectDialog.ObjectSelected += NomenclatureSelected;

            mytab.TabParent.AddSlaveTab (mytab, SelectDialog);
        }
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            OrmReference SelectDialog = new OrmReference (AgreementUoW, EquipmentRepository.AvailableEquipmentQuery());
            SelectDialog.Mode = OrmReferenceMode.Select;
            SelectDialog.ButtonMode = ReferenceButtonMode.CanEdit;
            SelectDialog.ObjectSelected += EquipmentSelected;

            MyTab.TabParent.AddSlaveTab (MyTab, SelectDialog);
        }
Esempio n. 7
0
 protected void OnActionUnitsActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(MeasurementUnits));
     tdiMain.AddTab (refWin);
 }
Esempio n. 8
0
 protected void OnActionSignificanceActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Significance));
     tdiMain.AddTab (refWin);
 }
Esempio n. 9
0
 protected void OnActionProductSpecificationActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(ProductSpecification));
     tdiMain.AddTab (refWin);
 }
Esempio n. 10
0
 protected void OnActionOrganizationsActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Organization));
     tdiMain.AddTab (refWin);
 }
Esempio n. 11
0
 protected void OnActionBanksRFActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Bank));
     tdiMain.AddTab (refWin);
 }
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            if(IncomeDoc.Operation == IncomeOperations.Return)
            {
                var selectFromEmployeeDlg = new ReferenceRepresentation (new ViewModel.EmployeeBalanceVM (IncomeDoc.EmployeeCard));
                selectFromEmployeeDlg.Mode = OrmReferenceMode.MultiSelect;
                selectFromEmployeeDlg.ObjectSelected += SelectFromEmployeeDlg_ObjectSelected;

                var dialog = new OneWidgetDialog (selectFromEmployeeDlg);
                dialog.Show ();
                dialog.Run ();
                dialog.Destroy ();
            }

            if(IncomeDoc.Operation == IncomeOperations.Object)
            {
                var selectFromObjectDlg = new ReferenceRepresentation (new ViewModel.ObjectBalanceVM (IncomeDoc.Facility));
                selectFromObjectDlg.Mode = OrmReferenceMode.MultiSelect;
                selectFromObjectDlg.ObjectSelected += SelectFromObjectDlg_ObjectSelected;;

                var dialog = new OneWidgetDialog (selectFromObjectDlg);
                dialog.Show ();
                dialog.Run ();
                dialog.Destroy ();
            }

            if(IncomeDoc.Operation == IncomeOperations.Enter)
            {
                var selectNomenclatureDlg = new OrmReference (typeof(Nomenclature));
                selectNomenclatureDlg.Mode = OrmReferenceMode.MultiSelect;
                selectNomenclatureDlg.ObjectSelected += SelectNomenclatureDlg_ObjectSelected;

                var dialog = new OneWidgetDialog (selectNomenclatureDlg);
                dialog.Show ();
                dialog.Run ();
                dialog.Destroy ();
            }
        }
 void MenuitemSelectFromUnused_Activated(object sender, EventArgs e)
 {
     equipmentToSetSerial = ytreeEquipment.GetSelectedObject<ReceptionEquipmentItemNode>();
     var nomenclature = MyOrmDialog.UoW.GetById<Nomenclature>(equipmentToSetSerial.NomenclatureId);
     var selectUnusedEquipment = new OrmReference(EquipmentRepository.GetUnusedEquipment(nomenclature));
     selectUnusedEquipment.Mode = OrmReferenceMode.Select;
     selectUnusedEquipment.ObjectSelected += SelectUnusedEquipment_ObjectSelected;
     MyTab.TabParent.AddSlaveTab(MyTab, selectUnusedEquipment);
 }
Esempio n. 14
0
 protected void OnAction9Activated(object sender, EventArgs e)
 {
     var refWin = new OrmReference (typeof(Leader));
     var dialog = new OneWidgetDialog (refWin);
     dialog.Show ();
     dialog.Run ();
     dialog.Destroy ();
 }
Esempio n. 15
0
 protected void OnActionNationalityActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Nationality));
     tdiMain.AddTab (refWin);
 }
Esempio n. 16
0
 protected void OnActionNomenclatureActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Nomenclature));
     tdiMain.AddTab (refWin);
 }
Esempio n. 17
0
 protected void OnActionCommentTemplatesActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(CommentTemplate));
     tdiMain.AddTab (refWin);
 }
Esempio n. 18
0
 protected void OnActionPaidRentPackageActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(PaidRentPackage));
     tdiMain.AddTab (refWin);
 }
Esempio n. 19
0
 protected void OnActionCullingCategoryActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(CullingCategory));
     tdiMain.AddTab (refWin);
 }
Esempio n. 20
0
 protected void OnActionRouteColumnsActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(RouteColumn));
     tdiMain.AddTab (refWin);
 }
Esempio n. 21
0
 protected void OnActionDeliveryShiftActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(DeliveryShift));
     tdiMain.AddTab (refWin);
 }
Esempio n. 22
0
 protected void OnActionStatusActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(CounterpartyStatus));
     tdiMain.AddTab (refWin);
 }
Esempio n. 23
0
 protected void OnActionEmploeyActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Employee));
     tdiMain.AddTab (refWin);
 }
Esempio n. 24
0
 protected void OnActionWarehousesActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(Warehouse));
     tdiMain.AddTab (refWin);
 }
Esempio n. 25
0
 protected void OnActionEquipmentTypesActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(EquipmentType));
     tdiMain.AddTab (refWin);
 }
Esempio n. 26
0
 protected void OnActionLogisticsAreaActivated(object sender, EventArgs e)
 {
     OrmReference refWin = new OrmReference (typeof(LogisticsArea));
     tdiMain.AddTab (refWin);
 }
        void NomenclatureSelected(object sender, OrmReferenceObjectSectedEventArgs e)
        {
            if ((e.Subject as Nomenclature).Serial) {
                ITdiTab mytab = TdiHelper.FindMyTab (this);
                if (mytab == null) {
                    logger.Warn ("Родительская вкладка не найдена.");
                    return;
                }

                var invoices = DocumentUoW.Session.CreateCriteria (typeof(IncomingInvoice)).List<IncomingInvoice> ();
                //TODO FIXME !IMPORTANT! В этот фильтр следует добавлять
                //все возможные списки с оборудованием, которые будут появляться.
                //Чтобы исключить возможность добавления во входящую накладную
                //уже использующегося и зачисленного на предприятие оборудования.
                List<int> usedItems = new List<int> ();
                foreach (IncomingInvoice i in invoices) {
                    foreach (IncomingInvoiceItem item in i.Items) {
                        if (item.Equipment != null)
                            usedItems.Add (item.Equipment.Id);
                    }
                }
                ICriteria ItemsCriteria = DocumentUoW.Session.CreateCriteria (typeof(Equipment))
                    .Add (Restrictions.Eq ("Nomenclature", e.Subject))
                    .Add (Restrictions.Not (Restrictions.In ("Id", usedItems)));

                OrmReference SelectDialog = new OrmReference (typeof(Equipment), DocumentUoW, ItemsCriteria);
                SelectDialog.Mode = OrmReferenceMode.Select;
                SelectDialog.ButtonMode = ReferenceButtonMode.TreatEditAsOpen | ReferenceButtonMode.CanEdit;

                SelectDialog.ObjectSelected += (s, ev) => DocumentUoW.Root.AddItem (new IncomingInvoiceItem {
                    Nomenclature = (ev.Subject as Equipment).Nomenclature,
                    Equipment = ev.Subject as Equipment,
                    Amount = 1,
                    Price = 0
                });

                mytab.TabParent.AddSlaveTab (mytab, SelectDialog);

            } else {
                DocumentUoW.Root.AddItem (new IncomingInvoiceItem {
                    Nomenclature = e.Subject as Nomenclature,
                    Equipment = null,
                    Amount = 0, Price = 0
                });
            }
        }