Пример #1
0
        private void buttonAdv2_Click(object sender, EventArgs e)
        {
            PatientDBEntities PDE = new PatientDBEntities();
            PatientEntryTable PET = new PatientEntryTable();
            CollectionTable   CT  = new CollectionTable();

            if (TreatmentBox.Text != "" && RxBox.Text != "" && FeeBox.Text != "")
            {
                CT.Date        = CurrentDateDisplay.Value.ToString();
                CT.Treatment   = TreatmentBox.Text;
                CT.Rx          = RxBox.Text;
                CT.id          = id;
                CT.Fee         = int.Parse(FeeBox.Text);
                CT.Outstanding = int.Parse(OutStandingBox.Text);

                PDE.CollectionTable.Add(CT);
                PDE.PatientEntryTable.Add(PET);
                PDE.SaveChanges();
                ClearBox();
            }
            else
            {
                MessageBox.Show("Some Details Are Unfilled", "Alert");
            }
        }
Пример #2
0
        private void buttonAdv1_Click(object sender, EventArgs e)
        {
            PatientDBEntities pd = new PatientDBEntities();
            PatientEntryTable pe = new PatientEntryTable();

            if (NameTextBox.Text != "" && PhoneTextBox.Text != "" && AgeTextBox.Text != "" && HistoryTextBox.Text != "" && AddressTextBox.Text != "")
            {
                pe.Name    = NameTextBox.Text;
                pe.PhoneNo = PhoneTextBox.Text;
                pe.Age     = AgeTextBox.Text;
                pe.Gender  = "Male";
                pe.History = HistoryTextBox.Text;
                pe.Address = AddressTextBox.Text;
                pd.PatientEntryTable.Add(pe);
                pd.SaveChanges();
                MessageBox.Show("Saved");
                AddPatientsPanel.Visible = false;

                var dd = pd.PatientEntryTable.Select(a => new { Name = a.Name, PhoneNo = a.PhoneNo, History = a.History, id = a.id, });
                ShowData.DataSource = dd.ToList();
            }
            else
            {
                MessageBox.Show("No Data To Save..", "Alert");
            }

            //LoadRecords();
        }