public ActionResult openCreateAppointment(int id) { DoctorAppointmentsMV newdoctorapp = new DoctorAppointmentsMV(); newdoctorapp.DoctorID = id; return(View(newdoctorapp)); }
public ResponseMV ValidateAppointment(DoctorAppointmentsMV viewmodel) { ResponseMV result = new ResponseMV(); if (viewmodel.DoctorID == null) { result.ErrorMessages.Add("DoctorID", "not found name"); } if (viewmodel.Dayhhhhhhhhhhhhhhh.Equals(null)) { result.ErrorMessages.Add("Day", "not found name"); } //if (checkappoitment((int)viewmodel.DoctorID, viewmodel.Day) != null) //{ // result.ErrorMessages.Add("doctorName", "can not take this day"); //} //if (checkdoctorappointiment((int)viewmodel.DoctorID) != null) //{ // result.ErrorMessages.Add("doctorName2", "THIS DOCTOR HAS APPOINTMENT AND CAN NOT CREATE NEW APPOINTMENT FOR HIM"); //} if (checkappoitment(viewmodel) != null) { result.ErrorMessages.Add("Day2", "take this day appointment"); } result.IsValid = result.ErrorMessages.Count == 0 ? true : false; return(result); }
//public DoctorAppointmentsMV checkappoitment(int id, string day) //{ // var specresult = clinic.DoctorTBLs.Where(a => a.Doctorid == id).SingleOrDefault(); // var DoctorAppointmentList = clinic.DoctorAppointmentsTBLs.Where(a => a.DoctorTBL.SpecialtyTBL.SpecialtyName == specresult.SpecialtyTBL.SpecialtyName && a.Day == day); // return DoctorAppointmentList.Select(c => new DoctorAppointmentsMV // { // doctorName = c.DoctorTBL.DoctorName, // Day = c.Day, // spec = c.DoctorTBL.SpecialtyTBL.SpecialtyName, // }).SingleOrDefault(); //} public DoctorAppointmentsMV checkappoitment(DoctorAppointmentsMV newappdoctor) { var DoctorAppointmentList = clinic.DoctorAppointmentsTBLs.Where(a => a.DoctorID == newappdoctor.DoctorID && a.Day == (int)newappdoctor.Dayhhhhhhhhhhhhhhh); return(DoctorAppointmentList.Select(c => new DoctorAppointmentsMV { doctorName = c.DoctorTBL.DoctorName, Dayhhhhhhhhhhhhhhh = (DayOfWeek)c.Day, spec = c.DoctorTBL.SpecialtyTBL.SpecialtyName, }).SingleOrDefault()); }
public DoctorAppointmentsMV openFileDetalesCreate(DoctorAppointmentsMV model = null) { LookupBussiness look = new LookupBussiness(); if (model == null) { model = new DoctorAppointmentsMV(); } model.DoctorList = look.filldoctor(); return(model); }
public ResponseMV createnewAppointment(DoctorAppointmentsMV newAppointment) { ResponseMV result = ValidateAppointment(newAppointment); if (result.IsValid == true) { DoctorAppointmentsTBL Appointmenttemp = new DoctorAppointmentsTBL(); Appointmenttemp.DoctorID = newAppointment.DoctorID; Appointmenttemp.Day = (int)newAppointment.Dayhhhhhhhhhhhhhhh; clinic.DoctorAppointmentsTBLs.Add(Appointmenttemp); clinic.SaveChanges(); } return(result); }
public ActionResult getdaydoctor(int id, DateTime bookingdate) { check = true; DoctorAppointmentsMV doc = doctorday.selectday(id, (int)bookingdate.DayOfWeek); if (doc == null) { check = false; return(Content("the day for this doctor not correct ", "text/plain")); } //if (bookingdate.DayOfWeek==doc.Dayhhhhhhhhhhhhhhh) { return Content("this day for th doctor is: " + doc.Dayhhhhhhhhhhhhhhh+" this day is "+ bookingdate.DayOfWeek, "text/plain"); } return(Content("this day for th doctor is: " + doc.Dayhhhhhhhhhhhhhhh + " this day is " + bookingdate.DayOfWeek, "text/plain")); }
public ActionResult Createnewappointment(DoctorAppointmentsMV newappintment) { ResponseMV result = doctorapp.createnewAppointment(newappintment); if (result.IsValid == true) { return(RedirectToAction("Index")); } else { foreach (var item in result.ErrorMessages) { ModelState.AddModelError(item.Key, item.Value); } newappintment = doctorapp.openFileDetalesCreate(newappintment); return(View("Create", newappintment)); } }
public ActionResult CreatenewAppointmentDoctor(DoctorAppointmentsMV newdoctorapp) { ResponseMV result = docapp.createnewAppointment(newdoctorapp); if (result.IsValid == true) { TempData["ModelName"] = "sucess save " + newdoctorapp.doctorName + " " + newdoctorapp.Dayhhhhhhhhhhhhhhh; return(RedirectToAction("openCreateAppointment", new { id = newdoctorapp.DoctorID })); } else { foreach (var item in result.ErrorMessages) { ModelState.AddModelError(item.Key, item.Value); } return(View("openCreateAppointment", newdoctorapp)); } }
// GET: DoctorAppointment/Create public ActionResult Create() { DoctorAppointmentsMV doctoropen = doctorapp.openFileDetalesCreate(); return(View(doctoropen)); }