public ActionResult Create([Bind(Include = "Id,Date,EmployeeId,ManagerId,RHId")] CheckUp checkUp) { if (checkUp.EmployeeId.HasValue) { checkUp.Employee = employeeService.FindById(false, true, checkUp.EmployeeId); } if (checkUp.ManagerId.HasValue) { checkUp.Manager = employeeService.FindById(false, true, checkUp.ManagerId); } if (checkUp.RHId.HasValue) { checkUp.RH = employeeService.FindById(false, true, checkUp.RHId); } ModelState.Remove("checkUp.Employee"); ModelState.Remove("checkUp.Manager"); ModelState.Remove("checkUp.RH"); if (ModelState.IsValid) { _checkUpService.Save(checkUp); return(RedirectToAction("Index")); } return(View(checkUp)); }
public ActionResult Create([Bind(Include = "Id,Email,HospitalId,State,City")] CheckUp checkUp) { bool Status = false; string message = ""; if (ModelState.IsValid) { var isExist = IsEmailExist(checkUp.Email); if (isExist) { ModelState.AddModelError("EmailExist", "You Already Applied for Checkup"); ViewBag.HospitalId = new SelectList(db.Hospitals, "HospitalID", "HospitalName", checkUp.HospitalId); return(View(checkUp)); } else { db.CheckUps.Add(checkUp); db.SaveChanges(); Status = true; ViewBag.HospitalId = new SelectList(db.Hospitals, "HospitalID", "HospitalName", checkUp.HospitalId); message = "You have successfully applied for Checkup and You will receive a Email from the corresponding hospital to your registered mail id" + checkUp.Email; } ViewBag.Message = message; ViewBag.Status = Status; return(View(checkUp)); } return(View(checkUp)); }
protected void LoadModalData(CheckUp data = null) { hdfShowModal.Value = "1"; LoadMethods(); if (data == null) { ltrModalTitle.Text = "Add Check Up for " + ddlMembers.SelectedItem.Text; txtTeamId.Value = ddlTeams.SelectedValue; txtMemberId.Value = ddlMembers.SelectedValue; txtOutcome.Text = ""; txtActions.Text = ""; chkActionRequired.Checked = false; ddlMethod.SelectedIndex = -1; txtCheckUpDate.Text = ""; lnkAddCheckUp.CommandName = "New"; lnkAddCheckUp.Text = "<span class='glyphicon glyphicon-plus'></span> Add Check Up"; } else { ltrModalTitle.Text = "Add Check Up for " + data.Member.FullName; txtTeamId.Value = data.TeamId.ToString(); txtMemberId.Value = data.TeamMemberId.ToString(); txtOutcome.Text = data.Outcome; txtActions.Text = data.Actions; chkActionRequired.Checked = data.RequiresAction; ddlMethod.SelectedValue = ddlMethod.Items.FindByText(data.Method).Value; txtCheckUpDate.Text = data.CheckUpDate.ToShortDateString(); lnkAddCheckUp.CommandName = "Update"; lnkAddCheckUp.CommandArgument = data.CheckUpId.ToString(); lnkAddCheckUp.Text = "<span class='glyphicon glyphicon-check'></span> Update Check Up"; } }
public ActionResult DeleteConfirmed(int id) { CheckUp checkUp = db.CheckUps.Find(id); db.CheckUps.Remove(checkUp); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { CheckUp checkUp = _checkUpService.FindByIdIncludes(id); _checkUpService.Delete(checkUp); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { CheckUp checkUp = db.CheckUps.Find(id); db.CheckUps.Remove(checkUp); db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully", JsonRequestBehavior.AllowGet })); }
public ActionResult Edit([Bind(Include = "Id,BloodPressure,BodyTemperature,HeartRate,RespiratoryRate,TypeOfPrescription,Disease")] CheckUp checkUp) { if (ModelState.IsValid) { db.Entry(checkUp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(checkUp)); }
public ActionResult Edit([Bind(Include = "Id,Email,HospitalId,State,City")] CheckUp checkUp) { if (ModelState.IsValid) { db.Entry(checkUp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HospitalId = new SelectList(db.Hospitals, "HospitalID", "HospitalName", checkUp.HospitalId); return(View(checkUp)); }
public ActionResult Create([Bind(Include = "Id,BloodPressure,BodyTemperature,HeartRate,RespiratoryRate,TypeOfPrescription,Disease")] CheckUp checkUp) { if (ModelState.IsValid) { db.CheckUps.Add(checkUp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(checkUp)); }
private void NewRecord_CanExecute(object sender, CanExecuteRoutedEventArgs e) { if (CheckUp.IsAnyStringEmpty(NumberField.Text, DepStationField.Text, ArrStationField.Text, DepTimeField.Text)) { e.CanExecute = false; } else { e.CanExecute = true; } }
// GET: CheckUps/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckUp checkUp = db.CheckUps.Find(id); if (checkUp == null) { return(HttpNotFound()); } return(View(checkUp)); }
// GET: CheckUp/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckUp checkUp = _checkUpService.FindByIdIncludes(id); if (checkUp == null) { return(HttpNotFound()); } return(View(checkUp)); }
// GET: CheckUps/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckUp checkUp = db.CheckUps.Find(id); if (checkUp == null) { return(HttpNotFound()); } ViewBag.HospitalId = new SelectList(db.Hospitals, "HospitalID", "HospitalName", checkUp.HospitalId); return(View(checkUp)); }
public ActionResult InsertCheckUp(InsertCheckViewModel checkViewModel) { if (ModelState.IsValid) { CheckUp checkUp = new CheckUp(); checkUp.CheckType = checkViewModel.CheckType; checkUp.DoctorId = checkViewModel.DoctorId; checkUp.PatientId = checkViewModel.PatientId; checkUp.CreateAt = DateTime.Now; db.CheckUps.Add(checkUp); db.SaveChanges(); return(RedirectToAction("GetChecksUp")); } ViewBag.DoctorId = new SelectList(db.doctors.ToList(), "id", "doctorName"); ViewBag.PatientId = new SelectList(db.Patients.ToList(), "id", "name"); return(View(checkViewModel)); }
// GET: CheckUp/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckUp checkUp = _checkUpService.FindByIdIncludes(id); if (checkUp == null) { return(HttpNotFound()); } ViewBag.Employee = employeeService.GetAllByExcludes(c => c.Type.Equals(UserType.EMPLOYEE)); ViewBag.Manager = employeeService.GetAllByExcludes(c => c.Type.Equals(UserType.MANAGER)); ViewBag.RH = employeeService.GetAllByExcludes(c => c.Type.Equals(UserType.RH)); return(View(checkUp)); }
public void Test_Save_SaveSuccessfull() { Trace("...Testing... " + Class + " : " + Method); DBTestData.DBTestData.ResetDB(); CheckUp a = new CheckUp(); using (MyDbContext db = new MyDbContext()) { a.Date = DateTime.Now; a.Employee = db.Employees.Take(1).ToList()[0]; a.Manager = db.Employees.Take(1).ToList()[0]; a.RH = db.Employees.Take(1).ToList()[0]; a.Report = db.CheckUpReports.Take(1).ToList()[0]; var watch = System.Diagnostics.Stopwatch.StartNew(); db.CheckUps.Add(a); watch.Stop(); var elapsedTicks = watch.ElapsedTicks; Trace("Specific method time : " + elapsedTicks + " ticks"); } DBTestData.DBTestData.ResetDB(); using (MyDbContext db = new MyDbContext()) { a.Date = DateTime.Now; a.Employee = db.Employees.Take(1).ToList()[0]; a.Manager = db.Employees.Take(1).ToList()[0]; a.RH = db.Employees.Take(1).ToList()[0]; a.Report = db.CheckUpReports.Take(1).ToList()[0]; } long oldcount = DBTestData.DBTestData.TotalCount(); var watch2 = System.Diagnostics.Stopwatch.StartNew(); _CheckUpServiceToTest.Save(a); watch2.Stop(); var elapsedTicks2 = watch2.ElapsedTicks; Trace("Generic method time : " + elapsedTicks2 + " ticks"); long newCount = DBTestData.DBTestData.TotalCount(); Assert.AreEqual(oldcount + 1, newCount); }
protected void lnkAddCheckUp_Click(object sender, EventArgs e) { DateTime checkupDate = DateTime.MinValue; DateTime.TryParse(txtCheckUpDate.Text, out checkupDate); if (!Equals(checkupDate, DateTime.MinValue)) { CheckUpRepository checkUpManager = new CheckUpRepository(); var nCheckUp = new CheckUp(); nCheckUp.TeamId = Convert.ToInt32(ddlTeam.SelectedValue); nCheckUp.TeamMemberId = Convert.ToInt32(ddlMember.SelectedValue); nCheckUp.Method = ddlMethod.SelectedItem.Text; nCheckUp.CheckUpDate = checkupDate; nCheckUp.Outcome = txtOutCome.Text; nCheckUp.RequiresAction = chkActionRequired.Checked; nCheckUp.Actions = txtFollowUpAction.Text; checkUpManager.Add(nCheckUp); checkUpManager.Save(); //((SiteMaster)Page.Master).AddNotification(Page, "Check Up Added Successful", "Check Up for " + ddlMember.SelectedItem.Text + " was added.","function(){window.location = '" + Page.ResolveUrl("~/home.aspx?Team=" + nCheckUp.TeamId) + "';}"); Response.Redirect("~/home.aspx?Team=" + nCheckUp.TeamId); } }
public void Test_SaveCrypted_SaveSuccessfull() { Trace("...Testing... " + Class + " : " + Method); DBTestData.DBTestData.ResetDB(); CheckUp a = new CheckUp(); CheckUp b = new CheckUp(); using (MyDbContext db = new MyDbContext()) { a.Date = DateTime.Now; b.Date = a.Date; a.Employee = db.Employees.Take(1).ToList()[0]; b.Employee = a.Employee; a.Manager = db.Employees.Take(1).ToList()[0]; b.Manager = b.Manager; a.RH = db.Employees.Take(1).ToList()[0]; b.RH = a.RH; a.Report = db.CheckUpReports.Take(1).ToList()[0]; b.Report = a.Report; var watch = System.Diagnostics.Stopwatch.StartNew(); foreach (var item in db.ChangeTracker.Entries()) { item.State = EntityState.Modified; } db.CheckUps.Add(a); watch.Stop(); var elapsedTicks = watch.ElapsedTicks; Trace("Specific method time : " + elapsedTicks + " ticks"); } DBTestData.DBTestData.ResetDB(); using (MyDbContext db = new MyDbContext()) { a.Date = DateTime.Now; b.Date = a.Date; a.Employee = db.Employees.Take(1).ToList()[0]; b.Employee = a.Employee; a.Manager = db.Employees.Take(1).ToList()[0]; b.Manager = b.Manager; a.RH = db.Employees.Take(1).ToList()[0]; b.RH = a.RH; a.Report = db.CheckUpReports.Take(1).ToList()[0]; b.Report = a.Report; } long oldcount = DBTestData.DBTestData.TotalCount(); var watch2 = System.Diagnostics.Stopwatch.StartNew(); //_CheckUpServiceToTest.SaveCrypted(a); throw new NotImplementedException(); watch2.Stop(); var elapsedTicks2 = watch2.ElapsedTicks; Trace("Generic method time : " + elapsedTicks2 + " ticks"); long newCount = DBTestData.DBTestData.TotalCount(); if (oldcount + 1 != newCount) { Assert.Fail(); } Assert.AreEqual(a, b); }