예제 #1
0
        public void update_doctor(string iddoctor, string namedoctor, string sexdoctor, string idperson, string addressdoctor, string teldoctor, string celdoctor, string role, string salary)
        {
            try
            {
                AddPatient frm       = new AddPatient();
                string     comando   = "UPDATE staff set namestaff = '" + namedoctor + "', sexstaff = '" + sexdoctor + "', idpersonstaff = '" + idperson + "', addressstaff = '" + addressdoctor + "', telstaff = '" + teldoctor + "', celstaff = '" + celdoctor + "', rolestaff = '" + role + "', salarystaff = '" + salary + "' WHERE idstaff = '" + iddoctor + "'";
                SqlCommand insertion = new SqlCommand(comando, cnx);

                if (insertion.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Se actualizo correctamente", "Hecho");
                    adddoctor f = new adddoctor();
                    f.Close();

                    //f.Close();
                    //f.namedoctor_txt.Text = "";
                    //f.sexdoctor_cb.Text = "";
                    //f.idperson_txt.Text = "";
                    //f.addressdoctor_txt.Text = "";
                    //f.teldoctor_txt.Text = "";
                    //f.celdoctor_txt.Text = "";
                    //f.salary_txt.Text = "";
                    //condition = "yes";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se logro actualizar el Doctor. Causa: " + ex.Message);
            }
        }
예제 #2
0
        private void dgv_patients_DoubleClick(object sender, EventArgs e)
        {
            textBox1.Text = dgv_doctors.Rows[dgv_doctors.CurrentRow.Index].Cells["s_id"].Value.ToString();

            if (formulario_devolver == true)
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else if (formulario_devolver == false)
            {
                adddoctor f = new adddoctor();
                f.formulario_devolver = true;
                f.txt_s_id.Text       = dgv_doctors.Rows[dgv_doctors.CurrentRow.Index].Cells["s_id"].Value.ToString();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    load_doctors_dgv();
                }
            }
        }
예제 #3
0
        private void addpatient_btn_Click(object sender, EventArgs e)
        {
            adddoctor f = new adddoctor();

            try
            {
                Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is adddoctor);
                if (frm2 != null)
                {
                    frm2.BringToFront();
                    MessageBox.Show("Esta ventana ya esta abierta.", "Error");
                    return;
                }
                else
                {
                    f.MdiParent = this.MdiParent;
                    f.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se puede abrir el ventana solicitado. Razón: " + ex.Message, "Error al abrir la ventana.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }