Exemplo n.º 1
0
        public Core.Business.Map Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectMap");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.Map map = new Core.Business.Map();

                if (!reader.IsDBNull(0)) map.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) map.UID = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) map.Name = reader.GetString(2);
                if (!reader.IsDBNull(3)) map.Des = reader.GetString(3);
                if (!reader.IsDBNull(4)) map.Abscissa = reader.GetString(4);
                if (!reader.IsDBNull(5)) map.Ordinate = reader.GetString(5);

                reader.Close();
                return map;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Exemplo n.º 2
0
        public IList<Core.Business.Map> GetAllMap()
        {
            IList<Core.Business.Map> maplist = new List<Core.Business.Map>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectMapsAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.Map map = new Core.Business.Map();

                    if (!reader.IsDBNull(0)) map.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) map.UID = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) map.Name = reader.GetString(2);
                    if (!reader.IsDBNull(3)) map.Des = reader.GetString(3);
                    if (!reader.IsDBNull(4)) map.Abscissa = reader.GetString(4);
                    if (!reader.IsDBNull(5)) map.Ordinate = reader.GetString(5);

                    map.MarkOld();
                    maplist.Add(map);
                }
                reader.Close();
            }
            return maplist;
        }