public List <CountryModel> GetAllCountry()
        {
            try
            {
                return(objcountrydal.GetAllCountry());
            }
            catch (Exception)
            {
                return(null);

                throw;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             ddlCountries.DataSource = CountryDAL.GetAllCountry();
             ddlCountries.DataBind();
         }
     }
     catch (Exception ex)
     {
         lbMsg.Text = "error";
         AppLogger.WriteLog(ex.ToString());
     }
 }
        public static List <Country> GetAllCountry()
        {
            List <Country> CountryList = new List <Country>();

            using (SqlDataReader reader = CountryDAL.GetAllCountry())
            {
                while (reader.Read())
                {
                    Country item = new Country();
                    item.CountryId = Convert.ToInt32(reader["CountryId"]);
                    item.Name      = reader["Name"].ToString();
                    item.Code      = reader["Code"].ToString();
                    item.Visible   = Convert.ToBoolean(reader["Visible"]);
                    item.OrderNo   = Convert.ToInt32(reader["OrderNo"]);
                    CountryList.Add(item);
                }
            }

            return(CountryList);
        }
示例#4
0
 public static IEnumerable <Country> GetAllCountry()
 {
     return(CountryDAL.GetAllCountry());
 }