예제 #1
0
        public IEnumerable <UPC> Lista_tallas_upc(int?idEstilo)
        {
            Conexion   con   = new Conexion();
            List <UPC> Lista = new List <UPC>();

            try
            {
                SqlCommand    com  = new SqlCommand();
                SqlDataReader leer = null;
                //string listaStag="";
                com.Connection  = con.AbrirConexion();
                com.CommandText = "select S.TALLA, UPC from UPC U  " +
                                  "INNER JOIN CAT_ITEM_SIZE S ON U.IdTalla=S.ID " +
                                  "where IdEstilo='" + idEstilo + "'  ORDER by cast(ORDEN AS int) ASC ";
                leer = com.ExecuteReader();
                while (leer.Read())
                {
                    UPC catTalla = new UPC()
                    {
                        Talla = leer["TALLA"].ToString(),
                        UPC1  = Convert.ToInt64(leer["UPC"])
                    };
                    Lista.Add(catTalla);
                }
                leer.Close();
            }
            finally
            {
                con.CerrarConexion();
                con.Dispose();
            }
            return(Lista);
        }
예제 #2
0
        public void TableExecutor()

        {
            UPC upc = new UPC();

            FileInfo file = new FileInfo(path);

            DataTable uploadUpc = CreateTable();

            int bulkSize = 0;

            try
            {
                using (ExcelPackage package = new ExcelPackage(file))
                {
                    ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
                    int            rowCount  = worksheet.Dimension.Rows;
                    int            ColCount  = worksheet.Dimension.Columns;

                    for (int row = 1; row <= rowCount; row++)
                    {
                        if (row != 1)
                        {
                            upc.ItemID = Convert.ToInt32(worksheet.Cells[row, 1].Value?.ToString());
                            upc.Upc    = Convert.ToInt64(worksheet.Cells[row, 2].Value?.ToString());
                            if (upc.Upc == 0)
                            {
                                upc.Upc = -1;
                            }

                            DataRow insideRow = uploadUpc.NewRow();

                            insideRow["Item"] = upc.ItemID;
                            insideRow["Upc"]  = upc.Upc;
                            uploadUpc.Rows.Add(insideRow);
                            uploadUpc.AcceptChanges();
                            bulkSize++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            upload(uploadUpc, bulkSize, "dbo.UPC");
        }
예제 #3
0
        public double Sumuj(Zamowienie zamowienie)
        {
            IKosztyWysylki kurier = null;

            switch (zamowienie.RodzajTransportu)
            {
            case Przewoznik.DHL:
                kurier = new DHL();
                break;

            case Przewoznik.GLS:
                kurier = new GLS();
                break;

            case Przewoznik.UPC:
                kurier = new UPC();
                break;
            }

            return(kurier.obliczKosztPrzesylki(zamowienie));
        }
예제 #4
0
        public JsonResult Obtener_Lista_Tallas_UPC(List <string> ListTalla, int IdEstilo, int IdSummary)
        {
            UPC           upcTalla = new UPC();
            List <string> tallas   = ListTalla[0].Split('*').ToList();
            List <string> upc      = ListTalla[1].Split('*').ToList();

            int i = 0;

            foreach (var item in tallas)
            {
                i++;
            }

            i -= 1;
            for (int v = 0; v < i; v++)
            {
                upcTalla.Talla = tallas[v];

                string cantidadT = upc[v];
                if (cantidadT == "")
                {
                    cantidadT = "0";
                }
                long number = long.Parse(cantidadT);
                upcTalla.UPC1 = number;


                upcTalla.IdEstilo = IdEstilo;

                upcTalla.IdSummary = IdSummary;


                objTalla.RegistroTallasUPC(upcTalla);
            }
            return(Json("0", JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public void saveExcel()
        {
            FileInfo file = new FileInfo(path);

            try
            {
                using (ExcelPackage package = new ExcelPackage(file))
                {
                    ExcelWorksheet worksheet = package.Workbook.Worksheets[1];

                    // delete everything from the spreadsheet
                    worksheet.DeleteRow(2, worksheet.Dimension.Rows);

                    string itemID;

                    string title = "";

                    int row = 2;

                    int execption = 0;

                    setTitleDic();

                    try
                    {
                        foreach (var item in shopifyProfile
                                 .OrderBy(x => x.Value.handle)
                                 .OrderBy(x => x.Value.option1Value))
                        {
                            if (shopifyUser.ContainsKey(item.Value.sku + "_" + profile.ProfileUser))
                            {
                                execption++;

                                itemID = item.Value.sku;

                                Fragrancex fra = new Fragrancex();

                                fragrancex.TryGetValue(Convert.ToInt32(itemID), out fra);

                                string description = string.Empty;

                                double price = 0.0;

                                if (fra != null)
                                {
                                    description = fra.Description;

                                    price = fra.WholePriceUSD;
                                }

                                // Set Handle
                                worksheet.Cells[row, 1].Value = item.Value.handle;

                                // Logic for the title
                                title = BuildTitle(dicTitle, item.Value.handle, item.Value.collection);
                                worksheet.Cells[row, 2].Value = title;

                                //Logic for the HTML Body
                                worksheet.Cells[row, 3].Value = BuildHTML(title, row, profile.html, item.Value.image
                                                                          , description);

                                // Set Vendor
                                worksheet.Cells[row, 4].Value = item.Value.vendor;

                                // Set Type
                                worksheet.Cells[row, 5].Value = item.Value.type;

                                // Set Publish
                                worksheet.Cells[row, 6].Value = "TRUE";

                                // Option1 Name
                                worksheet.Cells[row, 7].Value = "Size";

                                // Option1 Value
                                worksheet.Cells[row, 8].Value = item.Value.option1Value;

                                // Set SKU
                                worksheet.Cells[row, 13].Value = item.Value.sku;

                                // Set Variant
                                worksheet.Cells[row, 14].Value = 400;

                                // Set Variant Inventory Tracker
                                worksheet.Cells[row, 15].Value = "shopify";

                                // Set Variant Inventory Policy
                                worksheet.Cells[row, 17].Value = "deny";

                                // Set Variant Fulfillment Service
                                worksheet.Cells[row, 18].Value = "manual";

                                // Set Variant Compare At Price
                                //if (item.Value.comparePrice != 0)
                                //{
                                //    worksheet.Cells[row, 20].Value = item.Value.comparePrice;
                                //}

                                // Set Variant Requires Shipping
                                worksheet.Cells[row, 21].Value = "TRUE";

                                // Set Variant Taxable
                                worksheet.Cells[row, 22].Value = "FALSE";

                                // UPC creator

                                UPC upcs = new UPC();

                                upc.TryGetValue(Convert.ToInt32(itemID), out upcs);

                                if (upcs != null)
                                {
                                    worksheet.Cells[row, 23].Value = upcs.Upc;
                                }

                                // Set Image
                                worksheet.Cells[row, 24].Value = fixPictureHTML(item.Value.image);

                                // Set Tags
                                worksheet.Cells[row, 26].Value = item.Value.tags;

                                // Set Collection
                                worksheet.Cells[row, 27].Value = item.Value.collection;

                                // Prices

                                if (price != 0.0)
                                {
                                    // Set Price
                                    worksheet.Cells[row, 19].Value = getSellingPrice(price);
                                    // Set Variant Inventory Qty
                                    worksheet.Cells[row, 16].Value = profile.items;
                                }
                                else
                                {
                                    // Set Price
                                    worksheet.Cells[row, 19].Value = 100.0;
                                    // Set Variant Inventory Qty
                                    worksheet.Cells[row, 16].Value = 0;
                                }

                                worksheet.Cells[row, 28].Value = price;

                                row++;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }

                    package.Save();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            lBuscarMejorOpcion buscarMejorOpcion  = new BuscarMejorOpcion();
            lAsignarDatosEnvio lasignarDatosEnvio = new AsignarDatosEnvio();
            Context            context            = new Context();
            lConvertirTipoDato convertirTipoDato  = new CovertirTipoDatoService();
            double             dTiempoTraslado    = 0;
            decimal            TiempoTraslado     = 0;
            decimal            dCostoEnvio        = 0;
            string             cExpresion1        = "";
            string             cExpresion2        = "";
            string             cExpresion3        = "";
            string             cExpresion4        = "";
            string             cExpresion5        = "";
            DateTime           dtFechaEntrega     = new DateTime();
            DateTime           dtHoy      = DateTime.Now;
            lLeerArchivoTexto  Lector     = new LeerArchivoTexto();
            lEmpresas          empresa    = null;
            lEnvios            transporte = null;
            lEnvios            aereo      = new Avion()
            {
                dVelocidadEntrega = 600, dCostoEnvio = 10, cNombre = "Avion"
            };
            lEnvios tren = new Tren()
            {
                dVelocidadEntrega = 80, dCostoEnvio = 5, cNombre = "Tren"
            };
            lEnvios barco = new Barco()
            {
                dVelocidadEntrega = 46, dCostoEnvio = 1, cNombre = "Barco"
            };
            lEnvios bici = new Bici()
            {
                dVelocidadEntrega = 1, dCostoEnvio = 3, cNombre = "Bici"
            };
            lEmpresas fedex = new Estafeta(new List <lEnvios>()
            {
                barco
            }, 50, "Fedex");
            lEmpresas dhl = new DHL(new List <lEnvios>()
            {
                aereo, barco
            }, 40, "DHL");
            lEmpresas estafeta = new Estafeta(new List <lEnvios>()
            {
                tren
            }, 20, "Estafeta");
            lEmpresas upc = new UPC(new List <lEnvios>()
            {
                bici
            }, 50, "UPC");
            List <lEmpresas> lstEmpresas = new List <lEmpresas>()
            {
                fedex, dhl, estafeta, upc
            };
            List <lEnvios> lstTransportes = new List <lEnvios>()
            {
                aereo, tren, barco, bici
            };

            List <string> lines = Lector.LeerArchivo("Pedidos.txt");

            foreach (string line in lines)
            {
                string[] cInformacion = line.Split(',');

                lasignarDatosEnvio.AsignarEmpresa(cInformacion[3], ref empresa, lstEmpresas);

                lasignarDatosEnvio.AsignarTransporte(cInformacion[4], ref transporte, lstTransportes);

                if (empresa != null)
                {
                    Pedido      initialState = new DesactivarState();
                    State.State entPedido    = new State.State(initialState, cInformacion[0], cInformacion[1], convertirTipoDato.ConvertirStringADecimal(cInformacion[2]), empresa, transporte, Convert.ToDateTime(cInformacion[5]));
                    initialState.setContext(entPedido);

                    TiempoTraslado = empresa.TiempoTraslado(entPedido);

                    if (TiempoTraslado > 0)
                    {
                        dTiempoTraslado = convertirTipoDato.ConvertirDecimalADouble(TiempoTraslado);
                        dtFechaEntrega  = empresa.FechaEntrega(dTiempoTraslado, entPedido);
                        dCostoEnvio     = empresa.CostoEnvio(entPedido);

                        Console.WriteLine(buscarMejorOpcion.ObtenerMejorOpcion(lstEmpresas, empresa, entPedido, dCostoEnvio));

                        Expresion1 expresion1 = new Expresion1();
                        context.setStrategy(expresion1);
                        cExpresion1 = context.ValidarFechaEntrega(dtFechaEntrega, dtHoy, entPedido);

                        Expresion2 expresion2 = new Expresion2();
                        context.setStrategy(expresion2);
                        cExpresion2 = context.ValidarFechaEntrega(dtFechaEntrega, dtHoy, entPedido);

                        Expresion3 expresion3 = new Expresion3();
                        context.setStrategy(expresion3);
                        cExpresion3 = context.ValidarFechaEntrega(dtFechaEntrega, dtHoy, entPedido);

                        Expresion4 expresion4 = new Expresion4();
                        context.setStrategy(expresion4);
                        cExpresion4 = context.ValidarFechaEntrega(dtFechaEntrega, dtHoy, entPedido);

                        Expresion5 expresion5 = new Expresion5();
                        context.setStrategy(expresion5);
                        cExpresion5 = context.ValidarFechaEntrega(dtFechaEntrega, dtHoy, entPedido);


                        if (entPedido.state.ToString() == "State.ActivarState")
                        {
                            System.Console.ForegroundColor = ConsoleColor.Green;
                        }
                        else
                        {
                            System.Console.ForegroundColor = ConsoleColor.Yellow;
                        }
                        Console.WriteLine($"Tu paquete {cExpresion1} de {entPedido.cOrigen} y {cExpresion2} a {entPedido.cDestino} {cExpresion3} {cExpresion5} y {cExpresion4} un costo de {dCostoEnvio} (Cualquier reclamación con {cInformacion[3]}).");
                    }
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }