Esempio n. 1
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();
            }
        }
Esempio n. 2
0
        public static TrwPartyParty LocateTrwParty(IObjectSpace os, crmCParty party)
        {
            if (party.Person == null)
            {
                return(null);
            }

            TrwPartyParty trw_party = party.Person.TrwParty;

//                trw_partys.FirstOrDefault(x => x.Person == party.Person);
            if (trw_party == null)
            {
                trw_party        = os.CreateObject <TrwPartyParty>();
                trw_party.Person = party.Person;
                trw_party.Party  = party;
            }
            return(trw_party);
        }
Esempio n. 3
0
        public static void SetNumbers(IObjectSpace os, TrwPartyParty party, IObjectSpace seq_os)
        {
            if (party.Country != null && party.Country.IsVED)
            {
                if (party.Country.IsUIG)
                {
                    party.Market = TrwPartyMarket.MARKET_UIG;
                }
                else
                {
                    party.Market = TrwPartyMarket.MARKET_VED;
                }
            }
            TrwPartyKppSequenceType seq_type;

            if (party.Market == TrwPartyMarket.MARKET_UIG)
            {
                seq_type = TrwPartyKppSequenceType.PARTY_TYPE_MARKET2;
            }
            else
            {
                if (party.Market == TrwPartyMarket.MARKET_VED)
                {
                    seq_type = TrwPartyKppSequenceType.PARTY_TYPE_MARKET1;
                }
                else
                {
                    if (party.PartyType == TrwPartyType.PARTY_INTERMEDIA_TREASURE)
                    {
                        seq_type = TrwPartyKppSequenceType.PARTY_TYPE_PAY_INTERMEDIA;
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException("Unsupported market type");
                    }
                }
            }
            Int32 kpp = TrwPartyKppSequenceLogic.GetNextNumber(seq_os, seq_type, party.Oid);

            party.INN = "2500000000";
            party.KPP = "25" + kpp.ToString("D7");
        }