コード例 #1
0
        public static void FillBayDeals(IObjectSpace os, TrwSubject trw_subj, TrwSubjectImportDealParameters parms)
        {
            IList <crmContractDeal> deals = GetDeals(trw_subj, DealInfoDealType.DEAL_INFO_EXPENDITURE, parms);

            foreach (crmContractDeal deal in deals)
            {
                TrwSubjectDealBay subj_deal = trw_subj.DealsBay.FirstOrDefault(x => x.Deal == deal);
                if (subj_deal == null)
                {
                    subj_deal = os.CreateObject <TrwSubjectDealBay>();
                    trw_subj.DealsBay.Add(subj_deal);
                    subj_deal.DealType   = TrwSubjectDealType.TRW_SUBJECT_DEAL_REAL;
                    subj_deal.Deal       = deal;
                    subj_deal.DealBudget = null;
                }
            }
            if (parms.CreateOtherDeal)
            {
                TrwSubjectDealBay bay_other = trw_subj.DealsBay.FirstOrDefault(x => x.DealType == TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER);
                if (bay_other == null)
                {
                    bay_other = os.CreateObject <TrwSubjectDealBay>();
                    trw_subj.DealsBay.Add(bay_other);
                    bay_other.DealType       = TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER;
                    bay_other.PersonInternal = TrwSettings.GetInstance(os).PersonOtherBay;
                }
            }
        }
コード例 #2
0
 public void UpdateTrwSubjects(IObjectSpace os)
 {
     foreach (TrwSubject trw_subj in os.GetObjects <TrwSubject>())
     {
         trw_subj.Period = trw_subj.Period;
         trw_subj.Subjects.Clear();
         trw_subj.Subjects.Add(trw_subj.Subject);
         //
         IList <TrwSubjectDealSale> deal_sales = new List <TrwSubjectDealSale>(trw_subj.DealsSale);
         foreach (TrwSubjectDealSale deal_sale in deal_sales)
         {
             if (deal_sale.DealBudget == null)
             {
                 deal_sale.DealType = TrwSubjectDealType.TRW_SUBJECT_DEAL_REAL;
                 if (deal_sale.Deal != null)
                 {
                     deal_sale.CrmContractDeals.Add(deal_sale.Deal);
                 }
             }
             else
             {
                 os.Delete(deal_sale);
             }
         }
         TrwSubjectDealSale deal_sale_other = os.CreateObject <TrwSubjectDealSale>();
         trw_subj.DealsSale.Add(deal_sale_other);
         deal_sale_other.DealType = TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER;
         os.Delete(trw_subj.DealOtherSale);
         trw_subj.DealOtherSale         = deal_sale_other.DealBudget;
         deal_sale_other.PersonInternal = TrwSettings.GetInstance(os).PersonOtherSale;
         //                deal_sale_other.UpdateConsolidateDeal(true);
         //
         IList <TrwSubjectDealBay> deal_bays = new List <TrwSubjectDealBay>(trw_subj.DealsBay);
         foreach (TrwSubjectDealBay deal_bay in deal_bays)
         {
             if (deal_bay.DealBudget == null)
             {
                 deal_bay.DealType = TrwSubjectDealType.TRW_SUBJECT_DEAL_REAL;
                 if (deal_bay.Deal != null)
                 {
                     deal_bay.CrmContractDeals.Add(deal_bay.Deal);
                 }
             }
             else
             {
                 os.Delete(deal_bay);
             }
         }
         TrwSubjectDealBay deal_bay_other = os.CreateObject <TrwSubjectDealBay>();
         trw_subj.DealsBay.Add(deal_bay_other);
         deal_bay_other.DealType = TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER;
         os.Delete(trw_subj.DealOtherBay);
         trw_subj.DealOtherBay         = deal_bay_other.DealBudget;
         deal_bay_other.PersonInternal = TrwSettings.GetInstance(os).PersonOtherBay;
         //                deal_bay_other.UpdateConsolidateDeal(true);
         //
     }
 }
コード例 #3
0
        public static void FillBayDeals2(IObjectSpace os, TrwSubject trw_subj, TrwSubjectImportDealParameters parms)
        {
            IList <crmContractDeal> deals = GetDeals2(trw_subj, DealInfoDealType.DEAL_INFO_EXPENDITURE, parms);
            IDictionary <crmCPerson, TrwSubjectDealBay> pers_deal = new Dictionary <crmCPerson, TrwSubjectDealBay>();
            IList <crmCPerson> pers_list = new List <crmCPerson>();

            foreach (crmCParty party in trw_subj.Period.CorporationPartys)
            {
                if (!pers_list.Contains(party.Person))
                {
                    pers_list.Add(party.Person);
                }
            }
            foreach (crmContractDeal deal in deals)
            {
                if (!pers_list.Contains(deal.Supplier.Person))
                {
                    continue;
                }
                if (pers_deal.ContainsKey(deal.Supplier.Person))
                {
                    continue;
                }
                TrwSubjectDealBay subj_deal = os.CreateObject <TrwSubjectDealBay>();
                trw_subj.DealsBay.Add(subj_deal);
                subj_deal.DealType              = TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_PARTNER;
                subj_deal.PersonInternal        = deal.Supplier.Person;
                pers_deal[deal.Supplier.Person] = subj_deal;
//                subj_deal.DealBudget = null;
            }
            if (parms.CreateOtherDeal)
            {
                TrwSubjectDealBay bay_other = trw_subj.DealsBay.FirstOrDefault(x => x.DealType == TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER);
                if (bay_other == null)
                {
                    bay_other = os.CreateObject <TrwSubjectDealBay>();
                    trw_subj.DealsBay.Add(bay_other);
                    bay_other.DealType       = TrwSubjectDealType.TRW_SUBJECT_DEAL_CONS_OTHER;
                    bay_other.PersonInternal = TrwSettings.GetInstance(os).PersonOtherBay;
                }
            }
        }
コード例 #4
0
ファイル: Updater.cs プロジェクト: ewin66/IntecoAG.ERM
 public override void UpdateDatabaseAfterUpdateSchema()
 {
     base.UpdateDatabaseAfterUpdateSchema();
     // Добавление отчётов
     CheckDirectoryOnReports();
     // Добавление аналитических данных
     CreateDataToBeAnalysed();
     //
     UpdateAdminRole();
     UpdateNullRightRole();
     UpdateReadAllRole();
     UpdateEditAllRole();
     //
     fmCSettingsFinance.GetInstance(((ObjectSpace)ObjectSpace).Session);
     crmCSettingsContract.GetInstance(((ObjectSpace)ObjectSpace).Session);
     TrwSettings.GetInstance(ObjectSpace);
     //
     //UpdateParty();
     //UpdateStaff();
 }
コード例 #5
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();
     }
 }