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; }
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; }
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); }
/// <summary> /// 更新送货地址信息 /// </summary> /// <param name="link"></param> /// <returns></returns> public static int UpdateAddress(AddressInfo address) { return addresses.UpdateAddress(address); }
/// <summary> /// 添加送货地址信息 /// </summary> /// <param name="link"></param> public static void InsertAddress(AddressInfo address) { addresses.InsertAddress(address); }
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); }