コード例 #1
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        checkCount();
        OrdersInfo order = new OrdersInfo();
        long orderID =Convert.ToInt64(DateTime.Now.ToString("yyyyMMddhhmmss"));
        Response.Cookies["orderID"].Value = orderID.ToString();
        Response.Cookies["orderID"].Expires = DateTime.Now.AddDays(1);
        AddressInfo address = Address.GetAddressByID();
        //定单编号,用户,送货用户,地址,邮编,电话
        order.OrderID = orderID;
        order.UserName = address.UserName;
        order.AddressName = address.AddressName;
        order.Address = address.Address;
        order.Post = address.Post;
        order.Telephone = address.Telephone;
        //省份,城市,送货方式,付款方式
        order.Province = address.Province;
        order.City = address.City;
        order.SendType = address.SendType;
        order.PayType = address.PayType;
        //是否开发票,图书价格,送货费用,总价格,留言
        order.EnableInvoice =Convert.ToBoolean(InvoiceList.SelectedValue);
        order.BookPrice = Convert.ToDecimal(Session["orderPrice"].ToString().Substring(1));
        order.SendPrice = Convert.ToDecimal(sendPrice.Text.Substring(1));
        order.SumPrice = Convert.ToDecimal(sumPrice.Text.Substring(1));
        order.BalancePrice = Convert.ToDecimal(balancePay.Text);
        order.NeedPayPrice = Convert.ToDecimal(needBalancePay.Text);
        order.TgPrice = 0;
        order.IsTg = false;
        order.Message = messageTxt.Text;
        Orders.InsertOrders(order);
        Address.UpdateAddressBalance(order.BalancePrice);
        try
        {
            EmailSend es = new EmailSend();
            es.sendOrderEmail(orderID.ToString(), sumPrice.Text.Substring(1));
        }
        catch (Exception)
        {

        }
        finally
        {
            Response.Redirect("shoppingComplete.aspx");
        }
    }