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.DistributorPriceLevelCostHistory obj = this.SetDAL(this.Context.Context); this.Context.Context.DeleteObject(obj); } } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.DistributorPriceLevelCostHistory obj = this.SetDAL(objContext.Context); this.Context.Context.DeleteObject(obj); objContext.Context.SaveChanges(); objContext.Dispose(); } }
internal Indico.DAL.DistributorPriceLevelCostHistory SetDAL(IndicoEntities context) { this._doNotUpdateDALObject = true; // set the Indico.DAL.DistributorPriceLevelCostHistory properties Indico.DAL.DistributorPriceLevelCostHistory obj = new Indico.DAL.DistributorPriceLevelCostHistory(); if (this.ID > 0) { obj = context.DistributorPriceLevelCostHistory.FirstOrDefault <DistributorPriceLevelCostHistory>(o => o.ID == this.ID); } obj.Distributor = this.Distributor; obj.IndicoCost = this.IndicoCost; obj.ModifiedDate = this.ModifiedDate; obj.Modifier = this.Modifier; obj.PriceLevelCost = this.PriceLevelCost; obj.PriceTerm = this.PriceTerm; this._doNotUpdateDALObject = false; return(obj); }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.DistributorPriceLevelCostHistory)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.DistributorPriceLevelCostHistory obj = (Indico.DAL.DistributorPriceLevelCostHistory)eObj; // set the Indico.BusinessObjects.DistributorPriceLevelCostHistoryBO properties this.ID = obj.ID; this.Distributor = obj.Distributor; this.IndicoCost = obj.IndicoCost; this.ModifiedDate = obj.ModifiedDate; this.Modifier = obj.Modifier; this.PriceLevelCost = obj.PriceLevelCost; this.PriceTerm = obj.PriceTerm; this._doNotUpdateDALObject = false; }
public void Add() { if (this.Context != null) { this.Context.Context.AddToDistributorPriceLevelCostHistory(this.ObjDAL); } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.DistributorPriceLevelCostHistory obj = this.SetDAL(objContext.Context); objContext.Context.AddToDistributorPriceLevelCostHistory(obj); objContext.SaveChanges(); objContext.Dispose(); } }
/// <summary> /// Creates an instance of the DistributorPriceLevelCostHistoryBO class using the supplied Indico.DAL.DistributorPriceLevelCostHistory. /// </summary> /// <param name="obj">a Indico.DAL.DistributorPriceLevelCostHistory whose properties will be used to initialise the DistributorPriceLevelCostHistoryBO</param> internal DistributorPriceLevelCostHistoryBO(Indico.DAL.DistributorPriceLevelCostHistory obj, ref IndicoContext context) { this._doNotUpdateDALObject = true; this.Context = context; // set the properties from the Indico.DAL.DistributorPriceLevelCostHistory this.ID = obj.ID; this.Distributor = obj.Distributor; this.IndicoCost = obj.IndicoCost; this.ModifiedDate = obj.ModifiedDate; this.Modifier = obj.Modifier; this.PriceLevelCost = obj.PriceLevelCost; this.PriceTerm = obj.PriceTerm; this._doNotUpdateDALObject = false; }