protected override void OnNewRecord() { base.OnNewRecord(); //Werner: This need to happen before the BL.AOR.AOR_Order.New or devexpress EditValue_Changed freaks out aorOrder = BL.AOR.AOR_Order.New; aorOrderLines = aorOrder.AOR_OrderLine as List <DB.AOR_OrderLine>; aorFilters = new AutomaticOrderingFilters(); btnCancelOrder.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; }
internal static String Save(DB.AOR_Order entry, DataContext dataContext) { try { if (dataContext.EntityOrderingContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached) { dataContext.EntityOrderingContext.AOR_Order.Add(entry); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
public override void OpenRecord(long Id) { base.OpenRecord(Id); //ShouldRecover = false; is set in base.OpenRecord(Id); //Werner : Need to enable this once I figure out how to solve the recursive reference issue caused by Include //ShouldRecover = true; aorOrder = BL.AOR.AOR_Order.Load(Id, DataContext, new List <string>() { "AOR_OrderLine" }); aorOrderLines = aorOrder.AOR_OrderLine as List <DB.AOR_OrderLine>; aorFilters = new AutomaticOrderingFilters(); btnCalculate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; if (aorOrder.StatusId == (byte)BL.SYS.SYS_Status.Canceled || aorOrder.StatusId == (byte)BL.SYS.SYS_Status.Closed) { AllowSave = false; grvOrderItems.OptionsBehavior.Editable = false; btnCancelOrder.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; btnOrder.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; } grvOrderItems.FocusedRowHandle = aorOrder.LastChangedLine; //Disable all the filters at the top rgItems.Enabled = false; rgSales.Enabled = false; txtCategoryFrom.Enabled = false; txtCategoryTo.Enabled = false; lcgWeights.Enabled = false; ddlCompany.Enabled = false; txtSupplierCodeFrom.Enabled = false; txtSupplierCodeTo.Enabled = false; PopulateFilters(); }