Пример #1
0
 /// <summary>
 /// Constructor de la clase.
 /// </summary>
 /// <param name="orden">Criterio de ordenación.</param>
 public Ordenación(Orden orden)
 {
     nComparaciones = 0;
     nIntercambios = 0;
     this.orden = orden;
     tiempoEjecución = new NanoTemporizador();
 }
        public void EnviarOrden(string numeroCuenta, string nombreCliente, string nombreArticulo, int cantidad, DateTime fechaOrden)
        {
            Orden ordenAEnviar = new Orden
            {
                NumeroDeCuenta = numeroCuenta,
                NombreDeCuenta = nombreCliente,
                NombreDeArticulo = nombreArticulo,
                CantidadOrdenada = cantidad,
                FechaDeOrden = fechaOrden
            };

            proxy.EnviarOrdenAsync(ordenAEnviar);
        }
Пример #3
0
        public TipoComplejoXsd(XmlNode source) : this()
        {
            string orden = "sequence";

            try{
                nombre  = source.Attributes["name"].Value;
                isEmpty = source.HasChildNodes;
                if (!isEmpty)
                {
                    if (source["simpleContent"] != null)
                    {
                        //simple
                        simpleContent = new RestriccionXsd(source["simpleContent"]["restriccion"]);
                    }
                    else
                    {
                        //complejo
                        mixed = bool.Parse(source.Attributes["mixed"].Value);
                        if (source["extension"] != null)
                        {
                            isExtensibleElements = source["extension"]["any"] != null;
                            tipoXsdBase          = source["extension"].Attributes["base"].Value;
                            if (source["extension"]["all"] != null)
                            {
                                orden = "all";
                            }
                            else if (source["extension"]["choice"] != null)
                            {
                                orden = "choice";
                            }
                            else if (source["extension"]["sequence"] == null)
                            {
                                throw new Exception();
                            }

                            foreach (XmlNode elemento in source["extension"][orden].ChildNodes)
                            {
                                Añadir(new ElementoXsd(elemento), elemento.Attributes["ref"] != null, int.Parse(elemento.Attributes["minOccurs"].Value), int.Parse(elemento.Attributes["maxOccurs"].Value));
                            }
                        }
                        else
                        {
                            isExtensibleElements = source["any"] != null;
                            if (source["all"] != null)
                            {
                                orden = "all";
                            }
                            else if (source["choice"] != null)
                            {
                                orden = "choice";
                            }
                            else if (source["sequence"] == null)
                            {
                                throw  new Exception();
                            }

                            foreach (XmlNode elemento in source[orden].ChildNodes)
                            {
                                Añadir(new ElementoXsd(elemento), elemento.Attributes["ref"] != null, int.Parse(elemento.Attributes["minOccurs"].Value), int.Parse(elemento.Attributes["maxOccurs"].Value));
                            }
                        }
                    }
                    //atributos
                    foreach (XmlNode atributo in source["attribute"])
                    {
                        Añadir(new AtributoXsd(atributo), atributo["ref"] != null);
                    }
                    isExtensibleAttribute = source["anyAttribute"] != null;
                }
            }catch {
                throw new XsdException("el nodo no es un TipoComplejoXsd valido");
            }
        }
Пример #4
0
 public bool Update(Orden b)
 {
     return(OrdenRepository.Update(b));
 }
Пример #5
0
    public void crearOrdenes()
    {
        string codigoCliente  = "";
        string codigoVendedor = "";

        Console.WriteLine("CREANDO ORDENES");
        Console.WriteLine("================");
        Console.WriteLine("Ingrese el codigo del Cliente");
        codigoCliente = Console.ReadLine();

        Cliente cliente = ListaClientes.Find(v => v.Codigo.ToString() == codigoCliente);

        if (cliente == null)
        {
            Console.WriteLine("Cliente No encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Cliente: " + cliente.Nombre);
        }
        Console.WriteLine("");
        Console.WriteLine("Ingrese el codigo del Vendedor");
        codigoVendedor = Console.ReadLine();
        Vendedor vendedor = ListaVendedores.Find(v => v.Codigo.ToString() == codigoVendedor);

        if (vendedor == null)
        {
            Console.WriteLine("vendedor No encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Vendedor: " + vendedor.Nombre);
        }
        Console.WriteLine("");
        int   nuevoCodigo = ListaOrdenes.Count + 1;
        Orden OrdenNueva  = new Orden(nuevoCodigo, DateTime.Now, "SPS" + nuevoCodigo, cliente, vendedor);

        ListaOrdenes.Add(OrdenNueva);

        while (true)
        {
            Console.WriteLine("Ingrese el codigo del producto: ");
            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListaProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("Producto No encontrado");
                Console.ReadLine();
            }
            else
            {
                OrdenNueva.agregarProducto(producto);
                Console.WriteLine("Producto Agregado: " + producto.Descripcion + " con precio de: " + producto.Precio);
            }
            string continuar = "";
            Console.WriteLine("Desea continuar (s/n): ");
            continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }
        Console.WriteLine("");
        Console.WriteLine("El Subtotal de la orden es: " + OrdenNueva.Subtotal);
        Console.WriteLine("Impuesto total: " + OrdenNueva.Impuesto);
        Console.WriteLine("El total de la orden es: " + OrdenNueva.Total);
        Console.ReadLine();
    }
Пример #6
0
        static void Main(string[] args)
        {
            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Loopback, 4040);
            Socket     ss            = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);


            var productos = new ObservableCollection <Producto>();

            for (int i = 0; i < 20; i++)
            {
                productos.Add(new Producto()
                {
                    ProductId          = i,
                    Nombre             = "Producto servidor" + i,
                    Precio             = (decimal)i,
                    CantidadDisponible = i * 10,
                    Descripcion        = "The enum keyword is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. Usually it is best to"
                });
            }


            try
            {
                ss.Bind(localEndPoint);
                ss.Listen(10);
                while (true)
                {
                    Console.WriteLine("Servidor escuchando por conexiones");
                    Socket cliente     = ss.Accept();
                    string descCliente = cliente.LocalEndPoint.ToString();
                    Console.WriteLine("Conexion aceptada " + descCliente);
                    ObjectWriter w = new ObjectWriter(cliente);
                    ObjectReader r = new ObjectReader(cliente);

                    Transacciones transaccion = (Transacciones)r.ReadInt32();
                    switch (transaccion)
                    {
                    case Transacciones.SolicitarCarrito:
                        Console.WriteLine("\tSolicitud de carrito por: " + descCliente);
                        w.WriteInt32(productos.Count);
                        for (int i = 0; i < productos.Count; i++)
                        {
                            w.WriteObject <Producto>(productos[i]);
                        }
                        break;

                    case Transacciones.RealizarCompra:
                        Console.WriteLine("\tOrden de compra de " + descCliente);
                        Orden o = r.ReadObject <Orden>();
                        productos[o.ProductId].CantidadDisponible -= o.Cantidad;
                        break;
                    }
                    Console.WriteLine("Conexion terminada " + descCliente);
                    cliente.Shutdown(SocketShutdown.Both);
                    cliente.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #7
0
 public void CrearOrden(Orden orden)
 {
     dbContext.Ordenes.Add(orden);
     dbContext.SaveChanges();
 }
Пример #8
0
        /// <summary>
        /// Constructor de edición del Pedido Local
        /// </summary>
        /// <param name="pedidoEdicion"></param>
        public NuevoPedido(Pedido pedidoEdicion)
        {
            InitializeComponent();
            dataGridOrden.Items.Refresh();
            dataGridOrden.ItemsSource = listaOrdenes;
            idCuenta        = pedidoEdicion.Cuenta.Id;
            idPedidoEdicion = pedidoEdicion.Id;

            if (idCuenta.StartsWith("PL"))
            {
                tipoDePedido = "Local";
                var pedidoLocal = pedidoEdicion as PedidoLocal;
                UC_NuevoPLocal.Visibility = Visibility.Visible;
                UC_NuevoPLocal.comboBoxNumEmpleado.SelectedItem = pedidoLocal.Empleado.idEmpleadoGenerado;
                UC_NuevoPLocal.comboBoxNoMesa.SelectedItem      = pedidoLocal.Mesa.numeroMesa.ToString();
                try
                {
                    instanceContext = new InstanceContext(this);
                    var canal = new DuplexChannelFactory <IAdministrarPedidosMeseros>(instanceContext, "*");
                    serverMeseros = canal.CreateChannel();
                    Meseros       = serverMeseros.ObtenerMeseros();
                    foreach (var mesero in Meseros)
                    {
                        UC_NuevoPLocal.EditarSeleccionComboBoxNumEmpleado = mesero.idGenerado;
                    }
                    serverMeseros.ObtenerProductos();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message + "\n" + e.StackTrace);
                }
            }
            else
            {
                tipoDePedido = "Domicilio";
                var pedidoDomicilio = pedidoEdicion as PedidoADomicilio;
                UC_NuevoDomicilio.Visibility = Visibility.Visible;
                UC_NuevoDomicilio.comboBoxClienteNombre.SelectedItem = pedidoDomicilio.Cliente.nombre + " " + pedidoDomicilio.Cliente.apellidoPaterno + " " + pedidoDomicilio.Cliente.apellidoMaterno;
                UC_NuevoDomicilio.comboBoxDireccion.SelectedItem     = pedidoDomicilio.direccionDestino;
                UC_NuevoDomicilio.comboBoxTelefono.SelectedItem      = pedidoDomicilio.Cliente.Telefono.First();
                try
                {
                    instanceContext  = new InstanceContext(this);
                    callCenterClient = new AdministrarPedidosCallCenterClient(instanceContext);
                    callCenterClient.ObtenerDatos();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message + "\n" + e.StackTrace);
                }
            }
            productosSeleccionados              = pedidoEdicion.Producto.ToObservableCollection();
            provisionesSeleccionadas            = pedidoEdicion.ProvisionDirecta.ToObservableCollection();
            textBoxInstruccionesEspeciales.Text = pedidoEdicion.instruccionesEspeciales;
            labelSubtotal.Content = pedidoEdicion.Cuenta.subTotal;
            labelTotal.Content    = pedidoEdicion.Cuenta.precioTotal;

            foreach (var producto in pedidoEdicion.Producto)
            {
                Orden orden = new Orden
                {
                    cantidad       = producto.cantidad,
                    nombreProducto = producto.nombre,
                    precioUnitario = producto.precioUnitario,
                    precioTotal    = producto.precioUnitario * producto.cantidad
                };
                listaOrdenes.Add(orden);
            }

            foreach (var provision in pedidoEdicion.ProvisionDirecta)
            {
                Orden orden = new Orden
                {
                    cantidad       = provision.cantidad,
                    nombreProducto = provision.Provision.nombre,
                    precioUnitario = provision.Provision.costoUnitario,
                    precioTotal    = provision.Provision.costoUnitario * provision.cantidad
                };
                listaOrdenes.Add(orden);
            }
        }
Пример #9
0
 private void Clear() => _orden = new Orden();
Пример #10
0
        private async void btnAceptar_Click(object sender, EventArgs e)
        {
            DateTime inicio;
            DateTime fin;

            Orden orden = Orden.FECHA;

            if (rbCliente.Checked)
            {
                orden = Orden.CLIENTE;
            }
            if (rbMatricula.Checked)
            {
                orden = Orden.MATRICULA;
            }

            if (checkBoxDesde.Checked)
            {
                inicio = dateTimePickerDesde.Value;
            }
            else
            {
                inicio = DateTime.MinValue;
            }

            if (checkBoxHasta.Checked)
            {
                fin = dateTimePickerHasta.Value;
            }
            else
            {
                fin = DateTime.MaxValue;
            }


            if (rbResumido.Checked)
            {
                try
                {
                    Alquileres = await _repositorioAlquiler.ListarPorFechaResumido(inicio, fin, orden);

                    FormListadoResumidoAlquileres flra = Program.container.GetInstance <FormListadoResumidoAlquileres>();
                    await flra.Listar(Alquileres);

                    flra.ShowDialog();
                }catch (Exception ex)
                {
                    MessageBox.Show("Ocurrio un error");
                }
            }

            if (rbDetallado.Checked)
            {
                try
                {
                    Alquileres = await _repositorioAlquiler.ListarPorFechaDetallado(inicio, fin, orden);

                    Console.WriteLine(Alquileres.Count);
                    FormListadoDetalladoAlquileres al = Program.container.GetInstance <FormListadoDetalladoAlquileres>();
                    await al.Listar(Alquileres);

                    al.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ocurrio un error");
                }
            }
        }
Пример #11
0
        //
        // GET: /Checkout/Complete
        public ActionResult Complete(int id)
        {
            Orden order = storeDB.Orden.Where(o => o.OrderId == id).SingleOrDefault();

            return(View(order));
        }
        public bool EnvioCorreo(Bobina b, string Usuario, string obs)
        {
            Bobina_Controller controlbo = new Bobina_Controller();

            /* Carga de PAra la base de Datos*/
            /*-------------------------MENSAJE DE CORREO----------------------*/

            //Creamos un nuevo Objeto de mensaje
            System.Net.Mail.MailMessage mmsg = new System.Net.Mail.MailMessage();

            //Direccion de correo electronico a la que queremos enviar el mensaje
            //mmsg.To.Add("*****@*****.**");
            mmsg.To.Add("*****@*****.**");
            //mmsg.To.Add("*****@*****.**");
            //Nota: La propiedad To es una colección que permite enviar el mensaje a más de un destinatario

            //Asunto
            mmsg.Subject         = "Exceso de escarpe en Bobina";
            mmsg.SubjectEncoding = System.Text.Encoding.UTF8;

            //Direccion de correo electronico que queremos que reciba una copia del mensaje
            //mmsg.Bcc.Add("*****@*****.**"); //Opcional
            DateTime hoy   = DateTime.Now;
            string   fecha = hoy.ToString("dd/MM/yyyy HH:mm");

            string[] str = fecha.Split('/');
            string   dia = str[0];
            string   mes = str[1];
            string   año = str[2];
            //año = año.Substring(0, 4);
            //string hora = hoy.ToLongTimeString();
            string        Daño = "";
            List <Bobina> list = controlbo.BuscarEstado_bobi(b.Responsable);

            foreach (Bobina bobin in list)
            {
                if (bobin.Codigo == "100")
                {
                    Daño = bobin.Tipo;
                }
                else if (bobin.Codigo == ddlCausa.SelectedValue.ToString())
                {
                    Daño = bobin.Tipo;
                }
            }
            OrdenController orden = new OrdenController();
            Orden           OT    = orden.BuscarPorOT(b.NumeroOp);

            //Cuerpo del Mensaje
            mmsg.Body =
                "<table style='width:80%;'>" +
                "<tr>" +
                "<td>" +
                "<img src='http://www.qg.com/images/qg_logocrop.gif' />" +
                "<img src='http://www.qg.com/la/es/images/QG_Tagline_sp.jpg' />" +
                "&nbsp;</td>" +
                "</tr>" +
                "</table>" +
                //termino cargar logo
                "<div style='border-color:Black;border-width:3px;border-style:solid;'>" +
                "<table style='width:100%;'>" +
                "<tr>" +
                "<td style='width:194px;'>" +
                "&nbsp;</td>" +
                "<td colspan='3'>" +
                "&nbsp;</td>" +
                "</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                "OT Nro.: </td>" +
                "<td>" + b.NumeroOp + "</td>" +
                "<td>Nombre OT : </td>" +
                "<td>" + OT.NombreOT + "</td>" +
                "</tr>" +
                // "<tr>" +
                //     "<td  style='width:194px;'>" +
                //       " Fecha:</td>" +
                //     "<td colspan='3'>" + dia + "/" + mes + "/" + año + "</td>" +
                //"</tr>" +
                "<tr>" +
                "<td  style='width:194px;'>" +
                "Creador Por:</td>" +

                "<td colspan='3'>" + Usuario +
                "</td>" +
                "</tr>" +
                "</table>" +
                "<br />" +
                "</div>" +
                "<table style='width:80%;'><tr>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Codigo Bob.</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>P. Bruto</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>P. Tapa</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>P. Env.</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>P. Esc.</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Marca</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Tipo</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Ancho</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Gr</td>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;'>Maquina</td>" +
                "</tr>" +
                "<tr>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Codigo.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Peso_Original.ToString("N0").Replace(',', '.') + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Peso_Tapa.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Peso_emboltorio.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.PesoEscarpe.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Marca + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Tipo + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Ancho.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Gramage.ToString() + "</td>" +
                "<td style='border:1px solid #5D8CC9;'>" + b.Ubicacion + "</td>" +
                "</tr>" +
                "<tr>" +
                "<td style='border:1px solid #5D8CC9;background:#5D8CC9;' colspan='10'>Observación</td>" +
                "</tr>" +
                "<tr>" +
                "<td style='border:1px solid #5D8CC9;' colspan='10'>Daño: " + Daño + "- Obs.:" + obs + "</td></tr></table>";

            mmsg.BodyEncoding = System.Text.Encoding.UTF8;
            mmsg.IsBodyHtml   = true; //Si no queremos que se envíe como HTML

            //Correo electronico desde la que enviamos el mensaje
            mmsg.From = new System.Net.Mail.MailAddress("*****@*****.**");//"*****@*****.**");


            /*-------------------------CLIENTE DE CORREO----------------------*/

            //Creamos un objeto de cliente de correo
            System.Net.Mail.SmtpClient cliente = new System.Net.Mail.SmtpClient();

            //Hay que crear las credenciales del correo emisor
            cliente.Credentials =
                new System.Net.NetworkCredential("*****@*****.**", "SI2013.");

            //Lo siguiente es obligatorio si enviamos el mensaje desde Gmail

            /*
             * cliente.Port = 587;
             * cliente.EnableSsl = true;
             */
            cliente.Host = "mail.qgchile.cl";
            /*-------------------------ENVIO DE CORREO----------------------*/

            try
            {
                //Enviamos el mensaje
                cliente.Send(mmsg);
                return(true);
                //Label1.Text = "enviado correctamente";
            }
            catch (System.Net.Mail.SmtpException ex)
            {
                return(false);
                //Aquí gestionamos los errores al intentar enviar el correo
                //Label1.Text = "error al enviar el correo";
            }
        }
Пример #13
0
 /// <summary>
 /// Constructor de la clase.
 /// </summary>
 /// <param name="orden">Criterio de ordenación.</param>
 public QuickSort(Orden orden) : base(orden)
 {
 }
Пример #14
0
        public async Task <List <Alquiler> > ListarPorFechaResumido(DateTime inicio, DateTime fin, Orden orden)
        {
            string peticion = "SELECT al.id, al.fechaInicio, al.fechaFin, " +
                              "v.matricula, v.modelo," +
                              "m.nombre, " +
                              "c.dni, c.nombre " +
                              "FROM alquileres al " +
                              "INNER JOIN clientes c " +
                              "ON c.dni = al.dni " +
                              "AND al.fechaInicio >= @inicio " +
                              "AND al.fechaFin <= @fin " +
                              "INNER JOIN vehiculos v " +
                              "ON v.matricula = al.matricula " +
                              "INNER JOIN marcas m " +
                              "ON m.id = v.idMarca " +
                              "ORDER BY @orden";

            var conexion = ContextoBD.GetInstancia().GetConexion();

            conexion.Open();
            MySqlCommand command    = new MySqlCommand(peticion, conexion);
            string       ordenarPor = "";

            ;
            switch (orden)
            {
            case Orden.CLIENTE:
                ordenarPor = "c.dni";
                break;

            case Orden.FECHA:
                ordenarPor = "al.fechaInicio";
                break;

            case Orden.MATRICULA:
                ordenarPor = "v.matricula";
                break;
            }

            command.Parameters.AddWithValue("@orden", ordenarPor);
            command.Parameters.AddWithValue("@inicio", inicio);
            command.Parameters.AddWithValue("@fin", fin);
            command.Prepare();

            List <Alquiler> alquileres = new List <Alquiler>();

            try
            {
                DbDataReader reader = await command.ExecuteReaderAsync();

                if (reader.HasRows)
                {
                    Alquiler alquiler;

                    while (reader.Read())
                    {
                        alquiler = new Alquiler()
                        {
                            Id          = reader.GetInt32(0),
                            FechaInicio = reader.GetDateTime(1),
                            FechaFin    = reader.GetDateTime(2),
                            Vehiculo    = new Vehiculo()
                            {
                                Matricula = reader.GetString(3),
                                Modelo    = reader.GetString(4),
                                Marca     = new Marca()
                                {
                                    Nombre = reader.GetString(5)
                                },
                            },
                            Cliente = new Cliente()
                            {
                                Dni    = reader.GetString(6),
                                Nombre = reader.GetString(7)
                            }
                        };

                        alquileres.Add(alquiler);
                    }
                }
            }
            catch (DbException ex)
            {
                Console.WriteLine(ex);
                throw ex;
            }
            finally
            {
                conexion.Close();
            }

            return(alquileres);
        }
Пример #15
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Orden ordenes = OrdenBLL.Buscar((int)OrdenIdTextBox.Text.ToInt());

            return(ordenes != null);
        }
Пример #16
0
 /// <summary>
 /// Constructor de la clase
 /// </summary>
 /// <param name="orden">Criterio de ordenación del vector.</param>
 public Inserción(Orden orden):base(orden){}
Пример #17
0
 public OrdenBuilder(Orden ord)
 {
     _orden = ord;
 }
Пример #18
0
    public void CrearOrden()
    {
        Console.WriteLine("Creando Orden");
        Console.WriteLine("=============");
        Console.WriteLine("");

        Console.WriteLine("Ingrese el numero de mesa: ");
        string codigoCliente = Console.ReadLine();

        Cliente cliente = ListadeClientes.Find(c => c.Codigo.ToString() == codigoCliente);

        if (cliente == null)
        {
            Console.WriteLine("Mesa no encontrada");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Cliente: " + cliente.Nombre);
            Console.WriteLine("");
        }

        int nuevoCodigo = ListaOrdenes.Count + 1;

        Orden nuevaOrden = new Orden(nuevoCodigo, DateTime.Now, "SPS" + nuevoCodigo, cliente);

        ListaOrdenes.Add(nuevaOrden);

        while (true)
        {
            Console.WriteLine("¿DESEA AGREGAR UNA PIZZA? s/n");
            string continuar1 = Console.ReadLine();
            if (continuar1.ToLower() == "n")
            {
                break;
            }
            Console.WriteLine("*********** INGRESE EL PRODUCTO **********");
            Console.WriteLine(".");
            Console.WriteLine("************ P  I  Z  Z  A  S ************");
            Console.WriteLine("==========================================");
            Console.WriteLine("1 | Pizza Jamon    (12 piezas) | L. 199.00");
            Console.WriteLine("2 | Pizza Peperoni (12 piezas) | L. 199.00");
            Console.WriteLine("3 | Pizza Suprema  (12 piezas) | L. 199.00");


            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListadeProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("Producto no encontrado");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Producto agregado: " + producto.Descripcion + " con precio de: " + producto.Precio);
                nuevaOrden.AgregarProducto(producto);
            }

            Console.WriteLine("¿DESEA CONTINUAR? s/n");
            string continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }

        while (true)
        {
            Console.WriteLine("¿DESEA AGREGAR UNA ENTRADA? s/n");
            string continuar1 = Console.ReadLine();
            if (continuar1.ToLower() == "n")
            {
                break;
            }

            Console.WriteLine("*********** INGRESE EL PRODUCTO **********");
            Console.WriteLine(".");
            Console.WriteLine("********** E  N  T  R  A  D  A  S **********");
            Console.WriteLine("============================================");
            Console.WriteLine("4 | Pan de Ajo     (4 Unidades)  | L.  89.00");
            Console.WriteLine("5 | Alitas Picante (6 Unidades)  | L. 149.00");
            Console.WriteLine("6 | Pechurricas    (8 Unidades)  | L. 129.00");

            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListadeProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("Producto no encontrado");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Producto agregado: " + producto.Descripcion + " con precio de: " + producto.Precio);
                nuevaOrden.AgregarProducto(producto);
            }

            Console.WriteLine("¿DESEA CONTINUAR? s/n");
            string continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }

        while (true)
        {
            Console.WriteLine("¿DESEA AGREGAR UNA BEBIDA? s/n");
            string continuar1 = Console.ReadLine();
            if (continuar1.ToLower() == "n")
            {
                break;
            }

            Console.WriteLine("***** INGRESE EL PRODUCTO ******");
            Console.WriteLine(".");
            Console.WriteLine("****** B  E  B  I  D  A  S *****");
            Console.WriteLine("================================");
            Console.WriteLine("7 | Personal (Pepsi) | L.  29.00");
            Console.WriteLine("8 | 2 Litros (Pepsi) | L.  42.00");

            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListadeProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("Producto no encontrado");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Producto agregado: " + producto.Descripcion + " con precio de: " + producto.Precio);
                nuevaOrden.AgregarProducto(producto);
            }

            Console.WriteLine("¿DESEA CONTINUAR? s/n");
            string continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }

        Console.WriteLine("");
        Console.WriteLine("Total de la orden es de: " + nuevaOrden.Total);
        Console.ReadLine();
    }
 public void EnviarOrden(Orden ordenRecibida)
 {
     //simular procesamiento de orden
     orden = ordenRecibida;
 }
        public ActionResult Pagar()
        {
            if (!ModelState.IsValid)
            {
                return(View("Index"));
            }

            //consulto el usuario logueado
            var currentUser = System.Web.HttpContext.Current.User as CustomPrincipal;

            if (currentUser == null)
            {
                return(RedirectToAction("Index", "Account"));
            }

            var clientConfiguration = new MemcachedClientConfiguration {
                Protocol = MemcachedProtocol.Binary
            };

            clientConfiguration.Servers.Add(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 32769));
            ServiceProxyB2C.CrearOrdenResponse response = new ServiceProxyB2C.CrearOrdenResponse();
            using (var client = new MemcachedClient(clientConfiguration))
            {
                //consulto el cache del usuario logueado
                var cart = client.Get <Cart>("Cart-" + currentUser.UserName);

                if (cart != null)
                {
                    var proxy = new ServiceProxyB2CClient();

                    // se crea una nueva orden
                    Orden orden = new Orden();

                    // se deja el estado en validacion
                    orden.estatus     = EstatusOrden.VALIDACION;
                    orden.fecha_orden = DateTime.Now;

                    // se crea una nueva lista de items del carrito
                    List <ServiceProxyB2C.Item> lstitem = new List <ServiceProxyB2C.Item>();
                    foreach (Models.Item item in cart.Items)
                    {
                        ServiceProxyB2C.Item itemorden = new ServiceProxyB2C.Item();
                        itemorden.id_prod = item.Producto.id_producto;
                        // el servicio pide el nombre del producto, en el carrito no hay se coloca el nombre del espectaculo
                        itemorden.nombre_prod = item.Producto.espectaculo;

                        // en el servicio se pide el precio, se deja un valor fijo para ajustar modelo
                        itemorden.precio   = 100000;
                        itemorden.cantidad = item.Cantidad;
                        lstitem.Add(itemorden);
                    }
                    orden.item = lstitem.ToArray();

                    response = proxy.CrearOrdenes(orden);
                }
                else
                {
                    response.id_orden               = "";
                    response.estatus_orden          = EstatusOrden.RECHAZADA;
                    response.estatus_ordenSpecified = false;
                }
            }
            return(View("_Compra", response));
        }
Пример #21
0
 public bool registrarOrden(Orden o)
 {
     return(ordenDA.registrarOrden(o));
 }
Пример #22
0
 /// <summary>
 /// Constructor de la clase.
 /// </summary>
 /// <param name="orden">Criterio de ordenación.</param>
 public QuickSort(Orden orden) : base(orden) {  }
Пример #23
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            var    sid  = context.HttpContext.User.FindFirst(ClaimTypes.Sid).Value;
            var    role = context.HttpContext.User.FindFirst(ClaimTypes.Role).Value;
            string idencabezado;

            try
            {
                idencabezado = context.HttpContext.Request.RouteValues["id"].ToString();
            }
            catch (NullReferenceException err)
            {
                idencabezado = null;
            }

            var _repository     = context.HttpContext.RequestServices.GetService(TypeOfRepository);
            var ActionParameter = context.ActionArguments;


            if (role == Enum.GetName(typeof(RoleType), RoleType.Administrator) || role == Enum.GetName(typeof(RoleType), RoleType.Programmer))
            {
                return;
            }

            if (_repository is IRepository <Usuario> )
            {
                var _userRepository = _repository as IRepository <Usuario>;



                if (!string.IsNullOrEmpty(idencabezado))
                {
                    if (sid == idencabezado)
                    {
                        return;
                    }
                    else
                    {
                        context.Result = new UnauthorizedObjectResult("");
                    }
                }

                else if (ActionParameter.Count > 0)
                {
                    var parameter = context.ActionArguments["entity"] as UsuarioDto;

                    if (parameter.Id.ToString() != sid)
                    {
                        context.Result = new UnauthorizedObjectResult("");
                    }
                }
            }

            if (_repository is IRepository <Orden> )
            {
                var _ordenRepository = _repository as IRepository <Orden>;
                if (!string.IsNullOrEmpty(idencabezado))
                {
                    Orden orden = _ordenRepository.Find(o => o.IdUser.ToString() == idencabezado);

                    if (orden == null)
                    {
                        return;
                    }

                    if (sid == orden.IdUser.ToString())
                    {
                        return;
                    }
                    else
                    {
                        context.Result = new UnauthorizedObjectResult("No tienes autorizacion para modificar esta entidad!");
                    }
                }

                else if (ActionParameter.Count > 0)
                {
                    var parameter = context.ActionArguments["entity"] != null ? context.ActionArguments["entity"] as OrdenDto : context.ActionArguments["administer"] as OrdenDto;

                    Orden orden = _ordenRepository.Find(o => o.IdUser == parameter.Id);

                    if (orden.IdUser != parameter.IdUser)
                    {
                        context.Result = new UnauthorizedObjectResult("No puedes modificar el propietario de una entidad!");
                    }

                    if (parameter.IdUser.ToString() != sid)
                    {
                        context.Result = new UnauthorizedObjectResult("No tienes autorizacion para modificar esta entidad!");
                    }
                }
            }

            if (_repository is IRepository <OrdenComment> )
            {
                var _ordenRepository = _repository as IRepository <OrdenComment>;
                if (!string.IsNullOrEmpty(idencabezado))
                {
                    OrdenComment orden = _ordenRepository.Find(o => o.IdUser.ToString() == idencabezado);

                    if (orden == null)
                    {
                        return;
                    }

                    if (sid == orden.IdUser.ToString())
                    {
                        return;
                    }
                    else
                    {
                        context.Result = new UnauthorizedObjectResult("No tienes autorizacion para modificar esta entidad!");
                    }
                }

                else if (ActionParameter.Count > 0)
                {
                    var parameter = context.ActionArguments["entity"] != null ? context.ActionArguments["entity"] as OrdenCommentDto : context.ActionArguments["administer"] as OrdenCommentDto;

                    OrdenComment orden = _ordenRepository.Find(o => o.IdUser == parameter.Id);

                    if (orden.IdUser != parameter.IdUser)
                    {
                        context.Result = new UnauthorizedObjectResult("No puedes modificar el propietario de una entidad!");
                    }

                    if (parameter.IdUser.ToString() != sid)
                    {
                        context.Result = new UnauthorizedObjectResult("No tienes autorizacion para modificar esta entidad!");
                    }
                }
            }
        }
Пример #24
0
 public ActionResult CrearOrden([FromBody] Orden model)
 {
     return(Ok(
                ordenService.Save(model)
                ));
 }
Пример #25
0
        private void boton_productosExtras(object sender, EventArgs e)
        {
            Orden ord = Owner as Orden;

            int subindice;

            botonSel6 = sender as Button;
            //botonSel6.BackColor = Color.Yellow;

            precios = new Clases.ClasePreciosItems(Convert.ToInt32(botonSel6.AccessibleName));

            int   existe   = 0;
            float cantidad = 0;
            float valoru   = 0;

            try
            {
                if (precios.llenarDatos() == true)
                {
                    subindice = int.Parse(botonSel6.Tag.ToString());

                    for (int i = 0; i < ord.dgvPedido.Rows.Count; i++)
                    {
                        if (ord.dgvPedido.Rows[i].Cells["producto"].Value.Equals(botonSel6.Text.ToString().Trim()))
                        {
                            cantidad = float.Parse(ord.dgvPedido.Rows[i].Cells["cantidad"].Value.ToString().Trim());
                            cantidad = cantidad + 1;

                            ord.dgvPedido.Rows[i].Cells["cantidad"].Value = cantidad;
                            valoru = float.Parse(ord.dgvPedido.Rows[i].Cells["valuni"].Value.ToString().Trim());
                            ord.dgvPedido.Rows[i].Cells["valor"].Value = cantidad * valoru * Program.factorPrecio;
                            Program.factorPrecio = 1;

                            existe = 1;
                        }
                    }


                    if (existe == 0)
                    {
                        int x = 0;
                        x = ord.dgvPedido.Rows.Add();
                        ord.dgvPedido.Rows[x].Cells["cod"].Value      = 2;
                        ord.dgvPedido.Rows[x].Cells["producto"].Value = botonSel6.Text.ToString().Trim();
                        sNombreProducto_P = botonSel6.Text.ToString().Trim();
                        ord.dgvPedido.Rows[x].Cells["cantidad"].Value              = 1;
                        ord.dgvPedido.Rows[x].Cells["guardada"].Value              = 0;
                        ord.dgvPedido.Rows[x].Cells["idProducto"].Value            = modificadores.modificadores[subindice].sIdModificador;
                        ord.dgvPedido.Rows[x].Cells["cortesia"].Value              = 0;
                        ord.dgvPedido.Rows[x].Cells["motivoCortesia"].Value        = "";
                        ord.dgvPedido.Rows[x].Cells["cancelar"].Value              = 0;
                        ord.dgvPedido.Rows[x].Cells["motivoCancelacion"].Value     = "";
                        ord.dgvPedido.Rows[x].Cells["colIdMascara"].Value          = "";
                        ord.dgvPedido.Rows[x].Cells["colSecuenciaImpresion"].Value = iSecuencia.ToString();
                        ord.dgvPedido.Rows[x].Cells["colOrdenamiento"].Value       = "";
                        ord.dgvPedido.Rows[x].Cells["colIdOrden"].Value            = "";
                        sPagaIva_P = botonSel6.AccessibleDescription.ToString().Trim();
                        ord.dgvPedido.Rows[x].Cells["pagaIva"].Value = sPagaIva_P;

                        if (sPagaIva_P == "")
                        {
                            ord.dgvPedido.Rows[x].DefaultCellStyle.ForeColor    = Color.Blue;
                            ord.dgvPedido.Rows[x].Cells["cantidad"].ToolTipText = sNombreProducto_P.Trim().ToUpper() + " PAGA IVA";
                            ord.dgvPedido.Rows[x].Cells["producto"].ToolTipText = sNombreProducto_P.Trim().ToUpper() + " PAGA IVA";
                            ord.dgvPedido.Rows[x].Cells["valor"].ToolTipText    = sNombreProducto_P.Trim().ToUpper() + " PAGA IVA";
                        }

                        else
                        {
                            ord.dgvPedido.Rows[x].DefaultCellStyle.ForeColor    = Color.Purple;
                            ord.dgvPedido.Rows[x].Cells["cantidad"].ToolTipText = sNombreProducto_P.Trim().ToUpper() + " NO PAGA IVA";
                            ord.dgvPedido.Rows[x].Cells["producto"].ToolTipText = sNombreProducto_P.Trim().ToUpper() + " NO PAGA IVA";
                            ord.dgvPedido.Rows[x].Cells["valor"].ToolTipText    = sNombreProducto_P.Trim().ToUpper() + " NO PAGA IVA";
                        }

                        cantidad = float.Parse("1");

                        ord.dgvPedido.Rows[x].Cells["valuni"].Value = precios.precios[0].sPreciosItems;
                        valoru = float.Parse(precios.precios[0].sPreciosItems);
                        ord.dgvPedido.Rows[x].Cells["valor"].Value = Math.Round((cantidad * valoru * Program.factorPrecio), 2);
                        Program.factorPrecio = 1;

                        if (Program.factorPrecio != 1)
                        {
                            ord.dgvPedido.Rows[x].Cells["cantidad"].Value = 0.5;
                            cantidad = 0.5f;
                        }


                        Program.factorPrecio = 1;
                    }
                }

                ord.calcularTotales();
            }
            catch (Exception)
            {
                ok.LblMensaje.Text = "No hay precio en este producto ";
                ok.ShowInTaskbar   = false;
                ok.ShowDialog();
            }
        }
Пример #26
0
 public bool Save(Orden b)
 {
     return(OrdenRepository.Save(b));
 }
Пример #27
0
    public void CrearOrden()
    {
        Console.WriteLine("Creando Viaje");
        Console.WriteLine("=============");
        Console.WriteLine("");

        Console.WriteLine("Ingrese el codigo del Colaborador: ");
        Console.WriteLine("1. Rocio: ");
        Console.WriteLine("2. Catheryn: ");
        string codigoCliente = Console.ReadLine();

        Cliente cliente = ListadeClientes.Find(c => c.Codigo.ToString() == codigoCliente);

        if (cliente == null)
        {
            Console.WriteLine("Colaborador no encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Colaborador: " + cliente.Nombre);
            Console.WriteLine("");
        }

        Console.WriteLine("Ingrese el codigo del Transportista: ");
        Console.WriteLine("1. Toño: ");
        Console.WriteLine("2. Carlos ");
        string codigoVendedor = Console.ReadLine();

        Vendedor vendedor = ListadeVendedores.Find(v => v.Codigo.ToString() == codigoVendedor);

        if (vendedor == null)
        {
            Console.WriteLine("Transportista no encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Transportista: " + vendedor.Nombre);
            Console.WriteLine("");
        }

        int nuevoCodigo = ListaOrdenes.Count + 1;

        Orden nuevaOrden = new Orden(nuevoCodigo, DateTime.Now, "SPS" + nuevoCodigo, cliente, vendedor);

        ListaOrdenes.Add(nuevaOrden);

        while (true)
        {
            Console.WriteLine("Ingrese las colonias: ");
            Console.WriteLine("1. Santa Martha: ");
            Console.WriteLine("2. Aldea del Carmen: ");
            Console.WriteLine("3. De sula: ");
            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListadeProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("colonia no encontrada");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Colonia agregado: " + producto.Descripcion + " con precio de : " + producto.Precio);
                nuevaOrden.AgregarProducto(producto);
            }

            Console.WriteLine("Desea cregistrar otro viaje? s/n");
            string continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }

        Console.WriteLine("");
        Console.WriteLine("El total del viaje: " + nuevaOrden.Total);
        Console.ReadLine();
    }
        private bool ExisteEnBaseDatos()
        {
            Orden orden = OrdenesBLL.Buscar(int.Parse(OrdenIdTextBox.Text));

            return(orden != null);
        }
        public Task RegistrarOrdenDePago(Orden orden)
        {
            _dbContext.Ordenes.Add(orden);

            return(Task.FromResult(orden));
        }
Пример #30
0
    public void CrearOrden()
    {
        Console.WriteLine("Creando Orden");
        Console.WriteLine("=============");
        Console.WriteLine("");

        Console.WriteLine("Ingrese el codigo del cliente: ");
        string codigoCliente = Console.ReadLine();

        Cliente cliente = ListadeClientes.Find(c => c.Codigo.ToString() == codigoCliente);

        if (cliente == null)
        {
            Console.WriteLine("Cliente no encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Cliente: " + cliente.Nombre);
            Console.WriteLine("");
        }

        Console.WriteLine("Ingrese el codigo del vendedor: ");
        string codigoVendedor = Console.ReadLine();

        Vendedor vendedor = ListadeVendedores.Find(v => v.Codigo.ToString() == codigoVendedor);

        if (vendedor == null)
        {
            Console.WriteLine("Vendedor no encontrado");
            Console.ReadLine();
            return;
        }
        else
        {
            Console.WriteLine("Vendedor: " + vendedor.Nombre);
            Console.WriteLine("");
        }

        int nuevoCodigo = ListaOrdenes.Count + 1;

        Orden nuevaOrden = new Orden(nuevoCodigo, DateTime.Now, "SPS" + nuevoCodigo, cliente, vendedor);

        ListaOrdenes.Add(nuevaOrden);

        while (true)
        {
            Console.WriteLine("Ingrese el producto: ");
            string   codigoProducto = Console.ReadLine();
            Producto producto       = ListadeProductos.Find(p => p.Codigo.ToString() == codigoProducto);
            if (producto == null)
            {
                Console.WriteLine("Producto no encontrado");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Producto agregado: " + producto.Descripcion + " con precio de: " + producto.Precio);
                nuevaOrden.AgregarProducto(producto);
            }

            Console.WriteLine("Desea continuar? s/n");
            string continuar = Console.ReadLine();
            if (continuar.ToLower() == "n")
            {
                break;
            }
        }

        Console.WriteLine("");
        Console.WriteLine("Total de la orden es de: " + nuevaOrden.Total);
        Console.ReadLine();
    }
Пример #31
0
        public List <SqlParameter> SetParametersAddHeaderOrden(Orden datos)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@p1", SqlDbType = SqlDbType.NVarChar, Value = datos.Numero
                },
                new SqlParameter()
                {
                    ParameterName = "@p2", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha
                },
                new SqlParameter()
                {
                    ParameterName = "@p3", SqlDbType = SqlDbType.DateTime, Value = datos.Fecha_produccion
                },
                new SqlParameter()
                {
                    ParameterName = "@p4", SqlDbType = SqlDbType.NVarChar, Value = datos.Product_id
                },
                new SqlParameter()
                {
                    ParameterName = "@p5", SqlDbType = SqlDbType.NVarChar, Value = datos.Rollid_1
                },
                new SqlParameter()
                {
                    ParameterName = "@p6", SqlDbType = SqlDbType.Decimal, Value = datos.Width_1
                },
                new SqlParameter()
                {
                    ParameterName = "@p7", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght_1
                },
                new SqlParameter()
                {
                    ParameterName = "@p8", SqlDbType = SqlDbType.NVarChar, Value = datos.Rollid_2
                },
                new SqlParameter()
                {
                    ParameterName = "@p9", SqlDbType = SqlDbType.Decimal, Value = datos.Width_2
                },
                new SqlParameter()
                {
                    ParameterName = "@p10", SqlDbType = SqlDbType.Decimal, Value = datos.Lenght_2
                },
                new SqlParameter()
                {
                    ParameterName = "@p11", SqlDbType = SqlDbType.Bit, Value = datos.Anulada
                },
                new SqlParameter()
                {
                    ParameterName = "@p12", SqlDbType = SqlDbType.Bit, Value = datos.Procesado
                },
                new SqlParameter()
                {
                    ParameterName = "@p13", SqlDbType = SqlDbType.Decimal, Value = datos.Inch_Ancho
                },
                new SqlParameter()
                {
                    ParameterName = "@p14", SqlDbType = SqlDbType.Decimal, Value = datos.Longitud_Cortar
                },
                new SqlParameter()
                {
                    ParameterName = "@p15", SqlDbType = SqlDbType.Int, Value = datos.Cortes_Ancho
                },
                new SqlParameter()
                {
                    ParameterName = "@p16", SqlDbType = SqlDbType.Int, Value = datos.Cortes_Largo
                },
                new SqlParameter()
                {
                    ParameterName = "@p17", SqlDbType = SqlDbType.Int, Value = datos.Cantidad_Rollos
                },
                new SqlParameter()
                {
                    ParameterName = "@p18", SqlDbType = SqlDbType.Decimal, Value = datos.Descartable1_pies
                },
                new SqlParameter()
                {
                    ParameterName = "@p19", SqlDbType = SqlDbType.Decimal, Value = datos.Master_lenght1_Real
                },
                new SqlParameter()
                {
                    ParameterName = "@p20", SqlDbType = SqlDbType.Decimal, Value = datos.Util1_Real_Width
                },
                new SqlParameter()
                {
                    ParameterName = "@p21", SqlDbType = SqlDbType.Decimal, Value = datos.Util1_real_Lenght
                },
                new SqlParameter()
                {
                    ParameterName = "@p22", SqlDbType = SqlDbType.Decimal, Value = datos.Rest1_width
                },
                new SqlParameter()
                {
                    ParameterName = "@p23", SqlDbType = SqlDbType.Decimal, Value = datos.Rest1_lenght
                },
                new SqlParameter()
                {
                    ParameterName = "@p24", SqlDbType = SqlDbType.Decimal, Value = datos.Descartable2_pies
                },
                new SqlParameter()
                {
                    ParameterName = "@p25", SqlDbType = SqlDbType.Decimal, Value = datos.Master_lenght2_Real
                },
                new SqlParameter()
                {
                    ParameterName = "@p26", SqlDbType = SqlDbType.Decimal, Value = datos.Util2_Real_Width
                },
                new SqlParameter()
                {
                    ParameterName = "@p27", SqlDbType = SqlDbType.Decimal, Value = datos.Util2_real_Lenght
                },
                new SqlParameter()
                {
                    ParameterName = "@p28", SqlDbType = SqlDbType.Decimal, Value = datos.Rest2_width
                },
                new SqlParameter()
                {
                    ParameterName = "@p29", SqlDbType = SqlDbType.Decimal, Value = datos.Rest2_lenght
                },
                new SqlParameter()
                {
                    ParameterName = "@p30", SqlDbType = SqlDbType.Int, Value = datos.Cortes_Largo2
                },
                new SqlParameter()
                {
                    ParameterName = "@p31", SqlDbType = SqlDbType.Int, Value = datos.Cantidad_Rollos2
                },
                new SqlParameter()
                {
                    ParameterName = "@p32", SqlDbType = SqlDbType.NChar, Value = datos.Tipo_Mov1
                },
                new SqlParameter()
                {
                    ParameterName = "@p33", SqlDbType = SqlDbType.NChar, Value = datos.Tipo_Mov2
                }
            };

            return(sp);
        }
Пример #32
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            bool isEmpty = !Helper.Llenos(txtEquipo, txtObservaciones, txtFolio);

            if (cliente == null || isEmpty)
            {
                return;
            }

            int      folio         = int.Parse(txtFolio.Text);
            string   equipo        = txtEquipo.Text;
            string   observaciones = txtObservaciones.Text;
            DateTime recepcion     = cdtpFechaRecepcion.Value;

            var orden = new Orden()
            {
                Folio          = folio,
                Equipo         = equipo,
                FechaRecepcion = recepcion,
                Observaciones  = observaciones,
                Status         = (int)OrdenStatus.ESPERA,
                IdCliente      = cliente.Id
            };

            var res = OrdenValidator.Validate(orden);

            if (ShowErrorValidation.Valid(res))
            {
                orden = OrdenController.I.Add(orden);
            }


            if (orden == null)
            {
                MessageBox.Show("Error al agregar a la base de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }

            //Agrega el estado de la orden al historial
            var ordenHistorial = new OrdenHistorial()
            {
                IdOrden     = orden.Id,
                FechaStatus = DateTime.Now,
                Status      = (int)OrdenStatus.ESPERA
            };

            res = OrdenHistorialValidator.Validate(ordenHistorial);
            if (ShowErrorValidation.Valid(res))
            {
                var saved = OrdenHistorialController.I.Add(ordenHistorial);
                if (saved == null)
                {
                    MessageBox.Show("No se puede agregar al historial de ordenes", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (orden != null)
            {
                Helper.VaciarTexto(txtFolio, txtEquipo, txtObservaciones, txtTelefono, txtDireccion, txtCliente);
                Console.WriteLine(orden.ToString());
                orden          = null;
                cliente        = null;
                ordenHistorial = null;
            }
        }
Пример #33
0
        public Orden ObtenerHistorialOrden(string numRastreo)
        {
            Orden  o         = new Orden();
            string conString = "SERVER=;" + "DATABASE=;" + "UID=;" + "PASSWORD=;";

            try
            {
                using (MySqlConnection connection = new MySqlConnection(conString))
                {
                    using (MySqlCommand cmd = connection.CreateCommand())
                    {
                        connection.Open();
                        cmd.CommandText = "SELECT o.numeroRastreo, o.fecha, " +
                                          "h.descripcion, h.fecha AS 'fechaH', h.estado AS 'estadoH', h.ciudad AS 'ciudadH'," +
                                          "d.nombre, d.calle, d.numero, d.avenida, d.colonia, d.cp, d.ciudad, d.estado, d.referencia, p.tamanio" +
                                          " FROM orden o INNER JOIN historial h ON o.id = h.idOrden INNER JOIN destinatario d ON o.idDestinatario = d.id INNER JOIN paquete p ON p.id = o.idPaquete WHERE o.numeroRastreo = '" + numRastreo + "';";
                        cmd.CommandType = CommandType.Text;
                        cmd.Connection  = connection;
                        MySqlDataReader reader = cmd.ExecuteReader();


                        List <Historial> historiales = new List <Historial>();

                        while (reader.Read())
                        {
                            Historial h = new Historial();
                            h.Fecha       = reader["fechaH"].ToString();
                            h.Descripcion = reader["descripcion"].ToString();
                            h.Ciudad      = reader["ciudadH"].ToString();
                            h.Estado      = reader["estadoH"].ToString();
                            historiales.Add(h);

                            Destinatario d = new Destinatario();
                            d.Nombre     = reader["nombre"].ToString();
                            d.Calle      = reader["calle"].ToString();
                            d.Numero     = reader["numero"].ToString();
                            d.Avenida    = reader["avenida"].ToString();
                            d.Colonia    = reader["colonia"].ToString();
                            d.Cp         = reader["cp"].ToString();
                            d.Ciudad     = reader["ciudad"].ToString();
                            d.Estado     = reader["estado"].ToString();
                            d.Referencia = reader["referencia"].ToString();



                            Paquete p = new Paquete();
                            p.Tamanio = reader["tamanio"].ToString();


                            o.NumeroRastreo = reader["numeroRastreo"].ToString();
                            o.Fecha         = reader["fecha"].ToString();
                            o.Paquete       = p;
                            o.Destinatario  = d;
                            o.Historiales   = historiales;
                        }

                        ;
                    }
                }
            }catch (Exception ex)
            {
                throw ex;
            }

            return(o);
        }
Пример #34
0
 public Object D_All(int __a, string __b)
 {
     try
     {
         if (__a == 0 || __a == 1 || __a == 9 || __a == 12 || __a == 17 || __a == 18)
         {
             DataSet       ds            = new Conexion().ejecutarDataSet("SP_REGISTRO_PRODUCTOPROMO", __a, __b);
             List <Combos> oLisfiltro    = new List <Combos>();
             var           obListafiltro = (from DataRow v_campos in ds.Tables[0].Rows
                                            select new
             {
                 ID = v_campos["ID"],
                 NOMBRE = v_campos["NOMBRE"]
             }).ToList();
             foreach (var p in obListafiltro)
             {
                 Combos lis = new Combos();
                 lis.ID     = Convert.ToInt32(p.ID);
                 lis.NOMBRE = Convert.ToString(p.NOMBRE);
                 oLisfiltro.Add(lis);
             }
             return(obListafiltro);
         }
         else if (__a == 3 || __a == 6)
         {
             DataSet ds = new Conexion().ejecutarDataSet("SP_REGISTRO_PRODUCTOPROMO", __a, __b);
             List <Producto_Promo> oLisfiltro = new List <Producto_Promo>();
             var obLista = (from DataRow v_campos in ds.Tables[0].Rows
                            select new
             {
                 ID = v_campos["ID"],
                 NOMBRE = v_campos["NOMBRE"],
                 PRECIO = v_campos["PRECIO"],
                 CANTIDAD = v_campos["CANTIDAD"],
                 BNOMBRE = v_campos["BNOMBRE"],
                 PNOMBRE = v_campos["PNOMBRE"],
                 IMAGEN = v_campos["IMAGEN"]
             }).ToList();
             foreach (var p in obLista)
             {
                 Producto_Promo lis = new Producto_Promo();
                 lis.ID       = Convert.ToInt32(p.ID);
                 lis.NOMBRE   = Convert.ToString(p.NOMBRE);
                 lis.PRECIO   = Convert.ToString(p.PRECIO);
                 lis.CANTIDAD = Convert.ToInt32(p.CANTIDAD);
                 lis.BNOMBRE  = Convert.ToString(p.BNOMBRE);
                 lis.PNOMBRE  = Convert.ToString(p.PNOMBRE);
                 lis.IMAGEN   = Convert.ToString(p.IMAGEN);
                 oLisfiltro.Add(lis);
             }
             return(obLista);
         }
         else if (__a == 4 || __a == 7 || __a == 10 || __a == 11 || __a == 13 || __a == 14 || __a == 15)
         {
             int res;
             res = Convert.ToInt32(cn.ejecutarEscalar("SP_REGISTRO_PRODUCTOPROMO", __a, __b));
             return(res);
         }
         else if (__a == 5)
         {
             DataSet         ds            = new Conexion().ejecutarDataSet("SP_REGISTRO_PRODUCTOPROMO", __a, __b);
             List <Cantidad> oLisfiltro    = new List <Cantidad>();
             var             obListafiltro = (from DataRow v_campos in ds.Tables[0].Rows
                                              select new
             {
                 ID = v_campos["ID"],
                 CANTIDAD = v_campos["CANTIDAD"]
             }).ToList();
             foreach (var p in obListafiltro)
             {
                 Cantidad lis = new Cantidad();
                 lis.ID       = Convert.ToInt32(p.ID);
                 lis.CANTIDAD = Convert.ToInt32(p.CANTIDAD);
                 oLisfiltro.Add(lis);
             }
             return(obListafiltro);
         }
         else if (__a == 8)
         {
             DataSet      ds            = new Conexion().ejecutarDataSet("SP_REGISTRO_PRODUCTOPROMO", __a, __b);
             List <Orden> oLisfiltro    = new List <Orden>();
             var          obListafiltro = (from DataRow v_campos in ds.Tables[0].Rows
                                           select new
             {
                 ID = v_campos["ID"],
                 TOKEN = v_campos["TOKEN"],
                 ID_PRODPROM = v_campos["ID_PRODPROM"],
                 NOMBREPROD = v_campos["NOMBREPROD"],
                 CANTIDAD = v_campos["CANTIDAD"],
                 PRECIO = v_campos["PRECIO"],
                 FECHAORDEN = v_campos["FECHAORDEN"],
                 IMAGENPROD = v_campos["IMAGENPROD"],
                 COMENTARIO = v_campos["COMENTARIO"],
                 NOMBRE_ESTADO = v_campos["NOMBRE_ESTADO"]
             }).ToList();
             foreach (var p in obListafiltro)
             {
                 Orden lis = new Orden();
                 lis.ID            = Convert.ToInt32(p.ID);
                 lis.TOKEN         = Convert.ToString(p.TOKEN);
                 lis.ID_PRODPROM   = Convert.ToInt32(p.ID_PRODPROM);
                 lis.NOMBREPROD    = Convert.ToString(p.NOMBREPROD);
                 lis.CANTIDAD      = Convert.ToInt32(p.CANTIDAD);
                 lis.PRECIO        = Convert.ToString(p.PRECIO);
                 lis.FECHAORDEN    = Convert.ToString(p.FECHAORDEN);
                 lis.IMAGENPROD    = Convert.ToString(p.IMAGENPROD);
                 lis.COMENTARIO    = Convert.ToString(p.COMENTARIO);
                 lis.NOMBRE_ESTADO = Convert.ToString(p.NOMBRE_ESTADO);
                 oLisfiltro.Add(lis);
             }
             return(obListafiltro);
         }
         else if (__a == 16)
         {
             DataSet            ds         = new Conexion().ejecutarDataSet("SP_REGISTRO_PRODUCTOPROMO", __a, __b);
             List <OrdenGlobal> oLisfiltro = new List <OrdenGlobal>();
             var obListafiltro             = (from DataRow v_campos in ds.Tables[0].Rows
                                              select new
             {
                 ID = v_campos["ID"],
                 TOKEN = v_campos["TOKEN"],
                 ID_PRODPROM = v_campos["ID_PRODPROM"],
                 NOMBREPROD = v_campos["NOMBREPROD"],
                 CANTIDAD = v_campos["CANTIDAD"],
                 PRECIO = v_campos["PRECIO"],
                 FECHAORDEN = v_campos["FECHAORDEN"],
                 IMAGENPROD = v_campos["IMAGENPROD"],
                 COMENTARIO = v_campos["COMENTARIO"],
                 NOMBRE_ESTADO = v_campos["NOMBRE_ESTADO"],
                 NOMBRES = v_campos["NOMBRES"]
             }).ToList();
             foreach (var p in obListafiltro)
             {
                 OrdenGlobal lis = new OrdenGlobal();
                 lis.ID            = Convert.ToInt32(p.ID);
                 lis.TOKEN         = Convert.ToString(p.TOKEN);
                 lis.ID_PRODPROM   = Convert.ToInt32(p.ID_PRODPROM);
                 lis.NOMBREPROD    = Convert.ToString(p.NOMBREPROD);
                 lis.CANTIDAD      = Convert.ToInt32(p.CANTIDAD);
                 lis.PRECIO        = Convert.ToString(p.PRECIO);
                 lis.FECHAORDEN    = Convert.ToString(p.FECHAORDEN);
                 lis.IMAGENPROD    = Convert.ToString(p.IMAGENPROD);
                 lis.COMENTARIO    = Convert.ToString(p.COMENTARIO);
                 lis.NOMBRE_ESTADO = Convert.ToString(p.NOMBRE_ESTADO);
                 lis.NOMBRES       = Convert.ToString(p.NOMBRES);
                 oLisfiltro.Add(lis);
             }
             return(obListafiltro);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #35
0
 /// <summary>
 /// Constructor de la clase.
 /// </summary>
 /// <param name="orden">Criterio de ordenación.</param>
 public Selección(Orden orden) : base(orden) { }