Example #1
0
        public string GetDataByEmail(string email)
        {
            //return string.Format("You entered: {0}", id);
            //TODO zwracanie obiektu zawierajacego dane

            Server2ModelMethods s2mm = new Server2ModelMethods();
            Patient p = new Patient();
            try
            {
                p = s2mm.getPersonByEmail(email);
            }
            catch (Exception e)
            {
                return e.Message;
            }
            //return string.Format("{0} {1}, {2}, student: {3}", p.Name, p.Surname, p.Email, p.Student);
            if (p != null)
            {
                return string.Format("{0}%%%{1}%%%{2}%%%{3}%%%{4}%%%{5}%%%{6}", p.Name, p.Surname, p.Email, p.pssl, p.Student, p.Height, p.Weight);
            }
            else
            {
                return "";
            }
        }
Example #2
0
 public string GetData(int id, bool mod)
 {
     Server2ModelMethods s2mm = new Server2ModelMethods();
     Patient p = new Patient();
     if (mod == false)
     {
         try
         {
             p = s2mm.getPatient(id);
         }
         catch (Exception e)
         {
             return e.Message;
         }
     }
     else
     {
         try
         {
             p = s2mm.getPersonByGLID(id);
         }
         catch (Exception e)
         {
             return e.Message;
         }
         //return p.pssl.ToString();
     }
     return string.Format("{0}%%%{1}%%%{2}%%%{3}%%%{4}%%%{5}%%%{6}%%%{7}", p.Name, p.Surname, p.Email, p.pssl, p.Student, p.Id, p.Height, p.Weight);
 }
        public Patient getPersonByEmail(string email)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();
            Patient r = new Patient();

            r = (from rr in db.Patients
                 where rr.Email == email
                 select rr).FirstOrDefault();

            return r;
        }
        public Patient getPatient(int id)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();
            Patient p = new Patient();

            p = (from rr in db.Patients
                 where rr.Id == id
                 select rr).First();

            return p;
        }
        public void deletePatient(int id)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();
            Patient p = new Patient();

            p = (from rr in db.Patients
                 where rr.Id == id
                 select rr).First();

            db.Patients.Remove(p);
            db.SaveChanges();
        }
 public List<String> GetMatchingSurnames(string __surname)
 {
     Server2DatabaseEntities db = new Server2DatabaseEntities();
     Patient p = new Patient();
     var query = from r in db.Patients
                 where r.Surname == __surname
                 select r;
     var qry = query.ToList();
     var qrarr = new List<String>();
     foreach (Patient pp in qry)
     {
         // Don't make me ever do this again.
         qrarr.Add(string.Format("{0}%%%{1}%%%{2}%%%{3}%%%{4}%%%{5}%%%{6}", pp.Name, pp.Surname, pp.Email, pp.pssl, pp.Student, pp.Height, pp.Weight));
     }
     return qrarr;
 }
        public void addPatient(string name, string surname, bool student, string email, float height, float weight)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();

            Patient p = new Patient();

            p.Name = name;
            p.Surname = surname;
            p.Student = student;
            p.Email = email;
            p.Weight = weight;
            p.Height = height;

            db.Patients.Add(p);
            db.SaveChanges();
        }
        public Patient getPersonByGLID(int pss)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();
            Patient r = new Patient();

            r = (from rr in db.Patients
                 where rr.pssl == pss
                 select rr).FirstOrDefault();

            return r;
        }
        public Patient getPersonBySurname(string surname)
        {
            Server2DatabaseEntities db = new Server2DatabaseEntities();
            Patient r = new Patient();

            r = (from rr in db.Patients
                 where rr.Surname == surname
                 select rr).First();
            //if(r.Any())

            return r;
        }
Example #10
0
        public string GetDataBySurname(string surname)
        {
            //return string.Format("You entered: {0}", id);
            //TODO zwracanie obiektu zawierajacego dane

            Server2ModelMethods s2mm = new Server2ModelMethods();
            Patient p = new Patient();
            try
            {
                p = s2mm.getPersonBySurname(surname);
            }
            catch (Exception e)
            {
                return e.Message;
            }
            return string.Format("{0}%%%{1}%%%{2}%%%{3}%%%{4}%%%{5}%%%{6}%%%{7}", p.Name, p.Surname, p.Email, p.pssl, p.Student, p.Id, p.Height, p.Weight);
        }