Esempio n. 1
0
        public virtual LayoutField UpdateLayoutField(LayoutField entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            LayoutField other = GetLayoutField(entity.LayoutFieldId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update LayoutField set  [LayoutFieldGUID]=@LayoutFieldGUID
							, [LayoutID]=@LayoutID
							, [FieldType]=@FieldType
							, [FieldID]=@FieldID
							, [CreatedOn]=@CreatedOn 
							 where LayoutFieldID=@LayoutFieldID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@LayoutFieldID", entity.LayoutFieldId)
                , new SqlParameter("@LayoutFieldGUID", entity.LayoutFieldGuid)
                , new SqlParameter("@LayoutID", entity.LayoutId ?? (object)DBNull.Value)
                , new SqlParameter("@FieldType", entity.FieldType ?? (object)DBNull.Value)
                , new SqlParameter("@FieldID", entity.FieldId)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetLayoutField(entity.LayoutFieldId));
        }