public IHttpActionResult PutLayananR(string id, LayananR layananR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != layananR.IdLayananRS) { return(BadRequest()); } db.Entry(layananR).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LayananRExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutDokter(string id, Dokter dokter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dokter.NPA) { return(BadRequest()); } db.Entry(dokter).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DokterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutRumahSakit(string id, RumahSakit rumahSakit) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rumahSakit.IdRS) { return(BadRequest()); } db.Entry(rumahSakit).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RumahSakitExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutJadwalLayanan(string id, JadwalLayanan jadwalLayanan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jadwalLayanan.IdJadwal) { return(BadRequest()); } db.Entry(jadwalLayanan).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JadwalLayananExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAdmin(string id, Admin admin) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != admin.NIP) { return(BadRequest()); } db.Entry(admin).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AdminExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostPasien(Pasien pasien) { var pc = new PasiensController(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Pasiens.Add(pasien); try { db.SaveChanges(); } catch (DbUpdateException) { if (pc.PasienExists(pasien.NIK)) { var responseMessage = "Pasien Sudah Terdaftar"; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, new Exception(responseMessage)))); } else { throw; } } return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Created, new Exception("Register Berhasil")))); }
public ActionResult Create([Bind(Include = "NIK,Nama,Alamat,TanggalLahir,KotaLahir,Email,JenisKelamin,Pekerjaan,StatusPernikahan,Agama,Password,ImageUrl")] Pasien pasien) { if (ModelState.IsValid) { db.Pasiens.Add(pasien); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Agama = new SelectList(db.Agamas, "Id", "Nama", pasien.Agama); return(View(pasien)); }
public ActionResult Create([Bind(Include = "IdRS,NamaRS,JenisRS,KelasRS,Deskripsi,Visi,Misi,Direktur,Alamat,Penyelenggara,Website,Kota,KodePos,Telephone,Fax,ImageUrl,IdAdmin")] RumahSakit rumahSakit) { if (ModelState.IsValid) { db.RumahSakits.Add(rumahSakit); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdAdmin = new SelectList(db.Admins, "NIP", "Nama", rumahSakit.IdAdmin); return(View(rumahSakit)); }
public ActionResult Create([Bind(Include = "id,NIK,NoAntrian,TanggalDaftar,IdLayananRS")] Antrian antrian) { if (ModelState.IsValid) { db.Antrians.Add(antrian); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdLayananRS = new SelectList(db.LayananRS, "IdLayananRS", "IdLayanan", antrian.IdLayananRS); ViewBag.NIK = new SelectList(db.Pasiens, "NIK", "Nama", antrian.NIK); return(View(antrian)); }
public ActionResult Create([Bind(Include = "NPA,Nama,JenisKelamin,TanggalLahir,KotaLahir,Email,Alamat,Password,IdSpesialis,Agama,ImageUrl")] Dokter dokter) { if (ModelState.IsValid) { db.Dokters.Add(dokter); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Agama = new SelectList(db.Agamas, "Id", "Nama", dokter.Agama); ViewBag.IdSpesialis = new SelectList(db.Spesialis, "IdSpesialis", "NamaSpesialis", dokter.IdSpesialis); return(View(dokter)); }
public ActionResult Create([Bind(Include = "IdLayanan,IdRS,IdLayananRS")] LayananR layananR) { if (ModelState.IsValid) { db.LayananRS.Add(layananR); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdLayanan = new SelectList(db.JenisLayanans, "IdLayanan", "JenisLayanan1", layananR.IdLayanan); ViewBag.IdRS = new SelectList(db.RumahSakits, "IdRS", "NamaRS", layananR.IdRS); return(View(layananR)); }
public ActionResult Create([Bind(Include = "NIK,NPA,Chat,DateTime")] Konsultasi konsultasi) { if (ModelState.IsValid) { db.Konsultasis.Add(konsultasi); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.NPA = new SelectList(db.Dokters, "NPA", "Nama", konsultasi.NPA); ViewBag.NIK = new SelectList(db.Pasiens, "NIK", "Nama", konsultasi.NIK); return(View(konsultasi)); }
public static void uploadJadwal() { BogorHealthEntities db = new BogorHealthEntities(); string pathToExcelFile = "" + @"D:\rsud.xlsx"; string sheetName = "JadwalLayanan"; var excelFile = new ExcelQueryFactory(pathToExcelFile); IQueryable <Jadwal> artistAlbums = (from a in excelFile.Worksheet <Jadwal>(sheetName) select a); IQueryable <JadwalLayanan> sp = artistAlbums.Select(dok => new JadwalLayanan { IdJadwal = dok.IdLayananRS + dok.IdDokter + dok.JamMulai.TimeOfDay.TotalHours + dok.Hari, IdLayananRS = dok.IdLayananRS, IdDokter = dok.IdDokter, Hari = dok.Hari, JamMulai = (dok.JamMulai.TimeOfDay), JamSelesai = dok.JamSelesai.TimeOfDay, }); foreach (var k in sp) { var cek = db.JadwalLayanans.Find(k.IdJadwal); if (cek == null) { db.JadwalLayanans.Add(k); db.SaveChanges(); } } Console.Write(sp); }
public static void uploadSpesialis() { BogorHealthEntities db = new BogorHealthEntities(); string pathToExcelFile = "" + @"D:\rsud.xlsx"; string sheetName = "Spesialis"; var excelFile = new ExcelQueryFactory(pathToExcelFile); var artistAlbums = from a in excelFile.Worksheet(sheetName) select a; IQueryable <Spesiali> sp = (from a in excelFile.Worksheet <Spesiali>(sheetName) select a); foreach (Spesiali spesiali in sp) { db.Spesialis.Add(spesiali); db.SaveChanges(); Console.WriteLine("Ok"); } }
public static void uploadAdmin() { BogorHealthEntities db = new BogorHealthEntities(); string pathToExcelFile = "" + @"D:\rsud.xlsx"; string sheetName = "Admin"; var excelFile = new ExcelQueryFactory(pathToExcelFile); var artistAlbums = from a in excelFile.Worksheet(sheetName) select a; IQueryable <Admin> sp = (from a in excelFile.Worksheet <Admin>(sheetName) select a); foreach (Admin dok in sp) { db.Admins.Add(dok); db.SaveChanges(); Console.WriteLine("Ok"); } }
public static void uploadLayananRS() { BogorHealthEntities db = new BogorHealthEntities(); string pathToExcelFile = "" + @"D:\rsud.xlsx"; string sheetName = "rrLayanan RS"; var excelFile = new ExcelQueryFactory(pathToExcelFile); var artistAlbums = from a in excelFile.Worksheet(sheetName) select a; IQueryable <LayananR> sp = (from a in excelFile.Worksheet <LayananR>(sheetName) select a); foreach (LayananR dok in sp) { var l = db.LayananRS.Find(dok.IdLayananRS); if (l == null) { db.LayananRS.Add(dok); db.SaveChanges(); Console.WriteLine("Ok"); } } }
public IHttpActionResult GetNumAntrian(String nik, String idlayanan) { Antrian ar = new Antrian(); var user = db.Pasiens.Find(nik); if (user == null) { var responseMessage = "Akun ini tidak terdaftar silahkan ."; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, new Exception(responseMessage)))); } var date = DateTime.Now; var antrianByDate = db.Antrians.Where(b => EntityFunctions.TruncateTime(b.TanggalDaftar) == date.Date).ToList(); if (antrianByDate.Count > 0) { var check = false; var noAntrian = 0; for (var i = 0; i < antrianByDate.Count; i++) { if (antrianByDate[i].NIK == nik) { check = true; } if (antrianByDate[i].IdLayananRS == idlayanan) { noAntrian = antrianByDate[i].NoAntrian; } } if (check == true) { var responseMessage = "Akun ini sudah mendaftar antrian pada hari ini. Silahkan coba hari selanjutnya."; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, new Exception(responseMessage)))); } else { ar.NIK = nik; ar.NoAntrian = noAntrian + 1; ar.IdLayananRS = idlayanan; ar.TanggalDaftar = date; db.Antrians.Add(ar); db.SaveChanges(); } } else { ar.NIK = nik; ar.NoAntrian = 1; ar.IdLayananRS = idlayanan; ar.TanggalDaftar = date; db.Antrians.Add(ar); db.SaveChanges(); } var res = new Antrians(); res.NIK = ar.NIK; res.NoAntrian = ar.NoAntrian; res.TanggalDaftar = ar.TanggalDaftar; var lay = db.LayananRS.Where(d => d.IdLayananRS == ar.IdLayananRS).FirstOrDefault(); res.Pasien = db.Pasiens.Where(d => d.NIK == nik).Select(b => new Pasiens { NIK = b.NIK, Nama = b.Nama, TanggalLahir = b.TanggalLahir, Alamat = b.Alamat, KotaLahir = b.KotaLahir, Email = b.Email, JenisKelamin = b.JenisKelamin, Pekerjaan = b.Pekerjaan, StatusPernikahan = b.StatusPernikahan, ImageUrl = b.ImageUrl, Agama = b.Agama1.Nama }).FirstOrDefault(); res.RumahSakit = db.RumahSakits.Where(d => d.IdRS == lay.IdRS).Select(b => new RumahSakits { IdRS = b.IdRS, Deskripsi = b.Deskripsi, Direktur = b.Direktur, Fax = b.Fax, Alamat = b.Alamat, JenisRS = b.JenisRS, KelasRS = b.KelasRS, ImageUrl = b.ImageUrl, KodePos = b.KodePos, Kota = b.Kota, Misi = b.Misi, NamaRS = b.NamaRS, Penyelenggara = b.Penyelenggara, Telephone = b.Telephone, Visi = b.Visi, Website = b.Website }).FirstOrDefault(); return(Ok(res)); }