コード例 #1
0
 protected void OnButtonBottleDelFineClicked(object sender, EventArgs e)
 {
     OrmMain.DeleteObject <Fine>(Entity.BottleFine.Id, UoW);
     Entity.BottleFine = null;
     CalculateTotal();
     UpdateButtonState();
 }
コード例 #2
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = TdiHelper.FindMyTab(this);

            if (mytab == null)
            {
                return;
            }

            var parentDlg = OrmMain.FindMyDialog(this);

            if (parentDlg == null)
            {
                return;
            }

            if (parentDlg.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(parentDlg.EntityObject.GetType(), typeof(Contact)))
                {
                    parentDlg.UoW.Save();
                }
                else
                {
                    return;
                }
            }

            ITdiDialog dlg = new ContactDlg(CounterpartyUoW.Root);

            mytab.TabParent.AddTab(dlg, mytab);
        }
コード例 #3
0
        static void CreateBaseConfig()
        {
            logger.Info("Настройка параметров базы...");

            // Настройка ORM
            var db = FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard
                     .ConnectionString(QSMain.ConnectionString)
                     .ShowSql()
                     .FormatSql();

            OrmMain.ConfigureOrm(db, new System.Reflection.Assembly[] {
                System.Reflection.Assembly.GetAssembly(typeof(MainClass)),
            });
            OrmMain.ClassMappingList = new List <IOrmObjectMapping> {
                //Простые справочники
                OrmObjectMapping <User> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <Provider> .Create().DefaultTableView().SearchColumn("Название", x => x.Name).End(),
                OrmObjectMapping <BodyMaterial> .Create().Dialog <BodyMaterialDlg>().DefaultTableView().SearchColumn("Русское название", x => x.NameRus).SearchColumn("Английское название", x => x.NameEng).End(),
                OrmObjectMapping <Conductor> .Create().Dialog <ConductorDlg>().DefaultTableView().SearchColumn("Русское название", x => x.NameRus).SearchColumn("Английское название", x => x.NameEng).End(),
                OrmObjectMapping <Fittings.Domain.ConnectionType> .Create().Dialog <ConnectionTypeDlg>().DefaultTableView().SearchColumn("Русское название", x => x.NameRus).SearchColumn("Английское название", x => x.NameEng).End(),
                OrmObjectMapping <FittingType> .Create().Dialog <FittingTypeDlg>().DefaultTableView().SearchColumn("Кат. №", x => x.ModelCode).SearchColumn("Русское название", x => x.NameRus).SearchColumn("Английское название", x => x.NameEng).End(),
                OrmObjectMapping <Pressure> .Create().Dialog <PressureDlg>().DefaultTableView().SearchColumn("PN", x => x.Pn).SearchColumn("class", x => x.Pclass).OrderAsc(x => x.Pn).End(),
                OrmObjectMapping <Diameter> .Create().Dialog <DiameterDlg>().DefaultTableView().SearchColumn("Дюймы", x => x.Inch).SearchColumn("Миллиметры", x => x.DN).OrderAsc(x => x.Mm).End(),
                OrmObjectMapping <Fitting> .Create().Dialog <FittingDlg>().DefaultTableView().SearchColumn("Код", x => x.Id.ToString()).SearchColumn("Артикул", x => x.Code).End(),
                OrmObjectMapping <Project> .Create().Dialog <ProjectDlg>().UseSlider(false).DefaultTableView().SearchColumn("Заказчик", x => x.Customer).SearchColumn("Название проекта", x => x.ProjectName).End(),
                OrmObjectMapping <Price> .Create().Dialog <PriceDlg>().DefaultTableView().SearchColumn("Дата", x => x.Date.ToString("d")).SearchColumn("Комментарий", x => x.Comment).SearchColumn("Поставщик", x => x.Provider.Name).End(),
            };
        }
コード例 #4
0
        public void Save <TEntity> (TEntity entity, bool orUpdate = true) where TEntity : IDomainObject
        {
            if (!orUpdate)
            {
                throw new NotImplementedException("orUpdate = false не реализовано для ChildUnitOfWork");
            }

            if (RootObject.Equals(entity))
            {
                if (externalRootVersion == null)
                {
                    externalRootVersion = Root;
                }
                else
                {
                    ObjectCloner.FieldsCopy(Root, ref externalRootVersion);
                }
                ObjectToSave.Add(externalRootVersion);
                Commit();
                OrmMain.DelayedNotifyObjectUpdated(ParentUoW.RootObject, entity);
            }
            else
            {
                ObjectToSave.Add(entity);
                OrmMain.DelayedNotifyObjectUpdated(RootObject, entity);
            }
        }
コード例 #5
0
 protected void OnButtonDeleteClicked(object sender, EventArgs e)
 {
     if (OrmMain.DeleteObject <ServiceClaim>(tableServiceClaims.GetSelectedObject <ServiceClaimVMNode>().Id))
     {
         tableServiceClaims.RepresentationModel.UpdateNodes();
     }
 }
コード例 #6
0
        void ConfigureDlg()
        {
            enumcomboOperation.ItemsEnum = typeof(ExpenseType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();

            var filterCasher = new EmployeeFilter(UoW);

            filterCasher.ShowFired           = false;
            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            var filterEmployee = new EmployeeFilter(UoW);

            filterEmployee.ShowFired           = false;
            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filterEmployee);
            yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();
            yentryEmployee.ChangedByUser += (sender, e) => UpdateEmployeeBalaceInfo();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            OrmMain.GetObjectDescription <ExpenseCategory> ().ObjectUpdated += OnExpenseCategoryUpdated;
            OnExpenseCategoryUpdated(null, null);
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            ExpenseType type = (ExpenseType)enumcomboOperation.SelectedItem;

            ylabelEmployeeWageBalance.Visible = type == ExpenseType.EmployeeAdvance ||
                                                type == ExpenseType.Salary;
            UpdateEmployeeBalaceInfo();
        }
コード例 #7
0
 void OpenCounterparty(object sender, EventArgs e)
 {
     TabParent.OpenTab(
         OrmMain.GenerateDialogHashName <Counterparty>(Entity.Counterparty.Id),
         () => new CounterpartyDlg(Entity.Counterparty.Id)
         );
 }
コード例 #8
0
        public CashFlow(
            ISubdivisionRepository subdivisionRepository, ICommonServices commonServices, ICategoryRepository categoryRepository)
        {
            _subdivisionRepository = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

            if (categoryRepository == null)
            {
                throw new ArgumentNullException(nameof(categoryRepository));
            }

            Build();

            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            comboPart.ItemsEnum            = typeof(ReportParts);
            comboIncomeCategory.ItemsList  = categoryRepository.IncomeCategories(UoW);
            comboExpenseCategory.Sensitive = comboIncomeCategory.Sensitive = false;
            var now = DateTime.Now;

            dateStart.Date = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
            dateEnd.Date   = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);

            var officeFilter = new EmployeeFilterViewModel();

            officeFilter.SetAndRefilterAtOnce(
                x => x.Status           = EmployeeStatus.IsWorking,
                x => x.RestrictCategory = EmployeeCategory.office);
            var employeeFactory = new EmployeeJournalFactory(officeFilter);

            evmeCashier.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory());

            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());

            var recurciveConfig = OrmMain.GetObjectDescription <ExpenseCategory>().TableView.RecursiveTreeConfig;
            var list            = categoryRepository.ExpenseCategories(UoW);

            list.Insert(0, allItem);
            var model = recurciveConfig.CreateModel((IList)list);

            comboExpenseCategory.Model = model.Adapter;
            comboExpenseCategory.PackStart(new CellRendererText(), true);
            comboExpenseCategory.SetCellDataFunc(comboExpenseCategory.Cells[0], HandleCellLayoutDataFunc);
            comboExpenseCategory.SetActiveIter(model.IterFromNode(allItem));

            UserSubdivisions = GetSubdivisionsForUser();
            specialListCmbCashSubdivisions.SetRenderTextFunc <Subdivision>(s => s.Name);
            specialListCmbCashSubdivisions.ItemsList = UserSubdivisions;

            ylblOrganisations.Visible = specialListCmbOrganisations.Visible = false;
            Organisations             = UoW.GetAll <Organization>();
            specialListCmbOrganisations.SetRenderTextFunc <Organization>(s => s.Name);
            specialListCmbOrganisations.ItemsList = Organisations;

            int  currentUserId = commonServices.UserService.CurrentUserId;
            bool canCreateCashReportsForOrganisations =
                commonServices.PermissionService.ValidateUserPresetPermission("can_create_cash_reports_for_organisations", currentUserId);

            checkOrganisations.Visible  = canCreateCashReportsForOrganisations;
            checkOrganisations.Toggled += CheckOrganisationsToggled;
        }
コード例 #9
0
ファイル: AdvanceReportDlg.cs プロジェクト: Enzogord/Vodovoz
        void ConfigureDlg()
        {
            var filterEmployee = new EmployeeFilter(UoW);

            filterEmployee.ShowFired           = false;
            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filterEmployee);
            yentryEmployee.Binding.AddBinding(Entity, e => e.Accountable, w => w.Subject).InitializeFromSource();

            var filterCasher = new EmployeeFilter(UoW);

            filterCasher.ShowFired           = false;
            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, e => e.Casher, w => w.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            OrmMain.GetObjectDescription <ExpenseCategory>().ObjectUpdated += OnExpenseCategoryUpdated;
            OnExpenseCategoryUpdated(null, null);
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <RecivedAdvance>()
                                           .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing()
                                           .AddColumn("Дата").AddTextRenderer(a => a.Advance.Date.ToString())
                                           .AddColumn("Получено").AddTextRenderer(a => a.Advance.Money.ToString("C"))
                                           .AddColumn("Непогашено").AddTextRenderer(a => a.Advance.UnclosedMoney.ToString("C"))
                                           .AddColumn("Статья").AddTextRenderer(a => a.Advance.ExpenseCategory.Name)
                                           .AddColumn("Основание").AddTextRenderer(a => a.Advance.Description)
                                           .Finish();
        }
コード例 #10
0
 protected void OnButtonDeleteClicked(object sender, EventArgs e)
 {
     if (OrmMain.DeleteObject(typeof(CounterpartyContract),
                              treeCounterpartyContracts.GetSelectedId()))
     {
         treeCounterpartyContracts.RepresentationModel.UpdateNodes();
     }
 }
コード例 #11
0
 protected void OnButtonDeleteClicked(object sender, EventArgs e)
 {
     if (OrmMain.DeleteObject(typeof(DeliveryPoint),
                              treeDeliveryPoints.GetSelectedId()))
     {
         treeDeliveryPoints.RepresentationModel.UpdateNodes();
     }
 }
コード例 #12
0
        protected void OnButtonAddEnumItemClicked(object sender, QS.Widgets.EnumItemClickedEventArgs e)
        {
            ProxyDocumentType type = (ProxyDocumentType)e.ItemEnum;
            var dlg = OrmMain.CreateObjectDialog(ProxyDocument.GetProxyDocumentClass(type));

            dlg.EntitySaved += Dlg_EntitySaved;
            TabParent.AddSlaveTab(this, dlg);
        }
コード例 #13
0
 protected void OnButtonDeleteClicked(object sender, EventArgs e)
 {
     if (OrmMain.DeleteObject(typeof(Proxy),
                              datatreeviewProxies.GetSelectedId()))
     {
         datatreeviewProxies.RepresentationModel.UpdateNodes();
     }
 }
コード例 #14
0
ファイル: AtWorksDlg.cs プロジェクト: Enzogord/Vodovoz
        protected void OnButtonOpenCarClicked(object sender, EventArgs e)
        {
            var selected = ytreeviewAtWorkDrivers.GetSelectedObjects <AtWorkDriver>();

            TabParent.OpenTab(OrmMain.GenerateDialogHashName <Car>(selected[0].Car.Id),
                              () => new CarsDlg(selected[0].Car)
                              );
        }
コード例 #15
0
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var item = tableWarehouses.GetSelectedObject <SubdivisionWithWarehousesVMNode>();

            if (item.WarehouseId.HasValue && OrmMain.DeleteObject <Warehouse>(item.WarehouseId.Value))
            {
                tableWarehouses.RepresentationModel.UpdateNodes();
            }
        }
コード例 #16
0
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var deliveryPoint = treeDeliveryPoints.GetSelectedObject <DeliveryPoint>();

            if (OrmMain.DeleteObject(typeof(DeliveryPoint), deliveryPoint.Id))
            {
                UpdateNodes();
            }
        }
コード例 #17
0
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var item = tableDocuments.GetSelectedObject <ProxyDocumentsVMNode>();

            if (OrmMain.DeleteObject(ProxyDocument.GetProxyDocumentClass(item.Type), item.Id))
            {
                tableDocuments.RepresentationModel.UpdateNodes();
            }
        }
コード例 #18
0
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var item = tableWarehouses.GetSelectedObject <SubdivisionWithWarehousesVMNode>();

            if (item.WarehouseId.HasValue && OrmMain.DeleteObject <Warehouse>(item.WarehouseId.Value))
            {
                DisposeUowAndUpdate();
            }
        }
コード例 #19
0
        private void ConfigureActions()
        {
            MenuButton addDocumentButton = new MenuButton();

            addDocumentButton.Label = "Добавить";
            Menu addDocumentActions = new Menu();

            foreach (var item in RepresentationModel.NewEntityActionsConfigs)
            {
                var menuItem = new MenuItem(item.Title);
                menuItem.Activated += (sender, e) => {
                    TabParent.OpenTab(DialogHelper.GenerateDialogHashName(item.EntityType, 0),
                                      item.GetNewEntityDlg,
                                      this
                                      );
                };
                SetCreateActionsSensitiveFunc(menuItem, item.EntityType);
                addDocumentActions.Add(menuItem);
            }
            addDocumentButton.Menu = addDocumentActions;
            addDocumentActions.ShowAll();
            hboxButtonActions.Add(addDocumentButton);
            Box.BoxChild addDocumentButtonBox = (Box.BoxChild)hboxButtonActions[addDocumentButton];
            addDocumentButtonBox.Expand = false;
            addDocumentButtonBox.Fill   = false;

            Button editDocumentbutton = new Button();

            editDocumentbutton.Label    = "Редактировать";
            editDocumentbutton.Clicked += (sender, e) => {
                OpenDocument();
            };
            SetOpenActionSensitiveFunc(editDocumentbutton);
            hboxButtonActions.Add(editDocumentbutton);
            Box.BoxChild editDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[editDocumentbutton];
            editDocumentbuttonBox.Expand = false;
            editDocumentbuttonBox.Fill   = false;

            Button deleteDocumentbutton = new Button();

            deleteDocumentbutton.Label    = "Удалить";
            deleteDocumentbutton.Clicked += (sender, e) => {
                var selectedObject = tableview.GetSelectedObject();
                if (OrmMain.DeleteObject(RepresentationModel.GetEntityType(selectedObject), RepresentationModel.GetDocumentId(selectedObject)))
                {
                    RepresentationModel.UpdateNodes();
                }
            };
            SetDeleteActionSensitiveFunc(deleteDocumentbutton);
            hboxButtonActions.Add(deleteDocumentbutton);
            Box.BoxChild deleteDocumentbuttonBox = (Box.BoxChild)hboxButtonActions[deleteDocumentbutton];
            deleteDocumentbuttonBox.Expand = false;
            deleteDocumentbuttonBox.Fill   = false;

            hboxButtonActions.ShowAll();
        }
コード例 #20
0
ファイル: CashIncomeDlg.cs プロジェクト: Enzogord/Vodovoz
        void ConfigureDlg()
        {
            enumcomboOperation.ItemsEnum = typeof(IncomeType);
            enumcomboOperation.Binding.AddBinding(Entity, s => s.TypeOperation, w => w.SelectedItem).InitializeFromSource();

            var filterCasher = new EmployeeFilter(UoW);

            filterCasher.ShowFired           = false;
            yentryCasher.RepresentationModel = new ViewModel.EmployeesVM(filterCasher);
            yentryCasher.Binding.AddBinding(Entity, s => s.Casher, w => w.Subject).InitializeFromSource();

            var filter = new EmployeeFilter(UoW);

            filter.ShowFired = false;
            yentryEmployee.RepresentationModel = new ViewModel.EmployeesVM(filter);
            yentryEmployee.Binding.AddBinding(Entity, s => s.Employee, w => w.Subject).InitializeFromSource();

            var filterRL = new RouteListsFilter(UoW);

            filterRL.OnlyStatuses = new RouteListStatus[] { RouteListStatus.EnRoute, RouteListStatus.OnClosing };
            yEntryRouteList.RepresentationModel = new ViewModel.RouteListsVM(filterRL);
            yEntryRouteList.Binding.AddBinding(Entity, s => s.RouteListClosing, w => w.Subject).InitializeFromSource();
            yEntryRouteList.CanEditReference = QSMain.User.Permissions["can_delete"];

            yEntryRouteList.Hidden        += YEntryRouteList_ValueOrVisibilityChanged;
            yEntryRouteList.Shown         += YEntryRouteList_ValueOrVisibilityChanged;
            yEntryRouteList.ChangedByUser += YEntryRouteList_ValueOrVisibilityChanged;

            yentryClient.ItemsQuery = Repository.CounterpartyRepository.ActiveClientsQuery();
            yentryClient.Binding.AddBinding(Entity, s => s.Customer, w => w.Subject).InitializeFromSource();

            ydateDocument.Binding.AddBinding(Entity, s => s.Date, w => w.Date).InitializeFromSource();

            OrmMain.GetObjectDescription <ExpenseCategory> ().ObjectUpdated += OnExpenseCategoryUpdated;
            OnExpenseCategoryUpdated(null, null);
            comboExpense.Binding.AddBinding(Entity, s => s.ExpenseCategory, w => w.SelectedItem).InitializeFromSource();

            OrmMain.GetObjectDescription <IncomeCategory> ().ObjectUpdated += OnIncomeCategoryUpdated;
            OnIncomeCategoryUpdated(null, null);
            comboCategory.Binding.AddBinding(Entity, s => s.IncomeCategory, w => w.SelectedItem).InitializeFromSource();

            checkNoClose.Binding.AddBinding(Entity, e => e.NoFullCloseMode, w => w.Active);

            yspinMoney.Binding.AddBinding(Entity, s => s.Money, w => w.ValueAsDecimal).InitializeFromSource();

            ytextviewDescription.Binding.AddBinding(Entity, s => s.Description, w => w.Buffer.Text).InitializeFromSource();

            ytreeviewDebts.ColumnsConfig = ColumnsConfigFactory.Create <Selectable <Expense> > ()
                                           .AddColumn("Закрыть").AddToggleRenderer(a => a.Selected).Editing()
                                           .AddColumn("Дата").AddTextRenderer(a => a.Value.Date.ToString())
                                           .AddColumn("Получено").AddTextRenderer(a => a.Value.Money.ToString("C"))
                                           .AddColumn("Непогашено").AddTextRenderer(a => a.Value.UnclosedMoney.ToString("C"))
                                           .AddColumn("Статья").AddTextRenderer(a => a.Value.ExpenseCategory.Name)
                                           .AddColumn("Основание").AddTextRenderer(a => a.Value.Description)
                                           .Finish();
        }
コード例 #21
0
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            var  node          = (ViewModel.AccountingVMNode)tableAccountingOperations.GetSelectedNode();
            Type operationType = node.Expense == 0 ? typeof(AccountIncome) : typeof(AccountExpense);

            if (OrmMain.DeleteObject(operationType, tableAccountingOperations.GetSelectedId()))
            {
                tableAccountingOperations.RepresentationModel.UpdateNodes();
            }
        }
コード例 #22
0
        public void Destroy()
        {
            logger.Debug("{0} called Destroy()", this.GetType());
            var description = OrmMain.GetObjectDescription <TEntity> ();

            if (description != null)
            {
                description.ObjectUpdatedGeneric -= OnExternalUpdate;
            }
        }
コード例 #23
0
 protected void OnButtonEditClicked(object sender, EventArgs e)
 {
     if (tableDocuments.GetSelectedObjects().GetLength(0) > 0)
     {
         int id = (tableDocuments.GetSelectedObjects()[0] as ProxyDocumentsVMNode).Id;
         ProxyDocumentType type = (tableDocuments.GetSelectedObjects()[0] as ProxyDocumentsVMNode).Type;
         var dlg = OrmMain.CreateObjectDialog(ProxyDocument.GetProxyDocumentClass(type), id);
         dlg.EntitySaved += Dlg_EntitySaved;
         TabParent.AddSlaveTab(this, dlg);
     }
 }
コード例 #24
0
ファイル: AtWorksDlg.cs プロジェクト: Enzogord/Vodovoz
        protected void OnButtonOpenDriverClicked(object sender, EventArgs e)
        {
            var selected = ytreeviewAtWorkDrivers.GetSelectedObjects <AtWorkDriver>();

            foreach (var one in selected)
            {
                TabParent.OpenTab(OrmMain.GenerateDialogHashName <Employee>(one.Employee.Id),
                                  () => new EmployeeDlg(one.Employee.Id)
                                  );
            }
        }
コード例 #25
0
        public void OpenEntityDlg(int id)
        {
            if (OrmMain.GetObjectDescription(typeof(TEntity)).SimpleDialog)
            {
                EntityEditSimpleDialog.RunSimpleDialog((GetMyTab().TabParent as Widget).Toplevel as Window, typeof(TEntity), id);
                return;
            }

            ITdiTab dlg = OrmMain.CreateObjectDialog(typeof(TEntity), id);

            GetMyTab().TabParent.AddTab(dlg, GetMyTab());
        }
コード例 #26
0
        public bool Save()
        {
            var valid = new QSValidator <FreeRentEquipment> (subject);

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

            subject.IsNew = false;
            OrmMain.DelayedNotifyObjectUpdated(ParentReference.ParentObject, subject);
            return(true);
        }
コード例 #27
0
 public void Destroy()
 {
     logger.Debug("{0} called Destroy()", this.GetType());
     base.Destroy();
     foreach (var type in subcribeOnTypes)
     {
         var map = OrmMain.GetObjectDescription(type);
         if (map != null)
         {
             map.ObjectUpdated -= OnExternalUpdateCommon;
         }
     }
 }
コード例 #28
0
        /// <summary>
        /// Создает новый базовый клас и подписывается на обновления для типа TEntity, при этом конструкторе необходима реализация NeedUpdateFunc (TEntity updatedSubject)
        /// </summary>
        protected RepresentationModelEntityBase()
        {
            var description = OrmMain.GetObjectDescription <TEntity> ();

            if (description != null)
            {
                description.ObjectUpdatedGeneric += OnExternalUpdate;
            }
            else
            {
                logger.Warn("Невозможно подписаться на обновления класа {0}. Не найден класс маппинга.", typeof(TEntity));
            }
        }
コード例 #29
0
        protected void OnButtonRemoveItemClicked(object sender, EventArgs e)
        {
            var annex = ytreeAnnexes.GetSelectedObject <RegulationDocAnnex>();

            if (annex.Id > 0)
            {
                OrmMain.DeleteObject(annex, UoW, () => Entity.RemoveAnnex(annex));
            }
            else
            {
                Entity.RemoveAnnex(annex);
            }
        }
コード例 #30
0
ファイル: AccountsView.cs プロジェクト: Enzogord/QSProjects
        protected void OnButtonDeleteClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                return;
            }

            if (OrmMain.DeleteObject(typeof(Account), (datatreeviewAccounts.GetSelectedObjects() [0] as Account).Id))
            {
                accountOwner.ObservableAccounts.Remove(datatreeviewAccounts.GetSelectedObjects() [0] as Account);
            }
        }