private void LoadDgvDetails() { string token = Session.Token; var idPurchaseRequest = Session.id; lblIDProcesoVenta.Visible = true; lblIDProcesoVenta.Text = Session.id; // lblNSolicitudCompra.Text = _loginData.id; var findByIdPurchaseRequest = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); List <AddProducts> lstSalesProcessesDetails = new List <AddProducts>(); if (findByIdPurchaseRequest.countRows != 0) { foreach (var item in findByIdPurchaseRequest.purchaseRequestProducts) { AddProducts pRobject = new AddProducts(); pRobject.nameProduct = item.product.name.ToString(); pRobject.weight = item.weight; pRobject.nameClient = item.purchaseRequest.client.fullName.ToString(); lstSalesProcessesDetails.Add(pRobject); } lblNombreUsuario.Text = lstSalesProcessesDetails[0].nameClient.ToString(); lblDate.Text = String.Concat("Finalizado el ", Session.date); } dgvDetails.AutoGenerateColumns = false; dgvDetails.DataSource = lstSalesProcessesDetails; string[] arrayString = new string[] { "nameProduct", "weight" }; //List<PropertyInfo> lst = typeof(AdminApi).GetProperties().Where(x => x.Name == "id" || x.Name == "fullName" || // x.Name == "email" || x.Name == "nameProfile" ).ToList(); foreach (var item in arrayString) { DataGridViewTextBoxColumn dataGrid = new DataGridViewTextBoxColumn(); dataGrid.DataPropertyName = item; if (item == "nameProduct") { dataGrid.HeaderText = "Nombre producto"; } if (item == "weight") { dataGrid.HeaderText = "Peso Kg"; } dataGrid.Name = item; dgvDetails.Columns.Add(dataGrid); } }
private void LoadDgvSP() { string token = Session.Token; var idPurchaseRequest = Session.id; // lblNSolicitudCompra.Text = _loginData.id; var findByIdPurchaseRequest = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); List <string> lstNamesProducts = new List <string>(); List <AddProducts> lstSalesProcessesDetails = new List <AddProducts>(); if (findByIdPurchaseRequest.countRows != 0) { lblFechaDecision.Visible = true; lblFechaDecision.Text = findByIdPurchaseRequest.purchaseRequestProducts[0].purchaseRequest.desiredDate; lblStatus.Visible = true; lblStatus.Text = findByIdPurchaseRequest.purchaseRequestProducts[0].purchaseRequest.purchaseRequestStatus.name.ToString(); //if (lblStatus.Text == "ACEPTADO POR EL CLIENTE") //{ // lblParticipando.Text = "Eres el Ganador"; //} foreach (var item in findByIdPurchaseRequest.purchaseRequestProducts) { AddProducts pRobject = new AddProducts(); pRobject.idPurchaseRequestProduct = item.id; pRobject.nameProduct = item.product.name.ToString(); pRobject.weight = item.weight; lstSalesProcessesDetails.Add(pRobject); lstNamesProducts.Add(item.product.name.ToString()); } } Session.lstNamesProducts = lstNamesProducts; Session.countRows = findByIdPurchaseRequest.countRows; Session.lstAddProducts = lstSalesProcessesDetails; dgvDetails.AutoGenerateColumns = false; dgvDetails.DataSource = lstSalesProcessesDetails; string[] arrayString = new string[] { "nameProduct", "weight" }; //List<PropertyInfo> lst = typeof(AdminApi).GetProperties().Where(x => x.Name == "id" || x.Name == "fullName" || // x.Name == "email" || x.Name == "nameProfile" ).ToList(); foreach (var item in arrayString) { DataGridViewTextBoxColumn dataGrid = new DataGridViewTextBoxColumn(); dataGrid.DataPropertyName = item; dataGrid.ReadOnly = true; if (item == "nameProduct") { dataGrid.HeaderText = "Nombre producto"; } if (item == "weight") { dataGrid.HeaderText = "Peso Kg"; } dataGrid.Name = item; dgvDetails.Columns.Add(dataGrid); } }
public PurchaseRequestDetails(PurchaseRequestDTO loginData) { _loginData = loginData; InitializeComponent(); var nameUser = Session.NameUser; var nameProfile = Session.NameProfile; lblBienvenido.Text = String.Concat("Bienvenido ", nameUser, " | ", nameProfile.ToUpper()); string token = Session.Token; string idPurchaseRequest = _loginData.id; lblNSolicitudCompra.Text = _loginData.id; var findByIdPurchaseRequest = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); List <AddProducts> listPurchaseRequestDetials = new List <AddProducts>(); if (findByIdPurchaseRequest.countRows != 0) { lblEstado.Text = String.Concat("Estado: ", findByIdPurchaseRequest.purchaseRequestProducts[0].purchaseRequest.purchaseRequestStatus.name); lblDesiredDate.Text = String.Concat("Fecha desea de entrega: ", findByIdPurchaseRequest.purchaseRequestProducts[0].purchaseRequest.desiredDate); foreach (var item in findByIdPurchaseRequest.purchaseRequestProducts) { AddProducts pRobject = new AddProducts(); pRobject.nameProduct = item.product.name.ToString(); pRobject.weight = item.weight; //pRobject.idPurchaseRequestType = purchaseRequest.purchaseRequests[0].idPurchaseRequestType.ToString(); pRobject.remark = item.remark.ToString(); pRobject.requieresRefrigerationBool = item.requiresRefrigeration; if (pRobject.requieresRefrigerationBool == 1) { pRobject.requiresRefrigeration = "Si"; } else if (pRobject.requieresRefrigerationBool == 0) { pRobject.requiresRefrigeration = "No"; } pRobject.agreedPrice = item.agreedPrice.ToString(); listPurchaseRequestDetials.Add(pRobject); } } dgvPurchaseRequestDetails.AutoGenerateColumns = false; dgvPurchaseRequestDetails.DataSource = listPurchaseRequestDetials; string[] arrayString = new string[] { "nameProduct", "weight", "remark", "requiresRefrigeration", "agreedPrice" }; //List<PropertyInfo> lst = typeof(AdminApi).GetProperties().Where(x => x.Name == "id" || x.Name == "fullName" || // x.Name == "email" || x.Name == "nameProfile" ).ToList(); foreach (var item in arrayString) { DataGridViewTextBoxColumn dataGrid = new DataGridViewTextBoxColumn(); dataGrid.DataPropertyName = item; if (item == "nameProduct") { dataGrid.HeaderText = "Nombre producto"; } if (item == "weight") { dataGrid.HeaderText = "Peso Kg"; } else if (item == "remark") { dataGrid.HeaderText = "Comentario"; } else if (item == "requiresRefrigeration") { dataGrid.HeaderText = "Requiere refrigeración"; } else if (item == "agreedPrice") { dataGrid.HeaderText = "Precio acordado"; } dataGrid.Name = item; dgvPurchaseRequestDetails.Columns.Add(dataGrid); } }
private void LoadDetails() { string token = Session.Token; var idPurchaseRequest = Session.id; // lblNSolicitudCompra.Text = _loginData.id; var findByIdPurchaseRequest = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); if (findByIdPurchaseRequest.statusCode == 403) { string text = findByIdPurchaseRequest.message; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); var login = new Login(); login.Show(); this.Close(); } else if (true) { } List <string> lstNamesProducts = new List <string>(); List <AddProducts> lstSalesProcessesDetails = new List <AddProducts>(); if (findByIdPurchaseRequest.countRows != 0) { lblFechaDecision.Visible = true; lblFechaDecision.Text = findByIdPurchaseRequest.purchaseRequestProducts[0].purchaseRequest.desiredDate.ToString(); foreach (var item in findByIdPurchaseRequest.purchaseRequestProducts) { AddProducts pRobject = new AddProducts(); pRobject.nameProduct = item.product.name.ToString(); pRobject.weight = item.weight; lstSalesProcessesDetails.Add(pRobject); lstNamesProducts.Add(item.product.name.ToString()); } } Session.lstNamesProducts = lstNamesProducts; Session.countRows = findByIdPurchaseRequest.countRows; dgvDetails.AutoGenerateColumns = false; dgvDetails.DataSource = lstSalesProcessesDetails; string[] arrayString = new string[] { "nameProduct", "weight" }; //List<PropertyInfo> lst = typeof(AdminApi).GetProperties().Where(x => x.Name == "id" || x.Name == "fullName" || // x.Name == "email" || x.Name == "nameProfile" ).ToList(); foreach (var item in arrayString) { DataGridViewTextBoxColumn dataGrid = new DataGridViewTextBoxColumn(); dataGrid.DataPropertyName = item; dataGrid.ReadOnly = true; if (item == "nameProduct") { dataGrid.HeaderText = "Nombre producto"; } if (item == "weight") { dataGrid.HeaderText = "Peso Kg"; } dataGrid.Name = item; dgvDetails.Columns.Add(dataGrid); } }
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 { } }
private void LoadDetailsAuctions() { string token = Session.Token; dynamic parameters = new System.Dynamic.ExpandoObject(); //parameters.idPurchaseRequest = Session.id; string idPurchaseRequest = Session.idTransportAuction; //var findByIdTransportAuction = VirtualFairIntegration.FindByIdTransportAuction(token, parameters); var findByIdTransportAuction = VirtualFairIntegration.FindByIdPurchaseRequest(token, idPurchaseRequest); List <AdminApi> lstParticipating = new List <AdminApi>(); dgvDetailsAuctions.AutoGenerateColumns = false; if (findByIdTransportAuction.countRows != 0) { lblTipoSubasta.Visible = true; lblFechaDecision.Visible = true; lblFechaDeseada.Visible = true; lblFechaDeseada.Text = findByIdTransportAuction.purchaseRequestProducts[0].purchaseRequest.desiredDate; lblFechaDecision.Text = findByIdTransportAuction.purchaseRequestProducts[0].purchaseRequest.creationDate; lblTipoSubasta.Text = String.Concat(findByIdTransportAuction.purchaseRequestProducts[0].purchaseRequest.purchaseRequestType.name, " ", findByIdTransportAuction.purchaseRequestProducts[0].idPurchaseRequest); lblStatus.Visible = true; lblStatus.Text = findByIdTransportAuction.purchaseRequestProducts[0].purchaseRequest.purchaseRequestStatus.name.ToString(); //if (lblStatus.Text == "ACEPTADO POR EL CLIENTE") // { // lblWinner.Visible = true; // lblWinner.Text = "Eres el ganador"; //} foreach (var item in findByIdTransportAuction.purchaseRequestProducts) { AdminApi users = new AdminApi(); //cambiar variables users.id = Convert.ToInt32(item.id.ToString()); users.fullName = item.product.name.ToString(); //nombre producto users.email = item.weight.ToString(); //peso kg users.city = item.remark.ToString(); //comentario users.address = item.requiresRefrigeration; //requiere refrigeracion if (users.address == "1") { users.country = "Si"; } else { users.country = "No"; } lstParticipating.Add(users); } dgvDetailsAuctions.DataSource = lstParticipating; } string[] arrayString = new string[] { "id", "fullName", "email", "city", "country" }; foreach (var item in arrayString) { DataGridViewTextBoxColumn dataGrid = new DataGridViewTextBoxColumn(); dataGrid.DataPropertyName = item; if (item == "id") //id { dataGrid.HeaderText = "ID"; } else if (item == "fullName") //nombre producto { dataGrid.HeaderText = "Nombre producto"; } else if (item == "email") //peso kg { dataGrid.HeaderText = "Peso Kg"; } else if (item == "city") // comentario { dataGrid.HeaderText = "Comentario"; } else if (item == "country") //requiere refrigeracion { dataGrid.HeaderText = "Requiere Refrigeración"; } dataGrid.Name = item; dgvDetailsAuctions.Columns.Add(dataGrid); } }