/// <summary> /// 得到单个订单信息 /// </summary> /// <param name="orderid"></param> /// <returns></returns> public static orderinfo getorderinfo(string orderid) { SqlParameter[] parms = new SqlParameter[1]; parms[0] = new SqlParameter("@orderid", SqlDbType.NVarChar, 50); parms[0].Value = orderid; orderinfo item = new orderinfo(); string sql = "select a.orderid,a.ordernumber,a.allmoney,a.paymoney,a.deliveryIid,a.deliveryIIid,a.orderdate,a.deliverydate,a.orderstate,a.contact,a.tel,a.mobile,a.address,c.deliveryI,d.deliveryII from [userorder] a,deliveryI c,deliveryII d where a.deliveryIid=c.deliveryIid and a.deliveryIIid=d.deliveryIIid and orderid=@orderid"; try { SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms); if (dr.Read()) { item.orderid = TypeParse.DbObjToString(dr["orderid"].ToString(), "0"); item.tel = TypeParse.DbObjToString(dr["tel"].ToString(), ""); item.ordernumber = TypeParse.DbObjToString(dr["ordernumber"].ToString(), ""); item.mobile = TypeParse.DbObjToString(dr["mobile"].ToString(), ""); item.address = TypeParse.DbObjToString(dr["address"].ToString(), ""); item.contact = TypeParse.DbObjToString(dr["contact"].ToString(), ""); item.allmoney = Decimal.Parse(TypeParse.DbObjToString(dr["allmoney"].ToString(), "0.00")); item.paymoney = Decimal.Parse(TypeParse.DbObjToString(dr["paymoney"].ToString(), "0.00")); item.orderstate = TypeParse.DbObjToInt(dr["orderstate"].ToString(), 0); item.orderdate = TypeParse.DbObjToDateTime(dr["orderdate"].ToString(), DateTime.Now); item.deliverydate = TypeParse.DbObjToDateTime(dr["deliverydate"].ToString(), DateTime.Now); item.ordernumber = TypeParse.DbObjToString(dr["ordernumber"].ToString(), ""); item.deliveryI = TypeParse.DbObjToString(dr["deliveryI"].ToString(), ""); item.deliveryII = TypeParse.DbObjToString(dr["deliveryII"].ToString(), ""); item.deliveryIid = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0); item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0); switch (item.orderstate) { case 0: item.orderstatestr = "进行中"; break; case 10: item.orderstatestr = "已完成"; break; case 44: item.orderstatestr = "待处理"; break; default: item.orderstatestr = "进行中"; break; } dr.Close(); dr.Dispose(); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { } return(item); }