public ActionResult Edit([Bind(Include = "Employee_Id,Nik,Nip,Name,First_Title,Last_Title,Full_Name,Birth_Place,Birth_Date,Address,Gender_Id,Religion_Id,Identity_Type_Id,Identity_Number,Bank_Id,Rec_Num,Phone_Mobile,Phone_Home,Employee_Status_Id,Blood_Type_Id,Nbm,Nidn,Email_General,Email_Corporate,Role,Active_Status_Id,Npwp,Nik_Salary,Photos,Password,Nik_Finger_Print,Fingerprint_Id,Document_Serdos,Document_Serdos_Ext,Work_Unit_Id,Department_Id,Employee_Role,Forum_Role,Payroll_Role,internal_eksternal,Rfid,Card_Accepted,Created_By,Created_Date,Modified_By,Modified_Date")] Emp_Employee emp_Employee)
        {
            if (ModelState.IsValid)
            {
                emp_Employee.Full_Name = emp_Employee.First_Title + " " + emp_Employee.Name + " " + emp_Employee.Last_Title;

                ////db.Emp_Employee.Attach(emp_Employee); // attach in the Unchanged state
                ////db.Entry(emp_Employee).Property(r => r.Nip).IsModified = true;
                ////db.Entry(emp_Employee).Property(r => r.Nik).IsModified = true;
                ////db.Entry(emp_Employee).Property(r => r.Name).IsModified = true;
                ////db.Entry(emp_Employee).Property(r => r.First_Title).IsModified = true;
                ////db.Entry(emp_Employee).Property(r => r.Last_Title).IsModified = true;
                ////db.Entry(emp_Employee).Property(r => r.Employee_Status_Id).IsModified = true;

                db.Entry(emp_Employee).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            //ViewBag.Active_Status_Id = new SelectList(db.Emp_Active_Status, "Active_Status_Id", "Description", emp_Employee.Active_Status_Id);
            //ViewBag.Bank_Id = new SelectList(db.Emp_Bank, "Bank_Id", "Bank_Name", emp_Employee.Bank_Id);
            ViewBag.Employee_Status_Id = new SelectList(db.Emp_Employee_Status, "Employee_Status_Id", "Description", emp_Employee.Employee_Status_Id);
            //ViewBag.Work_Unit_Id = new SelectList(db.Emp_Work_Unit, "Work_Unit_Id", "Work_Unit_Code", emp_Employee.Work_Unit_Id);
            //ViewBag.Gender_Id = new SelectList(db.Mstr_Gender, "Gender_Id", "Gender_Type", emp_Employee.Gender_Id);
            //ViewBag.Religion_Id = new SelectList(db.Mstr_Religion, "Religion_Id", "Religion_Code", emp_Employee.Religion_Id);
            return(View(emp_Employee));
        }
示例#2
0
        // GET: Course_LecturerMD/Create
        // http://localhost:32244/Course_LecturerMD/Create?Employee_Id=1477
        public ActionResult Create(int?Employee_Id)
        {
            ViewBag.Course_Id     = new SelectList(db.Acd_Course, "Course_Id", "Course_Name");
            ViewBag.Department_Id = new SelectList(db.Mstr_Department, "Department_Id", "Department_Name");
            ViewBag.Employee_Id   = new SelectList(db.Emp_Employee.Where(e => e.Emp_Employee_Status.Description.Contains("Dosen"))
                                                   .Select(e => new { e.Employee_Id, employeetext = e.Full_Name + " [" + e.Nik + "]" })
                                                   .ToList().OrderBy(e => e.employeetext), "Employee_Id", "employeetext");

            /*Employee_Id Selected*/
            if (Employee_Id != null)
            {
                Emp_Employee emp_employee = db.Emp_Employee.Find(Employee_Id);
                ViewBag.Employee_Id = new SelectList(db.Emp_Employee.Where(e => e.Emp_Employee_Status.Description.Contains("Dosen"))
                                                     .Select(e => new { e.Employee_Id, employeetext = e.Full_Name + " [" + e.Nik + "]" })
                                                     .ToList()
                                                     .OrderBy(e => e.employeetext), "Employee_Id", "employeetext", emp_employee.Employee_Id);
            }
            else
            {
                ViewBag.Employee_Id = new SelectList(db.Emp_Employee.Where(e => e.Emp_Employee_Status.Description.Contains("Dosen"))
                                                     .Select(e => new { e.Employee_Id, employeetext = e.Full_Name + " [" + e.Nik + "]" })
                                                     .ToList()
                                                     .OrderBy(e => e.employeetext), "Employee_Id", "employeetext");
            }

            return(View());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Emp_Employee emp_Employee = db.Emp_Employee.Find(id);

            db.Emp_Employee.Remove(emp_Employee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //int proses 3
        public ActionResult BeritaAcaraYudisium(int?Employee_Id, long?Student_Id, DateTime?tglY, string no, string namaJab, short?GraduatePredicateId, bool?IsGraduated)
        {
            if (TempData["shortMessage"] != null)
            {
                ViewBag.message = TempData["shortMessage"].ToString();
            }
            ViewBag.OriUrl = System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToString();

            string DeptFunc = (string)Session["DeptFunc"];

            Emp_Employee emp_Employee = new Emp_Employee();

            if (Employee_Id != null)
            {
                emp_Employee = db.Emp_Employee.Find(Employee_Id);
            }

            long         StudentId    = Convert.ToInt64(TempData["StudentId"] ?? Student_Id);
            Acd_Yudisium acd_Yudisium = db.Acd_Yudisium.Find(StudentId);

            acd_Yudisium.Yudisium_Date = tglY ?? acd_Yudisium.Yudisium_Date;
            acd_Yudisium.Sk_Num        = no ?? acd_Yudisium.Sk_Num;
            if (acd_Yudisium.Department_Functionary == null)
            {
                acd_Yudisium.Department_Functionary = namaJab ?? DeptFunc;
            }
            acd_Yudisium.Department_Functionary_Name = emp_Employee.Full_Name ?? acd_Yudisium.Department_Functionary_Name;
            acd_Yudisium.Department_Functionary_Nik  = emp_Employee.Nik ?? acd_Yudisium.Department_Functionary_Nik;

            //View Data
            var acd_Student = new Acd_Student();

            acd_Student           = db.Acd_Student.Where(s => s.Student_Id == StudentId).FirstOrDefault();
            ViewBag.Nim           = acd_Student.Nim;
            ViewBag.Name          = acd_Student.Full_Name;
            ViewBag.Department_Id = acd_Student.Department_Id;

            //viewbag for dropdown Is_Graduated
            List <SelectListItem> obj = new List <SelectListItem>();

            obj.Add(new SelectListItem {
                Text = "Lulus", Value = "true"
            });
            obj.Add(new SelectListItem {
                Text = "Tidak lulus", Value = "false"
            });
            ViewBag.Is_Graduated = new SelectList(obj, "Value", "Text", IsGraduated ?? acd_Yudisium.Is_Graduated);
            //viewbag for dropdown Graduate_Predicate
            ViewBag.Graduate_Predicate_Id = new SelectList(db.Mstr_Graduate_Predicate, "Graduate_Predicate_Id", "Predicate_Name", GraduatePredicateId ?? acd_Yudisium.Graduate_Predicate_Id);

            return(View(acd_Yudisium));
        }
        // GET: Employee/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Emp_Employee emp_Employee = db.Emp_Employee.Find(id);

            if (emp_Employee == null)
            {
                return(HttpNotFound());
            }
            return(View(emp_Employee));
        }
        // GET: Employee/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Emp_Employee emp_Employee = db.Emp_Employee.Find(id);

            if (emp_Employee == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.Active_Status_Id = new SelectList(db.Emp_Active_Status, "Active_Status_Id", "Description", emp_Employee.Active_Status_Id);
            //ViewBag.Bank_Id = new SelectList(db.Emp_Bank, "Bank_Id", "Bank_Name", emp_Employee.Bank_Id);
            ViewBag.Employee_Status_Id = new SelectList(db.Emp_Employee_Status, "Employee_Status_Id", "Description", emp_Employee.Employee_Status_Id);
            //ViewBag.Work_Unit_Id = new SelectList(db.Emp_Work_Unit, "Work_Unit_Id", "Work_Unit_Code", emp_Employee.Work_Unit_Id);
            //ViewBag.Gender_Id = new SelectList(db.Mstr_Gender, "Gender_Id", "Gender_Type", emp_Employee.Gender_Id);
            //ViewBag.Religion_Id = new SelectList(db.Mstr_Religion, "Religion_Id", "Religion_Code", emp_Employee.Religion_Id);
            return(View(emp_Employee));
        }
        //int proses 5
        public ActionResult SuratKeteranganLulus(int?Employee_Id, long?Student_Id, DateTime?tglS, string namaJab)
        {
            if (TempData["shortMessage"] != null)
            {
                ViewBag.message = TempData["shortMessage"].ToString();
            }
            ViewBag.OriUrl = System.Web.HttpContext.Current.Request.Url.AbsolutePath.ToString();

            string facFunc = (string)Session["FacFunc"];

            Emp_Employee emp_Employee = new Emp_Employee();

            if (Employee_Id != null)
            {
                emp_Employee = db.Emp_Employee.Find(Employee_Id);
            }

            long         StudentId    = Convert.ToInt64(TempData["StudentId"] ?? Student_Id);
            Acd_Yudisium acd_Yudisium = db.Acd_Yudisium.Find(StudentId);

            acd_Yudisium.Sk_Date = tglS ?? acd_Yudisium.Sk_Date;
            if (acd_Yudisium.Faculty_Functionary == null)
            {
                acd_Yudisium.Faculty_Functionary = namaJab ?? facFunc;
            }
            acd_Yudisium.Faculty_Functionary_Name = emp_Employee.Full_Name ?? acd_Yudisium.Faculty_Functionary_Name;
            acd_Yudisium.Faculty_Functionary_Nik  = emp_Employee.Nik ?? acd_Yudisium.Faculty_Functionary_Nik;

            //View Data
            var acd_Student = new Acd_Student();

            acd_Student           = db.Acd_Student.Where(s => s.Student_Id == StudentId).FirstOrDefault();
            ViewBag.Nim           = acd_Student.Nim;
            ViewBag.Name          = acd_Student.Full_Name;
            ViewBag.Department_Id = acd_Student.Department_Id;

            return(View(acd_Yudisium));
        }