/// <summary> /// Bind all the required lookup values. /// </summary> /// <remarks>Created: Werner Scheffer 28/11/2011</remarks> public override void OpenRecord(Int64 Id) { base.OpenRecord(Id); try { glxRecon = BL.GLX.GLX_Recon.Load(Id, DataContext); openRecordRecon = DataContext.ReadonlyContext.VW_Recon.FirstOrDefault(n => n.Id == (int)Id); } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }
internal static String Save(DB.GLX_Recon entry, DataContext dataContext) { try { if (dataContext.EntityAccountingContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached) { dataContext.EntityAccountingContext.GLX_Recon.Add(entry); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
/// <summary> /// Bind a blank new record to the form. /// </summary> /// <remarks>Created: Werner Scheffer 28/11/2011</remarks> protected override void OnNewRecord() { try { base.OnNewRecord(); isNew = true; glxRecon = BL.GLX.GLX_Recon.New; BindingSourceLines.DataSource = null; btnCancelRecon.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; changeset = new List <Int64>(); RecalcLineTotal(); } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }
//public static DB.GLX_Recon GetNextItem(DB.GLX_Recon glx_recon, DataContext dataContext) //{ // return dataContext.EntitySystemContext.SYS_Recon.OrderBy(o => o.StartDate).Where(n => n.StartDate > glx_recon.StartDate && n.StartDate != glx_recon.StartDate).FirstOrDefault(); //} //public static DB.GLX_Recon GetPreviousItem(DB.GLX_Recon glx_recon, DataContext dataContext) //{ // return dataContext.EntitySystemContext.SYS_Recon.OrderByDescending(o => o.StartDate).Where(n => n.StartDate > glx_recon.StartDate && n.StartDate != glx_recon.StartDate).FirstOrDefault(); //} public static void RejectRecon(DB.GLX_Recon glx_recon, DataContext dataContext) { glx_recon.StatusId = (byte)SYS.SYS_Status.Rejected; dataContext.EntityAccountingContext.ExecuteSqlCommand(string.Format("UPDATE [CDS_GLX].[GLX_Line] set ReconId = null WHERE ReconId = {0}", glx_recon.Id)); }