public IEnumerable <Person> GetAllPerson(Func <Person, bool> predicat = null) { IDAL dal = new DalClass(); IEnumerable <Person> doctors = dal.GetDoctors(); IEnumerable <Person> patients = dal.GetPatients(); IEnumerable <Person> all = doctors.Union(patients); return(all); }
public void AddDoctor(Doctor doctor) { try { IDAL dal = new DalClass(); IEnumerable <Doctor> doctors = dal.GetDoctors(doc => doc.idNumber == doctor.idNumber); if (doctors.Count() != 0) { throw new Exception("רופא זה כבר רשום במערכת"); } dal.AddDoctor(doctor); } catch (Exception ex) { throw ex; } }
public void UpdateDoctor(Doctor doctor) { try { IDAL dal = new DalClass(); IEnumerable <Doctor> doctors = dal.GetDoctors(doc => doc.idNumber == doctor.idNumber); if (doctors.Count() == 0) { throw new Exception("רופא זה לא מוכר במערכת, אנא הוסף אותו"); } dal.UpdateDoctor(doctor); } catch (Exception ex) { throw ex; } }
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("הנך רשום למערכת, אנא בצע התחברות. אם שכחת סיסמא לחץ על 'שכחת סיסמה?'"); } }
public IEnumerable <Doctor> GetDoctors(Func <Doctor, bool> predicat = null) { IDAL dal = new DalClass(); return(dal.GetDoctors(predicat)); }