void ArtWorksWhereThisIsResolutionProfileList_OnBeforeRemove(object sender, EventArgs e) { Indico.DAL.ArtWork obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender)[((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count - 1].ObjDAL; this.ObjDAL.ArtWorksWhereThisIsResolutionProfile.Remove(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender)[((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.ArtWorksWhereThisIsResolutionProfile.Remove(obj); objContext.SaveChanges(); objContext.Dispose(); } }
void ArtWorksWhereThisIsPocketTypeList_OnAfterAdd(object sender, EventArgs e) { Indico.DAL.ArtWork obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender)[((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count - 1].ObjDAL; this.ObjDAL.ArtWorksWhereThisIsPocketType.Add(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender)[((IndicoList <Indico.BusinessObjects.ArtWorkBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.ArtWorksWhereThisIsPocketType.Add(obj); objContext.SaveChanges(); objContext.Dispose(); } }