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.PatternCompressionImage obj = this.SetDAL(this.Context.Context); this.Context.Context.DeleteObject(obj); } } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.PatternCompressionImage obj = this.SetDAL(objContext.Context); this.Context.Context.DeleteObject(obj); objContext.Context.SaveChanges(); objContext.Dispose(); } }
internal Indico.DAL.PatternCompressionImage SetDAL(IndicoEntities context) { this._doNotUpdateDALObject = true; // set the Indico.DAL.PatternCompressionImage properties Indico.DAL.PatternCompressionImage obj = new Indico.DAL.PatternCompressionImage(); if (this.ID > 0) { obj = context.PatternCompressionImage.FirstOrDefault <PatternCompressionImage>(o => o.ID == this.ID); } obj.Extension = this.Extension; obj.Filename = this.Filename; if (_patternsWhereThisIsPatternCompressionImageLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.PatternBO.ToEntityList(this.PatternsWhereThisIsPatternCompressionImage, context), obj.PatternsWhereThisIsPatternCompressionImage); } this._doNotUpdateDALObject = false; return(obj); }
/// <summary> /// Creates an instance of the PatternCompressionImageBO class using the supplied Indico.DAL.PatternCompressionImage. /// </summary> /// <param name="obj">a Indico.DAL.PatternCompressionImage whose properties will be used to initialise the PatternCompressionImageBO</param> internal PatternCompressionImageBO(Indico.DAL.PatternCompressionImage obj, ref IndicoContext context) { this._doNotUpdateDALObject = true; this.Context = context; // set the properties from the Indico.DAL.PatternCompressionImage this.ID = obj.ID; this.Extension = obj.Extension; this.Filename = obj.Filename; this._doNotUpdateDALObject = false; }
public void Add() { if (this.Context != null) { this.Context.Context.AddToPatternCompressionImage(this.ObjDAL); } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.PatternCompressionImage obj = this.SetDAL(objContext.Context); objContext.Context.AddToPatternCompressionImage(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.PatternCompressionImage)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.PatternCompressionImage obj = (Indico.DAL.PatternCompressionImage)eObj; // set the Indico.BusinessObjects.PatternCompressionImageBO properties this.ID = obj.ID; this.Extension = obj.Extension; this.Filename = obj.Filename; this._doNotUpdateDALObject = false; }