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