Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TypeOfContract typeOfContract = db.TypeOfContracts.Find(id);

            db.TypeOfContracts.Remove(typeOfContract);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit(TypeOfContract typeOfContract)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeOfContract).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeOfContract));
 }
Example #3
0
        public static SalaryProvider CreateSalaryProvider(TypeOfContract typeOfContract)
        {
            var providers = Assembly.GetAssembly(typeof(SalaryProvider))
                            .GetTypes()
                            .Where(t => typeof(SalaryProvider).IsAssignableFrom(t));

            var provider = providers.Single(x => x.Name.ToLowerInvariant().Contains(typeOfContract.ToString().ToLowerInvariant()));

            return((SalaryProvider)Activator.CreateInstance(provider));
        }
Example #4
0
        public ActionResult Create(TypeOfContract typeOfContract)
        {
            if (ModelState.IsValid)
            {
                db.TypeOfContracts.Add(typeOfContract);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(typeOfContract));
        }
Example #5
0
 public ContractBuilder TypeOfContract(TypeOfContract contract)
 {
     if (SalaryCalculators.TypeOfContract.UmowaZlecenie == contract)
     {
         result = new UmowaZlecenie();
     }
     else if (SalaryCalculators.TypeOfContract.UmowaODzielo == contract)
     {
         result = new UmowaODzielo();
     }
     return(this);
 }
Example #6
0
        // GET: TypeOfContracts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypeOfContract typeOfContract = db.TypeOfContracts.Find(id);

            if (typeOfContract == null)
            {
                return(HttpNotFound());
            }
            return(View(typeOfContract));
        }
Example #7
0
        static void CreateNewEmployee(string name, string surname, TypeOfContract typeOfContract, int wage)
        {
            BaseEmployee employee;
            var          id = ListOfEmployees.Select(e => e.EmployeeId).DefaultIfEmpty(-1).Max() + 1;

            //if(typeOfContract == TypeOfContract.EmploymentContrat)
            //{
            //    employee = new Employee(name, surname, wage, id);
            //} else
            //{
            //    employee = new SpecificEmployee(name, surname, wage,id);
            //}
            employee = EmployeeFactory.CreateEmployee(new RequestEmployee()
            {
                Name           = name,
                Surname        = surname,
                TypeOfContract = typeOfContract,
                Wage           = wage,
                EmployeeId     = id,
            });
            ListOfEmployees.Add(employee);
        }