public ActionResult SignUp(DoctorSign doctorSign) { try { IBL bl = new BlClass(); Dictionary <string, string> errorMessege = bl.SignValidation(doctorSign); if (errorMessege.Count == 0) { bl.SignUp(doctorSign); ViewBag.TitlePopUp = "עבר בהצלחה"; ViewBag.Message = "ההרשמה עברה בהצלחה, אישור נוסף תמצא בתיבת המייל האישית שלך."; return(View("~/Views/Home/Index.cshtml")); } foreach (var item in errorMessege) { ModelState.AddModelError(item.Key, item.Value); } return(View("LogIn")); } catch (System.Exception ex) { ViewBag.TitlePopUp = "שגיאה"; ViewBag.Message = ex.Message; return(View("~/Views/Home/Index.cshtml")); } }
public ActionResult Log(DoctorSign doctorSign) { try { IBL bl = new BlClass(); Dictionary <string, string> errorMessege = bl.SignValidation(doctorSign); if (errorMessege.Count == 1) { if (doctorSign.email == "*****@*****.**" && doctorSign.password == "מנהל") { RouteConfig.IsManager = true; return(View("~/Views/Home/Index.cshtml")); } bl.SignIn(doctorSign); Doctor doctor = bl.GetDoctors(doc => doc.email == doctorSign.email).FirstOrDefault(); RouteConfig.doctor = doctor; return(View("~/Views/Home/Index.cshtml")); } foreach (var item in errorMessege) { ModelState.AddModelError(item.Key, item.Value); } ViewBag.SigndivActive = "true"; return(View("LogIn")); } catch (System.Exception ex) { ViewBag.TitlePopUp = "שגיאה"; ViewBag.Message = ex.Message; ViewBag.SigndivActive = "true"; return(View("LogIn")); } }
public Dictionary <string, string> SignValidation(DoctorSign doctorSign) { Dictionary <string, string> result = new Dictionary <string, string>(); if (doctorSign.idNumber == null) { result.Add("idNumber", "חובה להזין מספר ת.ז."); } else if (!Validation.IsId(doctorSign.idNumber)) { result.Add("idNumber", "מספר תעודת הזהות אינו תקין"); } if (doctorSign.email == null) { result.Add("email", "חובה להזין כתובת מייל"); } else if (!Validation.IsEmail(doctorSign.email)) { result.Add("email", "כתובת המייל אינה תקינה"); } if (doctorSign.password == null) { result.Add("password", "חובה לבחור סיסמה"); } else if (!Validation.IsPassword(doctorSign.password)) { result.Add("password", "סיסמה אינה תקינה"); } return(result); }
public void SignIn(DoctorSign doctorSign) { try { IDAL dal = new DalClass(); Doctor doctor = dal.GetDoctors(doc => doc.email == doctorSign.email).FirstOrDefault(); if (doctor == null && doctorSign.email != "*****@*****.**") { throw new Exception("כתובת המייל לא זוהתה במערכת. אנא בדוק אותה או בצע הרשמה"); } else if (doctor == null || doctorSign.password != doctor.password) { throw new Exception("סיסמה שגויה, נסה שנית"); } } catch (Exception ex) { throw ex; } }
public void SignUp(DoctorSign doctorSign) { IDAL dal = new DalClass(); Doctor doctor = dal.GetDoctors(doc => doc.idNumber == doctorSign.idNumber).FirstOrDefault(); if (doctor != null && doctor.password == null) { doctor.password = doctorSign.password; dal.UpdateDoctor(doctor); SendMail(doctor.email, "ההרשמה עברה בהצלחה", doctor.privateName + " " + doctor.familyName, "ברוכים הבאים לאתר שלנו, שמחים שהצטרפת." + "<br/>" + "נשמח לעמוד לעזרתך בכל פניה ובקשה ומקווים שתהיה לך חוויה נעימה." + "<br/>" + "תודה, צוות אח לאח"); } else if (doctor == null) { SendMail(doctorSign.email, "ההרשמה נכשלה", "", "לצערנו, נסיון ההרשמה שלך לאתרנו נכשל." + "<br/>" + "אנא נסה שוב בעוד חצי שנה ונשמח לעמוד לעזרתך." + "<br/>" + "תודה, צוות אח לאח"); throw new Exception("ניסיון הרשמתך לאתרנו נכשל, אנא בדוק את תיבת המייל שלך עבור פרטים נוספים."); } else { throw new Exception("הנך רשום למערכת, אנא בצע התחברות. אם שכחת סיסמא לחץ על 'שכחת סיסמה?'"); } }