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.SizeSet obj = this.SetDAL(this.Context.Context); this.Context.Context.DeleteObject(obj); } } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.SizeSet obj = this.SetDAL(objContext.Context); this.Context.Context.DeleteObject(obj); objContext.Context.SaveChanges(); objContext.Dispose(); } }
internal Indico.DAL.SizeSet SetDAL(IndicoEntities context) { this._doNotUpdateDALObject = true; // set the Indico.DAL.SizeSet properties Indico.DAL.SizeSet obj = new Indico.DAL.SizeSet(); if (this.ID > 0) { obj = context.SizeSet.FirstOrDefault <SizeSet>(o => o.ID == this.ID); } obj.Description = this.Description; obj.Name = this.Name; if (_patternsWhereThisIsSizeSetLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.PatternBO.ToEntityList(this.PatternsWhereThisIsSizeSet, context), obj.PatternsWhereThisIsSizeSet); } if (_sizesWhereThisIsSizeSetLoaded) { BusinessObject.SynchroniseEntityList( Indico.BusinessObjects.SizeBO.ToEntityList(this.SizesWhereThisIsSizeSet, context), obj.SizesWhereThisIsSizeSet); } this._doNotUpdateDALObject = false; return(obj); }
/// <summary> /// Creates an instance of the SizeSetBO class using the supplied Indico.DAL.SizeSet. /// </summary> /// <param name="obj">a Indico.DAL.SizeSet whose properties will be used to initialise the SizeSetBO</param> internal SizeSetBO(Indico.DAL.SizeSet obj, ref IndicoContext context) { this._doNotUpdateDALObject = true; this.Context = context; // set the properties from the Indico.DAL.SizeSet 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.AddToSizeSet(this.ObjDAL); } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.SizeSet obj = this.SetDAL(objContext.Context); objContext.Context.AddToSizeSet(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.SizeSet)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.SizeSet obj = (Indico.DAL.SizeSet)eObj; // set the Indico.BusinessObjects.SizeSetBO properties this.ID = obj.ID; this.Description = obj.Description; this.Name = obj.Name; this._doNotUpdateDALObject = false; }