Example #1
0
    static void Main(string[] args)
    {
        string        input   = "";
        List <Person> persons = new List <Person>();

        while ((input = Console.ReadLine()) != "End")
        {
            string[] splitInfo = input.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            string   name      = splitInfo[0];

            if (!persons.Any(x => x.Name == name))
            {
                Person person = new Person();
                person.Name = name;
                persons.Add(person);
            }

            var currentPerson = persons.First(x => x.Name == name);

            switch (splitInfo[1])
            {
            case "company":
                Company company = new Company();
                company.AddCompany(splitInfo[2], splitInfo[3], double.Parse(splitInfo[4]));
                currentPerson.Company = company;
                break;

            case "pokemon":
                Pokemon pokemon = new Pokemon();
                pokemon.AddPokemon(splitInfo[2], splitInfo[3]);
                currentPerson.Pokemons.Add(pokemon);
                break;

            case "parents":
                Parent parent = new Parent();
                parent.AddParent(splitInfo[2], splitInfo[3]);
                currentPerson.Parents.Add(parent);
                break;

            case "children":
                Children children = new Children();
                children.AddChildren(splitInfo[2], splitInfo[3]);
                currentPerson.Childrens.Add(children);
                break;

            case "car":
                Car car = new Car();
                car.AddCar(splitInfo[2], splitInfo[3]);
                currentPerson.Car = car;
                break;
            }
        }

        string personNeededInfo = Console.ReadLine();
        var    personInfo       = persons.First(x => x.Name == personNeededInfo);

        PrinOutput(personInfo);
    }
Example #2
0
        public string SaveCompany(Company company)
        {
            bool    result = false;
            Company cat    = new Company();
            {
                result = cat.AddCompany(company);
            }
            string message = result ? "İşlem Tamamlandı." : "Hata Oluştu.";

            return(JsonConvert.SerializeObject(message));
        }
        private Company AddCompany(string name)
        {
            var addCompany = new Company(driver);

            Thread.Sleep(2000);
            addCompany.AddCompany(name);
            addCompany.ConfirmSuccess();

            var companyNames = addCompany.GetCompanies();

            var addedCompany = companyNames.FirstOrDefault(x => x.Text == name);

            Assert.IsNotNull(addedCompany);

            return(addCompany);
        }
Example #4
0
 private void bttonAddCompLess_Click(object sender, EventArgs e) {
     this.LblReturn.Text = Company.AddCompany("NEW FORM CO. LTD ADDED", "Fishery", 32957, clientID: 5, contactDetID: 3).ToString();
     GetAllCompanies(sender, e, showGridRowCount: false);
 }
Example #5
0
 private void bttonAddComp_Click(object sender, EventArgs e) {         
     this.LblReturn.Text = Company.AddCompany("NEW FORM CO. LTD ADDED", "Fishery", 32957, "36598244", (DateTime)Utils.GetDateFromString("2016/5/17"), "www.myweb.co.uk", clientID: 4, contactDetID: 3, isVARreg: true, VATNumb:  "56876453").ToString();
     GetAllCompanies(sender, e, showGridRowCount: false);
 }