Esempio n. 1
0
 public int Add(SchemeRecord item)
 {
     return this.List.Add(item);
 }
        public Scheme GetLRSScheme(int id)
        {
            Scheme scheme = new Scheme();

            SchemeRecord record = null;
            using (SqlCommand command = new SqlCommand("[dbo].[GetLRSSchemeAttr]") { CommandType = CommandType.StoredProcedure })
            {
                command.Parameters.AddWithValue("@LRSSchemeId", id);

                using (IDataReader rdr = ExecuteReader(command))
                {
                    while (rdr.Read())
                    {
                        record = new SchemeRecord()
                        {
                            Id = rdr["Id"].ToString().SmartParseDefault<int>(default(int))
                            ,
                            ColumnName = rdr["COLUMN_NAME"].ToString()
                            ,
                            FriendlyName = rdr["FRIENDLY_NAME"].ToString()
                            ,
                            DataType = rdr["DATA_TYPE"].ToString()
                            ,
                            DisplayType = rdr["DISPLAY_TYPE"].ToString()
                            ,
                            MaxLength = rdr["CHARACTER_MAXIMUM_LENGTH"].ToString().SmartParseDefault<int>(default(int))
                            ,
                            ColumnDefault = rdr["COLUMN_DEFAULT"].ToString()
                            ,
                            IsNullable = rdr["IS_NULLABLE"].ToString().SmartParseDefault<bool>(false)
                            ,
                            IsRequired = rdr["IS_REQUIRED"].ToString().SmartParseDefault<bool>(false)
                        };
                        scheme.Add(record);
                    }
                }
            }
            return scheme;
        }