public ActionResult DoctorPage(string name) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Doctor_Result> doctorInfo = db.USP_SEL_Doctor(Session["DoctorEmail"].ToString()).ToList(); List <USP_SEL_DoctorComments_Result> comments = db.USP_SEL_DoctorComments(Session["DoctorEmail"].ToString()).ToList(); if (doctorInfo[0].Address == null) { doctorInfo[0].Address = "ثبت نشده"; } if (doctorInfo[0].ClinicPhone == null) { doctorInfo[0].ClinicPhone = "ثبت نشده"; } if (doctorInfo[0].WorkTime == null) { doctorInfo[0].WorkTime = "ثبت نشده"; } ViewBag.DoctorInfo = doctorInfo; ViewBag.Comments = comments; Models.CustomModel.Comment model = new Models.CustomModel.Comment(); return(View(model)); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext.Request.Cookies["AuthID"] != null && httpContext.Session["AuthID"] != null) { if (httpContext.Request.Cookies["AuthID"].Value == httpContext.Session["AuthID"].ToString()) { string authID = httpContext.Session["AuthID"].ToString(); if (httpContext.Session[authID + "IP"].ToString() == httpContext.Request.UserHostAddress) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_NameAndRole_Result> NameAndRole = db.USP_SEL_NameAndRole(httpContext.Session[authID].ToString()).ToList(); if (NameAndRole[0].Role == 0) { List <bool?> adminType = db.USP_SEL_AdminType(httpContext.Session[authID].ToString()).ToList(); if (adminType[0] == false) { return(true); } } return(false); } return(false); } return(false); } return(false); }
public ActionResult Login(AdminLogin admin) { ViewBag.IsLogin = false; PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckMail = db.USP_SEL_Email(admin.Email).ToList(); if (CheckMail.Count == 0) { TempData["WrongEmail"] = "ایمیل وارد شده صحیح نمی باشد!"; return(RedirectToAction("Login")); } List <int?> CheckPass = db.USP_SEL_Password(admin.Email, admin.Password).ToList(); if (CheckPass.Count == 0) { TempData["WrongPass"] = "******"; return(RedirectToAction("Login")); } string authID = Guid.NewGuid().ToString(); Session["AuthID"] = authID; Response.Cookies["AuthID"].Value = authID; Session[authID] = admin.Email; Session[authID + "IP"] = Request.UserHostAddress; string previousUrl = Session["PreviousUrl"].ToString(); Session.Remove("PreviousUrl"); return(Redirect(previousUrl)); }
public ActionResult Confirmation(RegisterPack doctor) { ViewBag.IsLogin = false; try { if (!ModelState.IsValid) { if (doctor.RegisterModel.Agree.ToString() == "False") { return(View("Register", doctor)); } else { TempData["Error"] = "خطا در مقادیر ورودی...دوباره امتحان کنید"; return(RedirectToAction("Register", doctor)); } } PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> medicalFieldID = db.USP_SEL_MedicalFieldID(doctor.RegisterModel.MedicalField).ToList(); db.USP_INS_Doctor(doctor.RegisterModel.FirstName, doctor.RegisterModel.LastName, doctor.RegisterModel.Email, doctor.RegisterModel.Password, doctor.RegisterModel.PhoneNumber, doctor.RegisterModel.Province, doctor.RegisterModel.City, medicalFieldID[0], doctor.RegisterModel.NationalID, doctor.RegisterModel.ClinicPhone, doctor.RegisterModel.Address); return(View()); } catch (Exception) { TempData["Error"] = "خطا...دوباره امتحان کنید"; return(RedirectToAction("Register")); } }
public ActionResult Panel() { string authID = Request.Cookies["AuthID"].Value; PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Doctor_Result> doctorInfo = db.USP_SEL_Doctor(Session[authID].ToString()).ToList(); List <USP_SEL_DoctorComments_Result> comments = db.USP_SEL_DoctorComments(Session[authID].ToString()).ToList(); if (doctorInfo[0].Address == null) { doctorInfo[0].Address = "ثبت نشده"; } if (doctorInfo[0].ClinicPhone == null) { doctorInfo[0].ClinicPhone = "ثبت نشده"; } if (doctorInfo[0].WorkTime == null) { doctorInfo[0].WorkTime = "ثبت نشده"; } ViewBag.DoctorInfo = doctorInfo; ViewBag.Comments = comments; Search model = new Search(); return(View(model)); }
public ActionResult TopNews() { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Articles_Result> result = db.USP_SEL_Articles().ToList(); ViewBag.TopNews = result; Search model = new Search(); return(View(model)); }
public ActionResult TopNewsMore(string name) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Article_Result> result = db.USP_SEL_Article(Convert.ToInt32(Session["NewsID"].ToString())).ToList(); ViewBag.Article = result; Search model = new Search(); return(View(model)); }
public JsonResult EmailValidation(RegisterPack doctor) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckMail = db.USP_SEL_Email(doctor.RegisterModel.Email).ToList(); if (CheckMail.Count == 1) { return(Json("با این ایمیل قبلا ثبت نام شده است", JsonRequestBehavior.DenyGet)); } return(Json(true, JsonRequestBehavior.DenyGet)); }
public JsonResult NationalIDValidation(RegisterPack doctor) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckNationalID = db.USP_SEL_NationalID(doctor.RegisterModel.NationalID).ToList(); if (CheckNationalID.Count == 1) { return(Json("با این کد ملی قبلا ثبت نام شده است", JsonRequestBehavior.DenyGet)); } return(Json(true, JsonRequestBehavior.DenyGet)); }
public JsonResult ClinicPhoneValidation(RegisterPack doctor) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckClinicPhone = db.USP_SEL_ClinicPhone(doctor.RegisterModel.ClinicPhone).ToList(); if (CheckClinicPhone.Count == 1) { return(Json("با این شماره تلفن مطب قبلا ثبت نام شده است", JsonRequestBehavior.DenyGet)); } return(Json(true, JsonRequestBehavior.DenyGet)); }
public JsonResult PhoneNumberValidation(RegisterPack doctor) { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckPhoneNumber = db.USP_SEL_PhoneNumber(doctor.RegisterModel.PhoneNumber).ToList(); if (CheckPhoneNumber.Count == 1) { return(Json("با این شماره موبایل قبلا ثبت نام شده است", JsonRequestBehavior.DenyGet)); } return(Json(true, JsonRequestBehavior.DenyGet)); }
public JsonResult PasswordValidation(DoctorProfile doctor) { PezeshkPlusEntities db = new PezeshkPlusEntities(); USP_SEL_Doctor_Result doctorLastInfo = (USP_SEL_Doctor_Result)Session["DoctorInfo"]; List <int?> CheckPassword = db.USP_SEL_Password(doctorLastInfo.Email, doctor.Password).ToList(); if (CheckPassword.Count == 0) { return(Json("پسورد وارد شده اشتباه است", JsonRequestBehavior.DenyGet)); } return(Json(true, JsonRequestBehavior.DenyGet)); }
// GET: Home public ActionResult Index() { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Top6MedicalFields_Result> top6MedicalFields = db.USP_SEL_Top6MedicalFields().ToList(); ViewBag.Top6MedicalFields = top6MedicalFields; List <USP_SEL_Top3Articles_Result> top3News = db.USP_SEL_Top3Articles().ToList(); ViewBag.Top3News = top3News; Search model = new Search(); return(View(model)); }
public ActionResult Panel() { PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_NotActivatedComments_Result> notActivatedComments = db.USP_SEL_NotActivatedComments().ToList(); ViewBag.NotActivatedComments = notActivatedComments; List <USP_SEL_NotActivatedDoctors_Result> notActivatedDoctors = db.USP_SEL_NotActivatedDoctors().ToList(); ViewBag.NotActivatedDoctors = notActivatedDoctors; Search model = new Search(); return(View(model)); }
public ActionResult ProfileSet() { string authID = Request.Cookies["AuthID"].Value; PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_Doctor_Result> doctorInfo = db.USP_SEL_Doctor(Session[authID].ToString()).ToList(); Session["DoctorInfo"] = doctorInfo[0]; ViewBag.MedicalFields = db.USP_SEL_MedicalFields().ToList(); DoctorProfile model = new DoctorProfile(); return(View(model)); }
//public bool IsLogin; public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.HttpContext.Request.Cookies["AuthID"] != null && filterContext.HttpContext.Session["AuthID"] != null) { if (filterContext.HttpContext.Request.Cookies["AuthID"].Value == filterContext.HttpContext.Session["AuthID"].ToString()) { string authID = filterContext.HttpContext.Session["AuthID"].ToString(); if (filterContext.HttpContext.Session[authID + "IP"].ToString() == filterContext.HttpContext.Request.UserHostAddress) { try { filterContext.Controller.ViewBag.IsLogin = true; PezeshkPlusEntities db = new PezeshkPlusEntities(); List <USP_SEL_NameAndRole_Result> NameAndRole = db.USP_SEL_NameAndRole(filterContext.HttpContext.Session[authID].ToString()).ToList(); if (NameAndRole[0].Role == 0) { filterContext.Controller.ViewBag.Role = "Admin"; } else { filterContext.Controller.ViewBag.Role = "Doctor"; } filterContext.Controller.ViewBag.Name = NameAndRole[0].LastName; } catch (Exception) { throw; } } else { filterContext.Controller.ViewBag.IsLogin = false; } } else { filterContext.Controller.ViewBag.IsLogin = false; } } else { filterContext.Controller.ViewBag.IsLogin = false; } base.OnActionExecuting(filterContext); }
public ActionResult RejectComment() { try { string url = Request.Url.AbsolutePath; url = url.Substring(url.LastIndexOf('/') + 1, (url.Length - 1) - url.LastIndexOf('/')); PezeshkPlusEntities db = new PezeshkPlusEntities(); db.USP_DEL_Comment(Convert.ToInt32(url)); TempData["ActiveComment"] = "کامنت رد شد"; } catch (Exception) { TempData["ActiveComment"] = "خطا کامنت رد نشد"; } return(RedirectToAction("Panel")); }
public ActionResult AcceptDoctor() { try { string url = Request.Url.AbsolutePath; url = url.Substring(url.LastIndexOf('/') + 1, (url.Length - 1) - url.LastIndexOf('/')); PezeshkPlusEntities db = new PezeshkPlusEntities(); db.USP_UPD_ActiveDoctor(Convert.ToInt32(url)); TempData["ActiveDoctor"] = "دکتر تایید شد"; } catch (Exception) { TempData["ActiveDoctor"] = "خطا دکتر تایید نشد"; } return(RedirectToAction("Panel")); }
public ActionResult Login(RegisterPack doctor) { ViewBag.IsLogin = false; PezeshkPlusEntities db = new PezeshkPlusEntities(); List <int?> CheckMail = db.USP_SEL_Email(doctor.LoginModel.Email).ToList(); if (CheckMail.Count == 0) { TempData["WrongEmail"] = "ایمیل وارد شده صحیح نمی باشد!"; return(RedirectToAction("Register")); } List <int?> CheckPass = db.USP_SEL_Password(doctor.LoginModel.Email, doctor.LoginModel.Password).ToList(); if (CheckPass.Count == 0) { TempData["WrongPass"] = "******"; return(RedirectToAction("Register")); } List <bool?> IsActive = db.USP_SEL_IsDoctorActive(doctor.LoginModel.Email).ToList(); if (IsActive[0] == false) { TempData["NotActive"] = "ثبت نام شما هنوز توسط مدیریت تایید نشده!"; return(RedirectToAction("Register")); } string authID = Guid.NewGuid().ToString(); Session["AuthID"] = authID; Response.Cookies["AuthID"].Value = authID; Session[authID] = doctor.LoginModel.Email; Session[authID + "IP"] = Request.UserHostAddress; string previousUrl = Session["PreviousUrl"].ToString(); Session.Remove("PreviousUrl"); return(Redirect(previousUrl)); }
public ActionResult Commenting(Models.CustomModel.Comment commentModel) { PezeshkPlusEntities db = new PezeshkPlusEntities(); try { if (commentModel.Rate != 0) { db.USP_UPD_Rate(Session["DoctorEmail"].ToString(), commentModel.Rate); } db.USP_INS_Comment(Session["DoctorEmail"].ToString(), commentModel.Text, commentModel.Name, null); TempData["CommentSent"] = "دیدگاه شما ارسال شد و پس از تایید مدیر نمایش داده خواهد شد"; } catch (Exception) { TempData["CommentNotSent"] = "خطایی در ارسال دیدگاه رخ داد!"; } return(RedirectToAction("DoctorPage", new { name = Session["DoctorName"].ToString() })); }
public ActionResult NewArticle(string Name, string Topic, string Text, HttpPostedFileBase Picture) { try { PezeshkPlusEntities db = new PezeshkPlusEntities(); string picAddress; if (Picture != null) { if (Path.GetExtension(Picture.FileName) != ".jpg" && Path.GetExtension(Picture.FileName) != ".JPG" && Path.GetExtension(Picture.FileName) != ".png" && Path.GetExtension(Picture.FileName) != ".PNG" && Path.GetExtension(Picture.FileName) != ".jpeg") { TempData["PictureError"] = "پسوند فایل ارسالی باید jpg یا jpeg یا png باشد"; return(RedirectToAction("Panel")); } if (Picture.ContentLength > 1 & Picture.ContentLength < (5 * 1024 * 1024)) { string extention = Path.GetExtension(Picture.FileName); string guidNamePic = Guid.NewGuid().ToString(); picAddress = $"/Images/Article/{guidNamePic}{extention}"; Picture.SaveAs(Server.MapPath("~" + picAddress)); } else { TempData["PictureError"] = "سایز فایل عکس ارسال شده باید حداکثر 5 Mg باشد"; return(RedirectToAction("Panel")); } } else { TempData["PictureError"] = "عکس اجباری است"; return(RedirectToAction("Panel")); } db.USP_INS_Article(Topic, Text, Name, picAddress); TempData["ArticleSent"] = "مقاله ثبت شد"; } catch (Exception) { TempData["ArticleNotSent"] = "خطا مقاله ثبت نشد"; } return(RedirectToAction("Panel")); }
public ActionResult Index(Search model) { if (model.Name == null) { model.Name = "%"; } if (model.Province == "انتخاب استان" || model.Province == null) { model.Province = "%"; } if (model.City == "انتخاب شهر" || model.City == null) { model.City = "%"; } if (model.MedicalFieldName == "انتخاب نوع تخصص" || model.MedicalFieldName == null) { model.MedicalFieldName = "%"; } PezeshkPlusEntities db = new PezeshkPlusEntities(); List <string> provinces = db.USP_SEL_Provinces().ToList(); ViewBag.Provinces = provinces; List <string> cities = db.USP_SEL_Cities().ToList(); ViewBag.Cities = cities; List <USP_SEL_ActiveMedicalFields_Result> medicalFields = db.USP_SEL_ActiveMedicalFields().ToList(); ViewBag.MedicalFields = medicalFields; List <USP_SEL_SearchDoctors_Result> result = db.USP_SEL_SearchDoctors(model.Name, model.Province, model.City, model.MedicalFieldName).ToList(); ViewBag.SearchResult = result; Search Model = new Search(); return(View(Model)); }
public ActionResult Register() { ViewBag.IsLogin = false; RegisterPack model = new RegisterPack(); Uri previousUri = Request.UrlReferrer; if (previousUri != null) { Session["PreviousUrl"] = previousUri.AbsolutePath; } else { Session["PreviousUrl"] = "~/Home"; } PezeshkPlusEntities db = new PezeshkPlusEntities(); ViewBag.MedicalFields = db.USP_SEL_MedicalFields().ToList(); return(View(model)); }
public ActionResult ProfileSet(DoctorProfile doctorProfile) { try { USP_SEL_Doctor_Result doctorLastInfo = (USP_SEL_Doctor_Result)Session["DoctorInfo"]; Session.Remove("DoctorInfo"); PezeshkPlusEntities db = new PezeshkPlusEntities(); if (doctorProfile.FirstName != doctorLastInfo.FirstName) { db.USP_UPD_FirstName(doctorLastInfo.Email, doctorProfile.FirstName); } if (doctorProfile.LastName != doctorLastInfo.LastName) { db.USP_UPD_LastName(doctorLastInfo.Email, doctorProfile.LastName); } if (doctorProfile.Password != null) { if (doctorProfile.NewPassword != null) { db.USP_UPD_Password(doctorLastInfo.Email, doctorProfile.NewPassword); } } if (doctorProfile.PhoneNumber != doctorLastInfo.PhoneNumber) { List <int?> CheckPhoneNumber = db.USP_SEL_PhoneNumber(doctorProfile.PhoneNumber).ToList(); if (CheckPhoneNumber.Count == 1) { TempData["PhoneNumberError"] = "با این شماره موبایل قبلا ثبت نام شده است"; return(RedirectToAction("ProfileSet")); } db.USP_UPD_PhoneNumber(doctorLastInfo.Email, doctorProfile.PhoneNumber); } if (doctorProfile.ClinicPhone != doctorLastInfo.ClinicPhone) { List <int?> CheckClinicPhone = db.USP_SEL_ClinicPhone(doctorProfile.ClinicPhone).ToList(); if (CheckClinicPhone.Count == 1) { TempData["ClinicPhoneError"] = "با این شماره تلفن مطب قبلا ثبت نام شده است"; return(RedirectToAction("ProfileSet")); } db.USP_UPD_ClinicPhone(doctorLastInfo.Email, doctorProfile.ClinicPhone); } if (doctorProfile.Province != doctorLastInfo.Province) { db.USP_UPD_Province(doctorLastInfo.Email, doctorProfile.Province); } if (doctorProfile.City != doctorLastInfo.City) { db.USP_UPD_City(doctorLastInfo.Email, doctorProfile.City); } if (doctorProfile.Address != doctorLastInfo.Address) { db.USP_UPD_Address(doctorLastInfo.Email, doctorProfile.Address); } if (doctorProfile.NationalID != doctorLastInfo.NationalID) { List <int?> CheckNationalID = db.USP_SEL_NationalID(doctorProfile.NationalID).ToList(); if (CheckNationalID.Count == 1) { TempData["NationalIDError"] = "با این کد ملی قبلا ثبت نام شده است"; return(RedirectToAction("ProfileSet")); } db.USP_UPD_NationalID(doctorLastInfo.Email, doctorProfile.NationalID); } if (doctorProfile.MedicalField != doctorLastInfo.MedicalField) { List <int?> previousMedicalFieldID = db.USP_SEL_MedicalFieldID(doctorLastInfo.MedicalField).ToList(); List <int?> medicalFieldID = db.USP_SEL_MedicalFieldID(doctorProfile.MedicalField).ToList(); db.USP_UPD_MedicalField(doctorLastInfo.Email, previousMedicalFieldID[0], medicalFieldID[0]); } if (doctorProfile.WorkTime != doctorLastInfo.WorkTime) { db.USP_UPD_WorkTime(doctorLastInfo.Email, doctorProfile.WorkTime); } if (doctorProfile.Picture != null) { if (Path.GetExtension(doctorProfile.Picture.FileName) != ".jpg" && Path.GetExtension(doctorProfile.Picture.FileName) != ".JPG" && Path.GetExtension(doctorProfile.Picture.FileName) != ".png" && Path.GetExtension(doctorProfile.Picture.FileName) != ".PNG" && Path.GetExtension(doctorProfile.Picture.FileName) != ".jpeg") { TempData["PictureError"] = "پسوند فایل ارسالی باید jpg یا jpeg یا png باشد"; return(RedirectToAction("ProfileSet")); } if (doctorProfile.Picture.ContentLength > 1 & doctorProfile.Picture.ContentLength < (5 * 1024 * 1024)) { if (doctorLastInfo.PicAddress != null) { if (System.IO.File.Exists(doctorLastInfo.PicAddress)) { System.IO.File.Delete(doctorLastInfo.PicAddress); } } string extention = Path.GetExtension(doctorProfile.Picture.FileName); string guidNamePic = Guid.NewGuid().ToString(); string picAddress = $"/Images/Doctors/{guidNamePic}{extention}"; doctorProfile.Picture.SaveAs(Server.MapPath("~" + $"{picAddress}")); db.USP_UPD_PicAddress(doctorLastInfo.Email, picAddress); } else { TempData["PictureError"] = "سایز فایل عکس ارسال شده باید حداکثر 5 Mg باشد"; return(RedirectToAction("ProfileSet")); } } } catch (Exception) { TempData["UpdateError"] = "خطایی در بروزرسانی اطلاعات رخ داد! لطفا مقادیر را چک کنید و دوباره تلاش کنید"; return(RedirectToAction("ProfileSet")); } TempData["UpdateSuccessFully"] = "پروفایل شما با موفقیت بروزرسانی شد"; return(RedirectToAction("ProfileSet")); }