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

            this.Context = context;

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

            this.EmailLogoPath = obj.EmailLogoPath;

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

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

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

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

            this.EmailLogoPath = obj.EmailLogoPath;


            this._doNotUpdateDALObject = false;
        }
Example #5
0
        internal Indico.DAL.EmailLogo SetDAL(IndicoEntities context)
        {
            this._doNotUpdateDALObject = true;

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

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

            obj.EmailLogoPath = this.EmailLogoPath;



            this._doNotUpdateDALObject = false;

            return(obj);
        }