Пример #1
0
        public CremaBinaryTable ReadTable(string tableName)
        {
            int index = -1;

            for (int i = 0; i < this.tableIndexes.Length; i++)
            {
                TableIndex tableIndex = this.tableIndexes[i];

                if (StringResource.Equals(tableIndex.TableName, tableName) == true)
                {
                    index = i;
                    break;
                }
            }

            if (index == -1)
            {
                throw new KeyNotFoundException("테이블을 찾을수 없습니다.");
            }

            CremaBinaryTable table = this.ReadTable(new BinaryReader(this.stream), this.tableIndexes[index].Offset);

            this.tables[index] = table;
            return(table);
        }
        public virtual StringResource UpdateStringResource(StringResource entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            StringResource other = GetStringResource(entity.StringResourceId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update StringResource set  [StringResourceGUID]=@StringResourceGUID
							, [StoreID]=@StoreID
							, [Name]=@Name
							, [LocaleSetting]=@LocaleSetting
							, [ConfigValue]=@ConfigValue
							, [Modified]=@Modified
							, [CreatedOn]=@CreatedOn 
							 where StringResourceID=@StringResourceID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@StringResourceID", entity.StringResourceId)
                , new SqlParameter("@StringResourceGUID", entity.StringResourceGuid)
                , new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@LocaleSetting", entity.LocaleSetting)
                , new SqlParameter("@ConfigValue", entity.ConfigValue ?? (object)DBNull.Value)
                , new SqlParameter("@Modified", entity.Modified)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetStringResource(entity.StringResourceId));
        }