public ActionResult EditSuratA(int id = 0) { surat surat = new surat(); if (id != 0) { surat = db.surats.Where(x => x.id_surat == id).FirstOrDefault(); } return(View(surat)); }
public ActionResult Details(int id = 0) { surat detailsurat = new surat(); if (id != 0) { detailsurat = db.surats.Find(id); } return(View(detailsurat)); }
public ActionResult DeleteSurat(int id) { try { surat surat = db.surats.Where(x => x.id_surat == id).FirstOrDefault(); db.surats.Remove(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Proses Dibatalkan!" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditStatusRekening(int id) { surat rekening = db.surats.Where(u => u.id_surat == id).FirstOrDefault(); if (rekening.status == "Request") { rekening.status = "Process"; db.Entry(rekening).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "RequestRekening", GetRequestRekening()), message = "Proses Dilanjutkan" }, JsonRequestBehavior.AllowGet)); } else if (rekening.status == "Process") { rekening.status = "Finish"; db.Entry(rekening).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessRekening", GetProcessRekening()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } return(Json("Success")); }
public ActionResult EditSuratA(surat surat) { try { surat surat2 = db.surats.Find(surat.id_surat); surat2.keterangan = surat.keterangan; surat2.status = "Finish"; surat2.oleh = Session["nama"].ToString(); db.Entry(surat2).State = EntityState.Modified; db.SaveChanges(); if (surat2.id_jenis == 1) { return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessRekening", GetProcessRekening()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } else if (surat2.id_jenis == 2) { return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessKerja", GetProcessKerja()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } else if (surat2.id_jenis == 3) { return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessNPWP", GetProcessNPWP()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } else if (surat2.id_jenis == 4) { return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessPemberitahuan", GetProcessPemberitahuan()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } else if (surat2.id_jenis == 5) { return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ProcessVisa", GetProcessVisa()), message = "Proses Selesai" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Surat Hilang" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditSurat(surat surat) { try { surat surat2 = db.surats.Find(surat.id_surat); surat2.detail_surat.nama_bank = surat.detail_surat.nama_bank; surat2.detail_surat.keperluan = surat.detail_surat.keperluan; surat2.detail_surat.no_passport = surat.detail_surat.no_passport; surat2.detail_surat.tgl_pergi = surat.detail_surat.tgl_pergi; surat2.detail_surat.tgl_pulang = surat.detail_surat.tgl_pulang; surat2.detail_surat.tujuan = surat.detail_surat.tujuan; surat2.detail_surat.tujuan_instansi = surat.detail_surat.tujuan_instansi; surat2.detail_surat.kegiatan = surat.detail_surat.kegiatan; surat2.detail_surat.lokasi = surat.detail_surat.lokasi; db.Entry(surat2).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "Details", surat2), message = "Edit Data Sukses" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult RequestSurat(surat surat) { try { int id = Convert.ToInt32(Session["nik"]); if (surat.id_jenis == 1) { var cek = db.surats.Where(x => x.nik == id && x.status != "Finish" && x.id_jenis == 1).FirstOrDefault(); if (cek == null) { surat.nik = Convert.ToInt32(Session["nik"]); surat.tanggal = DateTime.Today; surat.status = "Request"; db.surats.Add(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Request surat buka rekening berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Harap tunggu, Request pembukaan rekening anda masih diproses" }, JsonRequestBehavior.AllowGet)); } } if (surat.id_jenis == 2) { var cek = db.surats.Where(x => x.nik == id && x.status != "Finish" && x.id_jenis == 2).FirstOrDefault(); if (cek == null) { surat.nik = Convert.ToInt32(Session["nik"]); surat.tanggal = DateTime.Today; surat.status = "Request"; db.surats.Add(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Request keterangan kerja berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Harap tunggu, Request surat keterangan kerja anda masih diproses" }, JsonRequestBehavior.AllowGet)); } } if (surat.id_jenis == 3) { var cek = db.surats.Where(x => x.nik == id && x.status != "Finish" && x.id_jenis == 3).FirstOrDefault(); if (cek == null) { surat.nik = Convert.ToInt32(Session["nik"]); surat.tanggal = DateTime.Today; surat.status = "Request"; db.surats.Add(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Request surat NPWP berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Harap tunggu, Request surat NPWP anda masih diproses" }, JsonRequestBehavior.AllowGet)); } } if (surat.id_jenis == 4) { var cek = db.surats.Where(x => x.nik == id && x.status != "Finish" && x.id_jenis == 4).FirstOrDefault(); if (cek == null) { surat.nik = Convert.ToInt32(Session["nik"]); surat.tanggal = DateTime.Today; surat.status = "Request"; db.surats.Add(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Request surat pemberitahuan berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Harap tunggu, Request surat pemberitahuan anda masih diproses" }, JsonRequestBehavior.AllowGet)); } } if (surat.id_jenis == 5) { var cek = db.surats.Where(x => x.nik == id && x.status != "Finish" && x.id_jenis == 5).FirstOrDefault(); if (cek == null) { if (surat.detail_surat.tgl_pulang < surat.detail_surat.tgl_pergi) { return(Json(new { success = false, message = "Tanggal yang anda input tidak valid" }, JsonRequestBehavior.AllowGet)); } surat.nik = Convert.ToInt32(Session["nik"]); surat.tanggal = DateTime.Today; surat.status = "Request"; db.surats.Add(surat); db.SaveChanges(); return(Json(new { success = true, html = Global.RenderRazorViewToString(this, "ListAllSurat", GetAllSurat()), message = "Request surat Visa berhasil" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Harap tunggu, Request surat visa anda masih diproses" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { success = false, message = "error!" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { success = false, message = ex.Message }, JsonRequestBehavior.AllowGet)); } }