Ejemplo n.º 1
0
 private void GetGeoZone(Guid guid)
 {
     using (IDataReader reader = DBGeoZone.GetOne(guid))
     {
         LoadFromReader(this, reader);
     }
 }
Ejemplo n.º 2
0
        //public static DataTable GetPage(int pageNumber, int pageSize)
        //{
        //    DataTable dataTable = new DataTable();
        //    dataTable.Columns.Add("Guid",typeof(Guid));
        //    dataTable.Columns.Add("CountryGuid",typeof(Guid));
        //    dataTable.Columns.Add("CountryName", typeof(string));
        //    dataTable.Columns.Add("Name",typeof(string));
        //    dataTable.Columns.Add("Code",typeof(string));
        //    dataTable.Columns.Add("TotalPages", typeof(int));

        //    IDataReader reader = DBGeoZone.GetGeoZonePage(pageNumber, pageSize);
        //    while (reader.Read())
        //    {
        //        DataRow row = dataTable.NewRow();
        //        row["Guid"] = reader["Guid"];
        //        row["CountryGuid"] = reader["CountryGuid"];
        //        row["CountryName"] = reader["CountryName"];
        //        row["Name"] = reader["Name"];
        //        row["Code"] = reader["Code"];
        //        row["TotalPages"] = Convert.ToInt32(reader["TotalPages"]);
        //        dataTable.Rows.Add(row);
        //    }

        //    reader.Close();

        //    return dataTable;

        //}

        public static DataTable GetPage(
            Guid countryGuid,
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Guid", typeof(Guid));
            dataTable.Columns.Add("CountryGuid", typeof(Guid));
            dataTable.Columns.Add("CountryName", typeof(string));
            dataTable.Columns.Add("Name", typeof(string));
            dataTable.Columns.Add("Code", typeof(string));
            //dataTable.Columns.Add("TotalPages", typeof(int));

            using (IDataReader reader = DBGeoZone.GetPage(countryGuid, pageNumber, pageSize, out totalPages))
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["Guid"]        = new Guid(reader["Guid"].ToString());
                    row["CountryGuid"] = reader["CountryGuid"];
                    row["CountryName"] = reader["CountryName"];
                    row["Name"]        = reader["Name"];
                    row["Code"]        = reader["Code"];
                    //row["TotalPages"] = Convert.ToInt32(reader["TotalPages"]);
                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
Ejemplo n.º 3
0
 private bool Update()
 {
     return(DBGeoZone.Update(
                this.guid,
                this.countryGuid,
                this.name,
                this.code));
 }
Ejemplo n.º 4
0
        private bool Create()
        {
            this.guid = Guid.NewGuid();

            int rowsAffected = DBGeoZone.Create(
                this.guid,
                this.countryGuid,
                this.name,
                this.code);

            return(rowsAffected > 0);
        }
Ejemplo n.º 5
0
        public static GeoZone GetByCode(Guid countryGuid, string code)
        {
            GeoZone geoZone = new GeoZone();

            using (IDataReader reader = DBGeoZone.GetByCode(countryGuid, code))
            {
                LoadFromReader(geoZone, reader);
            }

            if (geoZone.Guid == Guid.Empty)
            {
                return(null);
            }
            return(geoZone);
        }
Ejemplo n.º 6
0
 public static IDataReader GetByCountry(Guid countryGuid)
 {
     return(DBGeoZone.GetByCountry(countryGuid));
 }
Ejemplo n.º 7
0
 public static bool Delete(Guid guid)
 {
     return(DBGeoZone.Delete(guid));
 }