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.IndimanPriceRemarks obj = this.SetDAL(this.Context.Context); this.Context.Context.DeleteObject(obj); } } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.IndimanPriceRemarks obj = this.SetDAL(objContext.Context); this.Context.Context.DeleteObject(obj); objContext.Context.SaveChanges(); objContext.Dispose(); } }
internal Indico.DAL.IndimanPriceRemarks SetDAL(IndicoEntities context) { this._doNotUpdateDALObject = true; // set the Indico.DAL.IndimanPriceRemarks properties Indico.DAL.IndimanPriceRemarks obj = new Indico.DAL.IndimanPriceRemarks(); if (this.ID > 0) { obj = context.IndimanPriceRemarks.FirstOrDefault <IndimanPriceRemarks>(o => o.ID == this.ID); } obj.CreatedDate = this.CreatedDate; obj.Creator = this.Creator; obj.Remarks = this.Remarks; if (this.Price > 0) { obj.Price = context.Price.FirstOrDefault(o => o.ID == this.Price); } 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.IndimanPriceRemarks)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.IndimanPriceRemarks obj = (Indico.DAL.IndimanPriceRemarks)eObj; // set the Indico.BusinessObjects.IndimanPriceRemarksBO properties this.ID = obj.ID; this.CreatedDate = obj.CreatedDate; this.Creator = obj.Creator; this.Remarks = obj.Remarks; this.Price = (obj.PriceReference.EntityKey != null && obj.PriceReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PriceReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
public void Add() { if (this.Context != null) { this.Context.Context.AddToIndimanPriceRemarks(this.ObjDAL); } else { IndicoContext objContext = new IndicoContext(); Indico.DAL.IndimanPriceRemarks obj = this.SetDAL(objContext.Context); objContext.Context.AddToIndimanPriceRemarks(obj); objContext.SaveChanges(); objContext.Dispose(); } }
/// <summary> /// Creates an instance of the IndimanPriceRemarksBO class using the supplied Indico.DAL.IndimanPriceRemarks. /// </summary> /// <param name="obj">a Indico.DAL.IndimanPriceRemarks whose properties will be used to initialise the IndimanPriceRemarksBO</param> internal IndimanPriceRemarksBO(Indico.DAL.IndimanPriceRemarks obj, ref IndicoContext context) { this._doNotUpdateDALObject = true; this.Context = context; // set the properties from the Indico.DAL.IndimanPriceRemarks this.ID = obj.ID; this.CreatedDate = obj.CreatedDate; this.Creator = obj.Creator; this.Price = (obj.PriceReference.EntityKey != null && obj.PriceReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PriceReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Remarks = obj.Remarks; this._doNotUpdateDALObject = false; }