Beispiel #1
0
        protected ClsResbCollection ConsultarResbDAL(string psCriterio)
        {
            //Declaración de variables
            DataSet ds = new DataSet();
            //Definición del adaptador
            SqlDataAdapter da = new SqlDataAdapter();
            //Definición de la coleccion
            ClsResbCollection resbCollection = new ClsResbCollection();
            ClsResb           resb;

            try
            {
                da.SelectCommand             = new SqlCommand(Procedimientos.sp_ConsRESB, this.Conexion);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                da.SelectCommand.Parameters.Add("@Criterio", SqlDbType.VarChar).Value = psCriterio;
                //Se llena el DataSet
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    int renglones = ds.Tables[0].Rows.Count;
                    int columnas  = ds.Tables[0].Columns.Count;
                    for (int contador = 0; contador < ds.Tables[0].Rows.Count; contador++) //Cada renglòn
                    {
                        resb = new ClsResb();

                        resb.Rsnum = int.Parse(ds.Tables[0].Rows[contador]["RSNUM"].ToString().Trim());
                        resb.Matnr = ds.Tables[0].Rows[contador]["MATNR"].ToString().Trim();
                        resb.Aufnr = ds.Tables[0].Rows[contador]["AUFNR"].ToString().Trim();
                        resb.Potx1 = ds.Tables[0].Rows[contador]["POTX1"].ToString().Trim();
                        resb.Potx2 = ds.Tables[0].Rows[contador]["POTX2"].ToString().Trim();
                        resb.Potx3 = ds.Tables[0].Rows[contador]["POTX3"].ToString().Trim();
                        resb.Baugr = ds.Tables[0].Rows[contador]["BAUGR"].ToString().Trim();
                        resb.Bdmng = double.Parse(ds.Tables[0].Rows[contador]["BDMNG"].ToString().Trim());
                        resb.Meins = ds.Tables[0].Rows[contador]["MEINS"].ToString().Trim();
                        resb.Werks = ds.Tables[0].Rows[contador]["WERKS"].ToString().Trim();
                        resb.Menge = double.Parse(ds.Tables[0].Rows[contador]["MENGE"].ToString().Trim());
                        resb.Bwart = ds.Tables[0].Rows[contador]["BWART"].ToString().Trim();
                        resb.Lgort = ds.Tables[0].Rows[contador]["LGORT"].ToString().Trim();
                        resbCollection.Add(resb);
                    }
                }

                return(resbCollection);
            }
            catch (Exception ex)
            {
                //Regenerar la excepción pero ahora con un mensaje personalizado para el usuario
                throw new Exception(Errores.ConsultarRegistro + Errores.MensajeOriginal + ex.Message.ToString());
            }
            finally
            {
                //Cerrar la conexión
                this.Conexion.Close();
            }
        }
Beispiel #2
0
        public ClsResbCollection ConsultarResbBAL(string psCriterio)
        {
            ClsResbCollection resbCollection = new ClsResbCollection();

            try
            {
                resbCollection = base.ConsultarResbDAL(psCriterio);

                return(resbCollection);
            }
            catch
            {
                throw;
            }
        }