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

            this.Context = context;

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

            this.CreatedDate = obj.CreatedDate;
            this.Name        = obj.Name;

            this._doNotUpdateDALObject = false;
        }
Ejemplo n.º 3
0
 public void Add()
 {
     if (this.Context != null)
     {
         this.Context.Context.AddToAutoOrderNumber(this.ObjDAL);
     }
     else
     {
         IndicoContext objContext       = new IndicoContext();
         Indico.DAL.AutoOrderNumber obj = this.SetDAL(objContext.Context);
         objContext.Context.AddToAutoOrderNumber(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }
Ejemplo 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.AutoOrderNumber))
            {
                throw new FormatException("Received wrong parameter type...");
            }

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

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

            this.CreatedDate = obj.CreatedDate;
            this.Name        = obj.Name;


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

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

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

            obj.CreatedDate = this.CreatedDate;
            obj.Name        = this.Name;



            this._doNotUpdateDALObject = false;

            return(obj);
        }