コード例 #1
0
        public void createOrder()
        {
            tblOrdercf = adpOrdercf.GetData();

            int result = adpOrdercf.Insert(DateTime.Now, 0, 0, 0);

            tblOrdercf               = adpOrdercf.GetDataMax();
            Cache["tblOrdercf"]      = tblOrdercf;
            OrderId                  = tblOrdercf[0].OrderId;
            tblOrderDetails          = adpOrderDetails.GetDataByOrderId(OrderId);
            Cache["tblOrderDetails"] = tblOrderDetails;
        }
コード例 #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            lblErrorMessage.Text = "";
            if (String.IsNullOrEmpty(txtOrderNumber.Text))
            {
                lblErrorMessage.Text      = "Please enter an order number";
                lblErrorMessage.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                int id = int.Parse(txtOrderNumber.Text);

                tblOrdercf = adpAllOrdercf.GetDataByID(id);
                var row = tblOrdercf;

                if (row.Count > 0)
                {
                    if (row != null)
                    {
                        txtDate.Text     = row[0].OrderDate.ToString();
                        txtSubtotal.Text = row[0].OrderSubTotal.ToString();
                        txtTax.Text      = row[0].OrderTax.ToString();
                        txtTotal.Text    = row[0].OrderTotal.ToString();

                        tblOrderDetails = adpOrderDetails.GetDataByOrderId(id);
                        var rowOrdercf = tblOrderDetails;
                        //lblErrorMessage.Text = rowOrdercf.Count.ToString();
                        grdOrder.DataSource = null;
                        grdOrder.DataBind();
                        if (row.Count > 0 && row != null)
                        {
                            grdOrder.DataSource = tblOrderDetails;
                            grdOrder.DataBind();
                        }
                        if (rowOrdercf.Count == 0)
                        {
                            lblErrorMessage.Text      = "This order was not Completed";
                            lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                }
                else
                {
                    lblErrorMessage.Text      = " Order ID " + id + " not found";
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
        }