Exemplo n.º 1
0
 private void UpdateOrders()
 {
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         IList <fmCSubject> subjs = os.GetObjects <fmCSubject>();
         foreach (fmCSubject subj in subjs)
         {
             if (subj.Direction != null)
             {
                 subj.TrwCodeReNumber();
             }
             foreach (crmContractDeal deal in subj.Deals)
             {
                 subj.DealsAdd(deal);
             }
         }
         IList <TrwOrder> trw_orders = os.GetObjects <TrwOrder>();
         foreach (TrwOrder trw_order in trw_orders)
         {
             if (trw_order.TrwInternalNumber == 0)
             {
                 Int32 int_num = 0;
                 if (Int32.TryParse(trw_order.TrwCode.Split('/')[1], out int_num))
                 {
                     trw_order.TrwInternalNumberSet(int_num);
                 }
             }
             trw_order.UpdatePropertys();
         }
         os.CommitChanges();
     }
 }
Exemplo n.º 2
0
 private void UpdateEditAllRole()
 {
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         csCSecurityRole EditAllRole = os.FindObject <csCSecurityRole>(
             new BinaryOperator("Name", ConfigurationManager.AppSettings["SecurityGroups.EditAllRole"]), true);
         if (EditAllRole == null)
         {
             EditAllRole      = os.CreateObject <csCSecurityRole>();
             EditAllRole.Name = ConfigurationManager.AppSettings["SecurityGroups.EditAllRole"];
         }
         EditAllRole.BeginUpdate();
         //
         EditAllRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Read);
         EditAllRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Write);
         EditAllRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Create);
         EditAllRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Delete);
         EditAllRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Navigate);
         //
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityRole), SecurityOperations.Read);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityRole), SecurityOperations.Write);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityRole), SecurityOperations.Create);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityRole), SecurityOperations.Delete);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityRole), SecurityOperations.Navigate);
         //
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityUser), SecurityOperations.Read);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityUser), SecurityOperations.Write);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityUser), SecurityOperations.Create);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityUser), SecurityOperations.Delete);
         EditAllRole.Permissions.DenyRecursive(typeof(IntecoAG.ERM.CS.Security.csCSecurityUser), SecurityOperations.Navigate);
         //
         EditAllRole.EndUpdate();
         os.CommitChanges();
     }
 }
Exemplo n.º 3
0
 private void UpdateContractDeals()
 {
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         crmUserParty cfr = os.GetObjects <crmUserParty>().FirstOrDefault(x => x.Party.Code == "2518");
         cfr.TrwCode = "15";
         IList <crmContractDeal> deals = os.GetObjects <crmContractDeal>();
         foreach (crmContractDeal deal in deals)
         {
             if (deal.Current != null)
             {
                 if (deal.Current.Customer != null)
                 {
                     deal.Current.Customer.ContractDeal         = deal;
                     deal.Current.Customer.TrwContractPartyType = TrwContractPartyType.PARTY_CUSTOMER;
                     if (cfr.Party == deal.Current.Customer.Party)
                     {
                         deal.Current.Customer.CfrUserParty = cfr;
                     }
                 }
                 if (deal.Current.Supplier != null)
                 {
                     deal.Current.Supplier.ContractDeal         = deal;
                     deal.Current.Supplier.TrwContractPartyType = TrwContractPartyType.PARTY_SUPPLIER;
                     if (cfr.Party == deal.Current.Supplier.Party)
                     {
                         deal.Current.Supplier.CfrUserParty = cfr;
                     }
                 }
             }
         }
         os.CommitChanges();
     }
 }
Exemplo n.º 4
0
        //public void UpdateContractDeal(IObjectSpace os) {
        //    foreach (crmContractDeal deal in os.GetObjects<crmContractDeal>(
        //            new UnaryOperator(UnaryOperatorType.IsNull, "Current.ContractDeal"))) {
        //                if (deal.Current != null && deal.Current.ContractDeal == null) {
        //                    deal.Current.ContractDeal = deal;
        //                }
        //    }
        //}

        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            if (this.CurrentDBVersion != new Version("1.1.1.239"))
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                foreach (var org in os.GetObjects <crmUserParty>())
                {
                    if (org.AccountingContract == null)
                    {
                        org.AccountingContractSet(os.CreateObject <FmAccountingContract>());
                        org.AccountingContract.Person = org.Party.Person;
                    }
                    if (org.AccountingFact == null)
                    {
                        org.AccountingFactSet(os.CreateObject <FmAccountingFinancial>());
                        org.AccountingFact.JournalTypeAccounting = JournalTypeAccounting.FM_JTA_FINANCIAL;
                        org.AccountingFact.Person = org.Party.Person;
                    }
                }
                os.CommitChanges();
            }
        }
Exemplo n.º 5
0
        private void UpdateNomenclatures()
        {
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                IList <csService> nom_mat = os.GetObjects <csService>();
                foreach (csService nom in nom_mat)
                {
                    if (nom.Code == null)
                    {
                        nom.Code = "";
                    }
                    if (nom.Code.Length > 0 && nom.Code.Length < 5)
                    {
                        nom.Code = '9' + nom.Code.PadLeft(4, '0');
                    }
                    nom.TrwMeasurementUnit = TrwSaleNomenclatureMeasurementUnit.SALE_NOMENCLATURE_MEASUREMET_UNIT_WORK;
                }
                IList <crmDeliveryItem> items = os.GetObjects <crmDeliveryItem>();
                foreach (crmDeliveryItem item in items)
                {
                    item.UpdateTrwNomenclature();
                }
                IList <TrwSaleNomenclature> sale_noms = os.GetObjects <TrwSaleNomenclature>(null, true);
                foreach (TrwSaleNomenclature nom in sale_noms)
                {
                    nom.TrwExportStateSet(Trw.Exchange.TrwExchangeExportStates.CREATED);
                    nom.UpdatePropertys();
                }

                os.CommitChanges();
            }
        }
Exemplo n.º 6
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable version
            if (this.CurrentDBVersion != new Version("1.1.1.223"))
            {
                return;
            }
            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                IList <TrwBudgetPeriod> periods = os.GetObjects <TrwBudgetPeriod>();

                foreach (TrwBudgetPeriod period in periods)
                {
                    period.InitPeriodValues();
                }

                IList <TrwSubject> trw_subjects = os.GetObjects <TrwSubject>();
                foreach (TrwSubject trw_subj in trw_subjects)
                {
                    trw_subj.Subjects.Add(trw_subj.Subject);
                    foreach (TrwSubjectDealSale trw_deal_sale in trw_subj.DealsSale)
                    {
                        trw_deal_sale.Subject = trw_subj.Subject;
                    }
                    foreach (TrwSubjectDealBay trw_deal_bay in trw_subj.DealsBay)
                    {
                        trw_deal_bay.Subject = trw_subj.Subject;
                    }
                }
                os.CommitChanges();
            }
        }
Exemplo n.º 7
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable version
            if (this.CurrentDBVersion != new Version("0.0.0.0"))
            {
                return;
            }
            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                csValuta val_rub = os.FindObject <csValuta>(
                    XPQuery <csValuta> .TransformExpression(((ObjectSpace)os).Session,
                                                            val => val.Code == "RUB"));
//                fmCAVTInvoiceVersion ver;
                IList <fmCAVTInvoiceVersion> ver_list = os.GetObjects <fmCAVTInvoiceVersion>(
                    XPQuery <fmCAVTInvoiceVersion> .TransformExpression(((ObjectSpace)os).Session,
                                                                        inv => inv.Valuta == null));
                foreach (fmCAVTInvoiceVersion ver in ver_list)
                {
                    ver.Valuta = val_rub;
                }
                os.CommitChanges();
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                IList <fmCAVTInvoiceBase> inv_list = os.GetObjects <fmCAVTInvoiceBase>(new UnaryOperator(UnaryOperatorType.IsNull, "InvoiceIntType"));
                foreach (fmCAVTInvoiceBase inv in inv_list)
                {
                    inv.InvoiceIntType = fmCAVTInvoiceIntType.NORMAL;
                }
                os.CommitChanges();
            }
            ObjectSpace.CommitChanges();
        }
Exemplo n.º 8
0
 /// <summary>
 /// Обновим права администратора, для политики Windows Autentication пользователь с административными
 /// правами создается автоматически, а вот список прав не обновляется
 /// Паша!!! Реализация не учитывает вариантов в системе безопасности и использует стандартный класс роли
 /// или его производные
 /// </summary>
 private void UpdateAdminRole()
 {
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         csCSecurityRole administratorRole = os.FindObject <csCSecurityRole>(
             new BinaryOperator("Name", SecurityStrategy.AdministratorRoleName), true);
         if (administratorRole == null)
         {
             administratorRole      = os.CreateObject <csCSecurityRole>();
             administratorRole.Name = SecurityStrategy.AdministratorRoleName;
             ModelOperationPermissionData modelPermission =
                 os.CreateObject <ModelOperationPermissionData>();
             administratorRole.PersistentPermissions.Add(modelPermission);
         }
         administratorRole.BeginUpdate();
         administratorRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Read);
         administratorRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Write);
         administratorRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Create);
         administratorRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Delete);
         administratorRole.Permissions.GrantRecursive(typeof(object), SecurityOperations.Navigate);
         administratorRole.EndUpdate();
         if (administratorRole.Users.Count == 0)
         {
             // Паша !!! Неустойчивый вариант, нужен код определяющий тип User по конфигу Application
             csCSecurityUser user = os.FindObject <csCSecurityUser>(
                 new BinaryOperator("UserName", ConfigurationManager.AppSettings["DefaultAdminName"]));
             if (user != null)
             {
                 user.Roles.Add(administratorRole);
             }
         }
         os.CommitChanges();
     }
 }
Exemplo n.º 9
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable version
            if (this.CurrentDBVersion != new Version("1.1.1.232"))
            {
                return;
            }
            FileInfo fi  = new FileInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            String   dir = fi.Directory.FullName + "\\Import\\";

            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                var service_importer = new NomenclatureImporter <SimpleAnalyticRecord>();
                service_importer.Import(os, dir + "csNomWork.csv");

                //
                IList <fmCSubject> subjects = os.GetObjects <fmCSubject>();
                foreach (fmCSubject subj in subjects)
                {
                    if (subj.SourceDeal != null)
                    {
                        subj.Deals.Add(subj.SourceDeal);
                    }
                }
                os.CommitChanges();
            }
        }
Exemplo n.º 10
0
        private void popupShowTicketComment_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            //IObjectSpace objectSpace = Application.CreateObjectSpace(ticketCommentType);
            IObjectSpace   objectSpace = ObjectSpace.CreateNestedObjectSpace();
            ITicketComment pca         = objectSpace.CreateObject(ticketCommentType) as ITicketComment;

            e.View = Application.CreateDetailView(objectSpace, pca, true);
        }
        private void ListViewProcessCurrentObjectController_CustomizeShowViewParameters(object sender, CustomizeShowViewParametersEventArgs e)
        {
            var comprobanteItemValor = ( ComprobanteItemValor )e.ShowViewParameters.CreatedView.CurrentObject;
            var nestedObjectSpace    = ObjectSpace.CreateNestedObjectSpace( );

            e.ShowViewParameters.CreatedView          = Application.CreateDetailView(nestedObjectSpace, nestedObjectSpace.GetObject(comprobanteItemValor.Valor), true);
            e.ShowViewParameters.CreateAllControllers = true;
            e.ShowViewParameters.TargetWindow         = TargetWindow.NewModalWindow;
        }
Exemplo n.º 12
0
 private void UpdateTrwOrders()
 {
     //
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         IList <fmCSubject> subjects = os.GetObjects <fmCSubject>();
         foreach (fmCSubject subject in subjects)
         {
             subject.OrderNumberCurrent = subject.TrwOrders.Count;
         }
         os.CommitChanges();
     }
 }
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            fmCAVTBookVAT book = e.CurrentObject as fmCAVTBookVAT;

            if (book == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                fmCAVTBookVATLogic.ImportBuhData(os, os.GetObject <fmCAVTBookVAT>(book));
                os.CommitChanges();
            }
        }
Exemplo n.º 14
0
 public override void UpdateDatabaseAfterUpdateSchema()
 {
     base.UpdateDatabaseAfterUpdateSchema();
     if (this.CurrentDBVersion != new Version("1.1.1.226"))
     {
         return;
     }
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         //
         UpdateTrwSubjects(os);
         os.CommitChanges();
     }
 }
Exemplo n.º 15
0
 public override void UpdateDatabaseAfterUpdateSchema()
 {
     base.UpdateDatabaseAfterUpdateSchema();
     // Disable version
     if (this.CurrentDBVersion != new Version("1.1.1.238"))
     {
         return;
     }
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         UpdatePaymentRequest(os);
         os.CommitChanges();
     }
 }
Exemplo n.º 16
0
        private void CalculateAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            TrwBudgetBase budget = e.CurrentObject as TrwBudgetBase;

            if (budget == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                budget = os.GetObject <TrwBudgetBase>(budget);
                budget.Calculate(os);
                os.CommitChanges();
            }
        }
Exemplo n.º 17
0
        private void ConfirmAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            FmFinPlanSubjectDocFull doc = e.CurrentObject as FmFinPlanSubjectDocFull;

            if (doc == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                doc = os.GetObject <FmFinPlanSubjectDocFull>(doc);
                FmFinPlanSubjectDocFullLogic.TransactToSubject(os, doc);
                os.CommitChanges();
            }
        }
Exemplo n.º 18
0
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            fmCAVTInvoiceRegister register = e.CurrentObject as fmCAVTInvoiceRegister;

            if (register == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                register = os.GetObject <fmCAVTInvoiceRegister>(register);
                fmCAVTInvoiceRegisterLogic.ImportBuhData(os, register);
                os.CommitChanges();
            }
        }
Exemplo n.º 19
0
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                ОснованиеЛогика.ImportInvoices(os, dialog.FileName);
                os.CommitChanges();
            }
            ObjectSpace.CommitChanges();
        }
Exemplo n.º 20
0
        private void GetNumberAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            TrwPartyParty party = View.CurrentObject as TrwPartyParty;

            if (party == null)
            {
                return;
            }
//            ObjectSpace.CommitChanges();
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                party = os.GetObject <TrwPartyParty>(party);
                TrwPartyPartyLogic.SetNumbers(os, party, Application.CreateObjectSpace());
                os.CommitChanges();
            }
        }
Exemplo n.º 21
0
        private void ReNumberAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            fmCAVTInvoiceRegister register = e.CurrentObject as fmCAVTInvoiceRegister;

            if (register == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                register = os.GetObject <fmCAVTInvoiceRegister>(register);
                fmCAVTInvoiceRegisterLogic.RegisterLineReNumber(os, register.InLines);
                fmCAVTInvoiceRegisterLogic.RegisterLineReNumber(os, register.OutLines);
                os.CommitChanges();
            }
        }
Exemplo n.º 22
0
        private void ImportBayDealsAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            TrwSubject trw_subj = e.CurrentObject as TrwSubject;

            if (trw_subj == null)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                trw_subj = os.GetObject <TrwSubject>(trw_subj);
                TrwSubjectLogic.FillBayDeals(os, trw_subj, _ImportActionParameters);
                os.CommitChanges();
            }
            _ImportActionParameters = null;
        }
Exemplo n.º 23
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable
            if (this.CurrentDBVersion != new Version("0.0.0.0"))
            {
                return;
            }

            if (this.CurrentDBVersion > new Version("1.1.1.218"))
            {
                return;
            }

            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                foreach (fmCDirection dir in os.GetObjects <fmCDirection>())
                {
                    if (dir.DateEnd < gfmCAnalytic.DateMinValue)
                    {
                        dir.IsPeriodUnlimited = true;
                    }
                }
                foreach (fmCSubjectExt subj in new List <fmCSubjectExt>(os.GetObjects <fmCSubjectExt>()))
                {
                    if (subj.DateEnd < gfmCAnalytic.DateMinValue)
                    {
                        subj.IsPeriodUnlimited = true;
                    }
                    if (subj.Name.ToLower() == "удалить")
                    {
                        subj.Status = fmISubjectStatus.DELETE;
                    }
                    if (subj.Status == fmISubjectStatus.DELETE &&
                        subj.OrderExts.Count == 0)
                    {
                        os.Delete(subj);
                    }
                }
                foreach (fmCOrderExt order in os.GetObjects <fmCOrderExt>(null, true))
                {
                    if (order.DateEnd < gfmCAnalytic.DateMinValue)
                    {
                        order.IsPeriodUnlimited = true;
                    }
                }
                os.CommitChanges();
            }
        }
Exemplo n.º 24
0
 public override void UpdateDatabaseAfterUpdateSchema()
 {
     base.UpdateDatabaseAfterUpdateSchema();
     if (this.CurrentDBVersion != new Version("1.1.1.229"))
     {
         return;
     }
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         //
         FileInfo fi  = new FileInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
         String   dir = fi.Directory.FullName + "\\Import\\";
         //
         new ClassificatorImporter <ReferecesRecord>().Import(os, dir + "fmOrderUpdate001.csv");
         //
         os.CommitChanges();
     }
 }
 private void AutoBinding_Execute(object sender, SimpleActionExecuteEventArgs e)
 {
     foreach (fmCSAStatementAccountDoc doc in e.SelectedObjects)
     {
         //current = View.CurrentObject as fmCSAStatementAccountDoc;
         if (doc == null)
         {
             continue;
         }
         using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
             fmCSAStatementAccountDoc current = os.GetObject <fmCSAStatementAccountDoc>(doc);
             doc.PaymentDocument.AutoBinding(current, null);
             os.CommitChanges();
         }
         ObjectSpace.CommitChanges();
     }
     //DevExpress.XtraEditors.XtraMessageBox.Show("Автоматическая привязка Заявок произведена успешно");
 }
Exemplo n.º 26
0
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            csIImportSupport obj = View.CurrentObject as csIImportSupport;

            if (obj == null)
            {
                return;
            }
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                    obj = os.GetObject(obj);
                    obj.Import(os, dialog.FileName);
                    os.CommitChanges();
                }
            }
        }
Exemplo n.º 27
0
        public static XPBaseObject GetXpObjectByKeyValue(ObjectSpace oSpace, string value, Type type) {
            if (string.IsNullOrEmpty(value))
                return null;

            if (!type.IsSubclassOf(typeof(XPBaseObject)))
                return null;

            var keyPropertyName = oSpace.Session.GetClassInfo(type).
                        PersistentProperties.
                        OfType<XPMemberInfo>().
                        Where(p => p.HasAttribute(typeof(KeyPropertyAttribute))).
                        Select(p => p.Name).
                        FirstOrDefault() ??

                    oSpace.Session.GetClassInfo(type).
                        PersistentProperties.
                        OfType<XPMemberInfo>().
                        Where(p => p.Name == "Name" || p.Name == "Code")
                        .Select(p => p.Name)
                        .FirstOrDefault() ??
                    "Oid";

            var item = (XPBaseObject)oSpace.FindObject(
                                type,
                                new BinaryOperator(keyPropertyName, value),
                                true);
            if (item != null)
                return item;

            var nestedObjectSpace = oSpace.CreateNestedObjectSpace();
            item = (XPBaseObject)nestedObjectSpace.CreateObject(type);
            item.ClassInfo.PersistentProperties.
                OfType<XPMemberInfo>().
                Where(p => p.Name == keyPropertyName).
                FirstOrDefault().
                SetValue(item, value);

            item.Save();
            nestedObjectSpace.CommitChanges();

            return oSpace.GetObject(item);

        }
Exemplo n.º 28
0
        private void ImportAvansAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            fmCAVTInvoiceRegister register = e.CurrentObject as fmCAVTInvoiceRegister;

            if (register == null)
            {
                return;
            }
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                fmCAVTInvoiceRegisterLogic.ImportAvansData(os, dialog.FileName);
                os.CommitChanges();
            }
        }
Exemplo n.º 29
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable version
            if (this.CurrentDBVersion != new Version("1.1.1.220"))
            {
                return;
            }
            //
            FileInfo fi  = new FileInfo(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            String   dir = fi.Directory.FullName + "\\Import\\";

            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                var imp_fiv = new FAAccountImporter();
                imp_fiv.Import(os, "1000", dir + "fmCFAAccount.csv");
                os.CommitChanges();
            }
            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                var imp_fiv = new fmOrderImporter();
                imp_fiv.Import(os, dir + "fmCOrderList.csv");
                os.CommitChanges();
            }
            //
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                var imp_ot = new SimpleAnalyticImporter <fmCFinIndex>();
                imp_ot.Import(os, dir + "fmCFinIndex.csv");
                var imp_fiv = new FinIndexItemImporter();
                imp_fiv.Import(os, dir + "fmCFinIndexItem.csv");
                os.CommitChanges();
            }

            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                foreach (fmCOrderExt order in os.GetObjects <fmCOrderExt>(null, true))
                {
                    order.IsSyncRequired = false;
                }
                os.CommitChanges();
            }
            //ObjectSpace.CommitChanges();
        }
Exemplo n.º 30
0
 public override void UpdateDatabaseAfterUpdateSchema()
 {
     base.UpdateDatabaseAfterUpdateSchema();
     if (this.CurrentDBVersion != new Version("1.1.1.224"))
     {
         return;
     }
     using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
         TrwSettings     instance   = TrwSettings.GetInstance(os);
         crmCLegalPerson other_sale = os.FindObject <crmCLegalPerson>(new BinaryOperator("Code", "12582"));
         other_sale.Name          = "Прочие заказчики";
         instance.PersonOtherSale = other_sale.Person;
         crmCLegalPerson other_bay = os.FindObject <crmCLegalPerson>(new BinaryOperator("Code", "12581"));
         other_bay.Name          = "Прочие поставщики";
         instance.PersonOtherBay = other_bay.Person;
         //
         UpdateTrwSubjects(os);
         os.CommitChanges();
     }
 }
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ОперацияКонтРучные cont = View.CurrentObject as ОперацияКонтРучные;

            if (cont == null)
            {
                return;
            }
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) {
                cont = os.GetObject <ОперацияКонтРучные>(cont);
                Import(os, cont, dialog.FileName);
                os.CommitChanges();
            }
        }