Exemplo n.º 1
0
 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.ProductSequence obj = this.SetDAL(this.Context.Context);
             this.Context.Context.DeleteObject(obj);
         }
     }
     else
     {
         IndicoContext objContext       = new IndicoContext();
         Indico.DAL.ProductSequence obj = this.SetDAL(objContext.Context);
         this.Context.Context.DeleteObject(obj);
         objContext.Context.SaveChanges();
         objContext.Dispose();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance of the ProductSequenceBO class using the supplied Indico.DAL.ProductSequence.
        /// </summary>
        /// <param name="obj">a Indico.DAL.ProductSequence whose properties will be used to initialise the ProductSequenceBO</param>
        internal ProductSequenceBO(Indico.DAL.ProductSequence obj, ref IndicoContext context)
        {
            this._doNotUpdateDALObject = true;

            this.Context = context;

            // set the properties from the Indico.DAL.ProductSequence
            this.ID = obj.ID;

            this.Description = obj.Description;
            this.Number      = obj.Number;

            this._doNotUpdateDALObject = false;
        }
Exemplo n.º 3
0
 public void Add()
 {
     if (this.Context != null)
     {
         this.Context.Context.AddToProductSequence(this.ObjDAL);
     }
     else
     {
         IndicoContext objContext       = new IndicoContext();
         Indico.DAL.ProductSequence obj = this.SetDAL(objContext.Context);
         objContext.Context.AddToProductSequence(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }
Exemplo n.º 4
0
        internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj)
        {
            this._doNotUpdateDALObject = true;

            // Check the received type
            if (eObj.GetType() != typeof(Indico.DAL.ProductSequence))
            {
                throw new FormatException("Received wrong parameter type...");
            }

            Indico.DAL.ProductSequence obj = (Indico.DAL.ProductSequence)eObj;

            // set the Indico.BusinessObjects.ProductSequenceBO properties
            this.ID = obj.ID;

            this.Description = obj.Description;
            this.Number      = obj.Number;


            this._doNotUpdateDALObject = false;
        }
Exemplo n.º 5
0
        internal Indico.DAL.ProductSequence SetDAL(IndicoEntities context)
        {
            this._doNotUpdateDALObject = true;

            // set the Indico.DAL.ProductSequence properties
            Indico.DAL.ProductSequence obj = new Indico.DAL.ProductSequence();

            if (this.ID > 0)
            {
                obj = context.ProductSequence.FirstOrDefault <ProductSequence>(o => o.ID == this.ID);
            }

            obj.Description = this.Description;
            obj.Number      = this.Number;



            this._doNotUpdateDALObject = false;

            return(obj);
        }