Beispiel #1
0
        private void btnEditarpieza_Click(object sender, EventArgs e)
        {
            if (dgvInventario.SelectedRows.Count == 1)
            {
                int    id = (int)dgvInventario.CurrentRow.Cells[0].Value;
                string nomb = (string)dgvInventario.CurrentRow.Cells[1].Value;
                string nom, mar;
                int    cant;
                double prec;


                if (MessageBox.Show("¿Seguro que desea editar la pieza :" + nomb + "?", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    MySqlConnection con = Conexion.Obtener_Conexion();
                    MySqlCommand    com = new MySqlCommand("select * from inventario where id_pieza = " + id + " ", con);
                    MySqlDataReader dr  = com.ExecuteReader();
                    dr.Read();


                    nom  = dr.GetString(1);
                    mar  = dr.GetString(2);
                    cant = dr.GetInt32(3);
                    prec = Math.Round(dr.GetDouble(4), 2);


                    Form Editar = new FormMenuInventarioEditar(id, nom, mar, cant, prec);
                    Editar.ShowDialog();
                    Refrescar_y_cargar_datagrid();
                    con.Close();
                }
            }
        }
 private void btnEditar_Click(object sender, EventArgs e)
 {
     if (dgvClientes.SelectedRows.Count == 1)
     {
         int      id    = (int)dgvClientes.CurrentRow.Cells[0].Value;
         string   nom   = (string)dgvClientes.CurrentRow.Cells[1].Value;
         string[] datos = new string[6];
         if (MessageBox.Show("¿Seguro que desea editar al Cliente :" + nom + "?", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             MySqlConnection con      = Conexion.Obtener_Conexion();
             MySqlCommand    com      = new MySqlCommand("select * from clientes where id_cliente = " + id + " ", con);
             MySqlDataReader dr       = com.ExecuteReader();
             int             contador = 0;
             dr.Read();
             while (contador <= 5)
             {
                 datos[contador] = dr.GetString(contador + 1);
                 contador++;
             }
             Form Editar = new FormMenuClientesEditar(id, datos);
             Editar.ShowDialog();
             Refrescar_y_cargar_datagrid();
         }
     }
 }
Beispiel #3
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     if (dgvAutos.SelectedRows.Count == 1)
     {
         int      id_auto     = (int)dgvAutos.CurrentRow.Cells[1].Value;
         string   propietario = (string)dgvAutos.CurrentRow.Cells[0].Value;
         string   auto        = (string)dgvAutos.CurrentRow.Cells[2].Value;
         string[] datos       = new string[5];
         if (MessageBox.Show("¿Seguro que desea editar el automovil :" + auto + " del propietario :" + propietario + "?", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             MySqlConnection con      = Conexion.Obtener_Conexion();
             MySqlCommand    com      = new MySqlCommand("select * from autos where id_auto = " + id_auto + " ", con);
             MySqlDataReader dr       = com.ExecuteReader();
             int             contador = 0;
             dr.Read();
             while (contador <= 4)
             {
                 datos[contador] = dr.GetString(contador + 2);
                 contador++;
             }
             con.Close();
             Form Editar = new FormMenuAutosEditar(id_auto, propietario, datos);
             Editar.ShowDialog();
             Refrescar_y_cargar_datagrid();
         }
     }
 }
        public FormReporteInventario()
        {
            InitializeComponent();
            MySqlConnection con = Conexion.Obtener_Conexion();

            reportcargar();
        }
Beispiel #5
0
 private void btnEliminarpieza_Click(object sender, EventArgs e)
 {
     if (dgvInventario.SelectedRows.Count == 1)
     {
         string nom = (string)dgvInventario.CurrentRow.Cells[1].Value;
         if (MessageBox.Show("¿Seguro que desea eliminar la pieza :" + nom + "?", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             int             id        = (int)dgvInventario.CurrentRow.Cells[0].Value;
             MySqlConnection con       = Conexion.Obtener_Conexion();
             MySqlCommand    com       = new MySqlCommand("Delete From inventario where id_pieza = " + id + "", con);
             int             Resultado = com.ExecuteNonQuery();
             if (Resultado > 0)
             {
                 PopupNotifier popup = new PopupNotifier();
                 popupNotifier1.Image       = Properties.Resources.info;
                 popupNotifier1.TitleText   = "Automotriz Castillo";
                 popupNotifier1.ContentText = "Se elimino la pieza";
                 popupNotifier1.Popup();
                 Refrescar_y_cargar_datagrid();
             }
             else
             {
                 MessageBox.Show("No se Elimino");
             }
             con.Close();
         }
     }
 }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("¿Esta seguro que desea cambiar el usuario?:", "System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         MySqlConnection con = Conexion.Obtener_Conexion();
         MySqlCommand    com = new MySqlCommand("UPDATE `usuarios` SET `usu` = '" + txtUsu.Text + "' where `id_usuario` = " + Datos_Usu.id_usu + " ", con);
         int             res = com.ExecuteNonQuery();
         if (res > 0)
         {
             Datos_Usu.usu = txtUsu.Text;
             PopupNotifier popup = new PopupNotifier();
             popupNotifier1.Image       = Properties.Resources.info;
             popupNotifier1.TitleText   = "Automotriz Castillo";
             popupNotifier1.ContentText = "Se cambio la usuario";
             popupNotifier1.Popup();
             this.Close();
         }
         else
         {
             PopupNotifier popup = new PopupNotifier();
             popupNotifier1.Image       = Properties.Resources.info;
             popupNotifier1.TitleText   = "Automotriz Castillo";
             popupNotifier1.ContentText = "No se cambio la usuario";
             popupNotifier1.Popup();
         }
     }
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            MySqlConnection con  = Conexion.Obtener_Conexion();
            MySqlCommand    com  = new MySqlCommand("UPDATE `autos` SET `marca`='" + txtMar.Text + "',`modelo`='" + txtMod.Text + "',`color`='" + txtCol.Text + "',`mat`='" + txtMat.Text + "',`vin`='" + txtVIN.Text + "' WHERE id_auto = " + num_auto + "", con);
            int             resu = com.ExecuteNonQuery();

            con.Close();
            if (resu > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se guardaron los cambios";
                popupNotifier1.Popup();

                this.Close();
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No se guardaron los cambios";
                popupNotifier1.Popup();
            }
        }
Beispiel #8
0
        public void Refrescar_y_cargar_datagrid()
        {
            MySqlConnection  con     = Conexion.Obtener_Conexion();
            MySqlCommand     com     = new MySqlCommand("SELECT servicios.id_servicio , concat(clientes.nom,' ',clientes.ap,' ',clientes.am) as 'Nombre' ,concat(autos.marca,' ',autos.modelo,' ',autos.mat) as 'Automovil',servicios.costo as 'Costo' FROM servicios  INNER JOIN clientes ON servicios.id_cliente = clientes.id_cliente INNER JOIN autos ON servicios.id_auto = autos.id_auto ", con);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvServicios.DataSource = ds.Tables[0];
        }
Beispiel #9
0
        public void Refrescar_y_cargar_datagrid()
        {
            MySqlConnection  con     = Conexion.Obtener_Conexion();
            MySqlCommand     com     = new MySqlCommand("SELECT concat(clientes.nom,' ',clientes.ap) as 'Propietario',id_auto as 'N° de automovil',CONCAT( autos.marca,' , ',autos.modelo) as 'Automovil',autos.color as 'Color',autos.mat as 'Matricula',autos.vin as 'VIN' FROM clientes INNER JOIN autos ON clientes.id_cliente = autos.id_cliente", con);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvAutos.DataSource = ds.Tables[0];
        }
Beispiel #10
0
        public void Refrescar_y_cargar_datagrid()
        {
            MySqlConnection  con     = Conexion.Obtener_Conexion();
            MySqlCommand     com     = new MySqlCommand("SELECT `id_pieza` as 'N° de pieza', `nom` as 'Pieza', `mar` as 'Marca', `cant` as 'Cantidad', `costu` as 'Precio unitario' FROM `inventario` ", con);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvInventario.DataSource = ds.Tables[0];
        }
Beispiel #11
0
        public void Refrescar_y_cargar_datagrid()
        {
            MySqlConnection  con     = Conexion.Obtener_Conexion();
            MySqlCommand     com     = new MySqlCommand("select id_usuario as 'N° de Empleado',nom_usu 'Nombre',usu as 'Usuario', tel as 'Telefono',correo as 'Correo Electronico', CASE rang WHEN '1' THEN 'Colaborador' WHEN '2' THEN 'Gerente' WHEN '3' THEN 'Dueño' WHEN '4' THEN 'Administrador' END as 'Rango' from usuarios", con);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvPersonal.DataSource = ds.Tables[0];
        }
Beispiel #12
0
        public void Refrescar_y_cargar_datagrid()
        {
            MySqlConnection  con     = Conexion.Obtener_Conexion();
            MySqlCommand     com     = new MySqlCommand("select id_cliente as 'N° de cliente',concat(nom,' ',ap,' ',am) as 'Nombre',tel as 'Telefono', correo as 'Correo Electronico',rfc as 'RFC' from clientes", con);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvClientes.DataSource = ds.Tables[0];
        }
        public FormMenuServiciosVisualizar(int id_servicio)
        {
            double sum_piezas    = 0;
            double cost_servicio = 0;
            double cost_total    = 0;
            int    cont          = 0;

            InitializeComponent();
            MySqlConnection con = Conexion.Obtener_Conexion();
            MySqlCommand    com = new MySqlCommand("SELECT servicios.id_servicio , concat(clientes.nom,' ',clientes.ap) as 'Nombre' ,concat(autos.marca,' ',autos.modelo,' ',autos.mat) as 'Automovil',servicios.desc_servicio,servicios.trabajador,servicios.costo as 'Costo'  FROM servicios INNER JOIN clientes ON servicios.id_cliente = clientes.id_cliente INNER JOIN autos ON servicios.id_auto = autos.id_auto  WHERE id_servicio = " + id_servicio + "", con);
            MySqlDataReader dr  = com.ExecuteReader();

            dr.Read();


            lblCliente.Text     = dr.GetString(1);
            lblAuto.Text        = dr.GetString(2);
            textBox1.Text       = dr.GetString(3);
            lblTrabajador.Text  = dr.GetString(4);
            lblCosto_Total.Text = dr.GetDouble(5).ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            cost_total          = dr.GetDouble(5);
            dr.Close();

            con.Close();

            MySqlConnection  con1    = Conexion.Obtener_Conexion();
            MySqlCommand     com1    = new MySqlCommand("SELECT piezas_servicio.pieza AS 'Pieza',piezas_servicio.cant_usada AS 'Cantidad usada',piezas_servicio.costo_u_pieza AS 'Costo/u',piezas_servicio.total_cost_piezas AS 'Total de piezas' FROM `piezas_servicio` WHERE id_servicio = " + id_servicio + "", con1);
            MySqlDataAdapter m_datos = new MySqlDataAdapter(com1);
            DataSet          ds      = new DataSet();

            m_datos.Fill(ds);
            dgvPiezas.DataSource = ds.Tables[0];

            con1.Close();


            foreach (DataGridViewRow row in dgvPiezas.Rows)
            {
                sum_piezas += Double.Parse(row.Cells[3].Value.ToString());
                cont++;
            }
            cost_servicio = cost_total - sum_piezas;

            lblCosto_Piezas.Text   = sum_piezas.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            lblCosto_Servicio.Text = cost_servicio.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            lblCosto_Total.Text    = cost_total.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
            lblidservicio.Text     = id_servicio.ToString();
        }
Beispiel #14
0
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            MySqlConnection con = Conexion.Obtener_Conexion();
            MySqlCommand    com = new MySqlCommand("INSERT INTO `servicios` (`id_servicio`, `id_cliente`, `id_auto`, `desc_servicio`, `trabajador`, `costo`) VALUES (NULL, " + id_cliente + ", " + id_auto + ", '" + txtDesc.Text + "', '" + txtTrabajador.Text + "', " + costo_total + ");", con);
            int             res = com.ExecuteNonQuery();

            con.Close();
            if (res > 0)
            {
                MySqlConnection con1 = Conexion.Obtener_Conexion();
                MySqlCommand    com1 = new MySqlCommand("SELECT MAX(id_servicio) FROM servicios", con1);
                MySqlDataReader dr   = com1.ExecuteReader();
                dr.Read();

                id_servicio = dr.GetInt32(0);

                dr.Close();
                con1.Close();

                foreach (DataGridViewRow row in dgvPiezas.Rows)
                {
                    int    cant_usada;
                    double costo_u_pieza, total_cost_piezas;
                    string pieza;


                    pieza             = row.Cells[0].Value.ToString();
                    cant_usada        = Int32.Parse(row.Cells[1].Value.ToString());
                    costo_u_pieza     = Double.Parse(row.Cells[2].Value.ToString());
                    total_cost_piezas = Double.Parse(row.Cells[3].Value.ToString());

                    double.Parse(row.Cells[1].Value.ToString());

                    MySqlConnection con2 = Conexion.Obtener_Conexion();
                    MySqlCommand    com2 = new MySqlCommand("INSERT INTO `piezas_servicio`(`id_piezas_usadas`, `id_servicio`, `pieza`, `cant_usada`, `costo_u_pieza`, `total_cost_piezas`) VALUES (NULL," + id_servicio + ",'" + pieza + "'," + cant_usada.ToString() + "," + costo_u_pieza.ToString() + "," + costo_total.ToString() + ")", con2);
                    int             res1 = com2.ExecuteNonQuery();
                    if (res1 > 0)
                    {
                        con2.Close();
                        MessageBox.Show("Se agrego");
                    }
                }
            }
            con.Close();
            this.Close();
        }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtNom.Text.Trim() == "" || txtAp.Text.Trim() == "" || txtAm.Text.Trim() == "" || txtTel.Text.Trim() == "")
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Llenar los campos";
                popupNotifier1.Popup();

                asterisco1.Visible = true;
                asterisco2.Visible = true;
                asterisco3.Visible = true;
                asterisco4.Visible = true;
                return;
            }
            MySqlConnection con = Conexion.Obtener_Conexion();
            MySqlCommand    com = new MySqlCommand("INSERT INTO `clientes` (`id_cliente`, `nom`, `ap`, `am`, `tel`, `correo`, `rfc`) VALUES (NULL, '" + txtNom.Text + "', '" + txtAp.Text + "', '" + txtAm.Text + "', '" + txtTel.Text + "', '" + txtCorreo.Text + "', '" + txtRFC.Text + "');", con);
            int             res = com.ExecuteNonQuery();

            con.Close();
            if (res > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se agrego al cliente";
                popupNotifier1.Popup();
                txtNom.Text    = "";
                txtAp.Text     = "";
                txtAm.Text     = "";
                txtCorreo.Text = "";
                txtTel.Text    = "";
                txtRFC.Text    = "";
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No pudo agregar al cliente";
                popupNotifier1.Popup();
            }
            con.Close();
        }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtMar.Text.Trim() == "" || txtMod.Text.Trim() == "" || txtMat.Text.Trim() == "")
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Llenar los campos";
                popupNotifier1.Popup();

                asterisco1.Visible = true;
                asterisco2.Visible = true;
                asterisco3.Visible = true;

                return;
            }

            MySqlConnection con  = Conexion.Obtener_Conexion();
            MySqlCommand    com  = new MySqlCommand("INSERT INTO `autos`(`id_auto`, `id_cliente`, `marca`, `modelo`, `color`, `mat`, `vin`) VALUES (NULL," + num_cliente + ",'" + txtMar.Text + "','" + txtMod.Text + "','" + txtCol.Text + "','" + txtMat.Text + "','" + txtVIN.Text + "')", con);
            int             resu = com.ExecuteNonQuery();

            if (resu > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se agrego automovil a " + nombre + "";
                popupNotifier1.Popup();


                con.Close();

                this.Close();
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No se agrego automovil";
                popupNotifier1.Popup();
                con.Close();
            }
        }
Beispiel #17
0
        //DGVInventario
        public void Refrescar_y_cargar_datagrid_Inventario()
        {
            MySqlConnection  con = Conexion.Obtener_Conexion();
            MySqlDataAdapter com = new MySqlDataAdapter("SELECT `id_pieza` as 'N° de pieza', concat(`nom`,' , ',`mar`)as 'Pieza', `costu` as 'Precio unitario', `cant` as 'Cantidad' FROM `inventario` ", con);
            DataTable        dt  = new DataTable();

            com.Fill(dt);
            foreach (DataRow cc in dt.Rows)
            {
                int n = dgvInventario.Rows.Add();

                dgvInventario.Rows[n].Cells[0].Value = false;
                dgvInventario.Rows[n].Cells[1].Value = cc[0].ToString();
                dgvInventario.Rows[n].Cells[2].Value = cc[1].ToString();
                dgvInventario.Rows[n].Cells[3].Value = cc[2].ToString();
                dgvInventario.Rows[n].Cells[4].Value = cc[3].ToString();
                dgvInventario.Rows[n].Cells[5].Value = "";
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNom.Text.Trim() == "" || txtAp.Text.Trim() == "" || txtAm.Text.Trim() == "" || txtTel.Text.Trim() == "")
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Llenar los campos";
                popupNotifier1.Popup();

                asterisco1.Visible = true;
                asterisco2.Visible = true;
                asterisco3.Visible = true;
                asterisco4.Visible = true;
                return;
            }
            MySqlConnection con = Conexion.Obtener_Conexion();
            MySqlCommand    com = new MySqlCommand("UPDATE `clientes` SET `nom`='" + txtNom.Text + "',`ap`='" + txtAp.Text + "',`am`='" + txtAm.Text + "',`tel`='" + txtTel.Text + "',`correo`='" + txtCorreo.Text + "',`rfc`='" + txtRFC.Text + "' WHERE id_cliente = " + num_cliente + "", con);
            int             res = com.ExecuteNonQuery();

            con.Close();
            if (res > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se edito al cliente";
                popupNotifier1.Popup();
                this.Close();
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No pudo editar al cliente";
                popupNotifier1.Popup();
            }
            con.Close();
        }
Beispiel #19
0
        //Llenar los datagrid
        //DGVCLiente_Autos
        public void Refrescar_y_cargar_datagrid_Clientes_con_Autos()
        {
            MySqlConnection  con = Conexion.Obtener_Conexion();
            MySqlDataAdapter com = new MySqlDataAdapter("SELECT clientes.id_cliente,concat(clientes.nom,' ',clientes.ap,' ',clientes.am) as 'Propietario',id_auto as 'N° de automovil',CONCAT( autos.marca,' , ',autos.modelo) as 'Automovil',autos.color as 'Color',autos.mat as 'Matricula',autos.vin as 'VIN' FROM clientes INNER JOIN autos ON clientes.id_cliente = autos.id_cliente", con);
            DataTable        dt  = new DataTable();

            com.Fill(dt);

            foreach (DataRow cc in dt.Rows)
            {
                int n = dgvClientes_Autos.Rows.Add();

                dgvClientes_Autos.Rows[n].Cells[0].Value = false;
                dgvClientes_Autos.Rows[n].Cells[1].Value = cc[0].ToString();
                dgvClientes_Autos.Rows[n].Cells[2].Value = cc[1].ToString();
                dgvClientes_Autos.Rows[n].Cells[3].Value = cc[2].ToString();
                dgvClientes_Autos.Rows[n].Cells[4].Value = cc[3].ToString();
                dgvClientes_Autos.Rows[n].Cells[5].Value = cc[4].ToString();
                dgvClientes_Autos.Rows[n].Cells[6].Value = cc[5].ToString();
                dgvClientes_Autos.Rows[n].Cells[7].Value = cc[6].ToString();
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtNom.Text.Trim() == "" || txtMarca.Text.Trim() == "" || txtCost.Text.Trim() == "")
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Llenar los campos";
                popupNotifier1.Popup();

                asterisco1.Visible = true;
                asterisco2.Visible = true;
                asterisco3.Visible = true;
                asterisco4.Visible = true;

                return;
            }
            double cant, cost;

            try
            {
                if (txtCant.Value > 0 && Convert.ToDouble(txtCost.Text) > 0)
                {
                    cant = Convert.ToInt32(txtCant.Value);
                    cost = Convert.ToDouble(txtCost.Text);
                }
                else
                {
                    PopupNotifier popup = new PopupNotifier();
                    popupNotifier1.Image       = Properties.Resources.info;
                    popupNotifier1.TitleText   = "Automotriz Castillo";
                    popupNotifier1.ContentText = "Error solo ingresar numeros en los apartados de Cantidad y Costo";
                    popupNotifier1.Popup();
                    return;
                }
            }
            catch
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Error solo ingresar numeros en los apartados de Cantidad y Costo";
                popupNotifier1.Popup();
                return;
            }


            MySqlConnection con  = Conexion.Obtener_Conexion();
            MySqlCommand    com  = new MySqlCommand("UPDATE `inventario` SET `nom`='" + txtNom.Text + "',`mar`='" + txtMarca.Text + "',`cant`=" + cant + ",`costu`=" + cost + " WHERE id_pieza = " + num_pieza + "", con);
            int             resu = com.ExecuteNonQuery();

            if (resu > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se edito la pieza";
                popupNotifier1.Popup();

                this.Close();
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No se pudo editar la pieza";
                popupNotifier1.Popup();
            }
            con.Close();
        }
Beispiel #21
0
        public void login()
        {
            if (swicht.Value == true)
            {
                Tipo_de_conexion.ti_con = 1;
            }
            else
            {
                Tipo_de_conexion.ti_con = 0;
            }

            try
            {
                MySqlConnection con = Conexion.Obtener_Conexion();
                MySqlCommand    com = new MySqlCommand("SELECT * FROM `usuarios` WHERE `usu` = '" + txtUsu.Text + "' and `con` = '" + txtCon.Text + "'", con);
                MySqlDataReader dr  = com.ExecuteReader();
                dr.Read();

                if (dr.GetInt32(0) > 0 && dr.GetInt32(4) > 0)
                {
                    Datos_Usu.id_usu = dr.GetInt32(0);
                    Datos_Usu.nomusu = dr.GetString(1);
                    Datos_Usu.usu    = dr.GetString(2);
                    Datos_Usu.con    = dr.GetString(3);
                    Datos_Usu.rango  = dr.GetInt32(4);
                    Datos_Usu.correo = dr.GetString(5);
                    Datos_Usu.tel    = dr.GetString(6);

                    switch (Datos_Usu.rango)
                    {
                    case 1:
                        Datos_Usu.rangoSTG = "Colaborador";
                        break;

                    case 2:
                        Datos_Usu.rangoSTG = "Gerente";
                        break;

                    case 3:
                        Datos_Usu.rangoSTG = "Dueño";
                        break;

                    case 4:
                        Datos_Usu.rangoSTG = "Administrador";
                        break;
                    }


                    con.Close();
                    variable_com_cierre_correcto = 1;
                    this.Close();
                }
                else
                {
                    con.Close();
                    PopupNotifier popup = new PopupNotifier();
                    popupNotifier1.Image       = Properties.Resources.info;
                    popupNotifier1.TitleText   = "Automotriz Castillo";
                    popupNotifier1.ContentText = "Error en Usuario o Contraseña";
                    popupNotifier1.Popup();
                    return;
                }
                this.Close();
            }
            catch
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Error en Usuario o Contraseña";
                popupNotifier1.Popup();
                return;
            }
        }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtNom.Text.Trim() == "" || txtMarca.Text.Trim() == "" || txtCost.Text.Trim() == "")
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Llenar los campos";
                popupNotifier1.Popup();

                asterisco1.Visible = true;
                asterisco2.Visible = true;
                asterisco3.Visible = true;
                asterisco4.Visible = true;

                return;
            }
            double cant, cost;

            try
            {
                if (txtCant.Value > 0 && Convert.ToDouble(txtCost.Text) > 0)
                {
                    cant = Convert.ToInt32(txtCant.Value);
                    cost = Convert.ToDouble(txtCost.Text);
                }
                else
                {
                    PopupNotifier popup = new PopupNotifier();
                    popupNotifier1.Image       = Properties.Resources.info;
                    popupNotifier1.TitleText   = "Automotriz Castillo";
                    popupNotifier1.ContentText = "Error solo ingresar numeros en los apartados de Cantidad y Costo";
                    popupNotifier1.Popup();
                    return;
                }
            }
            catch
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Error solo ingresar numeros en los apartados de Cantidad y Costo";
                popupNotifier1.Popup();
                return;
            }


            MySqlConnection con  = Conexion.Obtener_Conexion();
            MySqlCommand    com  = new MySqlCommand("INSERT INTO `inventario`(`id_pieza`, `nom`, `mar`, `cant`, `costu`) VALUES (NULL,'" + txtNom.Text + "','" + txtMarca.Text + "'," + cant + "," + cost + ")", con);
            int             resu = com.ExecuteNonQuery();

            if (resu > 0)
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "Se agrego la pieza";
                popupNotifier1.Popup();

                asterisco1.Visible = false;
                asterisco2.Visible = false;
                asterisco3.Visible = false;
                asterisco4.Visible = false;

                txtNom.Text   = "";
                txtMarca.Text = "";
                txtCant.Value = 0;
                txtCost.Text  = "";
            }
            else
            {
                PopupNotifier popup = new PopupNotifier();
                popupNotifier1.Image       = Properties.Resources.info;
                popupNotifier1.TitleText   = "Automotriz Castillo";
                popupNotifier1.ContentText = "No se pudo agregar la pieza";
                popupNotifier1.Popup();
            }
            con.Close();
        }