Beispiel #1
0
        ///*******************************************************************************
        ///NOMBRE DE LA FUNCIÓN: Frm_Ope_Ordenes_Entrada_Especiales_Load
        ///DESCRIPCIÓN  : Método Load del formulario para pre-configurar y cagar datos en los controles
        ///PARAMENTROS  :
        ///CREO         : Antonio Salvador Benavides Guardado
        ///FECHA_CREO   : 31/Jul/2015
        ///MODIFICO     :
        ///FECHA_MODIFICO:
        ///CAUSA_MODIFICACIÓN:
        ///*******************************************************************************
        private void Frm_Ope_Ordenes_Entrada_Especiales_Load(object sender, EventArgs e)
        {
            DataTable Dt_Contenedores = new DataTable();

            Cls_Metodos_Generales.Habilita_Deshabilita_Controles(Pnl_Generales, false);
            Cls_Metodos_Generales.Limpia_Controles(Pnl_Generales);
            Pnl_Generales.Visible = true;
            Cls_Cat_Ubicaciones_Negocio P_Ubicaciones = new Cls_Cat_Ubicaciones_Negocio();

            P_Ubicaciones.P_Estatus = " = 'ACTIVO'";
            Dt_Contenedores         = P_Ubicaciones.Consultar_Ubicaciones();
            Cls_Metodos_Generales.Rellena_Combo_Box(Cmb_Ubicacion, Dt_Contenedores, Cat_Ubicaciones.Campo_Ubicacion, Cat_Ubicaciones.Campo_Ubicacion_Id);
            Btn_Nuevo_Click(null, null);
            Cls_Apl_Roles_Negocio P_Rol = new Cls_Apl_Roles_Negocio();
            DataTable             Dt_Accesos;

            P_Rol.P_Rol_Id        = Txt_Rol_Id.Text;
            P_Rol.P_Nombre_Menu   = "Órdenes de Entrada Especiales";
            Dt_Accesos            = P_Rol.Consultar_Acceso_Roles();
            Btn_Nuevo.Visible     = false;
            Pnl_Generales.Enabled = false;
            foreach (DataRow Dr_Renglon_Actual in Dt_Accesos.Rows)
            {
                if (Dr_Renglon_Actual[Apl_Acceso.Campo_Alta].ToString() == "S")
                {
                    Btn_Nuevo.Visible     = true;
                    Pnl_Generales.Enabled = true;
                    Cmb_Contenedores.Focus();
                }
            }
        }
Beispiel #2
0
        private void Btn_Cargar_Contenedor_Click(object sender, EventArgs e)
        {
            if (Cmb_Contenedores.Text.Trim() != "")
            {
                DataTable Dt_Contenedores = (DataTable)Grid_Contenedores_Entrada.DataSource;
                foreach (DataRow Dr_Contenedor in Dt_Contenedores.Rows)
                {
                    if (Dr_Contenedor["Tipo_Contenedor_ID"].ToString() == Cmb_Contenedores.SelectedValue.ToString())
                    {
                        Cmb_Contenedores.Text = "";
                        Txt_Cantidad.Text     = "";
                        Cmb_Contenedores.Focus();
                        MessageBox.Show("*El contenedor ya fue registrado anteriormente en esta Entrada Especial.", "Entradas Especiales", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                        return;
                    }
                }
            }
            if (Cmb_Contenedores.Text.Trim() != "" && Cmb_Ubicacion.SelectedIndex > 0 && Txt_Cantidad.Text.Trim() != "")
            {
                DataRow   Dr_Renglon_Nuevo;
                DataTable Dt_Contenedor = (DataTable)Grid_Contenedores_Entrada.DataSource;
                Dr_Renglon_Nuevo = Dt_Contenedor.NewRow();
                Dr_Renglon_Nuevo["Tipo_Contenedor"]     = Cmb_Contenedores.Text;
                Dr_Renglon_Nuevo["Tipo_Contenedor_ID"]  = Cmb_Contenedores.SelectedValue.ToString();
                Dr_Renglon_Nuevo["Ubicacion"]           = Cmb_Ubicacion.Text;
                Dr_Renglon_Nuevo["Ubicacion_ID"]        = Cmb_Ubicacion.SelectedValue.ToString();
                Dr_Renglon_Nuevo["Cantidad_Contenedor"] = Txt_Cantidad.Text;
                Dt_Contenedor.Rows.Add(Dr_Renglon_Nuevo);
                Dt_Contenedor.TableName = "Entradas_Especiales";
                Grid_Contenedores_Entrada.DataSource = Dt_Contenedor;

                Cmb_Contenedores.Text = "";
                Txt_Cantidad.Text     = "";
                Cmb_Contenedores.Focus();
            }
            else if (Cmb_Contenedores.Text.Trim() != "" && Cmb_Ubicacion.SelectedIndex > 0 && Txt_Cantidad.Text.Trim() != "")
            {
                DataRow   Dr_Renglon_Nuevo;
                DataTable Dt_Contenedor = (DataTable)Grid_Contenedores_Entrada.DataSource;
                Dr_Renglon_Nuevo = Dt_Contenedor.NewRow();
                Dr_Renglon_Nuevo["Tipo_Contenedor"]     = Cmb_Contenedores.SelectedText;
                Dr_Renglon_Nuevo["Tipo_Contenedor_ID"]  = Cmb_Contenedores.SelectedValue.ToString();
                Dr_Renglon_Nuevo["Ubicacion"]           = Cmb_Ubicacion.SelectedText;
                Dr_Renglon_Nuevo["Ubicacion_ID"]        = Cmb_Ubicacion.SelectedValue.ToString();
                Dr_Renglon_Nuevo["Cantidad_Contenedor"] = Txt_Cantidad.Text;
                Dt_Contenedor.Rows.Add(Dr_Renglon_Nuevo);
                Dt_Contenedor.TableName = "Entradas_Especiales";
                Dt_Contenedor.TableName = "Entradas_Especiales";
                Grid_Contenedores_Entrada.DataSource = Dt_Contenedor;

                Cmb_Contenedores.Text = "";
                Txt_Cantidad.Text     = "";
                Cmb_Contenedores.Focus();
            }
            else
            {
                MessageBox.Show("Faltan datos por llenar", "Entradas Especiales", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
        ///*******************************************************************************
        ///NOMBRE DE LA FUNCIÓN: Btn_Agregar_Click
        ///DESCRIPCIÓN  : Evento para agregar un contenedor
        ///PARAMENTROS  :
        ///CREO         : Hugo Enrique Ramírez Aguilera
        ///FECHA_CREO   : 30/Julio/2015
        ///MODIFICO     :
        ///FECHA_MODIFICO:
        ///CAUSA_MODIFICACIÓN:
        ///*******************************************************************************
        private void Btn_Agregar_Click(object sender, EventArgs e)
        {
            Boolean Entro = false;

            Error_Provider.Clear();

            if (Cmb_Contenedores.Text != "0" && Txt_Cantidad.Text != "")
            {
                //  recorre los contenedores buscando que ya exista
                for (int Cont_Contenedores = 0; Cont_Contenedores < Grid_Contenedores.Rows.Count; Cont_Contenedores++)
                {
                    if (Grid_Contenedores.Rows[Cont_Contenedores].Cells["Tipo_Contenedor_ID"].Value.ToString() == Cmb_Contenedores.SelectedValue.ToString())
                    {
                        Entro = true;
                        break;
                    }
                }

                //  si no existe
                if (!Entro)
                {
                    int Index = Grid_Contenedores.Rows.Count;

                    //  se agrega en contenedor al grid
                    Grid_Contenedores.Rows.Add();
                    Grid_Contenedores.Rows[Index].Cells["Tipo_Contenedor_ID"].Value = Cmb_Contenedores.SelectedValue.ToString();
                    Grid_Contenedores.Rows[Index].Cells["Tipo_Contenedor"].Value    = Cmb_Contenedores.Text;
                    Grid_Contenedores.Rows[Index].Cells["Cantidad"].Value           = Txt_Cantidad.Text;

                    //  combo contenedor
                    Cmb_Contenedores.Focus();
                    Cmb_Contenedores.SelectedIndex = 0;

                    //  cantidad
                    Txt_Cantidad.Text = "";
                }
            }
            else
            {
                CancelEventArgs X = new CancelEventArgs();
                Validador.Validacion_Campo_Vacio(X, Txt_Cantidad);
                Validador.Validacion_Combo_Requerido(X, Cmb_Contenedores, true);
            }
        }
        ///*******************************************************************************
        ///NOMBRE DE LA FUNCIÓN: Btn_Actualizar_Click
        ///DESCRIPCIÓN  : Evento para actualizar la informacion de un contenedor
        ///PARAMENTROS  :
        ///CREO         : Hugo Enrique Ramírez Aguilera
        ///FECHA_CREO   : 30/Julio/2015
        ///MODIFICO     :
        ///FECHA_MODIFICO:
        ///CAUSA_MODIFICACIÓN:
        ///*******************************************************************************
        private void Btn_Actualizar_Click(object sender, EventArgs e)
        {
            Boolean Entro = false;

            if (Grid_Contenedores.Rows.Count > 0)
            {
                if (Grid_Contenedores.CurrentRow.Index > -1 && Cmb_Contenedores.Text != "" && Txt_Cantidad.Text != "")
                {
                    //  recorre los contenedores buscando que ya exista
                    for (int Cont_Contenedores = 0; Cont_Contenedores < Grid_Contenedores.Rows.Count; Cont_Contenedores++)
                    {
                        if (Grid_Contenedores.Rows[Cont_Contenedores].Cells["Tipo_Contenedor_ID"].Value.ToString() == Cmb_Contenedores.SelectedValue.ToString() &&
                            Cont_Contenedores != Grid_Contenedores.CurrentRow.Index)
                        {
                            Entro = true;
                            break;
                        }
                    }

                    //  si no existe
                    if (!Entro)
                    {
                        int Index = Grid_Contenedores.Rows.Count;

                        //  se agrega en contenedor al grid
                        Grid_Contenedores.CurrentRow.Cells["Tipo_Contenedor_ID"].Value = Cmb_Contenedores.SelectedValue.ToString();
                        Grid_Contenedores.CurrentRow.Cells["Tipo_Contenedor"].Value    = Cmb_Contenedores.Text;
                        Grid_Contenedores.CurrentRow.Cells["Cantidad"].Value           = Txt_Cantidad.Text;

                        //  combo contenedor
                        Cmb_Contenedores.Focus();
                        Cmb_Contenedores.SelectedIndex = 0;

                        //  cantidad
                        Txt_Cantidad.Text = "";
                    }
                }
            }
        }
Beispiel #5
0
 private void Btn_Nuevo_Click(object sender, EventArgs e)
 {
     if (Btn_Nuevo.Text == "Nuevo")
     {
         Habilitar_Controles("Nuevo");
         Cls_Metodos_Generales.Habilita_Deshabilita_Controles(Pnl_Generales, true);
         Grid_Contenedores_Entrada.Enabled = true;
         Pnl_Generales.Visible             = true;
         Cmb_Contenedores.Text             = "";
         Cmb_Contenedores.Focus();
         Limpiar_Grid();
     }
     else
     {
         if (Validar_Componentes())
         {
             Cls_Ope_Ordenes_Entrada_Especiales_Negocio P_Entrada = new Cls_Ope_Ordenes_Entrada_Especiales_Negocio();
             P_Entrada.P_Usuario         = Txt_Nombre_Usuario.Text.ToUpper();
             P_Entrada.P_Ubicacion_ID    = Cmb_Ubicacion.SelectedValue.ToString();
             P_Entrada.P_Dt_Contenedores = (DataTable)Grid_Contenedores_Entrada.DataSource;
             if (P_Entrada.Alta())
             {
                 //Enviar_Correo(P_Entrada.P_No_Entrada, P_Entrada.P_Dt_Contenedores);
                 Habilitar_Controles("Inicial");
                 Cls_Metodos_Generales.Habilita_Deshabilita_Controles(Pnl_Generales, false);
                 Cls_Metodos_Generales.Limpia_Controles(Pnl_Generales);
                 Pnl_Generales.Visible = true;
                 DataTable Dt_Contenedores = new DataTable();
                 Cls_Cat_Ubicaciones_Negocio P_Ubicaciones = new Cls_Cat_Ubicaciones_Negocio();
                 P_Ubicaciones.P_Estatus = " = 'ACTIVO'";
                 Dt_Contenedores         = P_Ubicaciones.Consultar_Ubicaciones();
                 Cls_Metodos_Generales.Rellena_Combo_Box(Cmb_Ubicacion, Dt_Contenedores, Cat_Ubicaciones.Campo_Ubicacion, Cat_Ubicaciones.Campo_Ubicacion_Id);
                 Limpiar_Grid();
                 MessageBox.Show("Alta Exitosa", "Entradas Especiales", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
             }
         }
     }
 }