void PatternOtherCategorysWhereThisIsCategoryList_OnBeforeRemove(object sender, EventArgs e) { Indico.DAL.Pattern obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.PatternBO>)sender)[((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count - 1].ObjDAL; this.ObjDAL.PatternOtherCategorysWhereThisIsCategory.Remove(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.PatternBO>)sender)[((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.PatternOtherCategorysWhereThisIsCategory.Remove(obj); objContext.SaveChanges(); objContext.Dispose(); } }
void PatternsWhereThisIsGenderList_OnAfterAdd(object sender, EventArgs e) { Indico.DAL.Pattern obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.PatternBO>)sender)[((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count - 1].ObjDAL; this.ObjDAL.PatternsWhereThisIsGender.Add(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.PatternBO>)sender)[((IndicoList <Indico.BusinessObjects.PatternBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.PatternsWhereThisIsGender.Add(obj); objContext.SaveChanges(); objContext.Dispose(); } }