Beispiel #1
0
        //public static Area GetArea()
        //{
        //    AreaTableAdapter localAdapter = new AreaTableAdapter();

        //    Area theUser = null;
        //    try
        //    {
        //        AreaDS.AreaDataTable table = localAdapter.GetArea();

        //        if (table != null && table.Rows.Count > 0)
        //        {
        //            AreaDS.AreaRow row = table[0];
        //            theUser = FillUserRecord(row);
        //        }
        //    }
        //    catch (Exception q)
        //    {
        //        log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q);
        //        return null;
        //    }
        //    return theUser;
        //}
        public static Carrito GetCarritoById(string idCarrito)
        {
            CarritoTableAdapter localAdapter = new CarritoTableAdapter();

            if (string.IsNullOrEmpty(idCarrito))
            {
                return(null);
            }

            Carrito theUser = null;

            try
            {
                CarritoDS.CarritoDataTable table = localAdapter.GetCarritoById(idCarrito);

                if (table != null && table.Rows.Count > 0)
                {
                    CarritoDS.CarritoRow row = table[0];
                    theUser = FillCarritoRecord(row);
                }
            }
            catch (Exception q)
            {
                log.Error("Un error ocurrio mientras obtenia el Area de la base de dato", q);
                return(null);
            }
            return(theUser);
        }
Beispiel #2
0
        //public static List<Carrito> GetAreaJoinModuloListForSearch(string whereSql)
        //{
        //    if (string.IsNullOrEmpty(whereSql))
        //    {
        //        whereSql = "1 = 1";
        //    }

        //    List<Area> theList = new List<Area>();
        //    Area theUser = null;
        //    AreaTableAdapter theAdapter = new AreaTableAdapter();
        //    try
        //    {
        //        AreaDS.AreaDataTable table = theAdapter.GetAreaJoinModuloForSearch(whereSql);

        //        if (table != null && table.Rows.Count > 0)
        //        {
        //            foreach (AreaDS.AreaRow row in table.Rows)
        //            {
        //                theUser = FillUserRecord(row);
        //                theList.Add(theUser);
        //            }
        //        }
        //    }
        //    catch (Exception q)
        //    {
        //        log.Error("el error ocurrio mientras obtenia la lista del Area de la base de datos", q);
        //        //return null;
        //    }
        //    return theList;
        //}

        //public static List<Carrito> GetArea()
        //{
        //    List<Carrito> theList = new List<Carrito>();
        //    Carrito theUser = null;
        //    CarritoTableAdapter theAdapter = new CarritoTableAdapter();
        //    try
        //    {
        //        CarritoDS.CarritoDataTable table = theAdapter.GetCarritoById();

        //        if (table != null && table.Rows.Count > 0)
        //        {
        //            foreach (CarritoDS.CarritoRow row in table.Rows)
        //            {
        //                theUser = FillCarritoRecord(row);
        //                theList.Add(theUser);
        //            }
        //        }
        //    }
        //    catch (Exception q)
        //    {
        //        log.Error("el error ocurrio mientras obtenia la lista del Area de la base de datos", q);
        //        return null;
        //    }
        //    return theList;
        //}


        private static Carrito FillCarritoRecord(CarritoDS.CarritoRow row)
        {
            Carrito theNewRecord = new Carrito(
                row.carritoId,
                row.IsusuarioIdNull() ? 0 : row.usuarioId,
                row.contenido,
                row.fecha,
                row.estadoVenta);

            return(theNewRecord);
        }
Beispiel #3
0
        public static Carrito GetCarritoByIdUsurio(int userId)
        {
            if (userId <= 0)
            {
                throw new ArgumentException("userId cannot be equals or less than zero");
            }

            Carrito             objCarrito = null;
            CarritoTableAdapter adapter    = new CarritoTableAdapter();

            CarritoDS.CarritoDataTable table = adapter.GetCarritoByIdUsiuario(userId);
            if (table != null && table.Rows.Count > 0)
            {
                CarritoDS.CarritoRow row = table[0];
                objCarrito = FillCarritoRecord(row);
            }
            return(objCarrito);
        }