public virtual IABazaar.Core.Entities.EventHandler UpdateEventHandler(IABazaar.Core.Entities.EventHandler entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            IABazaar.Core.Entities.EventHandler other = GetEventHandler(entity.EventId);
            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update EventHandler set  [EventName]=@EventName
							, [CalloutURL]=@CalloutURL
							, [XmlPackage]=@XmlPackage
							, [Debug]=@Debug
							, [Active]=@Active 
							 where EventID=@EventID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@EventID", entity.EventId)
                , new SqlParameter("@EventName", entity.EventName)
                , new SqlParameter("@CalloutURL", entity.CalloutUrl)
                , new SqlParameter("@XmlPackage", entity.XmlPackage)
                , new SqlParameter("@Debug", entity.Debug)
                , new SqlParameter("@Active", entity.Active)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetEventHandler(entity.EventId));
        }
        public virtual IABazaar.Core.Entities.EventHandler InsertEventHandler(IABazaar.Core.Entities.EventHandler entity)
        {
            IABazaar.Core.Entities.EventHandler other = new IABazaar.Core.Entities.EventHandler();
            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into EventHandler ( [EventName]
				,[CalloutURL]
				,[XmlPackage]
				,[Debug]
				,[Active] )
				Values
				( @EventName
				, @CalloutURL
				, @XmlPackage
				, @Debug
				, @Active );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@EventID", entity.EventId)
                    , new SqlParameter("@EventName", entity.EventName)
                    , new SqlParameter("@CalloutURL", entity.CalloutUrl)
                    , new SqlParameter("@XmlPackage", entity.XmlPackage)
                    , new SqlParameter("@Debug", entity.Debug)
                    , new SqlParameter("@Active", entity.Active)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetEventHandler(Convert.ToInt32(identity)));
            }
            return(entity);
        }
 public virtual IABazaar.Core.Entities.EventHandler EventHandlerFromDataRow(DataRow dr)
 {
     if (dr == null)
     {
         return(null);
     }
     IABazaar.Core.Entities.EventHandler entity = new IABazaar.Core.Entities.EventHandler();
     entity.EventId    = (System.Int32)dr["EventID"];
     entity.EventName  = dr["EventName"].ToString();
     entity.CalloutUrl = dr["CalloutURL"].ToString();
     entity.XmlPackage = dr["XmlPackage"].ToString();
     entity.Debug      = (System.Boolean)dr["Debug"];
     entity.Active     = (System.Boolean)dr["Active"];
     return(entity);
 }
示例#4
0
 public IABazaar.Core.Entities.EventHandler InsertEventHandler(IABazaar.Core.Entities.EventHandler entity)
 {
     return(_iEventHandlerRepository.InsertEventHandler(entity));
 }
示例#5
0
 public IABazaar.Core.Entities.EventHandler UpdateEventHandler(IABazaar.Core.Entities.EventHandler entity)
 {
     return(_iEventHandlerRepository.UpdateEventHandler(entity));
 }
 public virtual IABazaar.Core.Entities.EventHandler DeleteEventHandler(IABazaar.Core.Entities.EventHandler entity)
 {
     this.DeleteEventHandler(entity.EventId);
     return(entity);
 }