Beispiel #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     ctuGridPatient.DgvPatient.Rows.Clear();
     if (AdmPatient.Read(cbbSearch.Text, txtSearch.Text))
     {
         return;
     }
     foreach (Patient pt in AdmPatient.ListPatient)
     {
         ctuGridPatient.DgvPatient.Rows.Add(pt.Name, pt.Surname, pt.Idcard, pt.Age);
     }
     if (AdmPatient.ListPatient.Count == 0)
     {
         MessageBox.Show("Error: No se pudo encontrar a ese paciente en la base de datos.");
         return;
     }
     ctuGridPatient.SetCountPatient();
     AdmPatient.ListPatient.Clear();
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            int i = -1;

            string[]     txt = new string[4];
            ValidTextBox vtb;

            foreach (Control con in Controls)
            {
                vtb = con as ValidTextBox;
                if (vtb != null)
                {
                    if (vtb.Text.Length == 0)
                    {
                        MessageBox.Show("Debes llenar los campos vacíos!");
                        return;
                    }
                    txt[++i] = vtb.Text;
                }
            }

            if (AdmPatient.IsRepeatData("tablePatient", "Cedula", txtCard.Text))
            {
                MessageBox.Show("La cedula " + txtCard.Text + " ya lo tiene un paciente.");
                return;
            }

            if (AdmPatient.Save(txt))
            {
                return;
            }

            ctuGridPatient.DgvPatient.Rows.Add(txtName.Text, txtSurname.Text, txtCard.Text, txtAge.Text);
            ctuGridPatient.SetCountPatient();
            foreach (Control con in Controls)
            {
                vtb = con as ValidTextBox;
                if (vtb != null)
                {
                    vtb.Clear();
                }
            }
        }
Beispiel #3
0
        public FrmShowPatient()
        {
            InitializeComponent();
            if (AdmPatient.ReadAll())
            {
                return;
            }
            foreach (Patient pt in AdmPatient.ListPatient)
            {
                ctuGridPatient.DgvPatient.Rows.Add(pt.Name, pt.Surname, pt.Idcard, pt.Age);
            }

            if (ctuGridPatient.DgvPatient.Rows.Count == 0)
            {
                MessageBox.Show("No hay ningún registro almacenado en la base de datos.");
                return;
            }
            ctuGridPatient.SetCountPatient();
            this.ShowDialog();
            AdmPatient.ListPatient.Clear();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtDrug.Text.Length == 0 || ctuDrugs.TxtPrescription.Text.Length == 0)
            {
                MessageBox.Show("Debes llenar los campos vacíos.");
                return;
            }

            if (AdmPatient.IsRepeatData("tableRecipe", "Farmaco", txtDrug.Text))
            {
                MessageBox.Show("Ese farmaco ya lo tiene el paciente.");
                return;
            }

            if (AdmRecipe.Save(txtDrug.Text, ctuDrugs.TxtPrescription.Text, ctuDrugs.DtpDateDest.Value))
            {
                return;
            }
            ctuGridDrugs.DgvDrugs.Rows.Add(txtDrug.Text, ctuDrugs.TxtPrescription.Text, ctuDrugs.DtpDateDest.Value.ToShortDateString(), DateTime.Now.ToShortDateString());
            ctuGridDrugs.LblDrugs.Text = "Total de Farmacos: " + ctuGridDrugs.DgvDrugs.RowCount;
            txtDrug.Clear();
            ctuDrugs.TxtPrescription.Clear();
        }