Exemple #1
0
        public void ForgotPassword(string mail)
        {
            try
            {
                IDAL   dal    = new DalClass();
                Doctor doctor = GetDoctors(doc => doc.email == mail).FirstOrDefault();
                if (doctor != null)
                {
                    Random random      = new Random();
                    int    newPassword = random.Next(10000, 1000000000);
                    SendMail(doctor.email, "איפוס סיסמה", doctor.privateName + " " + doctor.familyName, "הסיסמה שלך אופסה, הסיסמה החדשה היא:" + "<br/>" + newPassword + "<br/>" + "אנא שנה סיסמה בהקדם האפשרי");

                    //Edit Password
                    doctor.password = newPassword.ToString();
                    UpdateDoctor(doctor);
                }
                else
                {
                    throw new Exception("המייל שהוזן שגוי. בדוק אם הינך רשום למערכת (איך?! תפעיל את הזיכרון בבקשה.)");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public void AddPrescription(Prescription prescription)
        {
            IDAL dal = new DalClass();

            if (prescription.startDate < DateTime.Now)
            {
                throw new Exception("תאריך תחילת המרשם חייב להיות החל מהיום");
            }
            if (prescription.endDate < prescription.startDate)
            {
                throw new Exception("תאריך תחילת המרשם חייב להיות טרם סיומו");
            }

            //Obtaining a NDC number of all active prescriptions for this patient
            List <string> NDCforPatientMedicines = GetNDCForAllActiveMedicine(prescription.PatientId);

            Medicine med = GetMedicine(prescription.MedicineId);

            NDCforPatientMedicines.Add(med.NDC);

            List <string> Result     = IsConflict(NDCforPatientMedicines);
            bool          isConflict = Result[1] == "True" ? true : false;

            if (isConflict)
            {
                throw new Exception("נמצא ניגוד מרכיבים בין התרופות שהמטופל נוטל לבין זו החדשה. מחובתנו לדאוג לבריאות המטופל ולכן לא נוסיף לו מרשם זה. פירוט הודעת השגיאה: " + "\n" + Result[0]);
            }
            else
            {
                dal.AddPrescription(prescription);
            }
        }
Exemple #3
0
        public List <string> IsConflict(List <string> NDC)
        {
            IDAL dal = new DalClass();

            List <string> strings = dal.IsConflict(NDC);

            return(strings);
        }
Exemple #4
0
 public void Dispose(bool disp)
 {
     if (disp)
     {
         IDAL dal = new DalClass();
         dal.Dispose();
     }
 }
        public static bool ValidId(string id)
        {
            IDAL dal = new DalClass();

            if (dal.GetPatients(u => u.idNumber == id) != null)
            {
                return(false);
            }
            return(true);
        }
Exemple #6
0
        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 BoClass(EntityClass e)
        {
            entitylayer = e;
            datalayer   = new DalClass(e);
            ftpsc       = new FTPServerConnection(e);


            bothreedtimer          = new System.Windows.Threading.DispatcherTimer();
            bothreedtimer.Tick    += new EventHandler(bothreedtimer_Tick);
            bothreedtimer.Interval = new TimeSpan(0, 0, 1);
            bothreedtimer.Start();
        }
Exemple #8
0
 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;
     }
 }
Exemple #9
0
 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;
     }
 }
Exemple #10
0
 public static void UpdateEntry(Record record)
 {
     DAL.Models.Record recorddto = new DAL.Models.Record
     {
         UserName = record.UserName,
         LstItems = new List <Items>
         {
             new Items
             {
                 Item = record.LstItems[0].Item
             }
         },
         Count  = record.Count,
         DeptId = record.DeptId,
         RoleId = record.RoleId
     };
     DalClass.UpdateEntry(recorddto);
 }
Exemple #11
0
 public void AddPatient(Patient patient)
 {
     try
     {
         IDAL dal = new DalClass();
         IEnumerable <Patient> patients = dal.GetPatients(p => p.idNumber == patient.idNumber);
         if (patients.Count() != 0)
         {
             throw new Exception("מטופל זה כבר רשום במערכת");
         }
         patient.medicalHistory = patient.medicalHistory == null ? "לא נמסר מידע" : patient.medicalHistory;
         dal.AddPatient(patient);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #12
0
 public void UpdatePatient(Patient patient)
 {
     try
     {
         IDAL dal = new DalClass();
         IEnumerable <Patient> patients = dal.GetPatients(p => p.idNumber == patient.idNumber);
         if (patients.Count() == 0)
         {
             throw new Exception("מטופל זה לא מוכר במערכת, אנא הוסף אותו");
         }
         patient.medicalHistory = patient.medicalHistory == null ? "לא נמסר מידע" : patient.medicalHistory;
         dal.UpdatePatient(patient);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #13
0
 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;
     }
 }
Exemple #14
0
        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("הנך רשום למערכת, אנא בצע התחברות. אם שכחת סיסמא לחץ על 'שכחת סיסמה?'");
            }
        }
Exemple #15
0
        public bool ValidateImage(string _path)
        {
            List <string> testImages = new List <string>()
            {
                "pill", "pill bottle", "pills", "medicine", "bottle", "syrup", "medical", "drug", "drugs", "cure", "prescription drug", "vitamin", "cream", "ointment"
            };

            List <string> Result = new List <string>(); //returning the list of results order by certain confidence
            bool          flag   = false;

            string path = ConvertStringToUrl(_path);

            ImageDetails DrugImage = new ImageDetails(path);

            IDAL dal = new DalClass();

            dal.GetTags(DrugImage);

            var Threshold = 60.0; //testing the result with confidence above 60%

            foreach (var item in DrugImage.Details)
            {
                if (item.Value > Threshold)
                {
                    foreach (var option in testImages) //the words we can accept
                    {
                        if (item.Key == option)
                        {
                            flag = true;
                            break;
                        }
                    }
                }
            }

            return(flag); /*Result;*/
        }
Exemple #16
0
        public void AddMedicine(Medicine medicine, HttpPostedFileBase httpPostedFile)
        {
            try
            {
                IDAL dal = new DalClass();
                medicine.NDC = GetNDCForMedicine(medicine.genericaName);
                bool IsOkImage = ValidateImage(medicine.imagePath);

                if (IsOkImage)
                {
                    medicine.manufacturer = medicine.manufacturer == null ? "לא ידוע" : medicine.manufacturer;
                    dal.AddMedicine(medicine, httpPostedFile);
                }
                else
                {
                    throw new Exception("תמונה זו אינה מתארת תרופה. אנא נסה שוב עם תוכן מתאים יותר."
                                        + " המלצתנו היא שתבחר תמונה אחרת לתרופה שברצונך להוסיף למערכת.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #17
0
        public IEnumerable <Medicine> GetMedicines(Func <Medicine, bool> predicat = null)
        {
            IDAL dal = new DalClass();

            return(dal.GetMedicines(predicat));
        }
Exemple #18
0
        public IEnumerable <Patient> GetPatients(Func <Patient, bool> predicat = null)
        {
            IDAL dal = new DalClass();

            return(dal.GetPatients(predicat));
        }
Exemple #19
0
        public IEnumerable <Prescription> GetPrescriptions(Func <Prescription, bool> predicat = null)
        {
            IDAL dal = new DalClass();

            return(dal.GetPrescriptions(predicat));
        }
Exemple #20
0
        public IEnumerable <MedicineWrraper> GetAllNDC()
        {
            IDAL dal = new DalClass();

            return(dal.GetAllNDC());
        }
Exemple #21
0
        public Patient GetPatient(int?id)
        {
            IDAL dal = new DalClass();

            return(dal.GetPatient(id));
        }
Exemple #22
0
 public static int IsRegisteredUser(Models.User user)
 {
     _userdl = BdtoTodto(user);
     return(DalClass.IsRegisteredUser(_userdl));
     //redirect user home
 }
Exemple #23
0
        public IEnumerable <Prescription> FilterPrescriptionsForPatient(int patientID)
        {
            IDAL dal = new DalClass();

            return(dal.GetPrescriptions(pre => pre.PatientId == patientID));
        }
Exemple #24
0
        public string GetNDCForMedicine(string genericName)
        {
            IDAL dal = new DalClass();

            return(dal.GetNDCForMedicine(genericName));
        }
Exemple #25
0
        public Prescription GetPrescription(int?id)
        {
            IDAL dal = new DalClass();

            return(dal.GetPrescription(id));
        }
Exemple #26
0
        public IEnumerable <Doctor> GetDoctors(Func <Doctor, bool> predicat = null)
        {
            IDAL dal = new DalClass();

            return(dal.GetDoctors(predicat));
        }
Exemple #27
0
 public static int RegisterUser(Models.User user)
 {
     _userdl = BdtoTodto(user);
     return(DalClass.RegisterUser(_userdl));
     //redirect to login page show status failed/success
 }
Exemple #28
0
        public Doctor GetDoctor(int?id)
        {
            IDAL dal = new DalClass();

            return(dal.GetDoctor(id));
        }
Exemple #29
0
        public IEnumerable <Prescription> FilterActivePrescriptionsForPatient(int patientID)
        {
            IDAL dal = new DalClass();

            return(dal.GetPrescriptions(pre => pre.PatientId == patientID && pre.endDate >= DateTime.Now));
        }
Exemple #30
0
        public Medicine GetMedicine(int?id)
        {
            IDAL dal = new DalClass();

            return(dal.GetMedicine(id));
        }