示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult seleccion = MessageBox.Show("Seguro Que Quieres Eliminar Este Servicio ", "Eliminar Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (seleccion == DialogResult.Yes)
            {
                ClaseServicios ObjServicios = new ClaseServicios();
                try
                {
                    bool respuestaSQL = ObjServicios.EliminarServicios(textBox8.Text);
                    if (respuestaSQL == true)
                    {
                        MessageBox.Show("Los Datos De Este Servicio Fueron Eliminados Correctamente");
                        textBox8.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox4.Text = ""; textBox11.Text = ".l.";
                    }
                    else
                    {
                        MessageBox.Show(ObjServicios.Mensaje);
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show("ERROR!:" + Ex.Message + " " + ObjServicios.Mensaje);
                }
            }
        }
示例#2
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (ValidarCampoVacio(textBox9, "IdServicios"))
            {
                ClaseServicios ObjServicios = new ClaseServicios();
                try
                {
                    DataSet datosServicios = ObjServicios.ConsultarServicios(textBox9.Text);

                    DataTable DatosConsultados = datosServicios.Tables["DatosConsultados"];
                    int       numregistros     = DatosConsultados.Rows.Count;
                    if (numregistros == 0)
                    {
                        MessageBox.Show("No Existe En La Base De Datos Un Servicio Con Esta Identificacion");
                    }
                    else
                    {
                        dataGridView1.DataSource = DatosConsultados;
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show("ERROR!: " + Ex.Message + " " + ObjServicios.Mensaje);
                }
            }
        }
示例#3
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (ValidarCampoVacio(textBox7, "Nombre") && ValidarCampoVacio(textBox6, "TipoDeServicio") && ValidarCampoVacio(textBox4, "Cantidad") & ValidarCampoVacio(textBox11, "PrecioServicio"))
            {
                ClaseServicios ObjServicios = new ClaseServicios();

                try
                {
                    ObjServicios.IdServicios    = long.Parse(textBox8.Text);
                    ObjServicios.Nombre         = textBox7.Text;
                    ObjServicios.TipoDeServicio = textBox6.Text;
                    ObjServicios.Cantidad       = textBox4.Text;
                    ObjServicios.PrecioServicio = long.Parse(textBox11.Text);



                    bool respuestaSQL = ObjServicios.ActualizarServicios();

                    if (respuestaSQL == true)
                    {
                        MessageBox.Show("Los Datos De Este Servicio Fueron Actualizados Correctamente");
                        textBox8.Text = ""; textBox7.Text = ""; textBox6.Text = ""; textBox4.Text = ""; textBox11.Text = "";
                    }
                    else
                    {
                        MessageBox.Show(ObjServicios.Mensaje);
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show("ERROR!: " + Ex.Message + " " + ObjServicios.Mensaje);
                }
            }
        }
示例#4
0
        private void button6_Click(object sender, EventArgs e)
        {
            ClaseServicios ObjServicios = new ClaseServicios();


            try
            {
                DataSet   DatosServicios   = ObjServicios.ConsultarTodosServicios();
                DataTable DatosConsultados = DatosServicios.Tables["DatosConsultados"];
                int       numresgitros     = DatosConsultados.Rows.Count;
                if (numresgitros == 0)
                {
                    MessageBox.Show("No Hay Ningun Servicio En La Base De Datos");
                }
                else
                {
                    dataGridView1.DataSource = DatosConsultados;
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show("ERROR!: " + Ex.Message + " " + ObjServicios.Mensaje);
            }
        }