public IActionResult Details(int?id) { List <DoctorSpecialties> doctorSpecialties = new List <DoctorSpecialties>(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } using (var context = new VetSystemContext()) { var doc = context.Doctors.Where(s => s.Id == id).FirstOrDefault(); if (doc == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var departments = context.DoctorSpecialtiesDoctors.Where(x => x.DoctorId == id); foreach (var item in departments) { var findName = context.DoctorSpecialties.Where(x => x.Id == item.DoctorSpecialtiesId).FirstOrDefault(); doctorSpecialties.Add(findName); } DoctorDetailsModel ddm = new DoctorDetailsModel { Name = doc.Name, Departments = doctorSpecialties }; return(View(ddm)); } }
public ActionResult Create([Bind(Include = "Id,Name,Degree,Fees,Schedule,SpecialistId,Email,Password")] DoctorDetailsModel doctordetailsmodel, int id) { doctordetailsmodel.Email = privacy.Encrypt(doctordetailsmodel.Email); var e = db.Doctors.Where(c => c.Email == doctordetailsmodel.Email).ToList().Count; if (e == 0) { if (ModelState.IsValid) { doctordetailsmodel.SpecialistId = id; doctordetailsmodel.Name = privacy.Encrypt(doctordetailsmodel.Name); doctordetailsmodel.Degree = privacy.Encrypt(doctordetailsmodel.Degree); doctordetailsmodel.Schedule = privacy.Encrypt(doctordetailsmodel.Schedule); doctordetailsmodel.Password = EncodePassword(doctordetailsmodel.Password); db.Doctors.Add(doctordetailsmodel); db.SaveChanges(); } ViewBag.Message = "Insert Values Successfully"; } else { ViewBag.Message = "Email Already exists"; } ViewBag.Specialist = db.Specialist.ToList(); return(View(doctordetailsmodel)); //return RedirectToAction("Create"); }
public List <DoctorDetailsModel> GetAllDoctorList(string sortColumn) { List <DoctorDetailsModel> listDoctor = new List <DoctorDetailsModel>(); using (SqlConnection con = new SqlConnection(cs)) { string query = "select DoctorID,FirstName,LastName,Address,ContactNumber1 from UserDoctor"; if (!string.IsNullOrEmpty(sortColumn)) { query += " order by " + sortColumn; } SqlCommand cmd = new SqlCommand(query, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DoctorDetailsModel DDModel = new DoctorDetailsModel(); DDModel.doctorID = Int32.Parse(reader[0].ToString()); DDModel.firstName = reader[1].ToString(); DDModel.lastName = reader[2].ToString(); DDModel.address = reader[3].ToString(); DDModel.contactNumber1 = Int64.Parse(reader[4].ToString()); listDoctor.Add(DDModel); } } return(listDoctor); }
public async Task <IActionResult> GetDoctorDetail(int id) { using (var dataAccess = new DataAccess()) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var doctor = dataAccess.GetAllDoctors().FirstOrDefault(r => r.Id == id); if (doctor == null) { return(NotFound()); } else { var doctorDetailsModel = new DoctorDetailsModel { Id = (int)doctor.Id, Name = doctor.Name, SpokenLanguage = string.Join(",", dataAccess.GetSpokenLanguage(doctor).ToList()), MedicalSchoolAttended = string.Join(",", dataAccess.GetSchools(doctor).ToList()), PatientReviews = string.Join(",", dataAccess.GetReviews(doctor).ToList()), IsSuperStar = dataAccess.GetAverageRatingOfDoctor(doctor.Id, 5) }; return(Ok(doctorDetailsModel)); } } }
public ActionResult Login(string userName, string password) { try { if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { DoctorDetailsModel dbm = new DoctorDetailsModel().UserAuthentication(userName, password); if (dbm != null) { Session["DocName"] = dbm.UserName; Session["DocId"] = dbm.Id; return(RedirectToAction("AddPatient", "Disease")); } else { TempData["Error"] = "Invalid Username or Password."; } } else { TempData["Error"] = "Please enter Username or Password."; } } catch (Exception ex) { throw ex; } return(View()); }
public ActionResult DeleteConfirmed(int id) { DoctorDetailsModel doctordetailsmodel = db.Doctors.Find(id); db.Doctors.Remove(doctordetailsmodel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Registration() { var model = new DoctorDetailsModel() { Areas = GetAreas() }; return(View(model)); }
public void Post(DoctorForTable doctorModel) { string token = this.Request.Headers.GetValues("Token").Single(); string[] userDetails = UserDetails(token); int userID = Convert.ToInt32(userDetails[2]); try { DoctorDetailsModel docModel = new DoctorDetailsModel(); docModel.doctorID = doctorModel.DoctorID; docModel.firstName = doctorModel.FirstName; docModel.lastName = doctorModel.LastName; docModel.email = doctorModel.EmailID; docModel.relatedHospital = doctorModel.RelatedHospital; docModel.specialty = doctorModel.Specialty; docModel.address = doctorModel.Address; docModel.contactNumber1 = doctorModel.ContactNumber1; docModel.contactNumber2 = doctorModel.ContactNumber2; docModel.primaryDoctorMark = doctorModel.PrimaryDoctorMark; docModel.userID = 101; //Checking Doctordetails InDataBase bool checkDoctorInDB = UDBusiness.CheckDoctorInDB(docModel.doctorID, docModel.userID); if (!checkDoctorInDB) { //setting model to Doctor DB UDBusiness.SetDoctorDetails(docModel); //Updating Primary Mark if (docModel.primaryDoctorMark.Equals("Yes")) { UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID); } } else { //Update Doctor Details in DB UDBusiness.UpdateDoctorDetails(docModel, docModel.userID); if (docModel.primaryDoctorMark.Equals("Yes")) { UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID); } } //Authorization a =new Authorization } catch (Exception ex) { WriteLog write = new WriteLog(); string message = ex.Message; write.WriteLogMessage(message); string strMsg = UDBusiness.IngnoreSpecialCharacter(message); string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>"; } }
public void AddNewDoctor(DoctorForTable doctorModel) { try { UserDetailsModel udModel = (UserDetailsModel)Session["userModel"]; DoctorDetailsModel docModel = new DoctorDetailsModel(); docModel.doctorID = doctorModel.DoctorID; docModel.firstName = doctorModel.FirstName; docModel.lastName = doctorModel.LastName; docModel.email = doctorModel.EmailID; docModel.relatedHospital = doctorModel.RelatedHospital; docModel.specialty = doctorModel.Specialty; docModel.address = doctorModel.Address; docModel.contactNumber1 = doctorModel.ContactNumber1; docModel.contactNumber2 = doctorModel.ContactNumber2; docModel.primaryDoctorMark = doctorModel.PrimaryDoctorMark; docModel.userID = udModel.userId; //Checking Doctordetails InDataBase //bool checkDoctorInDB = UDBusiness.CheckDoctorInDB(docModel.doctorID,docModel.userID); bool checkDoctorInDB = UDBusiness.CheckDoctorInDBEF(docModel.doctorID, docModel.userID); if (!checkDoctorInDB) { //setting model to Doctor DB UDBusiness.AddNewDoctorEF(docModel); //Updating Primary Mark if (docModel.primaryDoctorMark.Equals("Yes")) { //UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID); UDBusiness.UpdateDoctorPrimaryMarkEF(docModel.userID, docModel.doctorID); } } else { //Update Doctor Details in DB //UDBusiness.UpdateDoctorDetails(docModel, docModel.userID); UDBusiness.UpdateDoctorInEF(docModel, docModel.userID); if (docModel.primaryDoctorMark.Equals("Yes")) { UDBusiness.UpdateDoctorPrimaryMarkEF(docModel.userID, docModel.doctorID); } } } catch (Exception ex) { WriteLog write = new WriteLog(); string message = ex.Message; write.WriteLogMessage(message); string strMsg = UDBusiness.IngnoreSpecialCharacter(message); string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>"; Response.Write(script); } }
// GET: /DoctorAdmin/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorDetailsModel doctordetailsmodel = db.Doctors.Find(id); if (doctordetailsmodel == null) { return(HttpNotFound()); } return(View(doctordetailsmodel)); }
public ActionResult Edit([Bind(Include = "Id,Name,Degree,Fees,Schedule,SpecialistId,Email,Password")] DoctorDetailsModel doctordetailsmodel, int SpecialistId) { if (ModelState.IsValid) { doctordetailsmodel.SpecialistId = SpecialistId; doctordetailsmodel.Name = privacy.Encrypt(doctordetailsmodel.Name); doctordetailsmodel.Email = privacy.Encrypt(doctordetailsmodel.Email); doctordetailsmodel.Degree = privacy.Encrypt(doctordetailsmodel.Degree); doctordetailsmodel.Password = EncodePassword(doctordetailsmodel.Password); doctordetailsmodel.Schedule = privacy.Encrypt(doctordetailsmodel.Schedule); db.Entry(doctordetailsmodel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Message = "Update Values Successfully"; return(View(doctordetailsmodel)); }
// GET: /DoctorAdmin/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorDetailsModel doctordetailsmodel = db.Doctors.Find(id); if (doctordetailsmodel == null) { return(HttpNotFound()); } doctordetailsmodel.Name = privacy.Decrypt(doctordetailsmodel.Name); doctordetailsmodel.Degree = privacy.Decrypt(doctordetailsmodel.Degree); doctordetailsmodel.Email = privacy.Decrypt(doctordetailsmodel.Email); doctordetailsmodel.Schedule = privacy.Decrypt(doctordetailsmodel.Schedule); return(View(doctordetailsmodel)); }
public void UpdateDoctorInEF(DoctorDetailsModel docModel, Int32 userID) { var accessLayer = new AccessLayer(); UserDoctor udModel = new UserDoctor(); udModel.DoctorID = docModel.doctorID; udModel.FirstName = docModel.firstName; udModel.LastName = docModel.lastName; udModel.EmailID = docModel.email; udModel.RelatedHostpital = docModel.relatedHospital; udModel.Specialty = docModel.specialty; udModel.Address = docModel.address; udModel.ContactNumber1 = docModel.contactNumber1; udModel.ContactNumber2 = docModel.contactNumber2; udModel.PrimaryDoctorMark = docModel.primaryDoctorMark; udModel.UserID = docModel.userID; accessLayer.UpdateDoctorInEF(udModel, userID); }
public JsonResult GetAllDoctorInfoById(int id) { List <DoctorDetailsModel> doctor = new List <DoctorDetailsModel>(); using (var ctx = new MedicalContext()) { var a = ctx.Doctors.Where(s => s.SpecialistId == id).Select(c => new { c.Name, c.Degree, c.Fees, c.Schedule });; foreach (var k in a) { DoctorDetailsModel doc = new DoctorDetailsModel(); doc.Name = privacy.Decrypt(k.Name); doc.Degree = privacy.Decrypt(k.Degree); doc.Fees = k.Fees; doc.Schedule = privacy.Decrypt(k.Schedule); doctor.Add(doc); } } return(Json(doctor)); }
public ActionResult DoctorProfileUpdate() { ViewBag.DoctorProfileUpdate = "active"; DoctorDetailsModel doctor = new DoctorDetailsModel(); int doctorid = Convert.ToInt32(Session["DoctorId"]); using (var db = new MedicalContext()) { var q = db.Doctors.Where(k => k.Id == doctorid).Select(c => new { c.Name, c.Degree, c.Fees }); foreach (var j in q) { doctor.Name = privacy.Decrypt(j.Name); doctor.Degree = privacy.Decrypt(j.Degree); doctor.Fees = j.Fees; } ViewBag.Doctor = doctor; return(View()); } }
public ActionResult UpdateDoctor(DoctorDetailsModel doctor) { int id = Convert.ToInt32(Session["DoctorId"]); string useremail = privacy.Encrypt(doctor.Email); using (var db = new MedicalContext()) { DoctorDetailsModel pa = db.Doctors.Single(e => e.Id == id); if (pa.Email == useremail) { pa.Name = privacy.Encrypt(doctor.Name); pa.Degree = privacy.Encrypt(doctor.Degree); pa.Fees = doctor.Fees; db.SaveChanges(); return(RedirectToAction("DoctorProfile", "Medical")); } return(RedirectToAction("DoctorProfile", "Medical")); } }
public JsonResult GetAllDoctorNameById(int id) { List <DoctorDetailsModel> doctors = new List <DoctorDetailsModel>(); using (var ctx = new MedicalContext()) { var a = ctx.Doctors.Where(s => s.SpecialistId == id); foreach (var k in a) { DoctorDetailsModel doc = new DoctorDetailsModel(); doc.Id = k.Id; doc.Name = privacy.Decrypt(k.Name); doctors.Add(doc); } } return(Json(doctors)); }
public void AddNewDoctorEF(DoctorDetailsModel docModel) { using (var dbContext = new HealthcareDBEntities()) { var newDoctor = new UserDoctor { DoctorID = docModel.doctorID, FirstName = docModel.firstName, LastName = docModel.lastName, EmailID = docModel.email, RelatedHostpital = docModel.relatedHospital, Specialty = docModel.specialty, Address = docModel.address, ContactNumber1 = docModel.contactNumber1, ContactNumber2 = docModel.contactNumber2, PrimaryDoctorMark = docModel.primaryDoctorMark, UserID = docModel.userID }; dbContext.UserDoctors.Add(newDoctor); dbContext.SaveChanges(); } }
public ActionResult Registration(DoctorDetailsModel doctorDetailsModel) { try { if (ModelState.IsValid) { DoctorDetailsModel dbm = new DoctorDetailsModel().GetDoctorDetailByUserName(doctorDetailsModel.UserName); if (dbm == null) { doctorDetailsModel.CreateDate = DateTime.Now; doctorDetailsModel.Save(); TempData["Success"] = "You have successfully registered"; ModelState.Clear(); //making form empty after submission of the data. var model1 = new DoctorDetailsModel() { Areas = GetAreas() }; return(View(model1)); } else { TempData["Error"] = "User Name already exist. Please choose another User name."; } } } catch (Exception ex) { throw ex; } var model = new DoctorDetailsModel() { Areas = GetAreas() }; return(View(model)); }
public void UpdateDoctorDetails(DoctorDetailsModel DDModel, Int32 userID) { SqlConnection con = new SqlConnection(cs); con.Open(); SqlCommand cmd = new SqlCommand("spUpdateDoctorDetails", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("doctorID", DDModel.doctorID); cmd.Parameters.AddWithValue("firstName", DDModel.firstName); cmd.Parameters.AddWithValue("lastName", DDModel.lastName); cmd.Parameters.AddWithValue("email", DDModel.email); cmd.Parameters.AddWithValue("specialty", DDModel.specialty); cmd.Parameters.AddWithValue("relatedHospital", DDModel.relatedHospital); cmd.Parameters.AddWithValue("address", DDModel.address); cmd.Parameters.AddWithValue("contact1", DDModel.contactNumber1); cmd.Parameters.AddWithValue("contact2", DDModel.contactNumber2); cmd.Parameters.AddWithValue("primaryMark", DDModel.primaryDoctorMark); cmd.Parameters.AddWithValue("userID", userID); cmd.ExecuteNonQuery(); con.Close(); }
public void SetDoctorDetails(DoctorDetailsModel DDModel) { UDDataAccess.SetDoctorDetails(DDModel); }
public void UpdateDoctorDetails(DoctorDetailsModel DDModel, Int32 userID) { UDDataAccess.UpdateDoctorDetails(DDModel, userID); }
public void AddNewDoctorEF(DoctorDetailsModel doctor) { var accessLayer = new AccessLayer(); accessLayer.AddNewDoctorEF(doctor); }