void OrdersWhereThisIsPaymentMethodList_OnBeforeRemove(object sender, EventArgs e) { Indico.DAL.Order obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.OrderBO>)sender)[((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count - 1].ObjDAL; this.ObjDAL.OrdersWhereThisIsPaymentMethod.Remove(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.OrderBO>)sender)[((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.OrdersWhereThisIsPaymentMethod.Remove(obj); objContext.SaveChanges(); objContext.Dispose(); } }
void OrdersWhereThisIsStatusList_OnAfterAdd(object sender, EventArgs e) { Indico.DAL.Order obj = null; if (this.Context != null) { if (((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count > 0) { obj = ((IndicoList <Indico.BusinessObjects.OrderBO>)sender)[((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count - 1].ObjDAL; this.ObjDAL.OrdersWhereThisIsStatus.Add(obj); } } else { IndicoContext objContext = new IndicoContext(); obj = ((IndicoList <Indico.BusinessObjects.OrderBO>)sender)[((IndicoList <Indico.BusinessObjects.OrderBO>)sender).Count - 1].SetDAL(objContext.Context); this.ObjDAL.OrdersWhereThisIsStatus.Add(obj); objContext.SaveChanges(); objContext.Dispose(); } }