public ActionResult CreateNewBook(BookingMV newbooking)
        {
            if (check == false)
            {
                TempData["checkbooking"] = "please check your date";
                newbooking = booking.openbookingCreate(newbooking);
                return(View("Create", newbooking));
            }
            DateTime timebb = (DateTime)newbooking.BookingPagedata;

            newbooking.FinishTime = timebb.AddMinutes(30);
            newbooking.type       = "Pending";
            ResponseMV result = booking.createnewbooking(newbooking);

            if (result.IsValid == true && check == true)
            {
                TempData["SaveBooking"] = "Booking save success";
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                if (check == false)
                {
                    TempData["checkbooking"] = "please check your date";
                }

                newbooking = booking.openbookingCreate(newbooking);
                return(View("Create", newbooking));
            }
        }
        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 ResponseMV editecustomer(DoctorMV doctor)
        {
            ResponseMV result = ValidateDoctor(doctor);
            if (result.IsValid == true)
            {
                var doctortemp = clinic.DoctorTBLs.Where(c => c.Doctorid == doctor.Doctorid).FirstOrDefault();

                
               
                doctortemp.DoctorName = doctor.DoctorName;
                doctortemp.Email = doctor.Email;
                doctortemp.Phone = doctor.Phone;
                doctortemp.Cityid = doctor.Cityid;
                doctortemp.Areaid = doctor.Areaid;
                doctortemp.Age = doctor.Age;
                doctortemp.Specialtyid = doctor.Specialtyid;
               
                clinic.SaveChanges();

             



            }
            return result;



        }
        public ResponseMV ValidateDoctor(DoctorMV viewmodel)
        {
            ResponseMV result = new ResponseMV();
            if (string.IsNullOrEmpty(viewmodel.DoctorName))
                result.ErrorMessages.Add("DoctorName", "not found name");
            if (viewmodel.Specialtyid==null)
                result.ErrorMessages.Add("spec", "not found name");



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return result;
        }
        public ResponseMV ValidateMedicalFileMedicine(MedicalFileMedicinMV viewmodel)
        {
            ResponseMV result = new ResponseMV();

            if (viewmodel.medicalID == null)
            {
                result.ErrorMessages.Add("medicalID", "not found name");
            }



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return(result);
        }
        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);
        }
Exemple #7
0
        public ResponseMV Validatebooking(BookingMV viewmodel)

        {
            DateTime timebook = new DateTime();

            timebook = (DateTime)viewmodel.BookingPagedata;


            BookingMV  resulttime = Bookssearch(viewmodel);
            ResponseMV result     = new ResponseMV();

            if (viewmodel.Doctorid == null)
            {
                result.ErrorMessages.Add("Doctorid", "not found name");
            }
            if (viewmodel.patientid == null)
            {
                result.ErrorMessages.Add("patientid", "not found name");
            }
            if (viewmodel.Specialtyid == null)
            {
                result.ErrorMessages.Add("Specialtyid", "not found name");
            }
            if (resulttime != null)
            {
                result.ErrorMessages.Add("BookingPagedata", "not correct time you must choose after     " + resulttime.FinishTime);
            }
            if (viewmodel.DateBooking == null)
            {
                result.ErrorMessages.Add("DateBooking", "can not save empty date");
            }
            if (viewmodel.DateBooking < DateTime.Now)
            {
                result.ErrorMessages.Add("DateBooking1", "this date not coorect choose day after this date" + viewmodel.DateBooking);
            }
            if (viewmodel.BookingPagedata == null)
            {
                result.ErrorMessages.Add("BookingPagedata1", "can not save empty time");
            }
            if (timebook.Minute > 0 && timebook.Minute != 30)
            {
                result.ErrorMessages.Add("BookingPagedata2", "can not save this time you must choose time without minute");
            }



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return(result);
        }
        public ResponseMV createnewpatientmedicalfile(MedicalFilesMV newfile)
        {
            ResponseMV result = ValidateMedicalFile(newfile);

            if (result.IsValid == true)
            {
                MedicalFileTBL filetemp = new MedicalFileTBL();
                filetemp.id          = newfile.id;
                filetemp.FileSerial  = newfile.FileSerial;
                filetemp.patientid   = newfile.patientid;
                filetemp.Discraption = newfile.Discraption;
                clinic.MedicalFileTBLs.Add(filetemp);
                clinic.SaveChanges();
            }
            return(result);
        }
        public ResponseMV createnewDetails(MedicalFileDetalisMV newdetails)
        {
            ResponseMV result = ValidateMedicalFileDetailes(newdetails);

            if (result.IsValid == true)
            {
                MedicalFileDetalisTBL detailstemp = new MedicalFileDetalisTBL();
                detailstemp.doctorID    = newdetails.doctorID;
                detailstemp.Description = newdetails.Description;
                detailstemp.FileID      = newdetails.FileID;
                detailstemp.Date        = newdetails.Date;

                clinic.MedicalFileDetalisTBLs.Add(detailstemp);
                clinic.SaveChanges();
            }
            return(result);
        }
        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 ResponseMV Validatepatient(PatientMV viewmodel)
        {
            ResponseMV result = new ResponseMV();

            if (string.IsNullOrEmpty(viewmodel.PatientName))
            {
                result.ErrorMessages.Add("PatientName", "not found name");
            }
            if (string.IsNullOrEmpty(viewmodel.SerialPatient))
            {
                result.ErrorMessages.Add("SerialPatient", "not found name");
            }



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return(result);
        }
        public ResponseMV ValidateMedicalFileDetailes(MedicalFileDetalisMV viewmodel)
        {
            ResponseMV result = new ResponseMV();

            if (viewmodel.doctorID == null)
            {
                result.ErrorMessages.Add("doctorname", "not found name");
            }
            if (viewmodel.FileID == null)
            {
                result.ErrorMessages.Add("FileID", "not found name");
            }



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return(result);
        }
        public ResponseMV createnewpatient(MedicalFileMedicinMV newmedical)
        {
            ResponseMV result = ValidateMedicalFileMedicine(newmedical);

            if (result.IsValid == true)
            {
                MedicalFilesMedicinTBL medicaltemp = new MedicalFilesMedicinTBL();

                medicaltemp.medicalID = newmedical.medicalID;


                medicaltemp.fileDetaliesID = newmedical.fileDetaliesID;

                clinic.MedicalFilesMedicinTBLs.Add(medicaltemp);
                clinic.SaveChanges();
            }
            return(result);
        }
Exemple #14
0
        public ActionResult Editpatient(PatientMV newpatient)
        {
            ResponseMV result = patient.editepatient(newpatient);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess edite       " + newpatient.PatientName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newpatient = patient.openPatientCreate(newpatient.PatientId, newpatient);
                return(View("Edit", newpatient));
            }
        }
        public ResponseMV createnewpatient(PatientMV patient)
        {
            ResponseMV result = Validatepatient(patient);

            if (result.IsValid == true)
            {
                PatientTBL patienttemp = new PatientTBL();
                patienttemp.PatientId     = patient.PatientId;
                patienttemp.SerialPatient = patient.SerialPatient;
                patienttemp.PatientName   = patient.PatientName;
                patienttemp.Phone         = patient.Phone;
                patienttemp.cityid        = patient.cityid;
                patienttemp.Areaid        = patient.Areaid;
                patienttemp.Age           = patient.Age;
                clinic.PatientTBLs.Add(patienttemp);
                clinic.SaveChanges();
            }
            return(result);
        }
Exemple #16
0
        public ActionResult EditDoctor(DoctorMV modeldoctor)
        {
            ResponseMV result = doctor.editecustomer(modeldoctor);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess save     " + modeldoctor.DoctorName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                modeldoctor = doctor.openPatientCreate(modeldoctor.Doctorid, modeldoctor);
                return(View("Edit", modeldoctor));
            }
        }
Exemple #17
0
        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));
            }
        }
        public ActionResult Createnewfile(MedicalFilesMV filenew)

        {
            ResponseMV result = file.createnewpatientmedicalfile(filenew);

            if (result.IsValid == true)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                filenew = file.openPatientCreate(filenew);
                return(View("Create", filenew));
            }
        }
Exemple #19
0
        public ActionResult Createnewdoctor(DoctorMV newdoctor)
        {
            ResponseMV result = doctor.createnewpatient(newdoctor);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess save     " + newdoctor.DoctorName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newdoctor = doctor.openPatientCreate(model: newdoctor);
                return(View("Create", newdoctor));
            }
        }
        public ActionResult SubmitDetalies(MedicalFileDetalisMV newdetalies)
        {
            newdetalies.Date   = DateTime.Now;
            newdetalies.FileID = (int)TempData["Fileid"];
            ResponseMV result = filedetailes.createnewDetails(newdetalies);

            if (result.IsValid == true)
            {
                return(RedirectToAction("medicalFileDetailes", new { id = newdetalies.FileID }));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newdetalies = filedetailes.openFileDetalesCreate(newdetalies);
                return(View("CreateNewDetalies", newdetalies));
            }
        }
        public ResponseMV editepatient(PatientMV patient)
        {
            ResponseMV result = Validatepatient(patient);

            if (result.IsValid == true)
            {
                var patienttemp = clinic.PatientTBLs.Where(c => c.PatientId == patient.PatientId).FirstOrDefault();

                patienttemp.PatientId     = patient.PatientId;
                patienttemp.SerialPatient = patient.SerialPatient;
                patienttemp.PatientName   = patient.PatientName;
                patienttemp.Phone         = patient.Phone;
                patienttemp.cityid        = patient.cityid;
                patienttemp.Areaid        = patient.Areaid;
                patienttemp.Age           = patient.Age;

                clinic.SaveChanges();
            }
            return(result);
        }
        public ActionResult submitemedicine(MedicalFileMedicinMV newmedical)
        {
            newmedical.fileDetaliesID = (int)TempData["FileDetaliesid"];
            ResponseMV result = medical.createnewpatient(newmedical);

            if (result.IsValid == true)
            {
                TempData["save"] = "save Sucess Medicien";

                return(RedirectToAction("Createnewmedicine", new { id = newmedical.fileDetaliesID }));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newmedical = medical.openmedicinCreate(newmedical);
                return(View("Createnewmedicine", newmedical));
            }
        }
Exemple #23
0
        public ResponseMV createnewbooking(BookingMV Booking)
        {
            ResponseMV result = Validatebooking(Booking);

            if (result.IsValid == true)
            {
                BookingTBL doctortemp = new BookingTBL();
                doctortemp.Doctorid        = Booking.Doctorid;
                doctortemp.patientid       = Booking.patientid;
                doctortemp.Specialtyid     = Booking.Specialtyid;
                doctortemp.BookingPagedata = Booking.BookingPagedata;
                doctortemp.DateBooking     = Booking.DateBooking;
                doctortemp.FinishTime      = Booking.FinishTime;
                doctortemp.type            = Booking.type;


                clinic.BookingTBLs.Add(doctortemp);
                clinic.SaveChanges();
            }
            return(result);
        }
        public ResponseMV createnewpatient(DoctorMV doctor)
        {
            ResponseMV result = ValidateDoctor(doctor);
            if (result.IsValid == true)
            {
                DoctorTBL doctortemp = new DoctorTBL();
                doctortemp. Doctorid = doctor.Doctorid;
                doctortemp. DoctorName = doctor.DoctorName;
                doctortemp. Email = doctor.Email;
                doctortemp. Phone = doctor.Phone;
                doctortemp. Cityid = doctor.Cityid;
                doctortemp. Areaid = doctor.Areaid;
                doctortemp. Age = doctor.Age;
                doctortemp. Specialtyid = doctor.Specialtyid;
                clinic.DoctorTBLs.Add(doctortemp);
                clinic.SaveChanges();
            }
            return result;


        }
Exemple #25
0
        public ActionResult Createnewpatient(PatientMV newpatient)
        {
            int f = (int)newpatient.ActionsList;

            newpatient.SerialPatient = newpatient.PatientName.Substring(0, 3) + newpatient.Phone.ToString();
            ResponseMV result = patient.createnewpatient(newpatient);

            if (result.IsValid == true)
            {
                TempData["ModelName"] = "sucess save     " + newpatient.PatientName;
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.ErrorMessages)
                {
                    ModelState.AddModelError(item.Key, item.Value);
                }
                newpatient = patient.openPatientCreate(model: newpatient);
                return(View("Create", newpatient));
            }
        }
        public ResponseMV ValidateMedicalFile(MedicalFilesMV viewmodel)
        {
            MedicalFilesMV res    = Selectfilepatient((int)viewmodel.patientid);
            ResponseMV     result = new ResponseMV();

            if (string.IsNullOrEmpty(viewmodel.FileSerial))
            {
                result.ErrorMessages.Add("FileSerial", "not found name");
            }
            if (viewmodel.patientid == null)
            {
                result.ErrorMessages.Add("patientname", "not found name");
            }
            if (res != null)
            {
                result.ErrorMessages.Add("patientname2", "has medical file");
            }



            result.IsValid = result.ErrorMessages.Count == 0 ? true : false;
            return(result);
        }