Beispiel #1
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";
        }
Beispiel #2
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.";
        }