Ejemplo n.º 1
0
        public IList <Shreet> GetAllShreet(string sql, SqlParameter[] paras)
        {
            IList <Shreet> list = null;

            DataTable table = SQLDBHelper.GetDataTable(sql, paras);

            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    list = new List <Shreet>();
                    foreach (DataRow row in table.Rows)
                    {
                        Shreet shreet = new Shreet();
                        shreet.ShreetId   = int.Parse(row["shreetId"].ToString());
                        shreet.ShreetName = row["shreetName"].ToString();
                        shreet.DistrictId = int.Parse(row["districtId"].ToString());
                        if (ds.GetDistrictByID(shreet.DistrictId) != null)
                        {
                            shreet.District = ds.GetDistrictByID(shreet.DistrictId)[0];
                        }
                        list.Add(shreet);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public IList <District> GetAllDistrict(string sql, SqlParameter[] paras)
        {
            IList <District> list  = null;
            DataTable        table = SQLDBHelper.GetDataTable(sql, paras);

            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    list = new List <District>();
                    foreach (DataRow row in table.Rows)
                    {
                        District district = new District();
                        district.DistrictId   = int.Parse(row["districtId"].ToString());
                        district.DistrictName = row["districtName"].ToString();
                        district.CityId       = int.Parse(row["cityId"].ToString());
                        if (cs.GetCityByID(district.CityId) != null)
                        {
                            district.City = cs.GetCityByID(district.CityId)[0];
                        }
                        list.Add(district);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
        public DataTable GetShreetByDistrictIdTwo(int districtId)
        {
            string sql = "SELECT * FROM Shreet where DistrictId=@DistrictId";

            SqlParameter[] parameters =
            {
                new SqlParameter("@DistrictId", SqlDbType.Int, 4)
            };
            parameters[0].Value = districtId;
            return(SQLDBHelper.GetDataTable(sql, parameters));
        }
Ejemplo n.º 4
0
        public DataTable GetShreetByKeyNameTooo(string KeyName)
        {
            string sql = "SELECT * FROM Shreet where ShreetName like '%" + KeyName + "%'";

            SqlParameter[] parameters =
            {
                new SqlParameter("@ShreetName", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = KeyName;
            return(SQLDBHelper.GetDataTable(sql, parameters));
        }
Ejemplo n.º 5
0
        public DataTable GetDistrictByCityIDTwo(int cityId)
        {
            string sql = "SELECT * FROM District where CityId=@CityId";

            SqlParameter[] parameters =
            {
                new SqlParameter("@CityId", SqlDbType.Int, 4)
            };
            parameters[0].Value = cityId;
            return(SQLDBHelper.GetDataTable(sql, parameters));
        }
Ejemplo n.º 6
0
        public IList <City> GetAllCity(string sql, SqlParameter[] paras)
        {
            IList <City> list  = null;
            DataTable    table = SQLDBHelper.GetDataTable(sql, paras);

            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    list = new List <City>();
                    foreach (DataRow row in table.Rows)
                    {
                        City city = new City();
                        city.CityId   = int.Parse(row["cityId"].ToString());
                        city.CityName = row["cityName"].ToString();
                        list.Add(city);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 7
0
        public IList <Shreet> GetShreetTx()
        {
            string         sql   = "SELECT * FROM Shreet";
            IList <Shreet> list  = null;
            DataTable      table = SQLDBHelper.GetDataTable(sql, null);

            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    list = new List <Shreet>();
                    foreach (DataRow row in table.Rows)
                    {
                        Shreet shreet = new Shreet();
                        shreet.ShreetId   = int.Parse(row["shreetId"].ToString());
                        shreet.ShreetName = row["shreetName"].ToString();
                        shreet.DistrictId = int.Parse(row["districtId"].ToString());
                        list.Add(shreet);
                    }
                }
            }
            return(list);
        }