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.OrderStatus obj = this.SetDAL(this.Context.Context);
             this.Context.Context.DeleteObject(obj);
         }
     }
     else
     {
         IndicoContext          objContext = new IndicoContext();
         Indico.DAL.OrderStatus obj        = this.SetDAL(objContext.Context);
         this.Context.Context.DeleteObject(obj);
         objContext.Context.SaveChanges();
         objContext.Dispose();
     }
 }
Ejemplo n.º 2
0
        internal Indico.DAL.OrderStatus SetDAL(IndicoEntities context)
        {
            this._doNotUpdateDALObject = true;

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

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

            obj.Description = this.Description;
            obj.Name        = this.Name;
            obj.Sequence    = this.Sequence;


            if (_ordersWhereThisIsStatusLoaded)
            {
                BusinessObject.SynchroniseEntityList(
                    Indico.BusinessObjects.OrderBO.ToEntityList(this.OrdersWhereThisIsStatus, context),
                    obj.OrdersWhereThisIsStatus);
            }

            this._doNotUpdateDALObject = false;

            return(obj);
        }
Ejemplo n.º 3
0
 public void Add()
 {
     if (this.Context != null)
     {
         this.Context.Context.AddToOrderStatus(this.ObjDAL);
     }
     else
     {
         IndicoContext          objContext = new IndicoContext();
         Indico.DAL.OrderStatus obj        = this.SetDAL(objContext.Context);
         objContext.Context.AddToOrderStatus(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates an instance of the OrderStatusBO class using the supplied Indico.DAL.OrderStatus.
        /// </summary>
        /// <param name="obj">a Indico.DAL.OrderStatus whose properties will be used to initialise the OrderStatusBO</param>
        internal OrderStatusBO(Indico.DAL.OrderStatus obj, ref IndicoContext context)
        {
            this._doNotUpdateDALObject = true;

            this.Context = context;

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

            this.Description = obj.Description;
            this.Name        = obj.Name;
            this.Sequence    = obj.Sequence;

            this._doNotUpdateDALObject = false;
        }
Ejemplo n.º 5
0
        internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj)
        {
            this._doNotUpdateDALObject = true;

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

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

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

            this.Description = obj.Description;
            this.Name        = obj.Name;
            this.Sequence    = obj.Sequence;


            this._doNotUpdateDALObject = false;
        }