private void CheckWeight(TextBox pObjtextBox) { float lFlWeight = 0; if (pObjtextBox.Text.Length > 0 && pObjtextBox.Text.Trim().Length > 0) { lFlWeight = float.Parse(pObjtextBox.Text); } BatchDivisionDTO lObjBatchDivisionDTO = (BatchDivisionDTO)dgBatch.CurrentItem; if (lFlWeight > 0 && lFlWeight <= mFlWeight) { lObjBatchDivisionDTO.TotalWeight = 0; if ((GetTotalWeights() + float.Parse(pObjtextBox.Text)) <= mFlWeight) { lObjBatchDivisionDTO.TotalWeight = float.Parse(pObjtextBox.Text); lObjBatchDivisionDTO.AverageWeight = lObjBatchDivisionDTO.TotalWeight / lObjBatchDivisionDTO.HeadQtty; } else { lObjBatchDivisionDTO.TotalWeight = GetWeight(lObjBatchDivisionDTO.HeadQtty.ToString()); lObjBatchDivisionDTO.AverageWeight = lObjBatchDivisionDTO.TotalWeight / lObjBatchDivisionDTO.HeadQtty; } } else { CustomMessageBox.Show("AtenciĆ³n", "El peso total no debe ser mayor al peso del lote original"); } UpdateDataGrid(lObjBatchDivisionDTO.HeadQtty); }
private void CheckQuantities(TextBox pObjtextBox) { BatchDivisionDTO lObjBatchDivisionDTO = (BatchDivisionDTO)dgBatch.CurrentItem; lObjBatchDivisionDTO.HeadQtty = 0; mIntHeadQuantity = GetBatchQuantity(mObjBatch) - GetHeads(); if (!string.IsNullOrEmpty(pObjtextBox.Text) && pObjtextBox.Text.Length > 0 && pObjtextBox.Text.Trim().Length != 0) { if ((Convert.ToInt32(pObjtextBox.Text) <= mIntHeadQuantity) && (Convert.ToInt32(pObjtextBox.Text) > 0)) { lObjBatchDivisionDTO.TotalWeight = GetWeight(pObjtextBox.Text); lObjBatchDivisionDTO.HeadQtty = Convert.ToInt32(pObjtextBox.Text); lObjBatchDivisionDTO.AverageWeight = lObjBatchDivisionDTO.TotalWeight / lObjBatchDivisionDTO.HeadQtty; lObjBatchDivisionDTO.CellActive = true; } else { lObjBatchDivisionDTO.TotalWeight = 0; lObjBatchDivisionDTO.HeadQtty = 0; lObjBatchDivisionDTO.AverageWeight = 0; lObjBatchDivisionDTO.BuyerClassification = 0; lObjBatchDivisionDTO.BuyerName = string.Empty; lObjBatchDivisionDTO.CellActive = false; } } UpdateDataGrid(lObjBatchDivisionDTO.HeadQtty); }
private void LoadDatagrid() { //FormLoading(); try { //mLstObjBatchDivision = mObjAuctionsFactory.GetBatchService().GetBatchDivisionListToPick(mObjAuction != null ? mObjAuction.Id : 0, mObjBatch.Id); mLstObjBatchDivision = new List <BatchDivisionDTO>(); this.Dispatcher.Invoke(() => { dgBatch.ItemsSource = null; BatchDivisionDTO lObj = new BatchDivisionDTO(); mLstObjBatchDivision.Add(lObj); dgBatch.ItemsSource = mLstObjBatchDivision; dgBatch.Items.Refresh(); //SetControlsAuction(lObjAuction); }); } catch (Exception) { throw; } }
private void SetBuyerClassificationObject(PartnerClassification partnerClassification, TextBox pObjTextbox) { if (partnerClassification != null) { BatchDivisionDTO lObjBatchDivisionDTO = (BatchDivisionDTO)dgBatch.CurrentItem; lObjBatchDivisionDTO.BuyerClassification = partnerClassification.Number; lObjBatchDivisionDTO.BuyerName = partnerClassification.Name; pObjTextbox.Text = partnerClassification.Number.ToString(); mObjBuyerClassification = partnerClassification; if (dgBatch.Items.Count == dgBatch.SelectedIndex + 1) { //new row BatchDivisionDTO lObj = new BatchDivisionDTO(); mLstObjBatchDivision.Add(lObj); dgBatch.Items.Refresh(); } } else { pObjTextbox.Text = string.Empty; mObjBuyerClassification = null; } }
private void txtHeadQtty_TextChanged(object pObjSender, TextChangedEventArgs pObjArgs) { if (Convert.ToInt32((pObjSender as TextBox).Text) > 0) { BatchDivisionDTO lObjBatchDivisionDTO = (BatchDivisionDTO)dgBatch.CurrentItem; lObjBatchDivisionDTO.CellActive = true; dgBatch.Items.Refresh(); } }
private void UpdateDataGrid(int pIntHeadQtty) { try { if (dgBatch.Items.Count == dgBatch.SelectedIndex + 1 && pIntHeadQtty > 0) { //new row BatchDivisionDTO lObj = new BatchDivisionDTO(); mLstObjBatchDivision.Add(lObj); } dgBatch.Items.Refresh(); } catch (Exception) { } }