예제 #1
0
        public AddressInfo GetAddressByID()
        {
            SqlHelper objSqlHelper = new SqlHelper();
            SqlParameter[] objParams = new SqlParameter[1];
            objParams[0] = new SqlParameter("@userName", SqlDbType.VarChar);

            objParams[0].Value = GetUserName();
            SqlDataReader reader = objSqlHelper.ExecuteReader("je_Ad_GetAddressByID", objParams);
            AddressInfo item = new AddressInfo();
            while (reader.Read())
            {
                item.UserName = reader.GetString(reader.GetOrdinal("userName"));
                item.AddressName = reader.GetString(reader.GetOrdinal("addressName"));
                item.Address = reader.GetString(reader.GetOrdinal("address"));
                item.Post = reader.GetString(reader.GetOrdinal("Post"));
                item.Telephone = reader.GetString(reader.GetOrdinal("Telephone"));
                item.Province = reader.GetString(reader.GetOrdinal("Province"));
                item.City = reader.GetString(reader.GetOrdinal("City"));
                item.SendType = reader.GetInt32(reader.GetOrdinal("SendType"));
                item.PayType = reader.GetInt32(reader.GetOrdinal("PayType"));
                item.Name = reader.GetString(reader.GetOrdinal("Name"));
                item.Price = reader.GetDecimal(reader.GetOrdinal("Price"));
                item.Balance = reader.GetDecimal(reader.GetOrdinal("Balance"));
            }
            reader.Close();
            return item;
        }
예제 #2
0
 public IList<AddressInfo> GetAddress(int userID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     List<AddressInfo> Addresss = new List<AddressInfo>();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@userID", SqlDbType.Int, 4);
     objParams[0].Value = userID;
     SqlDataReader reader = objSqlHelper.ExecuteReader("je_Ad_GetAddress", objParams);
     while (reader.Read())
     {
         AddressInfo item = new AddressInfo();
         item.AddressID = reader.GetInt32(reader.GetOrdinal("addressID"));
         item.AddressName = reader.GetString(reader.GetOrdinal("addressName"));
         item.Address = reader.GetString(reader.GetOrdinal("address"));
         item.Post = reader.GetString(reader.GetOrdinal("Post"));
         item.Telephone = reader.GetString(reader.GetOrdinal("Telephone"));
         item.IsDefault = reader.GetBoolean(reader.GetOrdinal("isDefault"));
         item.Province = reader.GetString(reader.GetOrdinal("Province"));
         item.City = reader.GetString(reader.GetOrdinal("City"));
         item.SendType = reader.GetInt32(reader.GetOrdinal("SendType"));
         item.Name = reader.GetString(reader.GetOrdinal("Name"));
         Addresss.Add(item);
     }
     reader.Close();
     return Addresss;
 }
예제 #3
0
 public void InsertAddress(AddressInfo address)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[7];
     objParams[0] = new SqlParameter("@addressName", address.AddressName);
     objParams[1] = new SqlParameter("@address", address.Address);
     objParams[2] = new SqlParameter("@post", address.Post);
     objParams[3] = new SqlParameter("@telephone", address.Telephone);
     objParams[4] = new SqlParameter("@isDefault", false);
     objParams[5] = new SqlParameter("@addDate", DateTime.Now);
     objParams[6] = new SqlParameter("@userName", address.UserName);
     objSqlHelper.ExecuteNonQuery("je_Ad_InsertAddress", objParams);
 }
예제 #4
0
 /// <summary>
 /// 更新送货地址信息
 /// </summary>
 /// <param name="link"></param>
 /// <returns></returns>
 public static int UpdateAddress(AddressInfo address)
 {
   return addresses.UpdateAddress(address);
 }
예제 #5
0
 /// <summary>
 /// 添加送货地址信息
 /// </summary>
 /// <param name="link"></param>
 public static void InsertAddress(AddressInfo address)
 {
     addresses.InsertAddress(address);
 }
예제 #6
0
 public int UpdateAddress(AddressInfo address)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[7];
     objParams[0] = new SqlParameter("@addressName", address.AddressName);
     objParams[1] = new SqlParameter("@address", address.Address);
     objParams[2] = new SqlParameter("@addressPost", address.Post);
     objParams[3] = new SqlParameter("@telephone", address.Telephone);
     objParams[4] = new SqlParameter("@UserName", GetUserName());
     objParams[5] = new SqlParameter("@Province", address.Province);
     objParams[6] = new SqlParameter("@City", address.City);
     return objSqlHelper.ExecuteNonQuery("je_Ad_UpdateAddress", objParams);
 }