Esempio n. 1
0
        static void sincronizarOfertas()
        {
            APIConsumer c = null;
            string      discountLabelOrg = string.Empty, priceOrg = string.Empty, listPriceOrg = string.Empty, costPriceOrg = string.Empty;

            new BOCuentas().listarProductosMP_Ofertas(ref dtProductosOfertas);
            string idCuentaMp = new BOCuentas().obtenerIdCuentaMP();

            if (dtProductosOfertas.Rows.Count > 0)
            {
                c = new APIConsumer();
            }
            for (int i = 0; i < dtProductosOfertas.Rows.Count; i++)
            {
                discountLabelOrg = dtProductosOfertas.Rows[i]["dFte"].ToString();
                priceOrg         = dtProductosOfertas.Rows[i]["priceFte"].ToString();
                listPriceOrg     = dtProductosOfertas.Rows[i]["lPriceFte"].ToString();
                costPriceOrg     = dtProductosOfertas.Rows[i]["cPriceFte"].ToString();

                string[] catsMp = dtProductosOfertas.Rows[i]["catMP"].ToString().Split(';');
                string[] catsOf = dtProductosOfertas.Rows[i]["catOf"].ToString().Split(';');
                //Actualizar MarketPlace producto y subcategoria
                for (int j = 0; j < catsMp.Length; j++)
                {
                    if (!string.IsNullOrEmpty(catsMp[j]))
                    {
                        c.crearRequestActualizacionProd(idCuentaMp, dtProductosOfertas.Rows[i]["nameMP"].ToString(), catsMp[j].ToString(), dtProductosOfertas.Rows[i]["idCamMP"].ToString(), listPriceOrg, priceOrg, costPriceOrg, discountLabelOrg);
                    }
                }
                //Actualizar oferta
                for (int j = 0; j < catsOf.Length; j++)
                {
                    if (!string.IsNullOrEmpty(catsOf[j]))
                    {
                        c.crearRequestActualizacionProd(idCuentaMp, dtProductosOfertas.Rows[i]["nameMP"].ToString(), catsOf[j].ToString(), dtProductosOfertas.Rows[i]["idCamOf"].ToString(), listPriceOrg, priceOrg, costPriceOrg, discountLabelOrg);
                    }
                }
            }
        }
Esempio n. 2
0
        static void borrarOfertas()
        {
            DataTable   dtBorrar = new DataTable();
            BOCuentas   ctas     = new BOCuentas();
            APIConsumer c        = null;

            ctas.listarOfertasBorrar(ref dtBorrar);
            string idOferta = ctas.obtenerIdOfertas();

            if (dtBorrar.Rows.Count > 0)
            {
                c = new APIConsumer();
                for (int i = 0; i < dtBorrar.Rows.Count; i++)
                {
                    string idCam = string.Empty;
                    if (!string.IsNullOrEmpty(dtBorrar.Rows[i]["idsproductos"].ToString()))
                    {
                        idCam = dtBorrar.Rows[i]["idsproductos"].ToString().Split(';')[1].Split(',')[1].Replace("idGenerado:", string.Empty).Trim();
                        c.crearRequestEliminacionProd(ctas.obtenerIdCuentaMP(), idOferta, idCam);
                    }
                }
                ctas.inactivarOfertas("SyncAdmin", int.Parse(dtBorrar.Rows[0]["idOferta"].ToString()));
            }
        }