private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt         = CLSLINEA.llenar_LINEAS();
            DataTable dt2        = CLSTRANSPORTE.llenar_TRANSPORTISTA();
            String    BIENLINEA  = "NO";
            String    BIENTRANSP = "NO";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow DR = dt.Rows[i];
                if (DR["DESCRIPCION"].ToString().Equals(comboBox1.Text))
                {
                    BIENLINEA = "SI";
                }
            }

            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                DataRow DR = dt2.Rows[i];
                if (DR["NOMBRE"].ToString().Equals(comboBox2.Text))
                {
                    BIENTRANSP = "SI";
                }
            }


            if (BIENLINEA.Equals("NO"))
            {
                MessageBox.Show(this, "EL LABORATORIO ELEGIDO ES INCORRECTO", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (BIENTRANSP.Equals("NO"))
            {
                MessageBox.Show("EL TRANSPORTE ELEGIDO ES INCORRECTO", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (txtcantidaduni.Text == "0|0|0")

            {
                MessageBox.Show(this, "NECESITA INDICAR EL DETALLE DE CARGA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (dataGridView1.RowCount == 0)
            {
                MessageBox.Show(this, "NO PUEDE EDITAR SIN REGISTROS DEL PERSONAL DE TRANSPORTE", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    TP.EDITA_PER_TRA(dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString(),
                                     dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString(),
                                     dataGridView1.Rows[i].Cells["TIPO"].Value.ToString(),
                                     Convert.ToInt32(comboBox2.SelectedValue)
                                     );
                }
                String msje = DESC.MODIFICAR_DESCARGA(Convert.ToInt32(LBLNUMERO.Text),
                                                      TXTOBSER.Text, comboBox2.Text, lbletibultos.Text, txtcantidaduni.Text,
                                                      dateTimePicker1.Value, dateTimePicker2.Value, comboBox1.Text);
                MessageBox.Show(this, msje, VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        void LLENAR_TRANSPORTE()
        {
            comboBox2.DataSource    = CLSTRANSPORTE.llenar_TRANSPORTISTA();
            comboBox2.DisplayMember = "NOMBRE";
            comboBox2.ValueMember   = "IDTRANSPORTE";

            // cargo la lista de items para el autocomplete dle combobox
            comboBox2.AutoCompleteCustomSource = CLSTRANSPORTE.Autocomplete();
            comboBox2.AutoCompleteMode         = AutoCompleteMode.Suggest;
            comboBox2.AutoCompleteSource       = AutoCompleteSource.CustomSource;
        }
Example #3
0
 void LLENAR_TRANSPORTISTA()
 {
     CMBTRANSPORTISTA.DataSource    = CLSTRANSPORTE.llenar_TRANSPORTISTA();
     CMBTRANSPORTISTA.DisplayMember = "NOMBRE";
     CMBTRANSPORTISTA.ValueMember   = "IDTRANSPORTE";
 }
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt         = CLSLINEA.llenar_LINEAS();
            DataTable dt2        = CLSTRANSPORTE.llenar_TRANSPORTISTA();
            String    BIENLINEA  = "NO";
            String    BIENTRANSP = "NO";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow DR = dt.Rows[i];
                if (DR["DESCRIPCION"].ToString().Equals(comboBox1.Text))
                {
                    BIENLINEA = "SI";
                }
            }

            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                DataRow DR = dt2.Rows[i];
                if (DR["NOMBRE"].ToString().Equals(comboBox2.Text))
                {
                    BIENTRANSP = "SI";
                }
            }


            if (BIENLINEA.Equals("NO"))
            {
                MessageBox.Show(this, "EL LABORATORIO ELEGIDO ES INCORRECTO", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (BIENTRANSP.Equals("NO"))
            {
                MessageBox.Show("EL TRANSPORTE ELEGIDO ES INCORRECTO", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (lblnumerocant.Text == "0|0|0")

            {
                MessageBox.Show(this, "NECESITA INDICAR EL DETALLE DE CARGA", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (TXTOBSER.Text == "")
            {
                MessageBox.Show(this, "INDIQUE OBSERVACION", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (dataGridView1.RowCount == 0)
            {
                MessageBox.Show(this, "NO HAY NINGUN PERSONAL EN EL DETALLE", VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    if (dataGridView1.Rows[i].Cells["CODIGO"].Value.Equals("N"))
                    {
                        TP.REGISTRA_PER_TRA(dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString(),
                                            dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString(),
                                            dataGridView1.Rows[i].Cells["TIPO"].Value.ToString(),
                                            Convert.ToInt32(comboBox2.SelectedValue)
                                            );
                    }
                }


                String MSJE = DESC.REGISTRAR_DESCARGA(TXTOBSER.Text, comboBox2.Text, lbletibultos.Text, lblnumerocant.Text, dateTimePicker1.Value, comboBox1.Text);
                MessageBox.Show(this, MSJE, VariablesGlobales.Titulo, MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (MSJE == "DESCARGA REGISTRADA")

                {
                    for (int i = 0; i <= dataGridView1.RowCount - 1; i++)
                    {
                        REGISTRAR_DETALLE(dataGridView1.Rows[i].Cells["NOMBRE"].Value.ToString(),
                                          dataGridView1.Rows[i].Cells["DOCUMENTO"].Value.ToString(), dataGridView1.Rows[i].Cells["TIPO"].Value.ToString(),
                                          Convert.ToInt32(LBLNUMERO.Text));
                    }

                    LLENARNUMERO();
                    TXTLICDNI.Clear();
                    TXTNOMBRE.Clear();
                    TXTOBSER.Clear();
                    chktermos.Checked    = false;
                    chktoneladas.Checked = false;
                    chkcajas.Checked     = true;
                    nudtermos.Value      = 1;
                    nudtoneladas.Value   = 1;
                    nudcajas.Value       = 1;
                    dataGridView1.Rows.Clear();
                }
            }
        }