Ejemplo n.º 1
0
    public static LoginAddress[] GetAddressesFromLoginID(int login_id)
    {
        List<LoginAddress> addresses = new List<LoginAddress>();

        CartDB db = new CartDB();
        DataSet ds = db.LoginGetAddresses(login_id);

        if (ds != null)
        {
            using (DataTableReader data = ds.CreateDataReader())
            {
                while (data.Read())
                {
                    int loginaddressid = data.GetInt32(data.GetOrdinal("LoginAddressID"));
                    int loginid = data.GetInt32(data.GetOrdinal("LoginID"));
                    string addressname = Helper.IsString(data.GetValue(data.GetOrdinal("AddressName")), "");
                    string bldgname = Helper.IsString(data.GetValue(data.GetOrdinal("BldgName")), "");
                    string address1 = Helper.IsString(data.GetValue(data.GetOrdinal("Address1")), "");
                    string address2 = Helper.IsString(data.GetValue(data.GetOrdinal("Address2")), "");
                    string city = Helper.IsString(data.GetValue(data.GetOrdinal("City")), "");
                    string statecode = Helper.IsString(data.GetValue(data.GetOrdinal("StateCode")), "");
                    string province = Helper.IsString(data.GetValue(data.GetOrdinal("Province")), "");
                    string zip = Helper.IsString(data.GetValue(data.GetOrdinal("Zip")), "");
                    string countrycode = Helper.IsString(data.GetValue(data.GetOrdinal("CountryCode")), "");
                    string phone = Helper.IsString(data.GetValue(data.GetOrdinal("Phone")), "");

                    addresses.Add(new LoginAddress(loginaddressid, login_id, addressname, bldgname, address1, address2, city, statecode, province, zip, countrycode,phone));
                }
            }
        }
        return addresses.ToArray();
    }