public void TwoOrders()
        {
            _orders.AddOrder(new Order(222));

            var order111Json = JsonOrder111WithProduct("");
            var order222Json = "{\"id\":222,\"products\":[]}";

            Assert.AreEqual("{\"orders\":[" + order111Json + "," + order222Json + "]}", new OrdersWriter(_orders).GetContents());
        }
Exemplo n.º 2
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        if (Page.IsValid && this.labMessage.Text == "订单详细情况如下:")
        {
            //得到用户输入的信息
            string strPhone;                                             //电话号码
            float  fltShipFee;                                           //邮递方式及其费用
            if (IsValidPhone(this.txtReceiverPhone.Text.Trim()) == true) //判断输入的电话号码是否合法
            {
                strPhone = this.txtReceiverPhone.Text.Trim();
            }
            else
            {
                Response.Write(ccObj.MessageBox("输入有误!"));
                return;
            }

            fltShipFee = float.Parse(this.Shipfee.Text);             //获取邮递方式及其费用
            string strName    = this.txtReciverName.Text.Trim();     //收货人姓名
            string strAddress = this.txtReceiverAddress.Text.Trim(); //收货人详细地址
            string strRemark  = this.txtRemark.InnerText.Trim();     //备注
            //将订单信息插入订单表中
            int intOrderID = ocObj.AddOrder(float.Parse(this.labTotalPrice.Text), fltShipFee, this.ShipType.Text, int.Parse(Session["UserID"].ToString()), strName, strPhone, strAddress, strRemark);
            int IntBookID; //商品ID
            int IntNum;    //购买商品数量


            float fltTotalPrice;
            //对订单中的每一个货物插入订单详细表中
            foreach (GridViewRow gvr in this.gvShopCart.Rows)
            {
                IntBookID     = int.Parse(gvr.Cells[1].Text);
                IntNum        = int.Parse(gvr.Cells[3].Text);
                fltTotalPrice = float.Parse(gvr.Cells[5].Text);
                ocObj.AddDetail(IntBookID, IntNum, intOrderID, fltTotalPrice);
            }

            //设置Session
            Session["ShopCart"] = null;  //清空购物车
            //Response.Redirect("PayWay.aspx?OrderID=" + IntOrderID);
            //Response.Redirect("GoBank.aspx?OrderID=" + IntOrderID );

            //配置支付需要的东西
            //订单号IntOrderID,价格totalPrice,官方教材,时间?当前时间date
            string temp = this.labTotalPrice.Text;


            Response.Write("<Script Language=JavaScript>alert('支付成功');location='Default.aspx'</Script>");
        }
    }
Exemplo n.º 3
0
        public JsonResult AddOrder()
        {
            object[] order  = new object[] { Request.Form["qty"], Request.Form["price"], Request.Form["customer_id"], Request.Form["name"], Request.Form["phone"], Request.Form["address"] };
            int      query  = orders.AddOrder(order);
            object   data   = "";
            int      status = 200;

            if (query > 0)
            {
                data = query;
            }
            else
            {
                data   = query;
                status = 400;
            }
            return(Json(new { data, status }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        private void btnAddOrder_Click_1(object sender, EventArgs e)
        {
            Dictionary <string, int> compIdQuantity = new Dictionary <string, int>();


            foreach (DataGridViewRow row in dgvAddComps.Rows)
            {
                compIdQuantity.Add(row.Cells[0].Value.ToString(), Convert.ToInt32(row.Cells[1].Value));
            }


            Orders.AddOrder(clientNr, comboBox1.Text, compIdQuantity, monthCmboBox.Text, serviceComboBox.Text, personnelID);
            ServiceTicket.AddServiceTicket(clientNr);
            bool clientIDFound = ClientProducts.CheckClientProducts1(clientNr);

            if (clientIDFound == true)
            {
                InvoiceForm invf = new InvoiceForm();
                invf.Show();
            }
        }
Exemplo n.º 5
0
 public void SetupOneOrder()
 {
     _order111 = new Order(111);
     _orders   = new Orders();
     _orders.AddOrder(_order111);
 }
 public void AddOrder()
 {
     Orders.AddOrder(CurrentCustomer, CurrentLocation, SalesList);
     // clear out the sales list
     SalesList = new List <OrderItem>();
 }
Exemplo n.º 7
0
    private Order AddOrder(Customer customer)
    {
        PasswordGenerator gen = new PasswordGenerator()
        {
            ConsecutiveCharacters = true, ExcludeSymbols = true, Maximum = 25, Minimum = 25, RepeatCharacters = true
        };
        string orderNo = gen.Generate();

        Order order = new Order()
        {
            CustomerID    = customer.CustomerID,
            OrderNumber   = orderNo,
            DatePlaced    = DateTime.Now,
            OrderStatusID = (int)OrderStatusEnum.Accepted,
            Tax           = Cart.Tax,
            Shipping      = Cart.Shipping,
            Total         = Cart.Total,
            OrderDate     = DateTime.Now,
            Active        = true,
            Comments      = CommentsTextBox.Text
        };

        if (Cart.GiftRegistryID > 0)
        {
            order.Comments = "This is a Gift Registry Order " + order.Comments;
        }
        if (ShippingLookupDataDropDownList.Visible)
        {
            order.ShippingProviderID = Convert.ToInt32(ShippingLookupDataDropDownList.SelectedValue);
        }

        if (ShippingCheckBox.Checked && Cart.GiftRegistryID == 0)
        {
            order.Address    = BillingAddressControl.Address;
            order.City       = BillingAddressControl.City;
            order.CountryID  = BillingAddressControl.CountryID;
            order.StateID    = BillingAddressControl.StateID;
            order.ProvinceID = BillingAddressControl.ProvinceID;
            order.Zipcode    = BillingAddressControl.Zipcode;
        }
        else if (ShippingCheckBox.Checked && Cart.GiftRegistryID > 0)
        {
            // Get the address of the Gift Registry
            int      customerID       = GiftRegistries.GetGiftRegistry(Cart.GiftRegistryID, 0, string.Empty, false).CustomerID;
            Customer registryCustomer = Customers.GetCustomer(customerID);
            order.Address    = registryCustomer.Address;
            order.City       = registryCustomer.City;
            order.CountryID  = registryCustomer.CountryID;
            order.StateID    = registryCustomer.StateID;
            order.ProvinceID = registryCustomer.ProvinceID;
            order.Zipcode    = registryCustomer.Zipcode;
        }
        else
        {
            order.Address    = ShippingAddressControl.Address;
            order.City       = ShippingAddressControl.City;
            order.CountryID  = ShippingAddressControl.CountryID;
            order.StateID    = ShippingAddressControl.StateID;
            order.ProvinceID = ShippingAddressControl.ProvinceID;
            order.Zipcode    = ShippingAddressControl.Zipcode;
        }
        AddOrderItems(order);

        order.OrderID = Orders.AddOrder(order);
        SendNewCustomerOrderEmail(orderNo);
        EmailManager.SendNewStoreOrderEmail(order, customer);
        return(order);
    }