public virtual LayoutFieldAttribute UpdateLayoutFieldAttribute(LayoutFieldAttribute entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            LayoutFieldAttribute other = GetLayoutFieldAttribute(entity.LayoutFieldAttributeId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update LayoutFieldAttribute set  [LayoutFieldAttributeGUID]=@LayoutFieldAttributeGUID
							, [LayoutID]=@LayoutID
							, [LayoutFieldID]=@LayoutFieldID
							, [Name]=@Name
							, [Value]=@Value 
							 where LayoutFieldAttributeID=@LayoutFieldAttributeID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@LayoutFieldAttributeID", entity.LayoutFieldAttributeId)
                , new SqlParameter("@LayoutFieldAttributeGUID", entity.LayoutFieldAttributeGuid)
                , new SqlParameter("@LayoutID", entity.LayoutId)
                , new SqlParameter("@LayoutFieldID", entity.LayoutFieldId)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@Value", entity.Value)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetLayoutFieldAttribute(entity.LayoutFieldAttributeId));
        }
Beispiel #2
0
        public void SaveAttribute(String Name, String Value)
        {
            LayoutFieldAttribute lfa = new LayoutFieldAttribute();

            lfa.LayoutID      = ThisField.LayoutID;
            lfa.LayoutFieldID = ThisField.LayoutFieldID;
            lfa.Name          = Name;
            lfa.Value         = Value;

            lfa.Update();
        }
        public virtual LayoutFieldAttribute LayoutFieldAttributeFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            LayoutFieldAttribute entity = new LayoutFieldAttribute();

            entity.LayoutFieldAttributeId   = (System.Int32)dr["LayoutFieldAttributeID"];
            entity.LayoutFieldAttributeGuid = (System.Guid)dr["LayoutFieldAttributeGUID"];
            entity.LayoutId      = (System.Int32)dr["LayoutID"];
            entity.LayoutFieldId = (System.Int32)dr["LayoutFieldID"];
            entity.Name          = dr["Name"].ToString();
            entity.Value         = dr["Value"].ToString();
            return(entity);
        }
        public virtual LayoutFieldAttribute InsertLayoutFieldAttribute(LayoutFieldAttribute entity)
        {
            LayoutFieldAttribute other = new LayoutFieldAttribute();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into LayoutFieldAttribute ( [LayoutFieldAttributeGUID]
				,[LayoutID]
				,[LayoutFieldID]
				,[Name]
				,[Value] )
				Values
				( @LayoutFieldAttributeGUID
				, @LayoutID
				, @LayoutFieldID
				, @Name
				, @Value );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@LayoutFieldAttributeID", entity.LayoutFieldAttributeId)
                    , new SqlParameter("@LayoutFieldAttributeGUID", entity.LayoutFieldAttributeGuid)
                    , new SqlParameter("@LayoutID", entity.LayoutId)
                    , new SqlParameter("@LayoutFieldID", entity.LayoutFieldId)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@Value", entity.Value)
                };
                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(GetLayoutFieldAttribute(Convert.ToInt32(identity)));
            }
            return(entity);
        }
 public virtual LayoutFieldAttribute DeleteLayoutFieldAttribute(LayoutFieldAttribute entity)
 {
     this.DeleteLayoutFieldAttribute(entity.LayoutFieldAttributeId);
     return(entity);
 }
 public LayoutFieldAttribute InsertLayoutFieldAttribute(LayoutFieldAttribute entity)
 {
     return(_iLayoutFieldAttributeRepository.InsertLayoutFieldAttribute(entity));
 }
 public LayoutFieldAttribute UpdateLayoutFieldAttribute(LayoutFieldAttribute entity)
 {
     return(_iLayoutFieldAttributeRepository.UpdateLayoutFieldAttribute(entity));
 }