Ejemplo n.º 1
0
        void VerRegistro(int n_IdRegistro)
        {
            DataTable dtPro      = new DataTable();
            DataTable dtInter    = new DataTable();
            DataTable dtTodo     = new DataTable();
            DataTable dtProIns   = new DataTable();
            DataTable dtInterIns = new DataTable();
            DataTable dtTodoIns  = new DataTable();

            CN_ges_planproduccion o_plapro = new CN_ges_planproduccion();
            BE_GES_PLANPRODUCCION e_plapro = new BE_GES_PLANPRODUCCION();
            DataTable             dtres    = new DataTable();

            FgProd.Rows.Count  = 2;
            FgInter.Rows.Count = 2;
            FgTodo.Rows.Count  = 2;

            FgProdIns.Rows.Count  = 2;
            FgInterIns.Rows.Count = 2;
            FgTodoIns.Rows.Count  = 2;

            objCabecera.mysConec = mysConec;
            objCabecera.TraerRegistro(n_IdRegistro);

            BE_CABECERA = objCabecera.e_Cabecera;
            dtPro       = objCabecera.dtProducto;
            dtInter     = objCabecera.dtIntermedio;
            dtTodo      = objCabecera.dtTodo;
            dtProIns    = objCabecera.dtProductoIns;
            dtInterIns  = objCabecera.dtIntermedioIns;
            dtTodoIns   = objCabecera.dtTodoIns;

            TxtDes.Text             = BE_CABECERA.c_des;
            TxtFchIni.Text          = Convert.ToDateTime(BE_CABECERA.d_fchini).ToString("dd/MM/yyyy");
            TxtFchFin.Text          = Convert.ToDateTime(BE_CABECERA.d_fchfin).ToString("dd/MM/yyyy");
            LblIdPlaVen.Text        = BE_CABECERA.n_idplapro.ToString();
            CboMesIni.SelectedValue = BE_CABECERA.n_mesini;

            o_plapro.mysConec = mysConec;
            o_plapro.TraerRegistro(BE_CABECERA.n_idplapro);
            e_plapro       = o_plapro.e_Cabecera;
            TxtPlaVen.Text = e_plapro.c_des;
            o_plapro       = null;

            llenarFlex(FgProd, dtPro, BE_CABECERA.n_mesini);
            llenarFlex(FgInter, dtInter, BE_CABECERA.n_mesini);
            llenarFlex(FgTodo, dtTodo, BE_CABECERA.n_mesini);

            llenarFlex(FgProdIns, dtProIns, BE_CABECERA.n_mesini);
            llenarFlex(FgInterIns, dtInterIns, BE_CABECERA.n_mesini);
            llenarFlex(FgTodoIns, dtTodoIns, BE_CABECERA.n_mesini);

            Tab2.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
        public bool Insertar(BE_GES_PLANPRODUCCION e_Cabecera, List <BE_GES_PLANPRODUCCIONDET> l_Detalle)
        {
            int              n_fila     = 0;
            bool             booOk      = false;
            DatosMySql       xMiFuncion = new DatosMySql();
            MySqlTransaction trans;

            trans = mysConec.BeginTransaction();

            try
            {
                if (xMiFuncion.StoreEjecutar("ges_planproduccion_insertar", e_Cabecera, mysConec, 1) == true)
                {
                    for (n_fila = 0; n_fila <= l_Detalle.Count - 1; n_fila++)
                    {
                        // AGREGAMOS LOS ITEMS
                        l_Detalle[n_fila].n_idplapro = Convert.ToInt32(xMiFuncion.intIdGenerado);
                        if (xMiFuncion.StoreEjecutar("ges_planproducciondet_insertar", l_Detalle[n_fila], mysConec, null) == true)
                        {
                            booOk = true;
                        }
                        else
                        {
                            booOcurrioError = xMiFuncion.booOcurrioError;
                            StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                            IntErrorNumber  = xMiFuncion.IntErrorNumber;
                        }
                    }
                }
                else
                {
                    booOcurrioError = xMiFuncion.booOcurrioError;
                    StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                    IntErrorNumber  = xMiFuncion.IntErrorNumber;
                }
                trans.Commit();
                return(booOk);
            }
            catch (Exception exc)
            {
                // SI SUCEDE UN ERROR DEVOLVEMOS FALSO
                booOcurrioError = xMiFuncion.booOcurrioError;
                StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                IntErrorNumber  = xMiFuncion.IntErrorNumber;
                trans.Rollback();
                return(booOk);
            }
        }
Ejemplo n.º 3
0
        public bool Actualizar(BE_GES_PLANPRODUCCION e_Cabecera, List <BE_GES_PLANPRODUCCIONDET> l_Detalle)
        {
            int              n_fila     = 0;
            bool             booOk      = false;
            DatosMySql       xMiFuncion = new DatosMySql();
            MySqlTransaction trans;

            trans = mysConec.BeginTransaction();
            string[,] arrParametros2 = new string[1, 3] {
                { "n_idplan", "System.INT16", e_Cabecera.n_id.ToString() }
            };
            try
            {
                // ELIMINAMOS EL DETALLE
                if (xMiFuncion.StoreEjecutar("ges_planproducciondet_delete", arrParametros2, mysConec) == false)
                {
                    booOcurrioError = xMiFuncion.booOcurrioError;
                    StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                    IntErrorNumber  = xMiFuncion.IntErrorNumber;
                    trans.Rollback();
                    return(booOk);
                }

                if (xMiFuncion.StoreEjecutar("ges_planproduccion_actualizar", e_Cabecera, mysConec, null) == true)
                {
                    for (n_fila = 0; n_fila <= l_Detalle.Count - 1; n_fila++)
                    {
                        // AGREGAMOS LOS ITEMS
                        l_Detalle[n_fila].n_idplapro = e_Cabecera.n_id;
                        if (xMiFuncion.StoreEjecutar("ges_planproducciondet_insertar", l_Detalle[n_fila], mysConec, null) == true)
                        {
                            booOk = true;
                        }
                        else
                        {
                            booOcurrioError = xMiFuncion.booOcurrioError;
                            StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                            IntErrorNumber  = xMiFuncion.IntErrorNumber;
                            trans.Rollback();
                            return(booOk);
                        }
                    }
                }
                else
                {
                    booOcurrioError = xMiFuncion.booOcurrioError;
                    StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                    IntErrorNumber  = xMiFuncion.IntErrorNumber;
                    trans.Rollback();
                    return(booOk);
                }
                trans.Commit();
                return(booOk);
            }
            catch (Exception exc)
            {
                // SI SUCEDE UN ERROR DEVOLVEMOS FALSO
                booOcurrioError = xMiFuncion.booOcurrioError;
                StrErrorMensaje = xMiFuncion.StrErrorMensaje;
                IntErrorNumber  = xMiFuncion.IntErrorNumber;
                trans.Rollback();
                return(booOk);
            }
        }