Beispiel #1
0
        private void Load()
        {
            ListBoxView.Items.Clear();             //clear listbox

            using (var db = new AutoDataContext()) //load values into listbox
            {
                var query = from item in db.Patient
                            orderby item.lastName, item.firstName, item.middleName
                    select new
                {
                    id          = item.id,
                    firstName   = item.firstName,
                    lastName    = item.lastName,
                    middleName  = item.middleName,
                    gender      = item.gender,
                    phoneNumber = item.phoneNumber
                }
                ;

                var arr = query.ToArray();

                foreach (var record in arr)
                {
                    Patient lst = new Patient(record.id
                                              , record.lastName + " " + record.firstName + " " + record.middleName
                                              , record.gender
                                              , record.phoneNumber
                                              );
                    ListBoxView.Items.Add(lst);
                }
            }
        }
Beispiel #2
0
        public void Load()
        {
            listReception.Clear();

            using (var db = new AutoDataContext())//load values into listbox
            {
                var query = from item in db.Reception
                            join patient in db.Patient on item.patientid equals patient.id
                            orderby item.dateNext
                            select new
                {
                    id            = item.id,
                    patient       = patient,
                    fio           = patient.lastName + " " + patient.firstName + " " + patient.middleName,
                    cost          = item.cost,
                    dateNext      = item.dateNext,
                    completedWork = item.completedWork
                }
                ;

                var arr = query.ToArray();

                foreach (var record in arr)
                {
                    Reception lst = new Reception(record.id
                                                  , record.fio
                                                  , record.cost
                                                  , record.dateNext
                                                  , record.completedWork
                                                  );
                    listReception.Add(lst);
                }
            }
        }
Beispiel #3
0
        public static void DeleteItem(int pid)
        {
            using (var db = new AutoDataContext())
            {
                Receptions reception   = new Receptions();
                var        items_query = from item in db.Reception
                                         where item.id == pid
                                         select item;

                if (items_query.Count() == 0)
                {
                    MessageBox.Show("Delete not completed (error: no correct id Reception table). Please contact service center.");
                    return;
                }

                foreach (var item in items_query)
                {
                    reception = item;
                }

                db.Reception.Remove(reception);
                try
                {
                    db.SaveChanges();// delete employee
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Delete reception complete with error: " + exc.Message);
                }
            }
        }
Beispiel #4
0
        /*
         * Update new row in table Doctor
         * Return
         * true if added sucsessfull
         * false if don' added (have error message)
         */
        public static bool UpdateItem(int pid, string pFirstName, string pMiddleName, string pLastName, double pRate)
        {
            if (pFirstName.Trim() == "")
            {
                MessageBox.Show("Enter first name");
                return(false);
            }

            if (pLastName.Trim() == "")
            {
                MessageBox.Show("Enter last name");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                Doctors doc = db.Doctor.Find(pid);
                doc.firstName  = pFirstName;
                doc.middleName = pMiddleName;
                doc.lastName   = pLastName;
                doc.hourRate   = pRate;

                db.SaveChanges();// update row

                return(true);
            }
        }
Beispiel #5
0
        public static void DeleteItem(int pid)
        {
            using (var db = new AutoDataContext())
            {
                Patients patient = new Patients();

                var items_query_employee = from item in db.Patient
                                           where item.id == pid
                                           select item;

                if (items_query_employee.Count() == 0)
                {
                    MessageBox.Show("Delete not completed (error: no correct id Employees table). Please contact service center.");
                    return;
                }

                foreach (var item in items_query_employee)
                {
                    patient = item;
                }

                db.Patient.Remove(patient);
                try
                {
                    db.SaveChanges();// delete employee
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Delete patient complete with error: " + exc.Message);
                }
            }
        }
 public ActionResult ISBNNumber()
 {
     string term = Session["value"].ToString();
     var db = new AutoDataContext();
     var result1 = from c in db.InfoBooks where c.BookName.ToUpper().Contains(term.ToUpper()) select c.ISBN.Trim();
     return Json(result1, JsonRequestBehavior.AllowGet);
 }
Beispiel #7
0
        /*
         * Update new row in table
         * Return
         * true if added sucsessfull
         * false if don' added (have error message)
         */
        public static bool UpdateItem(int pid, string pFirstName, string pMiddleName, string pLastName, string pGender, string pPhoneNumber)
        {
            if (pFirstName.Trim() == "")
            {
                MessageBox.Show("Enter first name");
                return(false);
            }

            if (pLastName.Trim() == "")
            {
                MessageBox.Show("Enter last name");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                Patients patient = db.Patient.Find(pid);
                patient.firstName   = pFirstName;
                patient.middleName  = pMiddleName;
                patient.lastName    = pLastName;
                patient.gender      = pGender;
                patient.phoneNumber = pPhoneNumber;

                db.SaveChanges();// update row

                return(true);
            }
        }
 public ActionResult Books()
 {
     var db = new AutoDataContext();
     //var result = db.InfoBooks.Select(p => p.BookName).ToList();
     var result1 = from c in db.InfoBooks join p in db.BookImages on c.Book_ID equals p.BookID select new { c.AuthorName, c.BookName, c.Category, p.Description1 };
     return Json(result1, JsonRequestBehavior.AllowGet);
 }
 public ActionResult Autocomplete(string term)
 {
     var db = new AutoDataContext();
     Session["value"] = term;
     var result = from c in db.InfoBooks.Select(p => p.BookName).Where(p => p.ToUpper().Contains(term.ToUpper())) select c.TrimStart().TrimEnd();
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Beispiel #10
0
        public static Receptions GetItem(int pid)
        {
            Receptions reception = new Receptions();

            using (var db = new AutoDataContext())
            {
                reception = db.Reception.Find(pid);
            }

            return(reception);
        }
Beispiel #11
0
        public static Patients GetItem(int pid)
        {
            Patients patient = new Patients();

            using (var db = new AutoDataContext())
            {
                patient = db.Patient.Find(pid);
            }

            return(patient);
        }
Beispiel #12
0
        /*
         * Update new row in table
         * Return
         * true if added sucsessfull
         * false if don' added (have error message)
         */
        public static bool UpdateItem(int pid, Patients patient, double cost, DateTime dateNext, string completedWork)
        {
            if (patient.id == 0)
            {
                MessageBox.Show("Patient not select");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                Receptions reception = db.Reception.Find(pid);
                reception.patientid     = patient.id;
                reception.cost          = cost;
                reception.dateNext      = dateNext;
                reception.completedWork = completedWork;
                db.SaveChanges();// update row

                return(true);
            }
        }
Beispiel #13
0
        private void Load()
        {
            if (Param.lastWindow != null)
            {
                if (Param.lastWindow.Equals("ListReception"))
                {
                    ButtonAdd.Content = "Обновить"; //change name button

                    using (var db = new AutoDataContext())
                    {
                        var query = from item in db.Reception
                                    join patient in db.Patient on item.patientid equals patient.id
                                    orderby item.dateNext
                                    where item.id == Param.id
                                    select new
                        {
                            id            = item.id,
                            patient       = patient,
                            fio           = patient.lastName + " " + patient.firstName + " " + patient.middleName,
                            cost          = item.cost,
                            dateNext      = item.dateNext,
                            completedWork = item.completedWork
                        }
                        ;

                        var arr = query.ToArray();

                        foreach (var record in arr)
                        {
                            RichEditCompletedWork.Document = new FlowDocument();
                            TextBoxPatient.Text            = record.fio;
                            TextBoxCost.Text        = record.cost.ToString();
                            DatePicker.SelectedDate = record.dateNext;
                            RichEditCompletedWork.AppendText(record.completedWork);

                            patient = record.patient;
                        }
                    }
                }
            }
        }
Beispiel #14
0
        /*
         * Add new row in table
         * Returnpost
         * true if added sucsessfull
         * false if don' added (have error message)
         */
        public static bool NewItem(string pFirstName, string pMiddleName, string pLastName, string pGender, string pPhoneNumber)
        {
            if (pFirstName.Trim() == "")
            {
                MessageBox.Show("Enter first name");
                return(false);
            }

            if (pLastName.Trim() == "")
            {
                MessageBox.Show("Enter last name");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                var items_query_employee = from item in db.Patient
                                           where item.firstName == pFirstName.Trim()
                                           & item.middleName == pMiddleName.Trim()
                                           & item.lastName == pLastName.Trim()
                                           select item;

                if (items_query_employee.Count() != 0)
                {
                    MessageBox.Show("Patient '" + pFirstName + pMiddleName + pLastName + "' already entered." + Environment.NewLine + "Saving cancelled!");
                    return(false);
                }

                Patients patient = new Patients();
                patient.firstName   = pFirstName;
                patient.middleName  = pMiddleName;
                patient.lastName    = pLastName;
                patient.gender      = pGender;
                patient.phoneNumber = pPhoneNumber;

                db.Patient.Add(patient);
                db.SaveChanges();// add new patient

                return(true);
            }
        }
Beispiel #15
0
        /*
         *  Add new row in table Doctor
         *  Returnpost
         *  true if added sucsessfull
         *  false if don' added (have error message)
         */
        public static bool NewItem(string pFirstName, string pMiddleName, string pLastName, double pRate)
        {
            if (pFirstName.Trim() == "")
            {
                MessageBox.Show("Enter first name");
                return(false);
            }

            if (pLastName.Trim() == "")
            {
                MessageBox.Show("Enter last name");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                var items_query_employee = from item in db.Doctor
                                           where item.firstName == pFirstName.Trim()
                                           & item.middleName == pMiddleName.Trim()
                                           & item.lastName == pLastName.Trim()
                                           select item;

                if (items_query_employee.Count() != 0)
                {
                    MessageBox.Show("Doctor '" + pFirstName + pMiddleName + pLastName + "' already entered." + Environment.NewLine + "Saving cancelled!");
                    return(false);
                }

                Doctors doc = new Doctors();
                doc.firstName  = pFirstName;
                doc.middleName = pMiddleName;
                doc.lastName   = pLastName;
                doc.hourRate   = pRate;

                db.Doctor.Add(doc);
                db.SaveChanges();// add new employee

                return(true);
            }
        }
Beispiel #16
0
        /*
         * Add new row in table
         * Returnpost
         * true if added sucsessfull
         * false if don' added (have error message)
         */
        public static bool NewItem(Patients patient, double cost, DateTime dateNext, string completedWork)
        {
            if (patient.id == 0)
            {
                MessageBox.Show("Patient not select");
                return(false);
            }

            using (var db = new AutoDataContext())
            {
                Receptions reception = new Receptions();
                reception.patientid     = patient.id;
                reception.cost          = cost;
                reception.dateNext      = dateNext;
                reception.completedWork = completedWork;

                db.Reception.Add(reception);
                db.SaveChanges();// add new

                return(true);
            }
        }
Beispiel #17
0
        private void Load()
        {
            if (Param.lastWindow != null)
            {
                if (Param.lastWindow.Equals("ListPatient"))
                {
                    ButtonAdd.Content = "Обновить"; //change name button

                    using (var db = new AutoDataContext())
                    {
                        var query = from item in db.Patient
                                    orderby item.lastName, item.firstName, item.middleName
                        where item.id == Param.id
                            select new
                        {
                            id          = item.id,
                            firstName   = item.firstName,
                            lastName    = item.lastName,
                            middleName  = item.middleName,
                            gender      = item.gender,
                            phoneNumber = item.phoneNumber
                        }
                        ;

                        var arr = query.ToArray();

                        foreach (var record in arr)
                        {
                            TextBoxFirstName.Text   = record.firstName;
                            TextBoxLastName.Text    = record.lastName;
                            TextBoxMiddleName.Text  = record.middleName;
                            ComboBoxGender.Text     = record.gender;
                            TextBoxPhoneNumber.Text = record.phoneNumber;
                        }
                    }
                }
            }
        }
 public ActionResult Decription(string tags)
 {
     var db = new AutoDataContext();
     var result = (from c in db.BookImages select c.Description1.Contains(tags)).Take(1);
     return Json(result, JsonRequestBehavior.AllowGet);
 }