private void btnVolver_Click(object sender, EventArgs e) { this.Close(); var salesProcesses = new SalesProcesses(); salesProcesses.Show(); }
private void btnDiscardParticipation_Click(object sender, EventArgs e) { string token = Session.Token; dynamic parameters = new System.Dynamic.ExpandoObject(); parameters.idPurchaseRequest = Session.id; parameters.idProducer = Session.IdProfile; var discardParticipation = VirtualFairIntegration.DestroySalesProcessesProducer(token, parameters); if (discardParticipation.statusCode == 200) { string text = discardParticipation.message; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); var salesProcesses = new SalesProcesses(); salesProcesses.Show(); this.Close(); } }
private void btnSaveChanges_Click(object sender, EventArgs e) { List <string> lstNamesProducts = Session.lstNamesProducts; string valuePrice = ""; string valueKg = ""; string token = Session.Token; var idPurchaseRequest = Session.id; var findByIdPurchaseRequest = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); //Peso ofrecido Kg List <string> lstIdProducts = new List <string>(); int countId = 0; foreach (var item1 in findByIdPurchaseRequest.purchaseRequestProducts) { //Session.idProduct = item1.id; lstIdProducts.Add(item1.id.ToString()); } var purchaseRequestProducers = new List <dynamic>(); foreach (var item in lstNamesProducts) { valueKg = String.Concat("nudPesoOfrecido", item); valuePrice = String.Concat("nudValor", item); Control ctrl = this.Controls.Find(valueKg.ToString(), true).FirstOrDefault(); Control ctrl1 = this.Controls.Find(valuePrice.ToString(), true).FirstOrDefault(); if (ctrl != null) { if (ctrl is NumericUpDown) { dynamic participate = new System.Dynamic.ExpandoObject(); NumericUpDown kg = ctrl as NumericUpDown; NumericUpDown price = ctrl1 as NumericUpDown; participate.idPurchaseRequestProduct = Convert.ToInt32(lstIdProducts[countId]); countId++; participate.idProducer = Convert.ToInt32(Session.IdProfile); participate.weight = kg.Value; participate.price = price.Value; purchaseRequestProducers.Add(participate); } } } var createMassive = VirtualFairIntegration.CreateMassiveProducer(token, purchaseRequestProducers); if (createMassive.statusCode == 201) { string text = createMassive.message; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); var salesProcesses = new SalesProcesses(); salesProcesses.Show(); this.Close(); } else { } }