public async Task <IActionResult> Edit(int id, [Bind("Id,Title,EnrolementDate,Description,Rent,Partial,StudentId")] BedInformation bedInformation) { if (id != bedInformation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bedInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BedInformationExists(bedInformation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "Id", "Name", bedInformation.StudentId); return(View(bedInformation)); }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtBedNumber.Text)) { MessageBox.Show("Bed Number Not Inserted!"); return; } if (string.IsNullOrEmpty(txtRoomNumber.Text)) { MessageBox.Show("Room Number Not Inserted!"); return; } BedInformation bed = new BedInformation(); bed.BedNumber = txtBedNumber.Text; bed.Room = txtRoomNumber.Text; try { if (MainForm.con.InsertBed(bed) > 0) { MessageBox.Show("Saved Succesfully"); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
Tuple <PatientDataModel, BedInformation> IPatientBusinessLogic.AllotBedToPatient(BedAllotmentModel allotBed) { if (allotBed.PatientId == 2) { throw new Exception(); } var objPatientInfo = new PatientDataModel(); var objBedInfo = new BedInformation(); return(new Tuple <PatientDataModel, BedInformation>(objPatientInfo, objBedInfo)); }
public async Task <IActionResult> Create(BedInformation bedInformation) { if (ModelState.IsValid) { _context.Add(bedInformation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.Student, "Id", "Name", bedInformation.StudentId); return(View(bedInformation)); }
private void InitializeDatabase(DbContext context) { var patient = new PatientDataModel { PatientName = "TestPatient", Address = "TestAddr", Email = "TestEmail", Mobile = "9898989898" }; context.Add(patient); var bed = new BedInformation { PatientId = 1, BedId = "1A1", BedInColumn = 1, BedInRow = 2, WardNumber = "1A" }; context.Add(bed); var medicalDevice = new MedicalDevice { DeviceName = "TestDevice", MaxValue = 160, MinValue = 80 }; context.Add(medicalDevice); var wardInfo = new IcuWardInformation() { WardNumber = "1B", Department = "Dept", TotalBed = 2 }; context.Add(wardInfo); var bed2 = new BedInformation { PatientId = null, BedId = "1B1", BedInColumn = 1, BedInRow = 2, WardNumber = "1B" }; context.Add(bed2); context.SaveChanges(); }
public BedInformation FetchBedLayoutInfo(string bedId) { var bedInfo = new BedInformation { BedId = "1A1", WardNumber = "1A", PatientId = 10, BedInRow = 2, BedInColumn = 2 }; return(bedInfo); }
public int InsertBed(BedInformation bed) { try { String query = string.Format("INSERT INTO `bedinformation`(`bedNumber`,`roomNumber`,`reamrk`)VALUES" + "('{0}','{1}','{2}')", bed.BedNumber, bed.Room, bed.Remark); con.Open(); var cmd = new MySqlCommand(query, con); int val = cmd.ExecuteNonQuery(); con.Close(); return(val); } catch (Exception ex) { throw ex; } }
private int AddBedInColumn(IcuWardLayoutModel objLayout, int bedCounter, int numberOfRow) { for (int numberOfColumn = 1; numberOfColumn <= objLayout.NumberOfColumn && objLayout.NumberOfBed >= bedCounter; numberOfColumn++) { var bedId = string.Concat(objLayout.WardNumber, bedCounter.ToString()); var bedInfo = new BedInformation { BedId = bedId, BedInColumn = numberOfColumn, BedInRow = numberOfRow, WardNumber = objLayout.WardNumber }; _icuLayoutDataRepository.InsertBed(bedInfo); bedCounter++; } return(bedCounter); }
public void TestInsertBedInformation() { var layoutData = new IcuLayoutDataRepository(Context); var bed = new BedInformation { PatientId = 10, BedId = "1d3", WardNumber = "1d", BedInColumn = 2, BedInRow = 2 }; layoutData.InsertBed(bed); var wardInDb = Context.BedInformation.First (p => p.WardNumber == "1d"); Assert.NotNull(wardInDb); }
public List <BedInformation> GetAllBed() { try { con.Open(); List <BedInformation> all = new List <BedInformation>(); var cmd = new MySqlCommand("select * from bedinformation", con); var reader = cmd.ExecuteReader(); while (reader.Read()) { BedInformation bed = new BedInformation(); bed.Id = int.Parse(reader["idbedinformation"].ToString()); bed.BedNumber = reader["bedNumber"].ToString(); bed.Room = reader["room"].ToString(); all.Add(bed); } con.Close(); return(all); } catch (Exception ex) { throw ex; } }
public void InsertBed(BedInformation bed) { _context.BedInformation.Add(bed); _context.SaveChanges(); }
public void InsertBed(BedInformation bed) { }