コード例 #1
0
 public static void DeleteContactEmail(IBillingCompany billingCompany, string email)
 {
     if (!billingCompany.LegalEntityInformation.ContactInforamtion.Emails.Contains(email))
     {
         throw new ContainArgumentException(email);
     }
     billingCompany.LegalEntityInformation.ContactInforamtion.Emails.Remove(email);
 }
コード例 #2
0
 public static void DeleteStation(IBillingCompany billingCompany, IStation station)
 {
     if (!billingCompany.Stations.Contains(station))
     {
         return;
     }
     billingCompany.Stations.Remove(station);
 }
コード例 #3
0
 public static void DeleteContactNumber(IBillingCompany billingCompany, int phoneNumber)
 {
     if (!billingCompany.LegalEntityInformation.ContactInforamtion.PhoneNumbers.Contains(phoneNumber))
     {
         throw new ContainArgumentException(phoneNumber.ToString());
     }
     billingCompany.LegalEntityInformation.ContactInforamtion.PhoneNumbers.Remove(phoneNumber);
 }
コード例 #4
0
        public static ITerminalContract MakeNewTerminalContract(ITerminal terminal, IBillingCompany billingCompany, IClient client, ISubscriberNumber subscriberNumber)
        {
            var contract = new TerminalContract(terminal, new Tuple <IBillingCompany, IClient>(billingCompany, client));

            client.Contracts.Add(contract);
            billingCompany.Contracts.Add(contract);

            return(contract);
        }
コード例 #5
0
        public static ITerminalContract MakeNewTerminalContract(IBillingCompany billingCompany, IClient client, ISubscriberNumber subscriberNumber)
        {
            ITerminalModel model = new TerminalModel("ModelName", new[] { "ru", "eng" }, new Tuple <double, double>(3.14, 3.14), true);

            ITerminal terminal = new Terminal(model, subscriberNumber);

            var contract = new TerminalContract(terminal, new Tuple <IBillingCompany, IClient>(billingCompany, client));

            client.Contracts.Add(contract);
            billingCompany.Contracts.Add(contract);

            return(contract);
        }
コード例 #6
0
 public static void CreateNewStation(IBillingCompany billingCompany, CodecType codecType)
 {
     billingCompany.Stations.Add(new Station(new List <Port>(), codecType));
 }
コード例 #7
0
 public static void ChangeAdress(IBillingCompany billingCompany, IAdress adress)
 {
     billingCompany.LegalEntityInformation.Adress = adress;
 }
コード例 #8
0
        static void Main(string[] args)
        {
            try
            {
                var fileLog = ConfigurationManager.AppSettings["FileLog"];
                var log     = new ProgramLog(fileLog);
            }
            catch (DirectoryNotFoundException)
            {
                var exception =
                    new ConfigurationDirectoryNotFoundException(ConfigurationManager.AppSettings["FileLog"]);
                Console.WriteLine(exception.Message);
                throw exception;
            }

            IAdress vasinAdress = ContactAddressInformation.CreateNewAdress("Belarus", "Grodno", "Kleckova",
                                                                            new Tuple <int, char, char>(12, '/', 'A'), 3);

            IList <int> vasinListNumbers = new List <int>();

            vasinListNumbers.Add(654321);
            vasinListNumbers.Add(543210);

            IList <string> vasinListEmails = new List <string>();

            vasinListEmails.Add("*****@*****.**");
            vasinListEmails.Add("*****@*****.**");

            IContactInforamtion vasinaContactInforamtion =
                ContactAddressInformation.CreateNewContacts(vasinListNumbers, vasinListEmails);

            IFullName vasyasFullName = PersonalIdentification.CreateNewFullName("Vasya", "Pupkin", "Ivanavich");

            IPassportIdentification passportIdentification = PersonalIdentification.CreateNewPassportIdentification(
                vasyasFullName,
                "REPUBLIC OF BELARUS", new DateTime(1997, 10, 28), true, "3456797K000PB9", "REPUBLIC OF BELARUS");
            IPassportData passportData = PersonalIdentification.CreateNewPassportData(passportIdentification,
                                                                                      "KH248248",
                                                                                      "MINISTRY OF INTERNAL AFFAIRS", new DateTime(2015, 10, 28), new DateTime(2025, 10, 28));

            IInformationOfAnIndividual informationOfVasya =
                InformationProvided.CreateNewInformationOfAnIndividual(vasinAdress, vasinaContactInforamtion,
                                                                       passportData);

            Console.WriteLine(informationOfVasya.ToString());

            //
            IBillingCompany billingCompany       = CompanyManagement.CreateNewCompany("Company");
            IAdress         billingCompanyAdress = ContactAddressInformation.CreateNewAdress("Belarus", "Grodno", "Kleckova",
                                                                                             new Tuple <int, char, char>(10, '/', '2'), 3);

            CompanyManagement.ChangeAdress(billingCompany, billingCompanyAdress);

            IList <int> companyListNumbers = new List <int>();

            vasinListNumbers.Add(123456);
            vasinListNumbers.Add(234567);

            IList <string> companyListEmails = new List <string>();

            vasinListEmails.Add("*****@*****.**");
            vasinListEmails.Add("*****@*****.**");

            IContactInforamtion companyContactInforamtion =
                ContactAddressInformation.CreateNewContacts(companyListNumbers, companyListEmails);

            CompanyManagement.ChangeContactInforamtion(billingCompany, companyContactInforamtion);
            CompanyManagement.ChangeAboutLegalEntity(billingCompany, "Some company");
            StationManagment.CreateNewStation(billingCompany, CodecType.G711);

            try
            {
                StationManagment.AddPortRange(billingCompany.Stations[0], 2030, 2110);
            }
            catch (PortArgumentOutOfRangeException e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine(StationManagment.OutputAllPorts(billingCompany.Stations[0]));


            IClient client = ContractManagement.CreateNewClient(informationOfVasya);

            IRate rate = ContractManagement.CreateNewRate("Tarif", 0.5);

            ISubscriberNumber subscriberNumber1 = ContractManagement.CreateNewSubscriberNumber(rate, 505050);
            ISubscriberNumber subscriberNumber2 = ContractManagement.CreateNewSubscriberNumber(rate, 525252);

            ContractManagement.MakeNewTerminalContract(billingCompany, client, subscriberNumber1);
            ContractManagement.MakeNewTerminalContract(billingCompany, client, subscriberNumber2);

            TerminalManagement.ConnectTerminal(billingCompany.Stations[0], client.Contracts[0].Terminal, 2030);
            Thread.Sleep(200);
            TerminalManagement.ConnectTerminal(billingCompany.Stations[0], client.Contracts[1].Terminal, 2100);
            Thread.Sleep(200);

            TerminalManagement.CallToSubscriber(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                                client.Contracts[1].Terminal);
            Thread.Sleep(200);
            TerminalManagement.AnswerTheCall(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                             client.Contracts[1].Terminal);
            Thread.Sleep(1200);
            TerminalManagement.CompleteCall(billingCompany.Stations[0], client.Contracts[0].Terminal,
                                            client.Contracts[1].Terminal);
            Thread.Sleep(200);

            TerminalManagement.DisconnectTerminal(billingCompany.Stations[0], client.Contracts[0].Terminal);
            Thread.Sleep(200);
            TerminalManagement.DisconnectTerminal(billingCompany.Stations[0], client.Contracts[1].Terminal);


            try
            {
                Console.WriteLine(CallManagement.ViewCallLog(client.Contracts[0].Terminal.SubscriberNumber, 30));
            }
            catch (CallLogArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #9
0
 public static void AddStation(IBillingCompany billingCompany, IStation station)
 {
     billingCompany.Stations.Add(station);
 }
コード例 #10
0
 public static void ChangeStation(IBillingCompany billingCompany, IStation oldStation, IStation newStation)
 {
     DeleteStation(billingCompany, oldStation);
     AddStation(billingCompany, newStation);
 }
コード例 #11
0
 public static void ChangeContactEmail(IBillingCompany billingCompany, string oldEmail, string newEmail)
 {
     DeleteContactEmail(billingCompany, oldEmail);
     AddContactEmail(billingCompany, newEmail);
 }
コード例 #12
0
 public static void ChangeContactInforamtion(IBillingCompany billingCompany, IContactInforamtion contactInforamtion)
 {
     billingCompany.LegalEntityInformation.ContactInforamtion = contactInforamtion;
 }
コード例 #13
0
 public static void AddContactEmail(IBillingCompany billingCompany, string email)
 {
     billingCompany.LegalEntityInformation.ContactInforamtion.Emails.Add(email);
 }
コード例 #14
0
 public static void ChangeAboutLegalEntity(IBillingCompany billingCompany, string aboutLegalEntity)
 {
     billingCompany.LegalEntityInformation.AboutLegalEntity = aboutLegalEntity;
 }
コード例 #15
0
 public static void ChangeContactNumber(IBillingCompany billingCompany, int oldPhoneNumber, int newPhoneNumber)
 {
     DeleteContactNumber(billingCompany, oldPhoneNumber);
     AddContactNumber(billingCompany, newPhoneNumber);
 }
コード例 #16
0
 public static void AddContactNumber(IBillingCompany billingCompany, int phoneNumber)
 {
     billingCompany.LegalEntityInformation.ContactInforamtion.PhoneNumbers.Add(phoneNumber);
 }
コード例 #17
0
 public static void ChangeNameLegalEntity(IBillingCompany billingCompany, string nameLegalEntity)
 {
     billingCompany.LegalEntityInformation.NameLegalEntity = nameLegalEntity;
 }