Example #1
0
        //public void obtnerDatosProducto(string CarritoId)
        //{
        //    JavaScriptSerializer js = new JavaScriptSerializer();
        //    string carritoSerializado = js.Serialize(carrito);
        //    obtnerDatosProducto(CarritoId);
        //}

        //public static Dictionary<string, DatorProductoCarrito> obtnerDatosProducto(string CarritoId)
        //{
        //    string cartJson = "";
        //    if (!string.IsNullOrEmpty(CarritoId))
        //    {
        //        cartJson = CarritoBLL.GetCarritoById(CarritoId).Contenido;
        //    }
        //    JavaScriptSerializer js = new JavaScriptSerializer();
        //    Dictionary<string, DatorProductoCarrito> carrito = js.Deserialize<Dictionary<string, DatorProductoCarrito>>(cartJson);
        //    return carrito.Values;
        //}

        public static List <Carrito> GetCarritoListForSearch(string whereSql)
        {
            if (string.IsNullOrEmpty(whereSql))
            {
                whereSql = "1 = 1";
            }

            List <Carrito>      theList    = new List <Carrito>();
            Carrito             theUser    = null;
            CarritoTableAdapter theAdapter = new CarritoTableAdapter();

            try
            {
                CarritoDS.CarritoDataTable table = theAdapter.GetCarritoForSearch(whereSql);

                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 Carrito de la base de datos", q);
                //return null;
            }
            return(theList);
        }
Example #2
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);
        }
Example #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);
        }