public static void Main(string[] args)
        {
            IEmployeesDatabaseConnection EmployeesDatabaseConnection = EmployeeAbstractizationFactory.CreateEmployeeDatabaseConnection();


            EmployeesDatabaseConnection.SetConnectionToLocalDatabase();

            IRecordsDatabaseConnection RecordsDatabaseConnection = RecordsAbstractizationFactory.CreateRecordsDatabaseConnection();

            RecordsDatabaseConnection.SetConnectionToLocalDatabase();

            IEmployeeDatabaseCRUD EmployeesCRUDOperations = EmployeeAbstractizationFactory.CreateInstanceForCRUDOperations();
            IRecordsDatabaseCRUD  RecordsCRUDOperations   = RecordsAbstractizationFactory.CreateInstanceForCRUDOperations();



            IEmployeeModel vasile = EmployeeAbstractizationFactory.CreateEmployeeInstance("vasile1", "10.11.1128", "Wheel", "10.2.2008");

            for (int i = 1; i < 2; i++)
            {
                vasile = EmployeeAbstractizationFactory.CreateEmployeeInstance((string)("vasile" + i.ToString()), "10.11.1128", "Wheel", "10.2.2008");
                EmployeesCRUDOperations.AddNewEmployeeToDatabase(vasile);
            }



            CreateHostBuilder(args).Build().Run();
        }
Exemple #2
0
        public IActionResult SaveModificationEmployee(int ID, string FullName, string BirthDay, string Qualification, string FirstDay)
        {
            if (Startup.isLogged == true)
            {
                try
                {
                    IEmployeeModel Dummy = EmployeeAbstractizationFactory.CreateEmployeeInstance(ID, FullName, BirthDay, Qualification, FirstDay);
                    Console.WriteLine(Dummy.ID.ToString() + "->" + Dummy.FullName + "  " + Dummy.BirthDay);
                    EmployeesCRUDOperations.UpdateEmployeeInDatabase(Dummy);


                    return(RedirectToAction("Employees"));
                }
                catch (Exception ex)
                { Console.WriteLine(ex); return(RedirectToAction("Error")); }
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
Exemple #3
0
        public IActionResult AddNewEmployeeSubmitButton(string FullNameInput, string BirthDayInput, string QualificationInput, string FirstDayInput)
        {
            Console.WriteLine(FullNameInput + "  " + BirthDayInput + "   " + QualificationInput + "  " + FirstDayInput);


            if (Startup.isLogged == true)
            {
                try
                {
                    IEmployeeModel Dummy = EmployeeAbstractizationFactory.CreateEmployeeInstance(FullNameInput, BirthDayInput, QualificationInput, FirstDayInput);

                    EmployeesCRUDOperations.AddNewEmployeeToDatabase(Dummy);

                    return(RedirectToAction("Employees"));
                }
                catch (Exception ex)
                { return(RedirectToAction("Error")); }
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }