Exemple #1
0
        public static bool UpdatePatient(Therapists therapist)
        {
            try
            {
                using (Natural_wayEntities db = new Natural_wayEntities())
                {
                    //יצירת רפרנס לאובייקט מהמסד נתונים
                    //Therapists newt = db.Therapists.Where(t => t.TherapistId == therapist.TherapistId).FirstOrDefault();
                    Therapists newt = db.Therapists.Where(t => t.TherapistTz == therapist.TherapistTz).FirstOrDefault();


                    newt.TherapistTz   = (therapist.TherapistTz != null && therapist.TherapistTz != "") ? therapist.TherapistTz: newt.TherapistTz;
                    newt.FirstName     = (therapist.FirstName != null && therapist.FirstName != "") ? therapist.FirstName: newt.FirstName;
                    newt.LastName      = (therapist.LastName != null && therapist.LastName != "") ? therapist.LastName: newt.LastName;
                    newt.Password      = (therapist.Password != null && therapist.Password != "") ? therapist.Password: newt.Password;
                    newt.PhoneNumber   = (therapist.PhoneNumber != null && therapist.PhoneNumber != "") ? therapist.PhoneNumber: newt.PhoneNumber;
                    newt.DateOfBirth   = (therapist.DateOfBirth != null) ? therapist.DateOfBirth: newt.DateOfBirth;
                    newt.Email         = (therapist.Email != null && therapist.Email != "") ? therapist.Email: newt.Email;
                    newt.Image         = (therapist.Image != null && therapist.Image != "") ? therapist.Image : newt.Image;
                    newt.ServiceAreaId = (therapist.ServiceAreaId != null) ? therapist.ServiceAreaId : newt.ServiceAreaId;
                    newt.Address       = (therapist.Address != null && therapist.Address != "") ? therapist.Address : newt.Address;

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
Exemple #2
0
 //gets dal and convert it to dto (by the ctor)
 public Meets1(Dal.Meets m) : this()
 {
     MeetId      = m.MeetId;
     PatientId   = (int)m.PatientId;
     TherapistId = (int)m.TherapistId;
     MeetDate    = m.MeetDate;
     CategoryId  = (int)m.CategoryId;
     Dal.Therapists t = Dal.TherapistsDal.GetById(TherapistId);
     TherapistName = t.FirstName + " " + t.LastName;
     CategoryName  = Dal.CategoriesDal.GetById(CategoryId).CategoryName;
     Dal.Patients p = Dal.PatientsDal.GetById(PatientId);
     PatientName = p.Firstname + " " + p.Lastname;
 }
Exemple #3
0
 public static bool Register(Therapists t)
 {
     try
     {
         using (Natural_wayEntities db = new Natural_wayEntities())
         {
             db.Therapists.Add(t);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         return(false);
     }
     return(true);
 }
        //gets dal and convert it to dto (by the ctor)
        public Therapists1(Dal.Therapists t)
        {
            TherapistId   = t.TherapistId;
            FirstName     = t.FirstName;
            LastName      = t.LastName;
            TherapistTz   = t.TherapistTz;
            DateOfBirth   = t.DateOfBirth;
            PhoneNumber   = t.PhoneNumber;
            Email         = t.Email;
            Password      = t.Password;
            Image         = t.Image;
            ServiceAreaId = (int)t.ServiceAreaId;
            Address       = t.Address;
            AboutMe       = t.AboutMe;
            Diploma       = t.Diploma;

            ServiceAreaName = Dal.ServiceAreasDal.GetById(ServiceAreaId).SAName;
            Categories      = Dal.CategoriesDal.GetCategoriesByTherapistId(TherapistId);
            CategoriesNames = Dal.CategoriesDal.GetCategoriesNamesByTherapistId(TherapistId);
        }