示例#1
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);
 }
示例#2
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 "";
            }
        }
示例#3
0
 public string TerriblyRetrieveDatabase()
 {
     Server2ModelMethods sdomm = new Server2ModelMethods();
     List<Patient> pp = new List<Patient>();
     pp = sdomm.GetListOfPatients();
     string sp = pp.ToString(); // Istnieje specjalne miejsce w piekle dla ludzi, którzy robią coś takiego.
     return sp;
 }
示例#4
0
        public string AddNewStudent(string _name, string _surn, bool batman, string _mail, float height, float weight)
        {
            //sdolm.addPerson(_name, _surn, batman, _mail);
            service1_1VC.incrementVersion("Adding new Student...");
            Server2ModelMethods sdomm = new Server2ModelMethods();

            try
            {
                sdomm.addPatient(_name, _surn, batman, _mail, height, weight);
            }
            catch (Exception e)
            {
                service1_1VC.incrementVersion("ERR: Unknown error while saving new Student data!");
                return e.Message;
            }
            service1_1VC.incrementVersion("Student successfully added.");
            return "Done";
        }
示例#5
0
        public string MakeDatabasesSynced()
        {
            service1_2VC.incrementVersion("Sync started...");
            ServiceReference1.Service1Client clnt = new ServiceReference1.Service1Client("wsHttpEndpoint");
            Server2ModelMethods sdomm = new Server2ModelMethods();
            List<String> res0 = clnt.OutrageousDatabaseLeak().ToList<String>();
            string procenty = "%%%";
            if (res0.Count == 0)
            {
                service1_2VC.incrementVersion("ERR: Sync aborted. Empty database!");
                return "Pusta baza.";
            }
            else
            {
                foreach (String str in res0)
                {
                    string[] ciach = System.Text.RegularExpressions.Regex.Split(str, procenty);
                    var qry = new List<Patient>();
                    qry = sdomm.GetListOfPatients();
                    foreach (Patient pat in qry)
                    {
                        bool basaur;
                        if (ciach[5] == "true" || ciach[5] == "True")
                            basaur = true;
                        else
                            basaur = false;
                        if (pat.pssl == Convert.ToInt32(ciach[4]))
                        {
                            sdomm.updatePatient(pat.Id, ciach[1], ciach[2], basaur, ciach[3], Convert.ToInt32(pat.Height), Convert.ToInt32(pat.Weight));
                        }
                        else
                        {
                            sdomm.addPatient(ciach[1], ciach[2], basaur, ciach[3], Convert.ToInt32(pat.Height), Convert.ToInt32(pat.Weight));
                        }
                    }

                }
            }
            service1_2VC.incrementVersion("All data has been synced.");
            return "Update Completed.";
        }
示例#6
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);
        }
示例#7
0
 public string NukeStudent(int _id)
 {
     Server2ModelMethods s2mm = new Server2ModelMethods();
     service1_1VC.incrementVersion("Deleting Student with ID =" + _id.ToString() + "...");
     try
     {
         s2mm.deletePatient(_id);
     }
     catch (Exception e)
     {
         return e.Message.ToString();
     }
     service1_1VC.incrementVersion("Student with ID = " + _id.ToString() + " successfully deleted.");
     return "Done";
 }
示例#8
0
 public List<String> GetEntriesByName(string surname)
 {
     Server2ModelMethods s2mm = new Server2ModelMethods();
     var lstst = new List<String>();
     return lstst = s2mm.GetMatchingSurnames(surname);
 }