Example #1
0
 void ProductsWhereThisIsPrinterList_OnBeforeRemove(object sender, EventArgs e)
 {
     Indico.DAL.Product obj = null;
     if (this.Context != null)
     {
         if (((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count > 0)
         {
             obj = ((IndicoList <Indico.BusinessObjects.ProductBO>)sender)[((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count - 1].ObjDAL;
             this.ObjDAL.ProductsWhereThisIsPrinter.Remove(obj);
         }
     }
     else
     {
         IndicoContext objContext = new IndicoContext();
         obj = ((IndicoList <Indico.BusinessObjects.ProductBO>)sender)[((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count - 1].SetDAL(objContext.Context);
         this.ObjDAL.ProductsWhereThisIsPrinter.Remove(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }
 void ProductsWhereThisIsResolutionProfileList_OnAfterAdd(object sender, EventArgs e)
 {
     Indico.DAL.Product obj = null;
     if (this.Context != null)
     {
         if (((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count > 0)
         {
             obj = ((IndicoList <Indico.BusinessObjects.ProductBO>)sender)[((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count - 1].ObjDAL;
             this.ObjDAL.ProductsWhereThisIsResolutionProfile.Add(obj);
         }
     }
     else
     {
         IndicoContext objContext = new IndicoContext();
         obj = ((IndicoList <Indico.BusinessObjects.ProductBO>)sender)[((IndicoList <Indico.BusinessObjects.ProductBO>)sender).Count - 1].SetDAL(objContext.Context);
         this.ObjDAL.ProductsWhereThisIsResolutionProfile.Add(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }