DisplayMonkey.Location._initFromRow(System.Data.SqlClient.SqlDataReader)

Here are the examples of the csharp api class DisplayMonkey.Location._initFromRow(System.Data.SqlClient.SqlDataReader) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: DisplayMonkey
Source File: Location.cs
public static List<Location> List(int levelId = 0)
        {
            List<Location> list = new List<Location>();

            using (SqlCommand cmd = new SqlCommand()
            {
                CommandType = CommandType.Text,
                CommandText =
                    "select l.*, v.Name Name2 from Location l inner join Level v on v.LevelId=l.LevelId " +
                    "where @levelId=0 or l.LevelId=@levelId order by v.Name, l.Name;",
            })
            {
                cmd.Parameters.AddWithValue("@levelId", levelId);
                cmd.ExecuteReaderExt((r) =>
                {
                    Location loc = new Location();
                    loc._initFromRow(r);
                    string name2 = r.StringOrBlank("Name2").Trim();
                    loc.Name = string.Format("{0} : {1}",
                        name2 == "" ? string.Format("Level {0}", loc.LevelId) : name2,
                        loc.Name
                        );
                    list.Add(loc);
                    return true;
                });
            }

            return list;
        }