static void Main(string[] args)
        {
            Developer dev = new Developer(1367, "Boris", "Soltariiski", 1000, "Production", new List<Project>
            {
                new Project("Project", DateTime.Today, "My project"),
                new Project("Just another project", DateTime.Parse("4.04.2009"), "Nothing to write")
            });

            Manager man = new Manager(45625, "Gosho", "Peshev", 1500.2m, "Sales", new List<Employee>
            {
                new Employee(67356, "Mariika", "Ivanova", 356, "Accounting"),
                new Employee(63462, "Abdul", "Mahir", 782.4m, "Marketing")
            });

            SalesEmployee salesEmpl = new SalesEmployee(777353, "Dragan", "Koevich", 693.90m, "Sales", new List<Sale>
            {
                new Sale("Product", DateTime.Today, 100.90m)
            });

            List<Employee> employees = new List<Employee> {dev, man, salesEmpl};

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
Beispiel #2
0
           CanDeleteObjectByTypeAndIdOnSyncSession()
        {
            using (var store = NewDocumentStore())
            {
                string developer1Id;
                var developer1 = new Developer
                {
                    Nick = "ayende"
                };

                using (var session = store.OpenSession())
                {
                    session.Store(developer1);
                    session.SaveChanges();
                    developer1Id = store.Conventions.FindFullDocumentKeyFromNonStringIdentifier(developer1.Id,
                                                                                                typeof(Developer),
                                                                                                false);
                }

                using (var session = (DocumentSession)store.OpenSession())
                {
                    Assert.False(session.IsDeleted(developer1Id));
                    session.Delete<Developer>(developer1.Id);
                    Assert.True(session.IsDeleted(developer1Id));
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    Assert.Null(session.Load<Developer>(developer1.Id));
                }
            }
        }
    static void Main(string[] args)
    {
        Developer dev = new Developer();
        dev.Name = "Michael";
        dev.Role = "Software Engineer";
        dev.PreferredLanguage = "C#";

        Developer devCopy = (Developer)dev.Clone();
        devCopy.Name = "Bob";
        // Role and PreferredLanguage will be copies of the above

        Console.WriteLine(dev.GetDetails());
        Console.WriteLine(devCopy.GetDetails());

        Typist typist = new Typist();
        typist.Name = "Tom";
        typist.Role = "Typist";
        typist.WordsPerMinute = 150;

        Typist typistCopy = (Typist)typist.Clone();
        typistCopy.Name = "Jerry";
        typistCopy.WordsPerMinute = 110;
        // Role and WordsPerMinute will be copies of the above

        Console.WriteLine(typist.GetDetails());
        Console.WriteLine(typistCopy.GetDetails());

        Console.ReadKey();
    }
        static void Main(string[] args)
        {
            Manager manager = new Manager
                (1,
                 "Ivan",
                 "Murtov",
                 3500,
                 "Accounting",
                 new List<RegularEmpoyee>()
                 {
                     new RegularEmpoyee(2, "Martin", "Venelinov", 1000d, "Sales"),
                     new RegularEmpoyee(3, "Radosting", "Mokanov", 1000d, "Sales")
                 });

            Developer developer = new Developer
                (2,
                "Ivan",
                "Ivanchev",
                8000d,
                "Production",
                new List<Projects>()
                {
                    new Projects("Project Prayer", new DateTime(2015, 12, 12), "Very cool project"),
                    new Projects("project SPUP", new DateTime(2015, 12,11), "MRI project for AR")
                });

            List<Employee> employees = new List<Employee>();
            employees.Add(developer);
            employees.Add(manager);

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            SalesEmployee saler = new SalesEmployee(123145, "Joro", "Petrov", 120.20m, DepartmentType.Production);
            saler.AddSale(new Sale("Liutenica", DateTime.Parse("12.12.2015"), 2.20m));

            Customer kakaMinka = new Customer(15651513, "Kaka", "Minka", 5000);
            Customer pepiMotichkata = new Customer(67654654, "Pepi", "Motichkata", 3000);
            Manager theBoss = new Manager(156136, "Chicho", "Gosho", 10000, DepartmentType.Marketing);

            Developer dev = new Developer(333, "Bai", "Stavri", 101010, DepartmentType.Accounting);
            var projectAmazon = new Project("Amazon", null, null, true);
            var projectSoftUni = new Project("SoftUni", DateTime.Now, "....", true);
            dev.Projects.Add(projectAmazon);

            List<Person> people = new List<Person>();
            people.Add(kakaMinka);
            people.Add(pepiMotichkata);
            people.Add(theBoss);

            foreach (Person per in people)
            {
                Console.WriteLine("ID: {0}\nFirst name: {1}\nLast name: {2}", per.Id,
                    per.FirstName, per.LastName);
                Console.WriteLine("----------------------------");
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Console.WriteLine(0);
            SalesEmployee saler = new SalesEmployee(1,"Goasho","Goshev", 555, Departments.Sales);
            saler.AddSale(new Sale("Waffle",null,0.99m));
            saler.AddSale(new Sale("Cheese",DateTime.Now,3.99m));

            Developer developer = new Developer(2,"Ivan","Ivanov", 231,Departments.Production);
            developer.AddProject(new Project("Softuni", new DateTime(2015,11,28),"University", true));
            developer.AddProject(new Project("Google X",null,"Alien Tech", true));
            developer.Projects.FirstOrDefault(project => project.Name == "Google X").CloseProject();

            Manager manager = new Manager(3,"Petar","Petrov",800,Departments.Accounting);
            manager.AddEmployee(saler);
            manager.AddEmployee(developer);

            Customer customer = new Customer(4,"Baba","Ivanka",300);
            //This doesnt work as by demand.
            //manager.AddEmployee(customer);

            List<Person> people = new List<Person>();
            people.Add(saler);
            people.Add(developer);
            people.Add(manager);
            people.Add(customer);

            people.ForEach(person => Console.WriteLine(person));
        }
Beispiel #7
0
    public void NoInitializers()
    {
        List<Developer> devs = new List<Developer>();

            Developer dev1 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev2 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev3 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev4 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            devs.Add(dev1);
            devs.Add(dev2);
            devs.Add(dev3);
            devs.Add(dev4);
    }
Beispiel #8
0
        static void Main()
        {
            List<Person> people = new List<Person>();

            Employee bill = new RegularEmployee(1234, "Bill", "Smith", 10.00, Department.Accounting);
            Person frank = new SalesEmployee(8725, "Frank", "Richardson", 20.00,
                new Sale("Toy", new DateTime(2015, 7, 19), 5.00),
                new Sale("MEGA TOY", new DateTime(2015, 8, 29), 10.00));
            RegularEmployee hank = new RegularEmployee(8456, "Hank", "Tyson", 26.00, Department.Accounting);
            Manager homer = new Manager(8726, "Homer", "James", 50.00, Department.Accounting,
                bill,
                hank);
            Project x = new Project("Project X", new DateTime(2013, 11, 11), "[no details]", State.Open);
            x.CloseProject();
            Developer ivan = new Developer(6545, "Ivan", "Ivanov", 32.00,
                new Project("Flying Car", new DateTime(2014, 1, 24), "[no details]", State.Open),
                x);
            Customer arin = new Customer(7555, "Arin", "Newman", 10000.12);

            people.Add(bill);
            people.Add(frank);
            people.Add(hank);
            people.Add(homer);
            people.Add(ivan);
            people.Add(arin);

            foreach (var person in people)
            {
                Console.WriteLine(person.ToString() + "\n------------------------------------------------------");
            }
        }
Beispiel #9
0
    static void Main()
    {
        var computer = new Sale("Lenovo","12-12-2014", 650);
        var dvd = new Sale("Philips", "12-12-2015", 300);
        var tv = new Sale("Samsung", "12-12-2016", 620);

        var john = new SalesEmployee(8120403565, "John", "Carera", 1500, Department.Production, dvd);
        var ivan = new SalesEmployee(85264040262, "Ivan", "Smallhouse", 5200, Department.Sales, computer, tv);

        var ludnica = new Project("gospodari.bg", "05-07-1947", "some details");
        var web = new Project("home.bg", "04-04-1984", "deeeetails");
        ludnica.CloseProject();
        
        var doncho = new Developer(85012236461, "Doncho", "Donkov", 41500, Department.Production, web, ludnica);

        var kiro = new Manager(7511119253, "Kiro", "Pora", john, ivan, doncho);

        var listOfPeople = new List<IPerson> {kiro, doncho, ivan, john};

        foreach (var person in listOfPeople)
        {
            Console.WriteLine(person);
            Console.WriteLine("--------------------------------------------------------------------------------");   
        }
    }
        static void Main()
        {
            var salesManager = new Manager(1, "Steve", "Ballmer", 250000, Department.Sales);
            var salesEmp1 = new SalesEmployee(3, "Stamat", "Stamatov", 2000, Department.Sales);
            var salesEmp2 = new SalesEmployee(4, "Minka", "Minkova", 2000, Department.Sales);
            salesEmp1.Sales.Add(new Sale("SQL Server 2014 Enterprise", DateTime.Now, 160000));
            salesEmp2.Sales.Add(new Sale("SQL Server 2014 Standard", DateTime.Now, 50000));

            salesManager.Employees.Add(salesEmp1);
            salesManager.Employees.Add(salesEmp2);

            var productionManager = new Manager(2, "Bill", "Gates", 725000, Department.Production);
            var developer1 = new Developer(5, "Pesho", "Peshev", 2500, Department.Production);
            var developer2 = new Developer(6, "Gosho", "Goshev", 2500, Department.Production);
            developer1.Projects.Add(new Project("Accounting module", DateTime.Now, string.Empty, ProjectState.Open));
            developer2.Projects.Add(new Project("Accounting module", DateTime.Now, string.Empty, ProjectState.Open));

            productionManager.Employees.Add(developer1);
            productionManager.Employees.Add(developer2);

            List<Person> people = new List<Person>()
            {
                salesManager,
                salesEmp1,
                salesEmp2,
                productionManager,
                developer1,
                developer2
            };

            foreach (var person in people)
            {
                Console.WriteLine("{0}\n", person);
            }
        }
Beispiel #11
0
        static void Main()
        {
            List<Person> persons = new List<Person>();

            SalesEmployee todor = new SalesEmployee(123, "Todor", "Todorov", 3000m, Departments.Sales);
            todor.AddSale(new Sales("Windows XP SP3", new DateTime(2007, 07, 12), 400m));
            todor.AddSale(new Sales("NOD 32 8.01", new DateTime(2007, 08, 08), 150m));
            persons.Add(todor);

            SalesEmployee dobri = new SalesEmployee(122, "Dobromir", "Hristov", 3500m, Departments.Sales);
            dobri.AddSale(new Sales("Windows 7 PRO SP1", new DateTime(2009, 04, 16), 450m));
            dobri.AddSale(new Sales("AMD Phenom II X4 3.20 GHz", new DateTime(2010, 12, 24), 200m));
            persons.Add(dobri);

            Developer nedqlko = new Developer(007, "Nedqlko", "Nikolov", 6000m, Departments.Production);
            nedqlko.AddProject(new Projects("Smite", new DateTime(2009, 05, 15), "3rd person MOBA"));
            persons.Add(nedqlko);

            Manager roxana = new Manager(111, "Roxana", "Iliuta", 10000m, Departments.Marketing);
            roxana.AddEmployee(todor);
            roxana.AddEmployee(dobri);
            roxana.AddEmployee(nedqlko);
            persons.Add(roxana);

            Customer richKid = new Customer(999, "Richi", "Rich", 2500m);
            persons.Add(richKid);

            foreach (var person in persons)
            {
                Console.WriteLine(person + Environment.NewLine);
            }
        }
        public void SetUp()
        {
            _repository = new MockRepository();

            _developer = new Developer() { Username = "******" };

            _calculators = new[] { new DefaultAchievementCalculator(_repository) };

            _repository.Save(_developer);
        }
        internal void PopulateStatistics(Developer developer, DeveloperStatistics statistics)
        {
            statistics.TotalAchievementsCount = developer.Achievements.Count();
            statistics.PositiveAchievementsCount = developer.Achievements.Where(x => x.Achievement.Disposition == AchievementDisposition.Positive).Sum(x => x.Count);
            statistics.NegativeAchievementsCount = developer.Achievements.Where(x => x.Achievement.Disposition == AchievementDisposition.Negative).Sum(x => x.Count);
            statistics.TotalNonNeutralAchievementsCount = (statistics.PositiveAchievementsCount + statistics.NegativeAchievementsCount);

            if (statistics.TotalNonNeutralAchievementsCount > 0)
                statistics.Percentage = (statistics.PositiveAchievementsCount / (decimal)statistics.TotalNonNeutralAchievementsCount);
        }
Beispiel #14
0
    public void Awake()
    {
        i = this;
        t = Object.FindObjectOfType<Transport>();

        Developer = new Developer(t);
        Game = new Game(t);
        Player = new Player(t);
        Tip = new Tip(t);
        Bitcoin = new Bitcoin(t);
    }
        public void UpdateDeveloper(Developer toUpdate)
        {
            TaskTrackerDataContext dataContext = this.DataContext;
            Developer d = dataContext.Developers.Single(developer => developer.ID == toUpdate.ID);
            d.Active = toUpdate.Active;
            d.ContactNumber = toUpdate.ContactNumber;
            d.DeveloperIterationTasks = toUpdate.DeveloperIterationTasks;
            d.Email = toUpdate.Email;
            d.FamilyName = toUpdate.FamilyName;
            d.GivenNames = toUpdate.GivenNames;
            d.Notes = toUpdate.Notes;

            SubmitChanges();
        }
        public static void Main()
        {
            List<Sale> sales = new List<Sale>
            {
                new Sale("notebook", 20, DateTime.Now),
                new Sale("pen",2,DateTime.Now)
            };

            SalesEmployee retailer = new SalesEmployee("Kiril", "Petrov", 2314763, Departments.Marketing, 900);

            retailer.AddSale(sales[0]);
            retailer.AddSale(sales[1]);

            var pesho = new Manager("Petur", "Asenov", 3874303, Departments.Accounting, 1200);
            var katya = new Developer("Katya", "Katerina", 5344363, Departments.Production, 2300);
            var ivan = new SalesEmployee("Ivan", "Ivanov", 3429993, Departments.Accounting, 1300);

            var project = new Project("Code", DateTime.Now, ProjectState.Open);

            katya.AddProject(project);

            pesho.AddEmployee(retailer);
            pesho.AddEmployee(katya);
            pesho.AddEmployee(ivan);

            List<Employee> employees = new List<Employee>();

            employees.Add(retailer);
            employees.Add(pesho);
            employees.Add(katya);
            employees.Add(ivan);


            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }

            Console.WriteLine(new string('=', 10));

            foreach (var employee in pesho.EmployeesManaged)
            {
                Console.WriteLine(employee);
            }
        }
Beispiel #17
0
        //------------------------------------------------------------------------------------
        //Procedure: AddDeveloper
        //Purpose:   Provides functionality for adding a developer record
        //           Used by Insert button.
        //Accepts:   NA
        //Returns:   True if success, false if not
        private bool AddDeveloper()
        {
            bool blnResult = false;

            Developer newDeveloper = new Developer(ref m_DL);

            newDeveloper.ID = int.Parse(cboID.Text.Trim());
            newDeveloper.Name = txtName.Text;
            newDeveloper.Salary = double.Parse(txtSalary.Text.Trim());

            //Set departments
            SetDeveloperDepartments(ref newDeveloper);

            //Write record to DB
            blnResult = newDeveloper.Update();

            return blnResult;
        }
Beispiel #18
0
        static void Main(string[] args)
        {
            Developer developer = new Developer(11111111, "Todor", "Yordanov", 5000m, "Production",
               new List<Project> {
                { new Project("Money", DateTime.Parse("12.11.2015"), "This porject makes money!")},
                { new Project("Money2", DateTime.Parse("2.1.2005"), "Moneyyy!")}
               });

            Manager manager = new Manager(12191311, "Yordan", "Todorov", 4000m, "Sales",
            new List<Employee> {
                { new Employee(12191311, "Stoyan", "Dimov", 2000m, "Sales")},
                { new Employee(12191311, "Yordan", "Marinov", 1700m, "Sales")},
                { new Employee(12191311, "Marin", "Todorov", 2300m, "Sales")},
            });

            Manager anotherManager = new Manager(12191398, "Yordan", "Yordanov", 11000m, "Marketing",
            new List<Employee> {
                { new Employee(12191311, "Petar", "Todorov", 4000m, "Marketing")},
                { new Employee(12191311, "Vasil", "Petkov", 3800m, "Marketing")},
                { new Employee(12191311, "Qnko", "Qnkov", 4200m, "Marketing")},
                { new Employee(12191311, "Mancho", "Vasilev", 6000m, "Marketing")}
            });

            SalesEmployee salesEmployee = new SalesEmployee(78873465, "Sancho", "Mancho", 8800m, "Marketing",
            new List<Sale> {
                { new Sale("Very cool software", DateTime.Parse("30.9.15"), 32000m)},
                { new Sale("Very cool software", DateTime.Parse("11.9.15"), 25000m)},
                { new Sale("Cool software", DateTime.Parse("20.9.15"), 10000m)},
                { new Sale("Cool software", DateTime.Parse("3.10.15"), 15000m)}
            });

            List<Employee> employees = new List<Employee>();
            employees.Add(developer);
            employees.Add(manager);
            employees.Add(anotherManager);
            employees.Add(salesEmployee);

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            Developer dev = new Developer("Fiki", "Stoyanov", 552, Department.Accounting, 2000);
            Developer dev2 = new Developer("Boris", "Ivanov", 563, Department.Production, 1000);
            Manager manager = new Manager("Kostadin", "Blagoev", 522, Department.Sales, 3200);
            SalesEmployee salesEmp = new SalesEmployee("Strahil", "Momchilov", 500, Department.Marketing, 750.43m);

            IList <Employee> employees = new List<Employee>
            {
                dev,
                dev2,
                manager,
                salesEmp
            };

            foreach (Employee employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            List<Person> personData = new List<Person>();
            Manager one = new Manager();
            one.EmployeSet.Add(new Developer());
            SalesEmployee two = new SalesEmployee();
            two.SaleSet.Add(new Sale());
            two.SaleSet.Add(new Sale());
            Developer three = new Developer();
            three.projectSet.Add(new Project());
            three.projectSet.Add(new Project());

            personData.Add(one);
            personData.Add(two);
            personData.Add(three);

            foreach (Person currentPerson in personData)
            {
                Console.WriteLine(currentPerson);
            }
        }
Beispiel #21
0
        static void Main()
        {
            Manager EK = new Manager(1, "Emil", "Kirilov", new List<Employee>());
            SalesEmployee DIG = new SalesEmployee(30968, "Ivaylo", "Genchev", new List<Sale>());
            Developer pesho = new Developer(2, "Petyr", "Cvetkov", new List<Project>());
            Manager me = new Manager
            {
                ID = 232323,
                FirstName = "Pesho",
                LastName = "Peshev",
                Employees = new List<Employee>()
            };
            Console.WriteLine(me.FirstName);

            List<Person> MostComputers = new List<Person> {EK, DIG, pesho};

            foreach (var person in MostComputers)
            {
                Console.WriteLine(person);
            }
        }
        public static void Main()
        {
            Project project1 = new Project("First project", new DateTime(2014, 12, 08), "open");
            project1.CloseProject();

            Project project2 = new Project("Second project", new DateTime(2015, 12, 24), "open");

            Manager manager = new Manager("8109087956", "Iskra", "Radeva", 3000m, "Marketing",
                new List<Employee>() {
                    new Developer("7710126545", "Ivan", "Mantarov", 1200m, "Marketing",
                    new List<Project>() {project1, project2})
                });

            SalesEmployee salesEmployee = new SalesEmployee("8009076545", "Miq", "Nikolova", 2000m, "Sales",
                new List<Sale>()
                {
                    new Sale("FirstSale", new DateTime(2015, 11, 13), 2200m), new Sale("SecondSale", DateTime.Today, 1358m)
                });

            Developer developer = new Developer("56121410000", "Krum", "Tomov", 2400, "Production",
                new List<Project>() {
                    new Project("otherProjectFirst", new DateTime(2013, 08, 21), "closed", "some details"),
                    new Project("OtherProject", new DateTime(2015, 09, 08), "open")
                });

            List<Person.Person> persons = new List<Person.Person>
            {
                manager,
                salesEmployee,
                developer
            };

            foreach (var person in persons)
            {
                Console.WriteLine("___________________________");
                Console.WriteLine(person);

            }
        }
        static void Main(string[] args)
        {
            Manager manager1 = new Manager("0000000001", "Manager1", "Manager1 Last name", Department.Accounting, 123m);
            Manager manager2 = new Manager("0000000002", "Manager2", "Manager2 Last name", Department.Sales, 3124m);
            Manager manager3 = new Manager("0000000003", "Manager2", "Manager2 Last name", Department.Marketing, 1423m);

            SalesEmployee salesEmployee1 = new SalesEmployee("0000000004", "SalesEmployee1", "SalesEmployee1 Last name", Department.Accounting, 512m);
            SalesEmployee salesEmployee2 = new SalesEmployee("0000000005", "SalesEmployee2", "SalesEmployee2 Last name", Department.Marketing, 513m);
            SalesEmployee salesEmployee3 = new SalesEmployee("0000000006", "SalesEmployee3", "SalesEmployee3 Last name", Department.Production, 1000m);

            Developer developer1 = new Developer("0000000007", "Developer1", "Developer1 Last name", Department.Marketing, 5523m);
            Developer developer2 = new Developer("0000000008", "Developer2", "Developer2 Last name", Department.Sales, 513m);
            Developer developer3 = new Developer("0000000009", "Developer3", "Developer3 Last name", Department.Accounting, 523m);

            Sale sale = new Sale("graphic card", DateTime.Now, 220m);
            Project project = new Project("OOP", "OOP course", DateTime.Now);

            manager1.AddEmployees(new HashSet<Employee> { salesEmployee1, developer3 });
            salesEmployee1.AddSales(new HashSet<Sale> { sale });
            developer1.AddProjects(new HashSet<Project> { project });

            IList<Employee> employees = new List<Employee>
            {
                manager1,
                manager2,
                manager3,
                salesEmployee1,
                salesEmployee2,
                salesEmployee3,
                developer1,
                developer2,
                developer3
            };

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
        static List<IEmployee> Employees()
        {
            Project homeAlone = new Project("Home alone", new DateTime(2016, 05, 22), "");
            Project tarzan = new Project("Tarzan", new DateTime(2015, 05, 22), "The movie is being shot right now");
            HashSet<Project> projects = new HashSet<Project>() { homeAlone, tarzan };

            Sale buchva = new Sale("Buchva", 17.156);
            Sale korniz = new Sale("Korniz", 22.156);
            Sale magdanoz = new Sale("Magdanoz", 2.05);
            HashSet<Sale> sales = new HashSet<Sale>() { buchva, korniz, magdanoz };

            SalesEmployee salesEmployee = new SalesEmployee("Geogi", "Ivanov", "9304294003", 29129.2314m,
                Department.Production, sales);
            Developer developer = new Developer("Danel", "Kraev", "9304294003", 29129.2314m,
                Department.Production, projects);

            HashSet<Employee> managedEmployees = new HashSet<Employee>() { salesEmployee, developer };
            Manager manager = new Manager("Simeon", "Vanov", "9304294003", 29129.2314m, Department.Production,
                managedEmployees);

            List<IEmployee> employees = new List<IEmployee>() { salesEmployee, developer, manager };
            return employees;
        }
        static List<IEmployee> Employees()
        {
            Projects homeAlone = new Projects("Home alone", new DateTime(2016, 05, 22), "");
            Projects tarzan = new Projects("Tarzan", new DateTime(2015, 05, 22), "The movie is being shot right now");
            HashSet<Projects> projects = new HashSet<Projects>() { homeAlone, tarzan };

            Sales krastavica = new Sales("krastavici", 1.15m);
            Sales korniz = new Sales("Korniz", 22.15m);
            Sales boiler = new Sales("Boiler", 200.05m);
            HashSet<Sales> sales = new HashSet<Sales>() { krastavica, korniz, boiler };

            SalesEmployee salesEmployee = new SalesEmployee("Daniel", "Lydianov", "9304294003", 2500.00m,
                Department.Production, sales);
            Developer developer = new Developer("Angel", "Miladinov", "9304294003", 1500.00m,
                Department.Production, projects);

            HashSet<Employee> managedEmployees = new HashSet<Employee>() { salesEmployee, developer };
            Manager manager = new Manager("Volen", "Siderov", "9304294003", 2000.00m, Department.Sales,
                managedEmployees);

            List<IEmployee> employees = new List<IEmployee>() { salesEmployee, developer, manager };
            return employees;
        }
Beispiel #26
0
    public void InitializersForList()
    {
        Developer dev1 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev2 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev3 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            Developer dev4 = new Developer();
            dev1.Name = "William";
            dev1.Height = "5";

            List<Developer> devs = new List<Developer>()
            {
                dev1, dev2, dev3, dev4
            };
    }
    static void Main()
    {
        Employee[] employees = new Employee[3];

        SalesEmployee stilian = new SalesEmployee("Stilian", "Stoikov", 1000, "Sales");
        stilian.Sales.Add(new Sales("Chocolate", 20));
        stilian.Sales.Add(new Sales("Bananas", 10));
        employees[0] = stilian;

        Developer georgi = new Developer("Georgi", "Georgiev", 1500, "Production");
        georgi.Projects.Add(new Project("Tetris game", new DateTime(2014,12,15), "open"));
        georgi.Projects.Add(new Project("Diablo 3", new DateTime(2013, 11, 10), "closed"));
        employees[1] = georgi;

        Manager theBoss = new Manager("Mihail", "Svetoslavov", 5000, "Marketing");
        theBoss.Subordinates.Add(georgi);
        theBoss.Subordinates.Add(stilian);
        employees[2] = theBoss;

        foreach (var employee in employees)
        {
            Console.WriteLine(employee.ToString());
        }
    }
Beispiel #28
0
        //------------------------------------------------------------------------------------
        //Procedure: UpdateDeveloper
        //Purpose:   Provides functionality for updating a developer record
        //           Used by Insert and Update buttons.
        //Accepts:   ref Developer objDeveloper: Developer record to update
        //Returns:   True if success, false if not
        private bool UpdateDeveloper(ref Developer objDeveloper)
        {
            bool blnResult = false;

            objDeveloper.Name = txtName.Text;
            objDeveloper.Salary = double.Parse(txtSalary.Text.Trim());

            //Set departments
            SetDeveloperDepartments(ref objDeveloper);

            //Write record to DB
            blnResult = objDeveloper.Update();

            return blnResult;
        }
        public void MultipleInheritanceTests()
        {
            IBackendDev developer = new Developer();

            Assert.Equal("C#", developer.LearnNewLanguage("C#"));
        }
        public static string ImportGames(VaporStoreDbContext context, string jsonString)
        {
            var sb = new StringBuilder();

            ImportGameDto[] gameDtos = JsonConvert.DeserializeObject <ImportGameDto[]>(jsonString);

            var games      = new List <Game>();
            var developers = new List <Developer>();
            var genres     = new List <Genre>();
            var tags       = new List <Tag>();

            foreach (var gameDto in gameDtos)
            {
                if (!IsValid(gameDto))
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                DateTime releaseDate;

                bool isReleaseDateValid = DateTime.TryParseExact(gameDto.ReleaseDate, "yyyy-MM-dd",
                                                                 CultureInfo.InvariantCulture, DateTimeStyles.None, out releaseDate);

                if (!isReleaseDateValid)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                if (gameDto.Tags.Length == 0)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                Game game = new Game()
                {
                    Name        = gameDto.Name,
                    Price       = gameDto.Price,
                    ReleaseDate = releaseDate
                };

                var gameDev = developers.FirstOrDefault(d => d.Name == gameDto.Developer);

                if (gameDev == null)
                {
                    var newGameDev = new Developer()
                    {
                        Name = gameDto.Developer
                    };
                    developers.Add(newGameDev);

                    game.Developer = newGameDev;
                }
                else
                {
                    game.Developer = gameDev;
                }

                Genre gameGenre = genres
                                  .FirstOrDefault(g => g.Name == gameDto.Genre);

                if (gameGenre == null)
                {
                    Genre newGenre = new Genre()
                    {
                        Name = gameDto.Genre
                    };

                    genres.Add(newGenre);
                    game.Genre = newGenre;
                }
                else
                {
                    game.Genre = gameGenre;
                }

                foreach (string tagName in gameDto.Tags)
                {
                    if (String.IsNullOrEmpty(tagName))
                    {
                        continue;
                    }

                    Tag gameTag = tags
                                  .FirstOrDefault(t => t.Name == tagName);

                    if (gameTag == null)
                    {
                        Tag newGameTag = new Tag()
                        {
                            Name = tagName
                        };

                        tags.Add(newGameTag);
                        game.GameTags.Add(new GameTag()
                        {
                            Game = game,
                            Tag  = newGameTag
                        });
                    }
                    else
                    {
                        game.GameTags.Add(new GameTag()
                        {
                            Game = game,
                            Tag  = gameTag
                        });
                    }
                }

                if (game.GameTags.Count == 0)
                {
                    sb.AppendLine(ErrorMessage);
                    continue;
                }

                games.Add(game);
                sb.AppendLine(String.Format(SuccessfullyImportedGame, game.Name, game.Genre.Name, game.GameTags.Count));
            }

            context.Games.AddRange(games);
            context.SaveChanges();

            return(sb.ToString().TrimEnd());
        }
Beispiel #31
0
 public void Create(Developer developer)
 {
     image.sprite = developer.image;
     Name.text    = developer.Name;
 }
Beispiel #32
0
        //Update

        private void UpdateList()
        {
            Console.Clear();
            ViewDevelopers();
            Console.WriteLine("Enter the index number of the developer you wish to edit: ");

            string numOfDevString = (Console.ReadLine());

            int.TryParse(numOfDevString, out int k);

            while (k <= 0 || k > _developerRepo._listOfDevelopers.Count)
            {
                Console.WriteLine("Invalid entry. Please try again. ");

                Console.WriteLine("Enter the index number of the developer you wish to edit: ");
                numOfDevString = (Console.ReadLine());
                int.TryParse(numOfDevString, out k);
            }


            Developer developer = new Developer();

            Console.WriteLine("Enter the new name: ");
            developer.Name = Console.ReadLine();

            Console.WriteLine($"FYI badge numbers cannot be changed.");
            developer.BadgeNumber = GetDeveloperByIndex(numOfDevString).BadgeNumber;


            string yesOrNo;

            do
            {
                Console.WriteLine($"Would you like to assign {developer.Name} to a team? y/n");

                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    ViewListOfTeams();
                    Console.WriteLine($"Enter the index number of the team you wish to assign {developer.Name} to.");

                    string numOfDevString2 = (Console.ReadLine());
                    int.TryParse(numOfDevString2, out int j);

                    while (j <= 0 || j > _devTeamRepo._listOfTeams.Count)
                    {
                        Console.WriteLine("Invalid entry. Please try again.");

                        Console.WriteLine($"Enter the index number of the team you wish to assign {developer.Name} to.");

                        numOfDevString2 = (Console.ReadLine());
                        int.TryParse(numOfDevString2, out j);
                    }

                    if (GetDeveloperByIndex(numOfDevString).Team == null)
                    {
                        developer.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                        _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamMembers.Add(developer);  //avoiding null exception for next if..
                    }
                    else if (GetDeveloperByIndex(numOfDevString).Team == _devTeamRepo._listOfTeams.ElementAt(j - 1))
                    {
                        Console.WriteLine("Developer was already assigned to that team and cannot be added agian.");
                        developer.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                    }
                    else
                    {
                        developer.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                        _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamMembers.Add(developer);
                    }

                    if (developer.Team == null)
                    {
                        Console.WriteLine("Sorry that team name was not found and team affiliation was not updated");
                    }
                }
                else if (yesOrNo == "n")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Please enter a (y) or (n)");
                }
            } while (yesOrNo != "y" && yesOrNo != "n");  //end of long do while loop

            do
            {
                Console.WriteLine($"Does {developer.Name} have Pluralsight access?  y/n ");
                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    developer.TypeOfAccess = (AccessType)1;
                }
                else if (yesOrNo == "n")
                {
                    developer.TypeOfAccess = (AccessType)0;
                }
                else
                {
                    Console.WriteLine("Please enter a (y) or (n)");
                }
            } while (yesOrNo != "y" && yesOrNo != "n");  //just a loop to deal with user not entering n or y


            //end

            bool wasUpdated = _developerRepo.UpdateDeveloper(k, developer);

            if (wasUpdated)
            {
                Console.WriteLine("Deveolper successfully updated");
            }
            else
            {
                Console.WriteLine("Update failed!");
            }
        }
Beispiel #33
0
        //Add developers and make any other changes to team
        private void AddDevelopersToTeam()
        {
            Console.Clear();

            //Choose team to edit


            ViewListOfTeams();
            Console.WriteLine($"Enter the index number of the team you wish to edit.");

            string tempString = (Console.ReadLine());

            int.TryParse(tempString, out int j);

            while (j <= 0 || j > _devTeamRepo._listOfTeams.Count)
            {
                Console.WriteLine("Invalid entry.  Please try again.");

                Console.WriteLine($"Enter the index number of the team you wish to edit.");

                tempString = (Console.ReadLine());
                int.TryParse(tempString, out j);
            }

            DevTeam          team    = new DevTeam();
            List <Developer> newList = new List <Developer>();
            //Create a new instance of DevTeam
            string response;

            _devTeamRepo.TeamDetails(j);
            Console.WriteLine("Do you wish to update team name at this time? y/n");
            response = Console.ReadLine().ToLower();
            if (response == "y")
            {
                Console.WriteLine("What is the new team name: ");  //Name
                team.TeamName = Console.ReadLine();
            }
            else
            {
                string oldName = _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamName;
                team.TeamName = oldName;
            }
            Console.WriteLine($"FYI Team ID cannot be changed.\n"); //ID
            //Loop to add multiple Developers at one time
            string yesOrNo;

            do
            {
                Console.WriteLine($"Would you like to assign developers to {team.TeamName}? y/n");

                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    ViewDevelopers();

                    Console.WriteLine($"How many developers would you like to add to {team.TeamName}?"); //Loop for Developers
                    string tempString2 = (Console.ReadLine());
                    int.TryParse(tempString2, out int k);
                    while (k <= 0 || k > _developerRepo.GetList().Count)
                    {
                        Console.WriteLine("Invalid entry.  Please try again.");

                        Console.WriteLine($"How many developers would you like to add to {team.TeamName}?");
                        tempString2 = Console.ReadLine();
                        int.TryParse(tempString2, out k);
                    }

                    Console.Clear();
                    ViewDevelopers();

                    string x;

                    for (int i = 0; i < k; i++)
                    {
                        Console.WriteLine($"What is the index number of the next developer you would like to add to {team.TeamName}?");
                        x = Console.ReadLine();
                        Developer ex = GetDeveloperByIndex(x);
                        if (ex != null)
                        {
                            if (ex.Team == null)
                            {
                                ex.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                                newList.Add(ex);  //this if statement avoids null exception for the next if...
                            }
                            else
                            if (ex.Team.TeamName == _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamName)
                            {
                                /*catch duplicate dev*/
                                Console.WriteLine("That developer was already assigned and cannot be added again");
                            }
                            else
                            {
                                newList.Add(ex);
                                ex.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                            }
                        }
                        //else continue;
                        while (ex == null)
                        {
                            Console.WriteLine("Invalid input. Try again!\n");



                            x  = Console.ReadLine();
                            ex = GetDeveloperByIndex(x);
                            if (ex != null)
                            {
                                if (ex.Team == null)
                                {
                                    ex.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                                    newList.Add(ex);  //this if statement avoids null exception for the next if...
                                }
                                else
                                if (ex.Team.TeamName == _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamName)
                                {
                                    /*catch duplicate dev*/
                                    Console.WriteLine("That developer was already assigned and cannot be added again");
                                }
                                else
                                {
                                    newList.Add(ex);
                                    ex.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                                }
                            }
                        }
                    }
                    team.TeamMembers = newList;
                }
                else
                if (yesOrNo == "n")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Please enter y or n.");
                }
            }while (yesOrNo != "y" && yesOrNo != "n");

            if (_devTeamRepo.UpdateTeam(j, team))
            {
                Console.WriteLine("Success");
            }
            else
            {
                Console.WriteLine("Update failed");
            }
        }
Beispiel #34
0
 public void AddDeveloper(Developer developer)
 {
     _developerRepository.AddDeveloper(developer);
 }
        static void Main(string[] args)
        {
            // var numan = new Human(); // we cannot instanciate object from abstract class

            Developer dev = new Developer("Tosho Todorovski", 30, 999999999,
                                          new List <string>()
            {
                "Javascript", "Css", "Less", "Scss"
            }, 6);
            Tester     test = new Tester("Jill Wayne", 32, 45678943443, 560);
            Operations op   = new Operations("Bob Bobsky", 28, 123123123,
                                             new List <string>()
            {
                "Optimus", "ProtoBeat", "PickPro"
            });
            DevOps     devOps = new DevOps("Anne Brown", 22, 123456789, true, false);
            QAEngineer qa     = new QAEngineer("Mia Wong", 34, 78932222312,
                                               new List <string>()
            {
                "Selenium"
            });

            Console.WriteLine("Testing Developer");
            Console.WriteLine(dev.GetInfo());
            dev.Greet("Students");
            Console.WriteLine("-----------------");

            dev.Code();

            Console.WriteLine("Testing Tester");
            Console.WriteLine(test.GetInfo());
            test.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("Operation Specialist");
            Console.WriteLine(op.GetInfo());
            op.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("DevOps Specialist");
            Console.WriteLine(devOps.GetInfo());
            devOps.Greet("Students");
            Console.WriteLine("-----------------");

            Console.WriteLine("QA engineer Specialist");
            Console.WriteLine(qa.GetInfo());
            qa.Greet("Students");
            Console.WriteLine("-----------------");

            IHuman qa1 = new QAEngineer("Mia Wong ITester", 34, 78932222312,
                                        new List <string>()
            {
                "Selenium"
            });

            int    number = 9000;
            object obj    = number;

            Console.WriteLine(obj);

            int number1 = (int)obj;

            Console.WriteLine(number1);
            Console.ReadLine();
        }
 /// <summary>
 /// Returns false if it can't create the item
 /// </summary>
 /// <returns>bool</returns>
 public bool CreateDeveloper(Developer developer)
 {
     return(developerRepo.Insert(developer));
 }
Beispiel #37
0
 public Task <bool> UpdateAsync(Developer developer, CancellationToken ct = default(CancellationToken))
 {
     throw new NotImplementedException();
 }
Beispiel #38
0
 public async Task <Developer> AddAsync(Developer newDeveloper, CancellationToken ct = default(CancellationToken))
 {
     newDeveloper.DevID = "A201811131318318923a19accc072146";
     return(newDeveloper);
 }
Beispiel #39
0
 public void Remove(Developer dev)
 {
     context.Developers.Remove(dev);
     Update();
 }
Beispiel #40
0
        /// <summary>
        /// Liefert die Messwerte mit den dazugehörigen Sensoren
        /// </summary>
        public static Commit[] ReadFromCsv()
        {
            string filePath = MyFile.GetFullNameInApplicationTree(Filename);

            string[] lines = File.ReadAllLines(filePath);
            Dictionary <string, Developer> developers = new Dictionary <string, Developer>();
            List <Commit> commits   = new List <Commit>();
            Commit        newCommit = null;
            int           changes;
            int           inserts;
            int           deletes;
            bool          isHeaderFound = false;

            foreach (var item in lines)
            {
                string[] parts = item.Split(',');

                if (parts.Length >= 4)
                {
                    if (isHeaderFound)
                    {
                        commits.Add(newCommit);
                        isHeaderFound = false;
                    }

                    string   hashCode = parts[0];
                    string   name     = parts[1];
                    string   message  = parts[3];
                    DateTime dateTime = Convert.ToDateTime(parts[2]);

                    newCommit = new Commit
                    {
                        Date     = dateTime,
                        HashCode = hashCode,
                        Message  = message
                    };

                    Developer devOp;
                    if (developers.TryGetValue(name, out devOp))
                    {
                        newCommit.Developer = devOp;
                        devOp.Commits.Add(newCommit);
                    }
                    else
                    {
                        Developer newDevOp = new Developer
                        {
                            Name = name,
                        };
                        newCommit.Developer = newDevOp;
                        newDevOp.Commits.Add(newCommit);
                        developers.Add(name, newDevOp);
                    }
                    isHeaderFound = true;
                }

                if (parts.Length > 1 && parts.Length < 4)
                {
                    GetFooterInformation(parts, out changes, out inserts, out deletes);
                    newCommit.FilesChanges = changes;
                    newCommit.Insertions   = inserts;
                    newCommit.Deletions    = deletes;
                    commits.Add(newCommit);
                    isHeaderFound = false;
                }
            }
            return(commits.ToArray());
        }
        private static void ClassMembersExampleOutput()
        {
            Developer d1 = new Developer(5000);

            d1.GetSalary();
        }
 public void AddDeveloper(Developer dev)
 {
     devrepos.Create(dev);
 }
Beispiel #43
0
 public void UpdateDeveloper(Developer developer)
 {
     _developerRepository.UpdateDeveloper(developer);
 }
Beispiel #44
0
 public static void WriteLogAsync(this LogServiceClient client, string message, DateTime?timeStamp = null
                                  , LogLevel logLevel       = LogLevel.Error
                                  , string action           = null, string accountId = null
                                  , string hostName         = null, string clientIp  = null
                                  , ServiceType serviceType = ServiceType.Unknown, Developer developer  = Developer.Undefined
                                  , Exception exception     = null, IDictionary <string, string> extras = null)
 {
     client.WriteLogAsync(message, (timeStamp?.ToTickTimeStamp() ?? DateTime.Now.ToTickTimeStamp())
                          , logLevel
                          , action, accountId, hostName, clientIp, serviceType, developer, exception, extras);
 }
Beispiel #45
0
        public static void WriteLogAsync(this LogServiceClient client, string message, long timeStamp
                                         , LogLevel logLevel       = LogLevel.Error
                                         , string action           = null, string accountId = null
                                         , string hostName         = null, string clientIp  = null
                                         , ServiceType serviceType = ServiceType.Unknown, Developer developer  = Developer.Undefined
                                         , Exception exception     = null, IDictionary <string, string> extras = null)
        {
            var mingLog = new MingLog()
            {
                Message   = message,
                TimeStamp = timeStamp,

                HostName    = hostName,
                ClientIp    = clientIp,
                ServiceType = serviceType,
                Developer   = developer,
                Action      = action,
                Level       = logLevel,
                AccountId   = accountId,
                Stack       = exception?.StackTrace,
            };

            if (extras != null)
            {
                foreach (var i in extras)
                {
                    mingLog.Extras.Add(extras);
                }
            }

            client.WriteLogAsync(mingLog);
        }
Beispiel #46
0
        public static void FatalError(this LogServiceClient client, string message
                                      , string action           = null, string accountId = null
                                      , ServiceType serviceType = ServiceType.Unknown, Developer developer  = Developer.Undefined
                                      , Exception exception     = null, IDictionary <string, string> extras = null)
        {
            //Default logLevel,timeStamp,hostName,clientIp
            var logLevel  = LogLevel.Fatal;
            var timeStamp = DateTime.Now.ToTickTimeStamp();
            var hostName  = GetHostName();
            var clientIp  = GetClientIp();

            client.WriteLogAsync(message, timeStamp, logLevel
                                 , action, accountId, hostName, clientIp, serviceType, developer, exception, extras);
        }
Beispiel #47
0
        //Methods for DevTeam
        //Create a New Team
        private void CreateTeam()
        {
            List <Developer> newList = new List <Developer>();

            Console.Clear();
            DevTeam team = new DevTeam();

            //Get Name
            Console.WriteLine("What is the name of the new team? ");
            team.TeamName = Console.ReadLine();
            //Get ID
            do
            {
TeamBadge:
                Console.WriteLine($"Enter the numerical Team ID for {team.TeamName}");
                string s = Console.ReadLine();

                int.TryParse(s, out int k);
                team.TeamID = k;
                foreach (DevTeam tm in _devTeamRepo._listOfTeams)
                {
                    if (tm.TeamID == k)
                    {
                        Console.WriteLine("That ID has already been assigned.  Please enter a unique TeamID");
                        goto TeamBadge;
                    }
                }
            } while (team.TeamID <= 0);

            //Loop to add multiple Developers at one time
            string yesOrNo;

            do
            {
                Console.WriteLine($"Would you like to assign developers to {team.TeamName}? y/n");

                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    ViewDevelopers();
                    Console.WriteLine($"How many developers would you like to add to {team.TeamName}?"); //Loop for Developers
                    string tempString2 = (Console.ReadLine());
                    int.TryParse(tempString2, out int k);
                    while (k <= 0 || k > _developerRepo.GetList().Count)
                    {
                        Console.WriteLine("Invalid entry.  Please try again. ");

                        Console.WriteLine($"How many developers would you like to add to {team.TeamName}?");
                        tempString2 = Console.ReadLine();
                        int.TryParse(tempString2, out k);
                    }

                    Console.Clear();
                    ViewDevelopers();

                    string x;

                    for (int i = 0; i < k; i++)
                    {
                        Console.WriteLine($"What is the index number of the next developer you would like to add to {team.TeamName}?");
                        x = Console.ReadLine();
                        Developer ex = GetDeveloperByIndex(x);
                        if (ex != null)
                        {
                            foreach (Developer dev in newList)
                            {
                                if (dev.Name == ex.Name)
                                {
                                    Console.WriteLine("That developer was already added and could not be added again");
                                    goto GetOutOfLoop;
                                }
                            }

                            newList.Add(ex);
                        }

                        while (GetDeveloperByIndex(x) == null)
                        {
                            Console.WriteLine("Invalid input. Try again!\n");

                            Console.WriteLine($"What is the index number of the next developer you would like to add to {team.TeamName}?");
                            x  = Console.ReadLine();
                            ex = GetDeveloperByIndex(x);
                            if (ex != null)
                            {
                                newList.Add(ex);
                            }
                        }
                        GetOutOfLoop : Console.WriteLine(""); //label to break out of loop if user trys to add the same dev
                    }
                    team.TeamMembers = newList;
                }
                else
                if (yesOrNo == "n")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Please enter y or n.");
                }
            }while (yesOrNo != "y" && yesOrNo != "n");

            _devTeamRepo.CreateNewTeam(team);
            if (newList != null)
            {
                foreach (Developer dev in newList)
                {
                    dev.Team = team;
                }
            }
        }///View List of teams
 public async Task <IActionResult> Create(Developer developer)
 {
     return(Ok());
 }
Beispiel #49
0
        //Add
        private void AddDeveloper()
        {
            Console.Clear();
            Developer developer = new Developer();

            Console.WriteLine("Enter the name of the new developer:");
            developer.Name = Console.ReadLine();
            Badge : Console.WriteLine("");
            Console.WriteLine($"Enter the badge number for {developer.Name}");
            string badgeAsString = Console.ReadLine();

            int.TryParse(badgeAsString, out int k);

            developer.BadgeNumber = k;
            if (k == 0)
            {
                Console.WriteLine("Invalid entry.  Try again.");
                goto Badge;
            }
            foreach (Developer dev in _developerRepo._listOfDevelopers)
            {
                if (k == dev.BadgeNumber)
                {
                    Console.WriteLine("That number is alredy assigned to another developer.  Please enter a unique ID");
                    goto Badge;
                }
            }
            string yesOrNo;

            do
            {
                Console.WriteLine($"Would you like to assign {developer.Name} to a team? y/n");

                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    Console.Clear();
                    ViewListOfTeams();
                    Console.WriteLine($"Enter the index number of the team you wish to assign {developer.Name} to.");

                    string numOfDevString = (Console.ReadLine());
                    int.TryParse(numOfDevString, out int j);

                    while (j <= 0 || j > _devTeamRepo._listOfTeams.Count)
                    {
                        Console.WriteLine("Invalid entry.   Please try again.");

                        Console.WriteLine($"Enter the index number of the team you wish to assign {developer.Name} to.");

                        numOfDevString = (Console.ReadLine());
                        int.TryParse(numOfDevString, out j);
                    }
                    developer.Team = _devTeamRepo._listOfTeams.ElementAt(j - 1);
                    _devTeamRepo._listOfTeams.ElementAt(j - 1).TeamMembers.Add(developer);

                    if (developer.Team == null)
                    {
                        Console.WriteLine("Sorry that team name was not found and team affiliation was not updated");
                    }
                }
                else if (yesOrNo == "n")
                {
                    break;
                }
                else
                {
                    Console.WriteLine("Please enter a (y) or (n)");
                }
            } while (yesOrNo != "y" && yesOrNo != "n");  //end of long do while loop

            do
            {
                Console.WriteLine($"Does {developer.Name} have Pluralsight access?  y/n ");
                yesOrNo = Console.ReadLine().ToLower();
                if (yesOrNo == "y")
                {
                    developer.TypeOfAccess = (AccessType)1;
                }
                else if (yesOrNo == "n")
                {
                    developer.TypeOfAccess = (AccessType)0;
                }
                else
                {
                    Console.WriteLine("Please enter a (y) or (n)");
                }
            } while (yesOrNo != "y" && yesOrNo != "n");  //just a loop to deal with user not entering n or y

            _developerRepo.AddToList(developer);
        }
Beispiel #50
0
    static void Main(string[] args)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

        Project operaSpy       = new Project("Opera Spy", new DateTime(2014, 2, 23), "Script", State.Closed);
        Project hospitalTokuda = new Project("Tokuda Care", new DateTime(2014, 5, 15), "Patient management system for Tokuda Hospital", State.Opened);
        Project eShopWebSite   = new Project("EShop ASP.Net", new DateTime(2014, 7, 30), "A website with ASP.Net for an australian trading company", State.Opened);

        Sale operaSpySale = new Sale("Opera Spy", new DateTime(2014, 08, 15), 2340m);
        Sale wordpressPortfolioTemplate = new Sale("Wordpress portfolio", new DateTime(2014, 03, 10), 220m);
        Sale firealarm    = new Sale("Firealarm game", new DateTime(2013, 07, 25), 2000m);
        Sale memoryMatrix = new Sale("Memory Matrix", new DateTime(2014, 09, 5), 1800m);
        Sale bankERP      = new Sale("UCB ERP", new DateTime(2014, 02, 02), 20340m);

        Employee pesho = new SalesEmployee("pp", "Petar", "Petrov", 20000m, Department.Sales, new List <ISale>()
        {
            operaSpySale, firealarm
        });
        Employee gosho = new SalesEmployee("gb", "Georgi", "Balabanov", 24000m, Department.Sales, new List <ISale>()
        {
            wordpressPortfolioTemplate, memoryMatrix
        });
        Employee marinka = new SalesEmployee("md", "Marinka", "Dicheva", 30000m, Department.Marketing, new List <ISale>()
        {
            bankERP
        });

        Employee gergana = new Developer("gm", "Gergana", "Mihailova", 25000, Department.Production, new List <IProject>()
        {
            operaSpy, eShopWebSite, hospitalTokuda
        });
        Employee dimana = new Developer("dm", "Dimana", "Mihailova", 28000, Department.Production, new List <IProject>()
        {
            operaSpy, hospitalTokuda
        });
        Employee donka = new Developer("dk", "Donka", "Karamanova", 15000, Department.Production, new List <IProject>()
        {
            hospitalTokuda
        });

        Manager petranka = new Manager("pk", "Petranka", "Karadocheva", 38000m, Department.Production, new List <Employee>()
        {
            dimana, donka,
        });
        Manager krastanka = new Manager("kk", "Krastanka", "Kurteva", 30000m, Department.Production, new List <Employee>()
        {
            gergana
        });
        Manager tsvetana = new Manager("tm", "Tsvetana", "Marinova", 35000m, Department.Marketing, new List <Employee>()
        {
            pesho, gosho, marinka
        });

        List <Employee> employees = new List <Employee>()
        {
            pesho, gosho, marinka, gergana, tsvetana, krastanka, petranka, donka, dimana,
        };

        foreach (var employee in employees)
        {
            Console.WriteLine(employee);
        }
    }
Beispiel #51
0
 public void AddDeveloper(Developer developer)
 {
     this.developers.Add(developer);
 }
Beispiel #52
0
 public void Add(Developer dev)
 {
     context.Developers.Add(dev);
     Update();
 }
Beispiel #53
0
 //------------------------------------------------------------------------------------
 //Procedure: GetCurrentDeveloper
 //Purpose:   Gets the developer record for the currently entered ID
 //           Used by Search functions.
 //Accepts:   ref Developer objDeveloper: Developer object that was retrieved
 //Returns:   True if success, False if not
 private bool GetCurrentDeveloper(out Developer objDeveloper)
 {
     if (ValidateID(cboID.Text))
     {
         if (FindDeveloper(cboID.Text, out objDeveloper))
         {
             return true;
         }
         else
         {
             MessageBox.Show(this, String.Format("An existing developer record was not found for ID: {0}", cboID.Text), "Developer Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return false;
         }
     }
     else
     {
         objDeveloper = null;
         return false;
     }
 }
Beispiel #54
0
        public static string ImportGames(VaporStoreDbContext context, string jsonString)
        {
            var sb = new StringBuilder();

            var games      = new List <Game>();
            var developers = new List <Developer>();
            var genres     = new List <Genre>();
            var tags       = new List <Tag>();

            var importGames = JsonConvert.DeserializeObject <IEnumerable <GameInputModel> >(jsonString);

            foreach (var importGame in importGames)
            {
                if (!IsValid(importGame))
                {
                    sb.AppendLine(ERROR_MESSAGE);
                    continue;
                }

                bool isValidReleaseDate = DateTime.TryParseExact(importGame.ReleaseDate, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime releaseDate);

                if (!isValidReleaseDate)
                {
                    sb.AppendLine(ERROR_MESSAGE);
                    continue;
                }

                if (importGame.Tags.Length == 0)
                {
                    sb.AppendLine(ERROR_MESSAGE);
                    continue;
                }

                var currentGame = new Game
                {
                    Name        = importGame.Name,
                    Price       = importGame.Price,
                    ReleaseDate = releaseDate
                };

                var currentDev = developers.FirstOrDefault(d => d.Name == importGame.Developer);

                if (currentDev == null)
                {
                    currentDev = new Developer
                    {
                        Name = importGame.Developer
                    };

                    developers.Add(currentDev);
                }

                currentGame.Developer = currentDev;

                var currentGenre = genres.FirstOrDefault(g => g.Name == importGame.Genre);

                if (currentGenre == null)
                {
                    currentGenre = new Genre
                    {
                        Name = importGame.Genre
                    };

                    genres.Add(currentGenre);
                }

                currentGame.Genre = currentGenre;

                foreach (var tag in importGame.Tags)
                {
                    if (string.IsNullOrEmpty(tag))
                    {
                        continue;
                    }

                    var currentTag = tags.FirstOrDefault(t => t.Name == tag);

                    if (currentTag == null)
                    {
                        currentTag = new Tag
                        {
                            Name = tag
                        };

                        tags.Add(currentTag);
                    }

                    currentGame.GameTags.Add(new GameTag
                    {
                        Tag  = currentTag,
                        Game = currentGame
                    });
                }

                games.Add(currentGame);
                sb.AppendLine($"Added {currentGame.Name} ({currentGame.Genre.Name}) with {currentGame.GameTags.Count()} tags");
            }

            context.Games.AddRange(games);
            context.SaveChanges();

            return(sb.ToString().TrimEnd());
        }
Beispiel #55
0
        //------------------------------------------------------------------------------------
        //Procedure: SetDeveloperDepartments
        //Purpose:   Provides functionality for setting departments on a developer object
        //           Used by AddDeveloper and UpdateDeveloper.
        //Accepts:   ref Developer objDeveloper: Developer record to set departments on
        //Returns:   NA
        private void SetDeveloperDepartments(ref Developer objDeveloper)
        {
            IEnumerator objEItem;
            ListViewItem lstItem;

            objEItem = lstDepartment.Items.GetEnumerator();

            //Add or Remove department records based on checkbox value
            while (objEItem.MoveNext())
            {
                lstItem = (ListViewItem)objEItem.Current;

                if (lstItem.Checked)
                {
                    objDeveloper.AddDepartment(int.Parse(lstItem.Tag.ToString()));
                }
                else
                {
                    objDeveloper.RemoveDepartment(int.Parse(lstItem.Tag.ToString()));
                }
            }
        }
    public static void Main()
    {
        IProject infoPortal = new Project(
            "Info Portal",
            new DateTime(2013, 1, 30),
            "Information portal for retirees",
            State.Closed);

        IProject brainGame = new Project(
            "Brainiac",
            new DateTime(2014, 6, 15),
            "Set of games which develop kids's logical thinking",
            State.Open);

        IProject greatDevelop = new Project(
            "Great Develop",
            new DateTime(2014, 9, 10),
            "Revolutional IDE for JavaScript developing",
            State.Open);

        ISale infoPortalSale  = new Sale("Info Portal", new DateTime(2014, 4, 12), 2100);
        ISale fingerPrint     = new Sale("IFinger", new DateTime(2014, 1, 8), 4299);
        ISale nightVision     = new Sale("IVision", new DateTime(2014, 7, 1), 5900);
        ISale hologramObject  = new Sale("IHologram", new DateTime(2013, 12, 14), 5200);
        ISale knowledgeSetter = new Sale("IFunnel", new DateTime(2012, 8, 19), 7500);

        IEmployee koko = new SalesEmployee(
            12,
            "Koicho",
            "Koichev",
            2200m,
            Department.Sales,
            new List <ISale> {
            fingerPrint, hologramObject
        });

        IEmployee sisko = new SalesEmployee(
            321,
            "Slavi",
            "Colov",
            1200.03m,
            Department.Sales,
            new List <ISale> {
            infoPortalSale, nightVision
        });

        IEmployee bobi = new SalesEmployee(
            122,
            "Bina",
            "Bobeva",
            1200.32m,
            Department.Sales,
            new List <ISale> {
            knowledgeSetter
        });

        IEmployee margarit = new Developer(
            20,
            "Margarit",
            "Margaritkov",
            1300.54m,
            Department.Production,
            new List <IProject> {
            brainGame, infoPortal
        });

        IEmployee iglika = new Developer(
            25,
            "Iglika",
            "Minzuharova",
            1100.12m,
            Department.Production,
            new List <IProject> {
            brainGame, greatDevelop
        });

        IEmployee pamukov = new Developer(
            620,
            "Vejdi",
            "Pamukov",
            1420.90m,
            Department.Production,
            new List <IProject> {
            brainGame, infoPortal, greatDevelop
        });

        IEmployee prokopi = new Manager(
            119,
            "Prokopi",
            "Prokopiev",
            960.35m,
            Department.Marketing,
            new List <IEmployee> {
            koko, bobi, pamukov
        });

        IEmployee zlatan = new Manager(
            199,
            "Zlatan",
            "Zlatanov",
            830.90m,
            Department.Marketing,
            new List <IEmployee> {
            iglika, margarit, sisko
        });

        IEmployee bogdanka = new Manager(
            119,
            "Bogdanka",
            "Bogdanova",
            1130.87m,
            Department.Accounting,
            new List <IEmployee> {
            zlatan, prokopi
        });

        IList <IEmployee> employess = new List <IEmployee>
        {
            koko,
            sisko,
            bobi,
            margarit,
            iglika,
            pamukov,
            prokopi,
            zlatan,
            bogdanka
        };

        foreach (IEmployee employee in employess)
        {
            Console.WriteLine(employee);
        }
    }
Beispiel #57
0
 public void UpdateDeveloper(Developer dev)
 {
     //Nothing
 }
 public void Update(Developer developer)
 {
     devrepos.Update(developer);
 }
 public string Visit(Developer developer)
 {
     return(developer.Name);
 }
Beispiel #60
0
 public Developer AttachDevUser(Developer dev)
 {
     return(context.Developers.OrderByDescending(d => d.Id).FirstOrDefault(d => d.Name == dev.Name && d.Info == dev.Info));
 }