示例#1
0
        public void delete_staff(string idstaff)
        {
            DialogResult result = MessageBox.Show("Seguro que desea eliminar este registro?", "Eliminar registro", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                try
                {
                    AddPatient frm       = new AddPatient();
                    string     comando   = "DELETE FROM staff WHERE idstaff = '" + idstaff + "'";
                    SqlCommand insertion = new SqlCommand(comando, cnx);

                    if (insertion.ExecuteNonQuery() > 0)
                    {
                        MessageBox.Show("Se ha Borrado correctamente", "Hecho");
                        frm.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
            else if (result == DialogResult.No)
            {
            }
        }
示例#2
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);
            }
        }
示例#3
0
        public void update_patient(String idpatient, String namepatient, String bdaypatient, String sexpatient, String idperson, String addresspatient, String telpatient, String celpatient, String tworkpatient, String insurancepatient, String affiliatepatient)
        {
            try
            {
                DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos del Paciente", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    AddPatient frm       = new AddPatient();
                    string     comando   = "UPDATE patient set name = '" + namepatient + "', sex = '" + sexpatient + "', bday = '" + bdaypatient + "', idperson = '" + idperson + "', address = '" + addresspatient + "', tel = '" + telpatient + "', cel = '" + celpatient + "', telwork = '" + tworkpatient + "', insurance = '" + insurancepatient + "', affiliate = '" + affiliatepatient + "' WHERE idpatient = '" + idpatient + "'";
                    SqlCommand insertion = new SqlCommand(comando, cnx);

                    if (insertion.ExecuteNonQuery() > 0)
                    {
                        MessageBox.Show("Se ha actualizado correctamente", "Hecho");
                        frm.Close();
                    }
                }
                else if (result == DialogResult.No)
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se llego a actualizar. Causa: " + ex.Message);
            }
        }
示例#4
0
        public void add_patient(String namepatient, String bdaypatient, String sexpatient, String idperson, String addresspatient, String telpatient, String celpatient, String tworkpatient, String insurancepatient, String affiliatepatient)
        {
            try
            {
                AddPatient frm       = new AddPatient();
                string     comando   = "INSERT INTO patient(name, bday, sex, idperson, address, tel, cel, telwork, insurance, affiliate) VALUES('" + namepatient + "','" + bdaypatient + "','" + sexpatient + "','" + idperson + "','" + addresspatient + "','" + telpatient + "','" + celpatient + "','" + tworkpatient + "','" + insurancepatient + "','" + affiliatepatient + "')";
                SqlCommand insertion = new SqlCommand(comando, cnx);

                if (insertion.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Se agrego correctamente", "Hecho");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se pudo agregar la infromacion del paciente: " + ex.Message);
            }
        }
示例#5
0
        public void add_staff(string namedoctor, string sexdoctor, string idperson, string addressdoctor, string teldoctor, string celdoctor, string role, string salary, string condition)
        {
            try
            {
                AddPatient frm       = new AddPatient();
                string     comando   = "INSERT INTO staff(namestaff, sexstaff, idpersonstaff, addressstaff, telstaff, celstaff, rolestaff, salarystaff) VALUES('" + namedoctor + "','" + sexdoctor + "','" + idperson + "','" + addressdoctor + "','" + teldoctor + "','" + celdoctor + "','" + role + "','" + salary + "')";
                SqlCommand insertion = new SqlCommand(comando, cnx);

                if (insertion.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Se agrego correctamente", "Hecho");
                    valor = "si";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se pudo agregar la infromacion del Doctor: " + ex.Message);
            }
        }
示例#6
0
        private void dgv_patients_DoubleClick(object sender, EventArgs e)
        {
            textBox1.Text = dgv_patients.Rows[dgv_patients.CurrentRow.Index].Cells["p_id"].Value.ToString();

            if (formulario_devolver == true)
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else if (formulario_devolver == false)
            {
                AddPatient f = new AddPatient();
                f.formulario_devolver = true;
                f.txt_p_id.Text       = dgv_patients.Rows[dgv_patients.CurrentRow.Index].Cells["p_id"].Value.ToString();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    load_patients_dgv();
                }
            }
        }
示例#7
0
        private void addpatient_btn_Click(object sender, EventArgs e)
        {
            AddPatient f = new AddPatient();

            try
            {
                Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is AddPatient);
                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);
            }
        }