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;
                }
            }
        }
        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;
                }
            }
        }
 public static void RefreshDeal(IObjectSpace os, TrwSubjectDealBay subj_deal)
 {
 }