void AddedBagsDataEditor_Ok(object sender, EventArgs e) { ReturnedBagsWrapper rbw = (ReturnedBagsWrapper)AddedBagsDataEditor.DataSource; if (rbw.StackId == Guid.Empty) { errorDisplayer.ShowErrorMessage("Stack is required"); } else if (rbw.Size < 0.0001M) { errorDisplayer.ShowErrorMessage("Wieght is required"); } else if (AddedBagsDataEditor.IsNew) { ginProcess.AddReturnedBags(GINTruckInformation.Weight.TruckId, ((ReturnedBagsWrapper)AddedBagsDataEditor.DataSource).RBInfo); AddedBagsGridViewer.DataBind(); AddedBagsDataEditor.IsNew = false; } else { var editedAddedBags = from addedBags in GINTruckInformation.Weight.AddedBags where addedBags.ReturnedBagsId == ((ReturnedBagsWrapper)AddedBagsDataEditor.DataSource).ReturnedBagsId select addedBags; if (editedAddedBags.Count() > 0) { editedAddedBags.ElementAt(0).Copy(((ReturnedBagsWrapper)AddedBagsDataEditor.DataSource).RBInfo); AddedBagsGridViewer.DataBind(); } } mpeAddedBagsDataEditorExtender.Hide(); }
protected void btnAddAddedBags_Click(object sender, EventArgs e) { AddedBagsDataEditor.IsNew = true; ReturnedBagsWrapper addedBagsWrapper = new ReturnedBagsWrapper(ginProcess.GetBlankReturnedBags(GINTruckInformation.Weight.TruckId), ginProcess.GINProcessInformation.CommodityGradeId, ginProcess.GINProcessInformation.ProductionYear); addedBagsWrapper.Returned = false; AddedBagsDataEditor.DataSource = addedBagsWrapper; AddedBagsDataEditor.DataBind(); mpeAddedBagsDataEditorExtender.Show(); }