Пример #1
0
        private void deleteData()
        {
            int Item = Int32.Parse(dataGridView1[0, index].Value.ToString());

            if (this.dataGridView1.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow item in this.dataGridView1.SelectedRows)
                {
                    var data = (from a in bd.Vehiculos
                                select a).Where(a => a.Id_Vehiculo.Equals(Item)).SingleOrDefault();
                    bd.Vehiculos.Remove(data);
                }
                bd.SaveChanges();
                this.loadDataGrid();
            }
        }
Пример #2
0
        private void updateData(Tanda_Laboral vehicle, int index)
        {
            if (string.IsNullOrEmpty(txtDescription.Text))
            {
                MessageBox.Show("Completar Información");
                return;
            }
            else
            {
                int Item        = Int32.Parse(dataGridView1[0, index].Value.ToString());
                var updateTanda = (from a in bd.Tanda_Laboral
                                   select a).Where(m => m.Id_TandaLaboral.Equals(Item)).SingleOrDefault();

                updateTanda.Descripcion = txtDescription.Text;
                bd.SaveChanges();
                txtDescription.Clear();

                this.loadData();
            }
        }
Пример #3
0
        private void updateData(Marca marca, int index)
        {
            if (string.IsNullOrEmpty(txtDescription.Text) || string.IsNullOrEmpty(cbxEstado.Text))
            {
                MessageBox.Show("Completar Información");
                return;
            }
            else
            {
                int Item          = Int32.Parse(dataGridView1[0, index].Value.ToString());
                var updateVehicle = (from a in bd.Marcas
                                     select a).Where(m => m.Id_Marca.Equals(Item)).SingleOrDefault();

                updateVehicle.Descripcion = txtDescription.Text;
                updateVehicle.Estado      = cbxEstado.Text.ToString() == "Activo" ? 1 : 0;
                bd.SaveChanges();
                txtDescription.Clear();
                cbxEstado.SelectedIndex = -1;

                this.loadData();
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!(string.IsNullOrEmpty(cbx_cliente.Text)) && !(string.IsNullOrEmpty(cbx_empleado.Text)) &&
                !(string.IsNullOrEmpty(cbx_estado.Text)) && !(string.IsNullOrEmpty(cbx_estado_cristal.Text)) &&
                !(string.IsNullOrEmpty(cbx_galones.Text)) && !(string.IsNullOrEmpty(cbx_gato.Text)) &&
                !(string.IsNullOrEmpty(cbx_rayadura.Text)) && !(string.IsNullOrEmpty(cbx_repuesto.Text)) &&
                !(string.IsNullOrEmpty(cbx_rotura_cristal.Text)) && !(string.IsNullOrEmpty(cbx_vehiculo.Text)) &&
                !(string.IsNullOrEmpty(cbx_estado_gomas.Text)))
            {
                Inspeccion ins = new Inspeccion();

                ins.Id_Cliente           = int.Parse(cbx_cliente.SelectedValue.ToString());
                ins.Empleado_inspeccion  = int.Parse(cbx_empleado.SelectedValue.ToString());
                ins.Vehiculo             = int.Parse(cbx_vehiculo.SelectedValue.ToString());
                ins.Tiene_Ralladuras     = cbx_rayadura.Text.ToString() == "Sí" ? 1 : 0;
                ins.Cantidad_Conbustible = cbx_galones.Text.ToString();
                ins.TieneGomaRepuesto    = cbx_repuesto.Text.ToString();
                ins.TieneGato            = cbx_gato.Text.ToString();
                ins.TieneRoturaCrsital   = cbx_rotura_cristal.Text.ToString();
                ins.EstadoGomas          = cbx_estado_gomas.Text.ToString();
                ins.Fecha  = FechaIngreso.Value.Date;
                ins.Estado = cbx_estado.Text.ToString() == "Disponible" ? 1 : 0;

                bd.Inspeccions.Add(ins);
                MessageBox.Show("Inspección agregada con éxito");
                bd.SaveChanges();
                loadDataGrid();

                cbx_cliente.SelectedIndex        = -1;
                cbx_empleado.SelectedIndex       = -1;
                cbx_vehiculo.SelectedIndex       = -1;
                cbx_rayadura.SelectedIndex       = -1;
                cbx_galones.SelectedIndex        = -1;
                cbx_repuesto.SelectedIndex       = -1;
                cbx_gato.SelectedIndex           = -1;
                cbx_rotura_cristal.SelectedIndex = -1;
                cbx_estado_gomas.SelectedIndex   = -1;
                cbx_estado.SelectedIndex         = -1;
            }
            else
            {
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                string            caption = "Advertencia";
                string            message = "Favor Completar todos los campos!";

                result = MessageBox.Show(message, caption, buttons);
            }
        }