public void Delete() { if (this.Context != null) { if (this.ObjDAL != null && this.ObjDAL.EntityKey != null) { if (this.ObjDAL.EntityState == System.Data.EntityState.Detached) { this.Context.Context.Attach(this.ObjDAL); this.Context.Context.DeleteObject(this.ObjDAL); } else { this.Context.Context.DeleteObject(this.ObjDAL); } } else { Indico.DAL.ResolutionProfile obj = this.SetDAL(this.Context.Context); this.Context.Context.DeleteObject(obj); } } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.ResolutionProfile obj = this.SetDAL(objContext.Context); this.Context.Context.DeleteObject(obj); objContext.Context.SaveChanges(); objContext.Dispose(); } }
/// <summary> /// Creates an instance of the ResolutionProfileBO class using the supplied Indico.DAL.ResolutionProfile. /// </summary> /// <param name="obj">a Indico.DAL.ResolutionProfile whose properties will be used to initialise the ResolutionProfileBO</param> internal ResolutionProfileBO(Indico.DAL.ResolutionProfile obj, ref IndicoContext context) { this._doNotUpdateDALObject = true; this.Context = context; // set the properties from the Indico.DAL.ResolutionProfile this.ID = obj.ID; this.Description = obj.Description; this.Name = obj.Name; this._doNotUpdateDALObject = false; }
public void Add() { if (this.Context != null) { this.Context.Context.AddToResolutionProfile(this.ObjDAL); } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.ResolutionProfile obj = this.SetDAL(objContext.Context); objContext.Context.AddToResolutionProfile(obj); objContext.SaveChanges(); objContext.Dispose(); } }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.ResolutionProfile)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.ResolutionProfile obj = (Indico.DAL.ResolutionProfile)eObj; // set the Indico.BusinessObjects.ResolutionProfileBO properties this.ID = obj.ID; this.Description = obj.Description; this.Name = obj.Name; this._doNotUpdateDALObject = false; }
internal Indico.DAL.ResolutionProfile SetDAL(IndicoEntities context) { this._doNotUpdateDALObject = true; // set the Indico.DAL.ResolutionProfile properties Indico.DAL.ResolutionProfile obj = new Indico.DAL.ResolutionProfile(); if (this.ID > 0) { obj = context.ResolutionProfile.FirstOrDefault <ResolutionProfile>(o => o.ID == this.ID); } obj.Description = this.Description; obj.Name = this.Name; if (_artWorksWhereThisIsResolutionProfileLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.ArtWorkBO.ToEntityList(this.ArtWorksWhereThisIsResolutionProfile, context), obj.ArtWorksWhereThisIsResolutionProfile); } if (_productsWhereThisIsResolutionProfileLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.ProductBO.ToEntityList(this.ProductsWhereThisIsResolutionProfile, context), obj.ProductsWhereThisIsResolutionProfile); } if (_visualLayoutsWhereThisIsResolutionProfileLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.VisualLayoutBO.ToEntityList(this.VisualLayoutsWhereThisIsResolutionProfile, context), obj.VisualLayoutsWhereThisIsResolutionProfile); } this._doNotUpdateDALObject = false; return(obj); }