コード例 #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.DesignType obj = this.SetDAL(this.Context.Context);
             this.Context.Context.DeleteObject(obj);
         }
     }
     else
     {
         IndicoContext         objContext = new IndicoContext();
         Indico.DAL.DesignType obj        = this.SetDAL(objContext.Context);
         this.Context.Context.DeleteObject(obj);
         objContext.Context.SaveChanges();
         objContext.Dispose();
     }
 }
コード例 #2
0
        internal Indico.DAL.DesignType SetDAL(IndicoEntities context)
        {
            this._doNotUpdateDALObject = true;

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

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

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


            if (_quoteDetailsWhereThisIsDesignTypeLoaded)
            {
                BusinessObject.SynchroniseEntityList(
                    Indico.BusinessObjects.QuoteDetailBO.ToEntityList(this.QuoteDetailsWhereThisIsDesignType, context),
                    obj.QuoteDetailsWhereThisIsDesignType);
            }

            this._doNotUpdateDALObject = false;

            return(obj);
        }
コード例 #3
0
        /// <summary>
        /// Creates an instance of the DesignTypeBO class using the supplied Indico.DAL.DesignType.
        /// </summary>
        /// <param name="obj">a Indico.DAL.DesignType whose properties will be used to initialise the DesignTypeBO</param>
        internal DesignTypeBO(Indico.DAL.DesignType obj, ref IndicoContext context)
        {
            this._doNotUpdateDALObject = true;

            this.Context = context;

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

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

            this._doNotUpdateDALObject = false;
        }
コード例 #4
0
 public void Add()
 {
     if (this.Context != null)
     {
         this.Context.Context.AddToDesignType(this.ObjDAL);
     }
     else
     {
         IndicoContext         objContext = new IndicoContext();
         Indico.DAL.DesignType obj        = this.SetDAL(objContext.Context);
         objContext.Context.AddToDesignType(obj);
         objContext.SaveChanges();
         objContext.Dispose();
     }
 }
コード例 #5
0
        internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj)
        {
            this._doNotUpdateDALObject = true;

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

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

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

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


            this._doNotUpdateDALObject = false;
        }