Example #1
0
        /// <summary>
        /// 通过会员名获取该会员的所有订单
        /// </summary>
        /// <param name="name">会员名</param>
        /// <returns>将该会员的订单信息保存在ArrayList对象中返回</returns>
        public ArrayList getOrders(string name, string is_pay)
        {
            ArrayList orders = new ArrayList();
            Order     order;
            string    sql = "select * from tb_orders where name='" + name + "' and is_pay='" + is_pay + "' order by order_time desc";

            SqlConnection conn = DBConn.getConn();

            conn.Open();

            SqlCommand    cmd = new SqlCommand(sql, conn);
            SqlDataReader sdr = cmd.ExecuteReader();

            while (sdr.Read())
            {
                order = new Order();

                order.Order_id     = Convert.ToInt32(sdr["order_id"].ToString());
                order.Order_number = sdr["order_number"].ToString();
                order.Name         = sdr["name"].ToString();

                order.CollectionCompanyName = sdr["collectioncompanyname"].ToString();
                order.CollectionContactName = sdr["collectioncontactname"].ToString();
                order.CollectionPhone       = sdr["collectionphone"].ToString();
                order.CollectionAddressLine = sdr["collectionaddressline"].ToString();
                order.CollectionTown        = sdr["collectiontown"].ToString();
                order.CollectionPostCode    = sdr["collectionpostcode"].ToString();
                order.CollectionCountry     = sdr["collectioncountry"].ToString();

                order.RecipientCompanyName = sdr["recipientcompanyname"].ToString();
                order.RecipientContactName = sdr["recipientcontactname"].ToString();
                order.RecipientPhone       = sdr["recipientphone"].ToString();
                order.RecipientAddressLine = sdr["recipientaddressline"].ToString();
                order.RecipientTown        = sdr["recipienttown"].ToString();
                order.RecipientPostCode    = sdr["recipientpostcode"].ToString();
                order.RecipientCountry     = sdr["recipientcountry"].ToString();

                order.Delivery_way  = sdr["delivery_way"].ToString();
                order.Delivery_date = sdr["delivery_date"].ToString();
                order.Delivery_time = sdr["delivery_time"].ToString();

                order.Purpose        = sdr["purpose"].ToString();
                order.Description    = sdr["description"].ToString();
                order.Estimate_value = Convert.ToSingle(sdr["estimate_value"].ToString());
                order.Insurance      = Convert.ToSingle(sdr["insurance"].ToString());
                order.Quantity       = Convert.ToInt32(sdr["quantity"].ToString());

                order.Invoice             = sdr["invoice"].ToString();
                order.Post_way            = sdr["post_way"].ToString();
                order.Wp_track_no         = sdr["wp_track_no"].ToString();
                order.Local_pick_pay      = Convert.ToSingle(sdr["local_pick_pay"].ToString());
                order.Weight              = Convert.ToSingle(sdr["weight"].ToString());
                order.Pay_before_discount = Convert.ToSingle(sdr["pay_before_discount"].ToString());
                order.Discount            = Convert.ToSingle(sdr["discount"].ToString());
                order.Pay_after_discount  = Convert.ToSingle(sdr["pay_after_discount"].ToString());
                order.Less_pay            = Convert.ToSingle(sdr["less_pay"].ToString());
                order.Pf_track            = sdr["pf_track"].ToString();
                order.Bill_track          = sdr["bill_track"].ToString();
                order.Wp_pay              = Convert.ToSingle(sdr["wp_pay"].ToString());
                order.Profit              = Convert.ToSingle(sdr["profit"].ToString());
                order.Pay_way             = sdr["pay_way"].ToString();
                order.Is_pay              = sdr["is_pay"].ToString();
                order.Pay_time            = sdr["pay_time"].ToString();
                order.Order_time          = Convert.ToDateTime(sdr["order_time"].ToString());
                order.Is_show             = sdr["is_show"].ToString();

                orders.Add(order);
            }

            conn.Close();

            return(orders);
        }