Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Personnel_Information personnel_Information = db.Personnel_Information.Find(id);

            db.Personnel_Information.Remove(personnel_Information);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "PersonnelID,FirstName,LastName,Age,PhoneNumber")] Personnel_Information personnel_Information)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personnel_Information).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(personnel_Information));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "PersonnelID,FirstName,LastName,Age,PhoneNumber")] Personnel_Information personnel_Information)
        {
            if (ModelState.IsValid)
            {
                db.Personnel_Information.Add(personnel_Information);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(personnel_Information));
        }
Exemplo n.º 4
0
        // GET: Personnel_Information/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Personnel_Information personnel_Information = db.Personnel_Information.Find(id);

            if (personnel_Information == null)
            {
                return(HttpNotFound());
            }
            return(View(personnel_Information));
        }
Exemplo n.º 5
0
        public ActionResult HireProcess()
        {
            //ViewBag.idemp = id2;
            //var ID = int.Parse(id2);
            //var addmodel1 = dbcontext.Employee_Qualification_Profile.ToList();
            //var tr = 0;

            //if (addmodel1.Count() == 0)
            //{
            //    tr = 1;
            //}
            //else
            //{
            //    var te = addmodel1.LastOrDefault().ID;
            //    tr = te + 1;
            //}
            //DateTime statis = Convert.ToDateTime("1/1/1900");
            //var strus = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Personnel);
            //var text = new Employee_Qualification_Profile
            //{ Employee_ProfileId = emp.ID.ToString(), Code = strus.Structure_Code + tr.ToString(), Qualification_start_date = statis, Qualification_end_date = statis };
            //var e = dbcontext.Employee_Qualification_Profile.Add(text);
            //dbcontext.SaveChanges();

            //emp.Employee_Qualification_Profile = e;
            //dbcontext.SaveChanges();
            var Applicant_Profile = dbcontext.Applicant_Profile.ToList();
            var Application       = dbcontext.Application.FirstOrDefault(a => a.Applicant_ProfileId == a.Applicant_Profile.ID.ToString());

            var Employee_Profile = dbcontext.Employee_Profile.ToList();
            var tr = 0;

            if (Employee_Profile.Count() == 0)
            {
                tr = 1;
            }
            else
            {
                var te = Employee_Profile.LastOrDefault().ID;
                tr = te + 1;
            }
            DateTime statis = DateTime.Now;
            var      strus  = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Personnel);

            var Ability = new Ability {
                registration_date = statis
            };
            var Personnel_Information = new Personnel_Information {
                Hire_Date = statis, Join_Date = statis, Boarding_Date = statis, Sector_Join_Date = statis, Social_Insurance_Date = statis
            };
            var Service_Information = new Service_Information {
                EOS_date = statis, Last_working_date = statis, Retired_expected_EOS = statis
            };

            var ab  = dbcontext.Ability.Add(Ability);
            var per = dbcontext.Personnel_Information.Add(Personnel_Information);
            var ser = dbcontext.Service_Information.Add(Service_Information);

            dbcontext.SaveChanges();
            var emp = new Employee_Profile {
                ID = Employee_Profile.LastOrDefault().ID, Code = strus.Structure_Code + tr.ToString(), Name = Application.Applicant_Profile.Name, Full = Application.Applicant_Profile.Full, Full_Name = Application.Applicant_Profile.Full_Name, Birth_date = Application.Applicant_Profile.Birth_date, Expire_date = Application.Applicant_Profile.Expire_date, Issue_date = Application.Applicant_Profile.Issue_date, ReligionId = Application.Applicant_Profile.ReligionId.ToString(), NationalityId = Application.Applicant_Profile.NationalityId.ToString(), Active = true, Ability = ab, Personnel_Information = per, Service_Information = ser, Surname = Application.Applicant_Profile.Surname, Sur_Name = Application.Applicant_Profile.Sur_Name
            };
            var e = dbcontext.Employee_Profile.Add(emp);

            dbcontext.SaveChanges();

            return(RedirectToAction("index"));
        }