Example #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");
            }
        }
Example #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();
        }
Example #3
0
        private void PatientNameSearchBox_TextChanged(object sender, EventArgs e)
        {
            PDE = new PatientDBEntities();
            PET = new PatientEntryTable();

            if (PatientNameSearchBox.Text != "")
            {
                var sele = PDE.PatientEntryTable.Where(x => x.Name.ToUpper().Contains(PatientNameSearchBox.Text.ToUpper())).OrderBy(a => a.Name);
                ShowData.DataSource = sele.ToList();
            }
            else
            {
                var dd = PDE.PatientEntryTable.Select(a => new { id = a.id, Name = a.Name, Gender = a.Gender, PhoneNo = a.PhoneNo });
                ShowData.DataSource = dd.ToList();
            }
        }
Example #4
0
        private void ShowData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            PDE = new PatientDBEntities();
            PET = new PatientEntryTable();
            if (e.RowIndex >= 0)
            {
                DataGridViewRow row        = this.ShowData.Rows[e.RowIndex];
                string          t          = row.Cells[0].Value.ToString();
                int             z          = int.Parse(t);
                string          r          = row.Cells[3].Value.ToString();
                var             getdetails = PDE.PatientEntryTable.FirstOrDefault(x => x.id == z);
                bindingSource1.DataSource = getdetails;
                //     ShowHistoryGrid.DataSource = bindingSource1[4];

                // var dd = PDE.PatientEntryTable.Where(a=>a.id ==z).Select(a => new { History = a.History }).ToList();
                long balance = 0;
                var  dd      = PDE.PatientEntryTable.Where(a => a.id == z).Select(a => new { Name = a.Name, a.Age, a.History, a.Gender, a.Address }).FirstOrDefault();
                NameLabel.Text   = dd.Name;
                AgeLabel.Text    = dd.Age;
                genderla.Text    = dd.Gender;
                WeightLabel.Text = dd.Address;
                HistoryBox.Text  = dd.History;


                var dk = PDE.CollectionTable.Where(a => a.id == z).Select(a => new { Outstanding = a.Outstanding }).ToList();
                foreach (var bal in dk)
                {
                    balance = balance + bal.Outstanding;
                    if (balance <= 0)
                    {
                        OutStandingLabel.Text = balance.ToString();
                    }
                    else
                    {
                        OutStandingLabel.Text = "0";
                    }
                }
                var de = PDE.CollectionTable.Where(a => a.id == z).Select(a => new { Date = a.Date, Rx = a.Rx, Treatment = a.Treatment }).ToList();

                // bindingSource1.DataSource = dd;
                //  ShowHistoryGrid.DataSource = bindingSource1;
                //  ShowHistoryGrid.DataSource = dd;

                ShowHistoryVisit.DataSource = de;
            }
        }