예제 #1
0
        public bool regup(string fname, string lname, string timme, string adres, string dayof, int typepay, int rasp, int ddd)
        {
            registrGANEntities connect = new registrGANEntities();
            int idp = connect.Patients.Where(w => w.FirstName == fname && w.LastName == lname && w.Adress == adres).Select(s => s.idPatiens).FirstOrDefault();

            if (idp != 0 && idp != -1 && rasp != 0 && rasp != -1)
            {
                Registr reg = new Registr()
                {
                    date          = dayof,
                    idrasp        = rasp,
                    idPatient     = idp,
                    time          = timme,
                    idTypepay     = typepay,
                    iduserRegistr = ddd
                };
                connect.Registr.Add(reg);
                connect.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool registration(string FirstN, string LastN, string MiddleN, string emal, string Adrss, string phne)
        {
            registrGANEntities Connect = new registrGANEntities();
            Patients           asd     = new Patients();

            if (FirstN == "" && LastN == "" && emal == "" && Adrss == "" && phne == "")
            {
                MessageBox.Show("Нужно заполнить все данные");
                return(false);
            }
            else if (FirstN == "")
            {
                MessageBox.Show("Вы не ввели Имя");
                return(false);
            }
            else if (LastN == "")
            {
                MessageBox.Show("Вы не ввели Фамилию");
                return(false);
            }
            else if (emal == "")
            {
                MessageBox.Show("Вы не ввели электронную почту");
                return(false);
            }
            else if (Adrss == "")
            {
                MessageBox.Show("Вы не ввели адресс");
                return(false);
            }
            else if (phne == "")
            {
                MessageBox.Show("Вы не ввели номер телефона");
                return(false);
            }
            else
            {
                Patients newpa = new Patients()
                {
                    FirstName  = FirstN,
                    LastName   = LastN,
                    Email      = emal,
                    MiddleName = MiddleN,
                    Adress     = Adrss,
                    Phone      = phne
                };
                asd = newpa;
            };
            Connect.Patients.Add(asd);
            Connect.SaveChanges();
            this.Close();
            return(true);
        }
예제 #3
0
        public bool thisupdate(string dayys, string timmes, int idd, int id)
        {
            registrGANEntities connect = new registrGANEntities();

            var chec = connect.Registr.Where(w => w.idRegistr == id).ToList();

            if (idd == -1 || idd == 0 || !chec.Any() || chec.Count == 0)
            {
                return(false);
            }
            else
            {
                var thisupdate = connect.Registr.Where(w => w.idRegistr == id).FirstOrDefault();
                thisupdate.date      = dayys;
                thisupdate.time      = timmes;
                thisupdate.idTypepay = idd;
                connect.SaveChanges();
                this.Close();
                return(true);
            }
        }
예제 #4
0
        public bool tthisupdate(string fname, string lname, string role, string phon, string emaill, string adresss, int idd)
        {
            registrGANEntities connect = new registrGANEntities();
            var check = connect.Doctors.Where(w => w.iddoctors == idd).ToList();

            if (idd == -1 || idd == 0 || !check.Any() || check.Count == 0)
            {
                return(false);
            }
            else
            {
                var thisupdate = connect.Doctors.Where(w => w.iddoctors == idd).FirstOrDefault();
                thisupdate.FirstName = fname;
                thisupdate.LastName  = lname;
                thisupdate.Role      = role;
                thisupdate.Phone     = phon;
                thisupdate.Email     = emaill;
                thisupdate.Adress    = adresss;
                connect.SaveChanges();
                return(true);
            }
        }
예제 #5
0
        public bool thisupdate(string fname, string lname, string middlen, string phon, string emaill, string adresss, int idd)
        {
            registrGANEntities connect = new registrGANEntities();
            var com = connect.Patients.Where(w => w.idPatiens == idd).ToList();

            if (idd == -1 || idd == 0 || com.Count == 0 || !com.Any())
            {
                return(false);
            }
            else
            {
                var thisupdate = connect.Patients.Where(w => w.idPatiens == idd).FirstOrDefault();
                thisupdate.FirstName  = fname;
                thisupdate.LastName   = lname;
                thisupdate.MiddleName = middlen;
                thisupdate.Phone      = phon;
                thisupdate.Email      = emaill;
                thisupdate.Adress     = adresss;
                connect.SaveChanges();
                this.Close();
                return(true);
            }
        }
예제 #6
0
        public bool delete(int idd)
        {
            registrGANEntities connector = new registrGANEntities();

            if (idd != 0 || idd != -1)
            {
                var dlee = connector.Patients.Where(w => w.idPatiens == idd).ToList();
                if (dlee.Count != 0 && dlee.Any())
                {
                    var dlee1 = connector.Patients.Where(w => w.idPatiens == idd).FirstOrDefault();
                    connector.Patients.Remove(dlee1);
                    connector.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }