示例#1
0
文件: UKORequests.cs 项目: azlp/uko
        private List <Adress> GetListOffAdressPersonalUko(UKOmodel _uko, List <Adress> _listOffAdress)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("GetListOffAdressOffUco", con);
                // SqlCommand buisinessUkoName = new SqlCommand("GetUkoBussinesEntityName",con);
                //SqlCommand personUkoName = new SqlCommand("GetUkoNameEntityName", con);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@ukoId", _uko.Id);

                //buisinesUkoName.Parameters.AddWithValue("@ukoId", _uko.Id);
                //personUkoName.Parameters.AddWithValue("@ukoId", _uko.Id);



                con.Open();



                SqlDataReader rdr = cmd.ExecuteReader();



                while (rdr.Read())
                {
                    Adress _adress = new Adress();

                    _adress.Id = nullCheck.checkStringDBNull(rdr["ID"]);

                    _adress.AdressTotal = "" + nullCheck.checkStringDBNull(rdr["PostCode"]) + "" +
                                          "" + nullCheck.checkStringDBNull(rdr["City"]) + "" + nullCheck.checkStringDBNull(rdr["Street"]) + "" +
                                          nullCheck.convertObjectToString(nullCheck.convertIntToObject(rdr["Bulding"])) + "" + nullCheck.convertObjectToString(nullCheck.convertIntToObject(rdr["Block"])) + "" + nullCheck.convertObjectToString(nullCheck.convertIntToObject(rdr["Flat"]));

                    _adress.City = rdr["City"].ToString();

                    _adress.AdressType = rdr["Type"].ToString();


                    _listOffAdress.Add(_adress);
                }

                con.Close();

                rdr.Close();

                return(_listOffAdress);
            }
            catch
            {
                con.Close();

                throw;
            }
        }