private void btnRecibirEntrega_Click(object sender, EventArgs e)
        {
            string token    = Session.Token;
            int    idClient = Session.IdProfile;

            Session.id = lblNSolicitudCompra.Text;
            int id = Convert.ToInt32(Session.id);
            //var comentario = txtComentario.Text;

            dynamic purchaseRequest = new System.Dynamic.ExpandoObject();

            purchaseRequest.id = id;
            purchaseRequest.idPurchaseRequestStatus = 8;

            var updateStatusById = VirtualFairIntegration.UpdateStatusById(token, purchaseRequest);

            if (updateStatusById.statusCode == 200)
            {
                string text  = updateStatusById.message;
                string title = "Información";
                MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information);

                var purchaseRequestBack = new PurchaseRequestExternal();
                purchaseRequestBack.Show();
                this.Close();
            }
        }
        private void btnVolver_Click(object sender, EventArgs e)
        {
            this.Close();

            var purchaseRequestExternal = new PurchaseRequestExternal();

            purchaseRequestExternal.Show();
        }
示例#3
0
        private void btnAgregarSolicitud_Click_1(object sender, EventArgs e)
        {
            if (cmbProducts.Items.Count == 0)
            {
                string text  = "No existen productos para comprar.";
                string title = "Información";
                MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();

                var purchaseRequestExternal = new PurchaseRequestExternal();
                purchaseRequestExternal.Show();
            }
            else
            {
                var peso = nudPesoKg.Value;
                int idPurchaseRequest = Convert.ToInt32(cmbProducts.SelectedValue.ToString());
                var nombreProducto    = cmbProducts.Text;
                //var comentario = txtComentario.Text;
                var refri = chkRequiereRefrigeracion.Checked;

                var refriValue = refri ? 1 : 0;

                var refrigeracion = refri ? "Si" : "No";

                var pr          = nombreProducto.Split('$');
                var pr1         = pr[1].Split(' ');
                var precioFinal = pr1[0];

                var filenamesList = new BindingList <AddProducts>(items);

                // var asdf1 = filenamesList.Where(x=> x.id == )

                if (filenamesList.Where(x => x.idProduct == idPurchaseRequest).FirstOrDefault() == null)
                {
                    AddProducts products = new AddProducts();

                    for (int z = 0; z <= Session.lstProducts.Count - 1; z++)
                    {
                        if (Session.lstProducts.Where(x => x.id == Session.lstProducts[z].id).First().id == idPurchaseRequest)
                        {
                            products.idProduct = Session.lstProducts.Where(x => x.id == Session.lstProducts[z].id).First().idProduct;
                        }
                    }

                    decimal precio = (peso * Convert.ToInt32(precioFinal));

                    products.id = Convert.ToInt32(idPurchaseRequest);
                    //products.idProduct = Convert.ToInt32(idProducto);
                    products.nameProduct = nombreProducto;
                    products.weight      = Convert.ToInt32(peso);
                    products.price       = Convert.ToString(precio);
                    products.requieresRefrigerationBool = refriValue;
                    products.requiresRefrigeration      = refrigeracion;

                    items.Add(products);

                    dgvProducts.DataSource = filenamesList;

                    dgvProducts.Update();
                    dgvProducts.Refresh();

                    nudPesoKg.Value = 0;
                    chkRequiereRefrigeracion.Checked = false;
                }
                else
                {
                    string text  = "No se puede agregar dos veces el mismo producto, favor eliminar y volver a agregar.";
                    string title = "Información";
                    MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }