Exemplo n.º 1
0
 public static Student GetStudent(int id)
 {
     using (var db = new SulamEntities())
     {
         return(db.Student.Where(u => u.code == id).First());
     }
 }
Exemplo n.º 2
0
        //פונקציה לשליחת מייל לאנשי צוות המוזמנים יום קודם האסיפה
        public static void SendEmail4meeting(DateTime dateTime)
        {
            DateTime           tomorrow = DateTime.Now.AddDays(1);
            List <Dal.Workers> workers4Meeting;

            using (var db = new SulamEntities())
            {
                var meetingCode = db.Meetings.Where(s => s.date.ToString() == tomorrow.ToShortDateString()).First().codeMeeting;
                workers4Meeting = db.Workers.Where(u => u.Code == meetingCode).ToList();
            }
            foreach (var item in workers4Meeting)
            {
                MailMessage mail   = new MailMessage("*****@*****.**", item.emailAdress, "test", "test");
                SmtpClient  client = new SmtpClient();
                client.Port                  = 258;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Host                  = "smtp.gmail.com";
                //client.EnableSsl = true;
                //client.Timeout = 10000;
                //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "password");
                mail.Subject      = "this is a test email.";
                mail.Body         = "this is my test email body";
                mail.BodyEncoding = UTF8Encoding.UTF8;
                mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                client.Send(mail);
            }
        }
Exemplo n.º 3
0
 public static Workers GetWorker(int id)
 {
     using (var db = new SulamEntities())
     {
         return(db.Workers.Where(u => u.Code == id).First());
     }
 }
Exemplo n.º 4
0
 //הוספה מחיקה עדכון ושליפה ילדי המוסד
 public static void AddStudent(Student student)
 {
     using (var db = new SulamEntities())
     {
         db.Student.Add(student);
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
 //הוספה מחיקה עדכון ושליפה אנשי צוות
 public static void AddWorker(Workers worker)
 {
     using (var db = new SulamEntities())
     {
         db.Workers.Add(worker);
         db.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public static void DeleteStudent(int studentCode)
 {
     using (var db = new SulamEntities())
     {
         Student student = db.Student.Where(s => s.code == studentCode).First();
         db.Student.Remove(student);
         db.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public static void DeleteWorker(int WorkerCode)
 {
     using (var db = new SulamEntities())
     {
         Workers worker = db.Workers.Where(u => u.Code == WorkerCode).First();
         db.Workers.Remove(worker);
         db.SaveChanges();
     }
 }
Exemplo n.º 8
0
        //פונקציה לרשימת תלמידים לפי קוד כתה
        public static void getStudentsByClass(int code)
        {
            List <Dal.Student> classList;

            using (var db = new SulamEntities())
            {
                classList = db.Student.Where(s => s.codeClass == code).ToList();
            }
        }
Exemplo n.º 9
0
 public static void UpdateStudent(Student newStudent)
 {
     using (var db = new SulamEntities())
     {
         Student student = db.Student.Where(u => u.code == newStudent.code).First();
         db.Student.Remove(student);
         db.Student.Add(newStudent);
         db.SaveChanges();
     }
 }
Exemplo n.º 10
0
 public static void UpdateWorker(Workers newWorker)
 {
     using (var db = new SulamEntities())
     {
         Workers worker = db.Workers.Where(u => u.Code == newWorker.Code).First();
         db.Workers.Remove(worker);
         db.Workers.Add(newWorker);
         db.SaveChanges();
     }
 }
Exemplo n.º 11
0
        //שליפה מהמסד את כל הטיפולים לפי קוד מטפל
        public static List <Dal.Treatment> GetTreatmentByCaregiverId(int id)
        {
            List <Dal.Treatment> treatmentList;/*= new List<DTO.DTO_Treatment>();*/

            //לפתוח את המסד וסוגר בסיום הפונקציה
            using (var db = new SulamEntities())
            {
                treatmentList = db.Treatment.Where(s => s.codeCaregiver == id).ToList();
            }
            return(treatmentList);
        }
Exemplo n.º 12
0
        public static Dal.Workers IsExist(string mail, int code)
        {
            //List<Dal.Worker>workerList;
            Workers t;

            using (var db = new SulamEntities())
            {
                t = db.Workers.FirstOrDefault(s => s.emailAdress == mail && s.Code == code);
                //Func<string, bool> IsTrue = x => x ==null;
            }

            return(t);
        }