public ActionResult TambahBorang(ManageMessageId?message, string id, string key, string value)
        {
            ViewBag.StatusMessage =
                message == ManageMessageId.Tambah ? "Permohonan Telah Berjaya Dihantar."
               : "";

            HR_SEMINAR_LUAR_DETAIL luardetail = new HR_SEMINAR_LUAR_DETAIL();
            HR_SEMINAR_LUAR        seminar    = new HR_SEMINAR_LUAR();
            HR_MAKLUMAT_PERIBADI   peribadi   = new HR_MAKLUMAT_PERIBADI();
            HR_MAKLUMAT_PEKERJAAN  pekerjaan  = new HR_MAKLUMAT_PEKERJAAN();


            luardetail.HR_NO_PEKERJA = id;

            luardetail.HR_SEMINAR_LUAR = new HR_SEMINAR_LUAR();
            luardetail.HR_SEMINAR_LUAR.HR_TARIKH_PERMOHONAN = DateTime.Now;


            HR_MAKLUMAT_PERIBADI  mPeribadi  = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == id);
            HR_MAKLUMAT_PEKERJAAN mPekerjaan = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == id);



            GE_JABATAN jabatan = db2.GE_JABATAN.SingleOrDefault(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN);

            if (jabatan == null)
            {
                jabatan = new GE_JABATAN();
            }
            GE_JABATAN jabatanlist = new GE_JABATAN();
            HR_JAWATAN jawatan     = db.HR_JAWATAN.SingleOrDefault(s => s.HR_KOD_JAWATAN == mPekerjaan.HR_JAWATAN);

            if (jawatan == null)
            {
                jawatan = new HR_JAWATAN();
            }
            HR_JAWATAN listjawatan = new HR_JAWATAN();

            ViewBag.HR_JABATAN      = jabatan.GE_KETERANGAN_JABATAN;
            ViewBag.HR_NAMA_PEKERJA = mPeribadi.HR_NAMA_PEKERJA;
            ViewBag.HR_NO_KPBARU    = mPeribadi.HR_NO_KPBARU;
            ViewBag.HR_JAWATAN      = jawatan.HR_NAMA_JAWATAN;

            HR_SEMINAR_LUAR h = new HR_SEMINAR_LUAR();

            h.HR_KOD_LAWATAN  = "T01";
            h.HR_NAMA_SEMINAR = "TAMBAH BARU SEMINAR";

            List <HR_SEMINAR_LUAR> sem = new List <HR_SEMINAR_LUAR>();

            sem = db.HR_SEMINAR_LUAR.ToList();
            sem.Add(h);

            string[] seminardetails = db.HR_SEMINAR_LUAR_DETAIL.Where(s => s.HR_NO_PEKERJA == id).Select(s => s.HR_KOD_LAWATAN).ToArray();

            ViewBag.HR_KOD_LAWATAN = new SelectList(sem, "HR_KOD_LAWATAN", "HR_NAMA_SEMINAR", null, null, seminardetails);
            ViewBag.key            = key;
            ViewBag.value          = value;
            return(View("TambahBorang", luardetail));
        }
        public ActionResult PadamLulusPengesahanNegara(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR_SEMINAR_LUAR sahseminar = new HR_SEMINAR_LUAR();

            sahseminar.HR_TARIKH_SOKONG = DateTime.Now;
            var tarikhsokong = string.Format("{0:dd/MM/yyyy}", sahseminar.HR_TARIKH_SOKONG);

            ViewBag.HR_TARIKH_SOKONG           = tarikhsokong;
            sahseminar.HR_TARIKH_LULUS_MENTERI = DateTime.Now;
            var tarikhlulus = string.Format("{0:dd/MM/yyyy}", sahseminar.HR_TARIKH_LULUS_MENTERI);

            ViewBag.HR_TARIKH_LULUS_MENTERI = tarikhlulus;

            List <HR_SEMINAR_LUAR> seminar = db.HR_SEMINAR_LUAR.Where(s => s.HR_KOD_LAWATAN == id).ToList();

            if (seminar == null)
            {
                return(HttpNotFound());
            }
            ViewBag.HR_NO_PEKERJA = db.HR_MAKLUMAT_PERIBADI.ToList();
            ViewBag.id            = id;
            return(PartialView("_PadamLulusPengesahanNegara", seminar));
        }
        public ActionResult InfoPekerja(string id, string value)
        {
            if (id == null && value == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR_SEMINAR_LUAR_DETAIL seminarpekerja = new HR_SEMINAR_LUAR_DETAIL();

            seminarpekerja.HR_KOD_LAWATAN = id;
            seminarpekerja.HR_NO_PEKERJA  = value;
            HR_SEMINAR_LUAR_DETAIL seminardetails = db.HR_SEMINAR_LUAR_DETAIL.SingleOrDefault(s => s.HR_KOD_LAWATAN == id && s.HR_NO_PEKERJA == value);
            HR_MAKLUMAT_PERIBADI   mPeribadi      = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == value);
            HR_MAKLUMAT_PEKERJAAN  mPekerjaan     = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == value);
            HR_SEMINAR_LUAR        seminar        = db.HR_SEMINAR_LUAR.SingleOrDefault(s => s.HR_KOD_LAWATAN == id);

            ViewBag.HR_NAMA_PEKERJA = mPeribadi.HR_NAMA_PEKERJA;
            ViewBag.HR_JAWATAN      = mPekerjaan.HR_JAWATAN;

            ViewBag.HR_JABATAN = mPekerjaan.HR_JABATAN;


            ViewBag.HR_BAHAGIAN = mPekerjaan.HR_BAHAGIAN;

            ViewBag.HR_BAHAGIAN = new SelectList(db2.GE_BAHAGIAN.Where(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN), "GE_KOD_BAHAGIAN", "GE_KETERANGAN");


            db.Configuration.ProxyCreationEnabled = false;

            //ViewBag.seminarluar = db.HR_SEMINAR_LUAR.Include(s => s.HR_SEMINAR_LUAR_DETAIL).Where(s => s.HR_KOD_LAWATAN == seminardetails.HR_KOD_LAWATAN).ToList();
            ViewBag.seminarluar = db.HR_SEMINAR_LUAR_DETAIL.Include(s => s.HR_SEMINAR_LUAR).Where(s => s.HR_NO_PEKERJA == seminardetails.HR_NO_PEKERJA).ToList();

            // ViewBag.seminarluar = db.HR_SEMINAR_LUAR_DETAIL.Where(s=> s.HR_NO_PEKERJA == seminardetails.HR_NO_PEKERJA).ToList();


            if (seminardetails == null)
            {
                return(HttpNotFound());
            }

            List <SelectListItem> kerap = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Ya", Value = "Y"
                },
                new SelectListItem {
                    Text = "Tidak", Value = "T"
                },
            };

            ViewBag.kerap = new SelectList(kerap, "Value", "Text");


            ViewBag.HR_NO_PEKERJA = db.HR_MAKLUMAT_PERIBADI.ToList();


            ViewBag.HR_JABATAN  = new SelectList(db2.GE_JABATAN, "GE_KOD_JABATAN", "GE_KETERANGAN_JABATAN");
            ViewBag.HR_BAHAGIAN = new SelectList(db2.GE_BAHAGIAN.Where(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN), "GE_KOD_BAHAGIAN", "GE_KETERANGAN");
            return(PartialView("_InfoPekerja", seminardetails));
        }
 public ActionResult DeleteConfirmed(HR_SEMINAR_LUAR seminar, string id, string key, string value)
 {
     seminar = db.HR_SEMINAR_LUAR.SingleOrDefault(s => s.HR_KOD_LAWATAN == seminar.HR_KOD_LAWATAN);
     db.HR_SEMINAR_LUAR.Remove(seminar);
     db.SaveChanges();
     {
         return(RedirectToAction("SenaraiPemohon", new { key = key, value = value }));
     }
 }
        public ActionResult TambahBorang([Bind(Include = "HR_KOD_LAWATAN,HR_NO_PEKERJA, HR_KERAP_IND, HR_LAPORAN_IND, HR_TARIKH_CUTI,HR_TARIKH_CUTI_AKH,HR_JUMLAH_CUTI,HR_TARIKH_KEMBALI,HR_ALAMAT_CUTI,HR_TARIKHMULA_MANGKU,HR_TARIKHAKHIR_MANGKU,HR_TIKET_KAPAL,HR_PENGINAPAN,HR_LAIN,HR_JUMLAH_BELANJA,HR_NAMA_PEGAWAI,HR_HUBUNGAN,HR_ALAMAT_PEGAWAI,HR_NOTEL_PEGAWAI,HR_EMAIL_PEGAWAI,HR_ALASAN")] HR_SEMINAR_LUAR_DETAIL luardetail, [Bind(Include = "HR_KOD_LAWATAN,HR_TARIKH_PERMOHONAN,HR_TARIKH_MULA,HR_TARIKH_TAMAT,HR_NAMA_SEMINAR,HR_TUJUAN,HR_TEMPAT,HR_FAEDAH,HR_LULUS_IND,HR_PERBELANJAAN,HR_LULUS_MENTERI_IND,HR_TARIKH_LULUS_MENTERI,HR_PERBELANJAAN_LAIN,HR_SOKONG_IND,HR_TARIKH_SOKONG,HR_NP_SOKONG,HR_JENIS_IND")] HR_SEMINAR_LUAR luar)
        {
            HR_MAKLUMAT_PERIBADI  mPeribadi  = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);
            HR_MAKLUMAT_PEKERJAAN mPekerjaan = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);
            GE_JABATAN            jabatan    = db2.GE_JABATAN.SingleOrDefault(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN);

            if (jabatan == null)
            {
                jabatan = new GE_JABATAN();
            }
            GE_JABATAN jabatanlist = new GE_JABATAN();
            HR_JAWATAN jawatan     = db.HR_JAWATAN.SingleOrDefault(s => s.HR_KOD_JAWATAN == mPekerjaan.HR_JAWATAN);

            if (jawatan == null)
            {
                jawatan = new HR_JAWATAN();
            }
            HR_JAWATAN listjawatan = new HR_JAWATAN();

            ViewBag.HR_JABATAN      = jabatan.GE_KETERANGAN_JABATAN;
            ViewBag.HR_NAMA_PEKERJA = mPeribadi.HR_NAMA_PEKERJA;
            ViewBag.HR_NO_KPBARU    = mPeribadi.HR_NO_KPBARU;
            ViewBag.HR_JAWATAN      = jawatan.HR_NAMA_JAWATAN;

            HR_SEMINAR_LUAR h = new HR_SEMINAR_LUAR();

            h.HR_KOD_LAWATAN  = "T01";
            h.HR_NAMA_SEMINAR = "TAMBAH BARU SEMINAR";

            List <HR_SEMINAR_LUAR> sem = new List <HR_SEMINAR_LUAR>();

            sem = db.HR_SEMINAR_LUAR.ToList();
            sem.Add(h);

            string[] seminardetails = db.HR_SEMINAR_LUAR_DETAIL.Where(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA).Select(s => s.HR_KOD_LAWATAN).ToArray();

            ViewBag.HR_KOD_LAWATAN = new SelectList(sem, "HR_KOD_LAWATAN", "HR_NAMA_SEMINAR", null, null, seminardetails);
            if (ModelState.IsValid)
            {
                if (luar.HR_KOD_LAWATAN == "T01")
                {
                    var SelectLastID = db.HR_SEMINAR_LUAR.OrderByDescending(s => s.HR_KOD_LAWATAN).FirstOrDefault().HR_KOD_LAWATAN;
                    var LastID       = new string(SelectLastID.SkipWhile(x => x == '0').ToArray());
                    var Increment    = Convert.ToSingle(LastID) + 1;
                    var KodLawatan   = Convert.ToString(Increment).PadLeft(5, '0');
                    luardetail.HR_KOD_LAWATAN = KodLawatan;
                    luar.HR_KOD_LAWATAN       = KodLawatan;
                    db.HR_SEMINAR_LUAR.Add(luar);
                }
                db.HR_SEMINAR_LUAR_DETAIL.Add(luardetail);
                db.SaveChanges();

                return(View("TambahBorang", luardetail));
            }
            return(View("TambahBorang", "PemohonanBaruLuar", new { Message = ManageMessageId.Tambah }));
        }
 public ActionResult EditLuarNegara([Bind(Include = "HR_KOD_LAWATAN,HR_TARIKH_PERMOHONAN,HR_TARIKH_MULA,HR_TARIKH_TAMAT,HR_NAMA_SEMINAR,HR_TUJUAN,HR_TEMPAT,HR_FAEDAH,HR_LULUS_IND,HR_PERBELANJAAN,HR_LULUS_MENTERI_IND,HR_TARIKH_LULUS_MENTERI,HR_PERBELANJAAN_LAIN,HR_SOKONG_IND,HR_TARIKH_SOKONG,HR_NP_SOKONG,HR_JENIS_IND,HR_TARIKH_CUTI,HR_TARIKH_CUTI_AKH,HR_JUMLAH_CUTI,HR_TARIKH_KEMBALI,HR_ALAMAT_CUTI")] HR_SEMINAR_LUAR seminar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seminar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(seminar));
 }
        public ActionResult DeleteConfirmed(HR_SEMINAR_LUAR seminar, HR_SEMINAR_LUAR_DETAIL seminardetails)
        {
            //ViewBag.seminarluar = db.HR_SEMINAR_LUAR_DETAIL.Include(s => s.HR_SEMINAR_LUAR).Where(s => s.HR_NO_PEKERJA == seminardetails.HR_NO_PEKERJA).ToList();

            //  db.HR_SEMINAR_LUAR.RemoveRange(db.HR_SEMINAR_LUAR.Where(s => s.HR_KOD_LAWATAN == seminar.kod);
            //seminar = db.HR_SEMINAR_LUAR.SingleOrDefault(s => s.HR_KOD_LAWATAN == seminar.HR_KOD_LAWATAN && s.HR_KOD_LAWATAN == seminar.HR_KOD_LAWATAN);

            db.HR_SEMINAR_LUAR.RemoveRange(db.HR_SEMINAR_LUAR.Include(s => s.HR_SEMINAR_LUAR_DETAIL).Where(s => s.HR_KOD_LAWATAN == seminar.HR_KOD_LAWATAN && s.HR_KOD_LAWATAN == seminardetails.HR_KOD_LAWATAN));
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public JsonResult CariLuar(string id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            HR_SEMINAR_LUAR item = db.HR_SEMINAR_LUAR.SingleOrDefault(s => s.HR_KOD_LAWATAN == id);

            if (item == null)
            {
                item = new HR_SEMINAR_LUAR();
            }
            return(Json(item, JsonRequestBehavior.AllowGet));
        }
        public ActionResult TambahNegara([Bind(Include = "HR_KOD_LAWATAN,HR_TARIKH_PERMOHONAN,HR_TARIKH_MULA,HR_TARIKH_TAMAT,HR_NAMA_SEMINAR,HR_TUJUAN,HR_TEMPAT,HR_FAEDAH,HR_LULUS_IND,HR_PERBELANJAAN,HR_LULUS_MENTERI_IND,HR_TARIKH_LULUS_MENTERI,HR_PERBELANJAAN_LAIN,HR_SOKONG_IND,HR_TARIKH_SOKONG,HR_NP_SOKONG,HR_JENIS_IND,HR_TARIKH_CUTI,HR_TARIKH_CUTI_AKH,HR_JUMLAH_CUTI,HR_TARIKH_KEMBALI,HR_ALAMAT_CUTI")] HR_SEMINAR_LUAR seminar)
        {
            if (ModelState.IsValid)
            {
                HR_SEMINAR_LUAR seminarluar = db.HR_SEMINAR_LUAR.SingleOrDefault(s => (s.HR_KOD_LAWATAN == seminar.HR_KOD_LAWATAN));

                if (seminarluar == null)
                {
                    var SelectLastID = db.HR_SEMINAR_LUAR.OrderByDescending(s => s.HR_KOD_LAWATAN).FirstOrDefault().HR_KOD_LAWATAN;
                    var LastID       = new string(SelectLastID.SkipWhile(x => x == '0').ToArray());
                    var Increment    = Convert.ToSingle(LastID) + 1;
                    var KodLawatan   = Convert.ToString(Increment).PadLeft(5, '0');
                    seminar.HR_KOD_LAWATAN = KodLawatan;

                    db.HR_SEMINAR_LUAR.Add(seminar);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            return(PartialView("_TambahNegara", seminar));
        }
        public JsonResult Seminar(string HR_KOD_LAWATAN)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            MajlisContext        mc = new MajlisContext();

            db.Configuration.ProxyCreationEnabled = false;

            //MaklumatKakitanganModels model = new MaklumatKakitanganModels();
            // Test test = new Test();

            //HR_MAKLUMAT_PERIBADI item = db.HR_MAKLUMAT_PERIBADI.Include(s => s.HR_MAKLUMAT_PEKERJAAN).SingleOrDefault(s => s.HR_NO_PEKERJA == HR_NO_PEKERJA);

            LuarNegaraModels modelluar = new LuarNegaraModels();

            HR_SEMINAR_LUAR sem = db.HR_SEMINAR_LUAR.Include(s => s.HR_SEMINAR_LUAR_DETAIL).SingleOrDefault(s => s.HR_KOD_LAWATAN == HR_KOD_LAWATAN);



            List <HR_SEMINAR_LUAR> seminar = db.HR_SEMINAR_LUAR.Where(s => s.HR_KOD_LAWATAN == HR_KOD_LAWATAN).ToList();

            return(Json(seminar, JsonRequestBehavior.AllowGet));
        }
        public ActionResult InfoLuarNegara(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR_SEMINAR_LUAR seminar = db.HR_SEMINAR_LUAR.Find(id);


            if (seminar == null)
            {
                return(HttpNotFound());
            }

            List <SelectListItem> bulan = new List <SelectListItem>
            {
                //new SelectListItem { Text = "JANUARI", Value = "1" },
                //new SelectListItem { Text = "FEBRUARI", Value = "2" },
                //new SelectListItem { Text = "MAC", Value = "3" },
                //new SelectListItem { Text = "APRIL", Value = "4" },
                //new SelectListItem { Text = "MAY", Value = "5" },
                //new SelectListItem { Text = "JUN", Value = "6" },
                //new SelectListItem { Text = "JULAI", Value = "7" },
                //new SelectListItem { Text = "OGOS", Value = "8" },
                //new SelectListItem { Text = "SEPTEMBER", Value = "9" },
                //new SelectListItem { Text = "OKTOBER", Value = "10" },
                //new SelectListItem { Text = "NOVEMBER", Value = "11" },
                //new SelectListItem { Text = "DISEMBER", Value = "12" }
            };

            ViewBag.bulan = new SelectList(bulan, "Value", "Text", DateTime.Now.Month);

            List <SelectListItem> belanja = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "MBPJ", Value = "M"
                },
                new SelectListItem {
                    Text = "SENDIRI", Value = "S"
                },
                new SelectListItem {
                    Text = "LAIN-LAIN", Value = "L"
                },
            };

            ViewBag.belanja = new SelectList(belanja, "Value", "Text");
            List <SelectListItem> luluskementerian = new List <SelectListItem>
            {
                new SelectListItem {
                    Text = "Ya", Value = "Y"
                },
                new SelectListItem {
                    Text = "Tidak", Value = "T"
                },
            };

            ViewBag.luluskementerian = new SelectList(luluskementerian, "Value", "Text");
            ViewBag.HR_SEMINAR_LUAR  = db.HR_SEMINAR_LUAR.ToList();
            var tarikhpermohonan = string.Format("{0:dd/MM/yyyy}", seminar.HR_TARIKH_PERMOHONAN);

            ViewBag.HR_TARIKH_PERMOHONAN = tarikhpermohonan;
            return(PartialView("_InfoLuarNegara", seminar));
        }
        public ActionResult TambahLulusPengesahanNegara([Bind(Include = "HR_KOD_LAWATAN,HR_NO_PEKERJA, HR_KERAP_IND, HR_LAPORAN_IND, HR_TARIKH_CUTI,HR_TARIKH_CUTI_AKH,HR_JUMLAH_CUTI,HR_TARIKH_KEMBALI,HR_ALAMAT_CUTI,HR_TARIKHMULA_MANGKU,HR_TARIKHAKHIR_MANGKU,HR_TIKET_KAPAL,HR_PENGINAPAN,HR_LAIN,HR_JUMLAH_BELANJA,HR_NAMA_PEGAWAI,HR_HUBUNGAN,HR_ALAMAT_PEGAWAI,HR_NOTEL_PEGAWAI,HR_EMAIL_PEGAWAI,HR_ALASAN")] HR_SEMINAR_LUAR_DETAIL luardetail, [Bind(Include = "HR_KOD_LAWATAN,HR_TARIKH_PERMOHONAN,HR_TARIKH_MULA,HR_TARIKH_TAMAT,HR_NAMA_SEMINAR,HR_TUJUAN,HR_TEMPAT,HR_FAEDAH,HR_LULUS_IND,HR_PERBELANJAAN,HR_LULUS_MENTERI_IND,HR_TARIKH_LULUS_MENTERI,HR_PERBELANJAAN_LAIN,HR_SOKONG_IND,HR_TARIKH_SOKONG,HR_NP_SOKONG,HR_JENIS_IND")] HR_SEMINAR_LUAR luar)
        {
            HR_MAKLUMAT_PERIBADI  mPeribadi  = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);
            HR_MAKLUMAT_PEKERJAAN mPekerjaan = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);

            if (ModelState.IsValid)
            {
                db.HR_SEMINAR_LUAR_DETAIL.Add(luardetail);
                db.SaveChanges();
                return(RedirectToAction("SenaraiLuarNegara"));
            }

            return(PartialView("_TambahLulusPengesahanNegara", luardetail));
        }
        public ActionResult PadamBorang(string id, string kod, string key, string value)
        {
            HR_SEMINAR_LUAR_DETAIL luardetail = new HR_SEMINAR_LUAR_DETAIL();
            HR_SEMINAR_LUAR        seminar    = new HR_SEMINAR_LUAR();
            HR_MAKLUMAT_PERIBADI   peribadi   = new HR_MAKLUMAT_PERIBADI();
            HR_MAKLUMAT_PEKERJAAN  pekerjaan  = new HR_MAKLUMAT_PEKERJAAN();

            luardetail.HR_NO_PEKERJA   = id;
            luardetail.HR_KOD_LAWATAN  = kod;
            luardetail.HR_SEMINAR_LUAR = new HR_SEMINAR_LUAR();
            //luardetail.HR_SEMINAR_LUAR.HR_TARIKH_PERMOHONAN = DateTime.Now;

            HR_SEMINAR_LUAR_DETAIL mDetail    = db.HR_SEMINAR_LUAR_DETAIL.SingleOrDefault(s => s.HR_NO_PEKERJA == id && s.HR_KOD_LAWATAN == kod);
            HR_SEMINAR_LUAR        mSeminar   = db.HR_SEMINAR_LUAR.SingleOrDefault(s => s.HR_KOD_LAWATAN == kod);
            HR_MAKLUMAT_PERIBADI   mPeribadi  = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == id);
            HR_MAKLUMAT_PEKERJAAN  mPekerjaan = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == id);

            GE_JABATAN jabatan = db2.GE_JABATAN.SingleOrDefault(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN);

            if (jabatan == null)
            {
                jabatan = new GE_JABATAN();
            }
            GE_JABATAN jabatanlist = new GE_JABATAN();
            HR_JAWATAN jawatan     = db.HR_JAWATAN.SingleOrDefault(s => s.HR_KOD_JAWATAN == mPekerjaan.HR_JAWATAN);

            if (jawatan == null)
            {
                jawatan = new HR_JAWATAN();
            }
            HR_JAWATAN listjawatan = new HR_JAWATAN();

            ViewBag.HR_JABATAN      = jabatan.GE_KETERANGAN_JABATAN;
            ViewBag.HR_NAMA_PEKERJA = mPeribadi.HR_NAMA_PEKERJA;
            ViewBag.HR_NO_KPBARU    = mPeribadi.HR_NO_KPBARU;
            ViewBag.HR_JAWATAN      = jawatan.HR_NAMA_JAWATAN;
            ViewBag.HR_NAMA_SEMINAR = mSeminar.HR_NAMA_SEMINAR;
            ViewBag.HR_TARIKH_MULA  = mSeminar.HR_TARIKH_MULA;
            ViewBag.HR_TARIKH_TAMAT = mSeminar.HR_TARIKH_TAMAT;
            ViewBag.HR_TEMPAT       = mSeminar.HR_TEMPAT;
            ViewBag.HR_TUJUAN       = mSeminar.HR_TUJUAN;
            var tarikhpemohonan = string.Format("{0:dd/MM/yyyy}", mSeminar.HR_TARIKH_PERMOHONAN);

            ViewBag.HR_TARIKH_PERMOHONAN = tarikhpemohonan;
            var tarikhmula = string.Format("{0:dd/MM/yyyy}", mSeminar.HR_TARIKH_MULA);

            ViewBag.HR_TARIKH_MULA = tarikhmula;
            var tarikhtamat = string.Format("{0:dd/MM/yyyy}", mSeminar.HR_TARIKH_TAMAT);

            ViewBag.HR_TARIKH_TAMAT = tarikhtamat;
            var tarikhcuti = string.Format("{0:dd/MM/yyyy}", mDetail.HR_TARIKH_CUTI);

            ViewBag.HR_TARIKH_CUTI = tarikhcuti;
            var tarikhcutiakhir = string.Format("{0:dd/MM/yyyy}", mDetail.HR_TARIKH_CUTI_AKH);

            ViewBag.HR_TARIKH_CUTI_AKH = tarikhcutiakhir;
            var tarikhkembali = string.Format("{0:dd/MM/yyyy}", mDetail.HR_TARIKH_KEMBALI);

            ViewBag.HR_TARIKH_KEMBALI = tarikhkembali;
            var tarikhmangkumula = string.Format("{0:dd/MM/yyyy}", mDetail.HR_TARIKH_MANGKU_MULA);

            ViewBag.HR_TARIKH_MANGKU_MULA = tarikhmangkumula;
            var tarikhmangkuakhir = string.Format("{0:dd/MM/yyyy}", mDetail.HR_TARIKH_MANGKU_AKHIR);

            ViewBag.HR_TARIKH_MANGKU_AKHIR = tarikhmangkuakhir;

            HR_SEMINAR_LUAR h = new HR_SEMINAR_LUAR();

            h.HR_KOD_LAWATAN  = "T01";
            h.HR_NAMA_SEMINAR = "TAMBAH BARU SEMINAR";

            List <HR_SEMINAR_LUAR> sem = new List <HR_SEMINAR_LUAR>();

            sem = db.HR_SEMINAR_LUAR.ToList();
            sem.Add(h);

            string[] seminardetails = db.HR_SEMINAR_LUAR_DETAIL.Where(s => s.HR_NO_PEKERJA == id).Select(s => s.HR_KOD_LAWATAN).ToArray();

            ViewBag.HR_KOD_LAWATAN = new SelectList(sem, "HR_KOD_LAWATAN", "HR_NAMA_SEMINAR", null, null, seminardetails);
            ViewBag.key            = key;
            ViewBag.value          = value;
            return(View("PadamBorang", mDetail));
        }
        public ActionResult EditBorang([Bind(Include = "HR_KOD_LAWATAN,HR_NO_PEKERJA, HR_KERAP_IND, HR_LAPORAN_IND, HR_TARIKH_CUTI,HR_TARIKH_CUTI_AKH,HR_JUMLAH_CUTI,HR_TARIKH_KEMBALI,HR_ALAMAT_CUTI,HR_TARIKHMULA_MANGKU,HR_TARIKHAKHIR_MANGKU,HR_TIKET_KAPAL,HR_PENGINAPAN,HR_LAIN,HR_JUMLAH_BELANJA,HR_NAMA_PEGAWAI,HR_HUBUNGAN,HR_ALAMAT_PEGAWAI,HR_NOTEL_PEGAWAI,HR_EMAIL_PEGAWAI,HR_ALASAN")] HR_SEMINAR_LUAR_DETAIL luardetail, [Bind(Include = "HR_KOD_LAWATAN,HR_TARIKH_PERMOHONAN,HR_TARIKH_MULA,HR_TARIKH_TAMAT,HR_NAMA_SEMINAR,HR_TUJUAN,HR_TEMPAT,HR_FAEDAH,HR_LULUS_IND,HR_PERBELANJAAN,HR_LULUS_MENTERI_IND,HR_TARIKH_LULUS_MENTERI,HR_PERBELANJAAN_LAIN,HR_SOKONG_IND,HR_TARIKH_SOKONG,HR_NP_SOKONG,HR_JENIS_IND")] HR_SEMINAR_LUAR luar)
        {
            HR_MAKLUMAT_PERIBADI  mPeribadi  = db.HR_MAKLUMAT_PERIBADI.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);
            HR_MAKLUMAT_PEKERJAAN mPekerjaan = db.HR_MAKLUMAT_PEKERJAAN.SingleOrDefault(s => s.HR_NO_PEKERJA == luardetail.HR_NO_PEKERJA);

            GE_JABATAN jabatan = db2.GE_JABATAN.SingleOrDefault(s => s.GE_KOD_JABATAN == mPekerjaan.HR_JABATAN);

            if (jabatan == null)
            {
                jabatan = new GE_JABATAN();
            }
            GE_JABATAN jabatanlist = new GE_JABATAN();

            HR_JAWATAN jawatan = db.HR_JAWATAN.SingleOrDefault(s => s.HR_KOD_JAWATAN == mPekerjaan.HR_JAWATAN);

            if (jawatan == null)
            {
                jawatan = new HR_JAWATAN();
            }
            HR_JAWATAN listjawatan = new HR_JAWATAN();

            ViewBag.HR_JABATAN      = jabatan.GE_KETERANGAN_JABATAN;
            ViewBag.HR_NAMA_PEKERJA = mPeribadi.HR_NAMA_PEKERJA;
            ViewBag.HR_NO_KPBARU    = mPeribadi.HR_NO_KPBARU;
            ViewBag.HR_JAWATAN      = jawatan.HR_NAMA_JAWATAN;


            if (ModelState.IsValid)
            {
                db.Entry(luardetail).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(View(luardetail));
        }