Пример #1
0
        private void OrderGridView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try{
            if (MessageBox.Show("Are you sure to delete this order?", "Delete Order", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Connection c = new Connection();
                dti = c.connect();

                int index = OrderGridView.SelectedRows[0].Index;
                string orderNumber = "SELECT orderID FROM orders WHERE orderID=\"" + OrderGridView[0, index].Value.ToString() + "\"";
                int orderID = int.Parse(dti.getOneField(orderNumber));
                string DeleteQuery = "DELETE FROM orders WHERE orderID=" + orderID;
                string Deletequery = "DELETE FROM orderitems WHERE orderID="+orderID;
                dti.executeDMQuery(DeleteQuery);
                dti.close();

                for (int i = 0; i < data.Rows.Count; i = i + 1)
                {
                    DataRow row = data.Rows[i];
                    if (int.Parse(row["orderID"].ToString()) == orderID)
                        data.Rows.Remove(row);
                }
                OrderGridView.Rows.RemoveAt(index);
                OrderGridView.Refresh();
            }
             }
             catch(Exception ee)
             { }
        }
Пример #2
0
    } // BindMenuGridView

    #endregion

    // order history
    #region Bind Order GridView
    private void BindOrderGridView()
    {
        DataTable     dt         = new DataTable();
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["OrderistaConnectionString"].ConnectionString);

        try
        {
            connection.Open();
            SqlCommand cmd = new SqlCommand("SELECT Orders.OrderID, Min(Order_Items.RestaurantName) AS RestaurantName, MIN(CreationTime) AS CreationTime, "
                                            + "MIN(Semitotal) AS Subtotal, Min(Taxes) AS Tax, MIN(ServiceCharge) AS ServiceFee, MIN(Total) AS Total, MIN(Orders.Status) AS Status "
                                            + "FROM Orders, Order_Items WHERE Orders.CentennialEmail = @username "
                                            + "AND Orders.OrderID = Order_Items.OrderID GROUP BY Orders.OrderID");
            cmd.Parameters.AddWithValue("@username", Session["username"]);
            cmd.Connection = connection;
            SqlDataAdapter sqlData = new SqlDataAdapter(cmd);

            sqlData.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                OrderGridView.DataSource = dt;
                OrderGridView.DataBind();
            }
        }
        catch (SqlException ex)
        {
            string msg = "Fetch Error: ";
            msg += ex.Message;
            throw new Exception(msg);
        }
        finally
        {
            connection.Close();
        }
    }
Пример #3
0
 private void mtSend_Click(object sender, EventArgs e)
 {
     try{
     if(OrderGridView.SelectedRows.Count>0){
         if(MessageBox.Show("Are you sure to send out this order?", "Send Order", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             Connection c = new Connection();
             dti = c.connect();
             int index = OrderGridView.SelectedRows[0].Index;
             string orderNumber = "SELECT orderID FROM orders WHERE orderID=\"" + OrderGridView[0, index].Value.ToString() + "\"";
             int orderID = int.Parse(dti.getOneField(orderNumber));
             string sendQuery = "UPDATE orders SET shipped=1 WHERE orderID=\"" + OrderGridView[0, index].Value.ToString() + "\"";
             dti.executeDMQuery(sendQuery);
             for (int i = 0; i < data.Rows.Count; i = i + 1)
             {
                 DataRow row = data.Rows[i];
                 if (int.Parse(row["orderID"].ToString()) == orderID)
                     data.Rows.Remove(row);
             }
             OrderGridView.DataSource = data;
             OrderGridView.Refresh();
         }
     }
     }
     catch(Exception ee)
     {  }
 }
Пример #4
0
        private void LoadProductionOrderColorAndSize()
        {
            DataTable dsProductionOrder = new DataTable();

            dsProductionOrder.Columns.Add("COLSYSID", typeof(Int64));
            dsProductionOrder.Columns.Add("COLNAME", typeof(string));
            OrderGridView.Columns.Clear();



            DataSet ds = ProjectFunctions.GetDataSet("sp_LoadProductionOrderColorAndSize '" + txtArtID.Text + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    dsProductionOrder.Columns.Add(dr["SZDESC"].ToString().Trim());
                }
                int Count = 0;

                OrderGridView.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn());
                OrderGridView.Columns[Count].OptionsColumn.AllowEdit = false;
                OrderGridView.Columns[Count].Visible   = true;
                OrderGridView.Columns[Count].Caption   = "COLSYSID";
                OrderGridView.Columns[Count].FieldName = "COLSYSID";

                Count++;

                OrderGridView.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn());
                OrderGridView.Columns[Count].OptionsColumn.AllowEdit = false;
                OrderGridView.Columns[Count].Visible   = true;
                OrderGridView.Columns[Count].Caption   = "COLNAME";
                OrderGridView.Columns[Count].FieldName = "COLNAME";



                Count++;

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    OrderGridView.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn());
                    OrderGridView.Columns[Count].OptionsColumn.AllowEdit = true;
                    OrderGridView.Columns[Count].Visible   = true;
                    OrderGridView.Columns[Count].Caption   = dr["SZDESC"].ToString();
                    OrderGridView.Columns[Count].FieldName = dr["SZSYSID"].ToString();
                    Count++;
                }
                if (dsProductionOrder.Rows.Count > 0)
                {
                    OrderGrid.DataSource = dsProductionOrder;
                    OrderGridView.BestFitColumns();
                }
                else
                {
                    OrderGrid.DataSource = null;
                    OrderGridView.BestFitColumns();
                }
            }
        }
Пример #5
0
 private void BindingOrderData()
 {
     try
     {
         List <DataAccessLayer.Modelo.Order> listOrder = logicData.GetOrderList();
         OrderGridView.DataSource = listOrder;
         OrderGridView.DataBind();
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
        private void ArrangeGridViewColumns()
        {
            if (OrdersGridControl.DataSource != null)
            {
                OrderGridView.PopulateColumns();

                // since the component has no idea of what is going to receive, we have to map and setup all by hand
                // hide some columns
                OrderGridView.Columns[nameof(CustomerOrder.FirstName)].Visible = false;
                OrderGridView.Columns[nameof(CustomerOrder.LastName)].Visible  = false;
                OrderGridView.Columns[nameof(CustomerOrder.Id)].Visible        = false;
                OrderGridView.Columns[nameof(CustomerOrder.OrderId)].Visible   = false;

                // apply some formats
                OrderGridView.Columns[nameof(CustomerOrder.OrderDate)].DisplayFormat.FormatType   = FormatType.DateTime;
                OrderGridView.Columns[nameof(CustomerOrder.OrderDate)].DisplayFormat.FormatString =
                    ConfigurationManager.AppSettings["DateFormat"];

                OrderGridView.Columns[nameof(CustomerOrder.OrderValue)].DisplayFormat.FormatType   = FormatType.Numeric;
                OrderGridView.Columns[nameof(CustomerOrder.OrderValue)].DisplayFormat.FormatString =
                    ConfigurationManager.AppSettings["CurrencyFormat"];

                // no edit on the columns
                foreach (GridColumn gridColumn in OrderGridView.Columns)
                {
                    if (TotalPages > 1)
                    {
                        gridColumn.SortMode = ColumnSortMode.Custom;
                    }
                    gridColumn.OptionsColumn.AllowEdit = false;
                }

                // add button
                GridColumn unbColumn = OrderGridView.Columns.AddField("ShowCustomerDetail");
                unbColumn.VisibleIndex = OrderGridView.Columns.Count;
                unbColumn.OptionsFilter.AllowFilter = false;
                unbColumn.OptionsColumn.ShowCaption = false;
                unbColumn.OptionsColumn.AllowSort   = DefaultBoolean.False;
                unbColumn.UnboundType = UnboundColumnType.Decimal;
                RepositoryItemButtonEdit edit = new RepositoryItemButtonEdit
                {
                    TextEditStyle = TextEditStyles.HideTextEditor
                };
                edit.ButtonClick       += ShowCustomerDetailClick;
                edit.Buttons[0].Caption = "View Detail";
                edit.Buttons[0].Kind    = ButtonPredefines.Glyph;
                OrderGridView.Columns["ShowCustomerDetail"].ColumnEdit = edit;

                OrderGridView.Columns[_sortColumn].SortOrder = _sortDirection;
            }
        }
        protected void ExportToExcel(object sender, EventArgs e)
        {
            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=orderreports.xls");
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-excel";
            using (StringWriter sw = new StringWriter())
            {
                HtmlTextWriter hw = new HtmlTextWriter(sw);

                //To Export all pages
                OrderGridView.AllowPaging = false;
                this.BindGridView();

                OrderGridView.HeaderRow.BackColor = Color.White;
                foreach (TableCell cell in OrderGridView.HeaderRow.Cells)
                {
                    cell.BackColor = OrderGridView.HeaderStyle.BackColor;
                }
                foreach (GridViewRow row in OrderGridView.Rows)
                {
                    row.BackColor = Color.White;
                    foreach (TableCell cell in row.Cells)
                    {
                        if (row.RowIndex % 2 == 0)
                        {
                            cell.BackColor = OrderGridView.AlternatingRowStyle.BackColor;
                        }
                        else
                        {
                            cell.BackColor = OrderGridView.RowStyle.BackColor;
                        }
                        cell.CssClass = "textmode";
                    }
                }

                OrderGridView.RenderControl(hw);

                //style to format numbers to string
                string style = @"<style> .textmode { } </style>";
                Response.Write(style);
                Response.Output.Write(sw.ToString());
                Response.Flush();
                Response.End();
            }
        }
Пример #8
0
 public OrderForm()
 {
     InitializeComponent();
     try{
     c = new Connection();
     dti = c.connect();
     data = dti.getToDataTable("SELECT orders.orderID, orders.buyer, orders.orderDate FROM orders, orderitems, warehouse WHERE warehouse.itemNumber=orderitems.itemID AND orders.orderID=orderitems.orderID AND orders.shipped=0 GROUP BY orders.orderDate");
     OrderGridView.DataSource = data;
     OrderGridView.Columns["orderID"].Visible = false;
     OrderGridView.Columns["orderDate"].Width = 270;
     OrderGridView.Columns["orderDate"].HeaderText = "Order Date";
     OrderGridView.Columns["buyer"].HeaderText = "Buyer Name";
     OrderGridView.Refresh();
     }
     catch(Exception ee)
     { }
 }
Пример #9
0
        /// <summary>
        ///     Opens the popup for the customer edition
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ShowCustomerDetailClick(object sender, ButtonPressedEventArgs e)
        {
            try
            {
                ShowLoadingPanel();
                CustomerOrder obj = (CustomerOrder)OrderGridView.GetRow(OrderGridView.FocusedRowHandle);

                // we call the editor cloning the object as we only want to update the record after we have updated the database (for heavy data sources)
                // or in the end of the method, we could just reload the grid's data source
                CustomerDetail dlg =
                    new CustomerDetail(obj.Clone())
                {
                    StartPosition = FormStartPosition.CenterParent
                };

                // ok?
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    // invoke repository
                    PersistenceResult result = await _repository.SaveCustomerInfoAsync(dlg.CustomerOrder);

                    if (result.Success)
                    {
                        // In this case we have a simple situation, just replace
                        obj.FirstName = dlg.CustomerOrder.FirstName;
                        obj.LastName  = dlg.CustomerOrder.LastName;
                        OrderGridView.UpdateCurrentRow();
                        MessageBox.Show("Record successfully saved!");
                    }
                    else
                    {
                        MessageBox.Show("An error has occurred when trying dto save the record");
                    }
                }

                dlg = null;
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            finally
            {
                HideLoadingPanel();
            }
        }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["MemberID"] != null && Request.IsAuthenticated)
        {
            string MemberID = Session["MemberID"].ToString(); // 获取当前用户 ID

            MemberInfoFormViewSqlDataSource.SelectCommand = string.Format("Select * from VIP_INFO where VipID='{0}'", MemberID);

            string        sqlSelectVipStr           = string.Format("Select * from VIP_INFO where VipID='{0}'", MemberID);
            SqlDataReader sqlSelectVipStrDataReader = DataBase.GetDataReader(sqlSelectVipStr);
            if (sqlSelectVipStrDataReader.Read())
            {
                if (sqlSelectVipStrDataReader["Province"] == "" || sqlSelectVipStrDataReader["City"] == "" || sqlSelectVipStrDataReader["Postcode"] == "" || sqlSelectVipStrDataReader["Address"] == "" || sqlSelectVipStrDataReader["Telephone"] == "")
                {
                    MsgLabel.Text       = "请输入您的收货信息。";
                    OrderButton.Visible = false;
                }
                else
                {
                    OrderButton.Visible = true;
                }
            }
            DataTable mydt = new DataTable();
            if (Session[CartTableName] != null)
            {
                mydt = (DataTable)Session[CartTableName];
                OrderGridView.DataSource = mydt;
                OrderGridView.DataBind();
            }
            else
            {
                Response.Redirect("../Product/ProductList.aspx");
            }
        }
        else
        {
            Response.Redirect("../Member/Login.aspx");
        }

        for (int i = 0; i < OrderGridView.Rows.Count; i++)
        {
            AllTotal += Convert.ToDecimal(OrderGridView.Rows[i].Cells[1].Text) * Int32.Parse(OrderGridView.Rows[i].Cells[2].Text);
        }
        OrderGridView.FooterRow.Cells[0].Text = "商品总价:" + AllTotal.ToString();
    }
Пример #11
0
        private void OrderGridViewDataBind()
        {
            if (selectedTable.Rows.Count == 0)
            {
                supplierlist.Enabled      = true;
                clearbutton.Visible       = false;
                createOrderButton.Enabled = false;
            }

            else
            {
                supplierlist.Enabled      = false;
                clearbutton.Visible       = true;
                createOrderButton.Enabled = true;
            }
            OrderGridView.DataSource = selectedTable;
            OrderGridView.DataBind();
        }
Пример #12
0
        protected void Open_Click(object sender, EventArgs e)
        {
            var controller = new ReceivingController();

            controller.ClearUnOrderedItems();

            UnorderedListView.DataSourceID = "UnorderedODS";

            if (OrderListDropDown.SelectedIndex > 0)
            {
                var vendorinfo = controller.GetVendorContact(int.Parse(OrderListDropDown.SelectedValue));

                CompanyName.Text    = vendorinfo.Name;
                CompanyAddress.Text = vendorinfo.Address;
                CompanyContact.Text = vendorinfo.Contact;
                CompanyPhone.Text   = vendorinfo.Phone;

                var iteminfo = controller.GetOrderDetails(int.Parse(OrderListDropDown.SelectedValue));
                OrderGridView.DataSource = iteminfo;
                OrderGridView.DataBind();

                ReceiveShimpment.Visible  = true;
                UnorderedLabel.Visible    = true;
                UnorderedListView.Visible = true;
                ForceClose.Visible        = true;
                Comments.Visible          = true;
            }
            else
            {
                CompanyName.Text    = null;
                CompanyAddress.Text = null;
                CompanyContact.Text = null;
                CompanyPhone.Text   = null;

                OrderGridView.DataSource = null;
                OrderGridView.DataBind();

                ReceiveShimpment.Visible  = false;
                UnorderedLabel.Visible    = false;
                UnorderedListView.Visible = false;
                ForceClose.Visible        = false;
                Comments.Visible          = false;
            }
        }
        private void BindGridView()
        {
            SqlConnection con = new SqlConnection(_ConnStr);

            con.Open();


            SqlCommand cmd = new SqlCommand("select ORD_Number,ORD_Date,ORD_SQ_RFQ_Number,ORD_SQ_RFQ_Company,ORD_SQ_RFQ_OriginCountry,ORD_SQ_RFQ_DestinationCountry,ORD_SQ_RFQ_OriginAirport,ORD_SQ_RFQ_DestinationAirport,ORD_SQ_RFQ_NumberofPackages,ORD_SQ_RFQ_TotalChwt,ORD_SQ_RFQ_Commodity,ORD_SQ_BuyerCurrency,ORD_SellerCurrency from Orders where ORD_Date between @fromdate and @todate and ORD_SQ_RFQ_Company = @company", con);

            cmd.Parameters.AddWithValue("@company", dropdowncustomer.SelectedItem.Text);
            cmd.Parameters.AddWithValue("@fromdate", Convert.ToDateTime(txtfromorderdate.Text));
            cmd.Parameters.AddWithValue("@todate", Convert.ToDateTime(txttoorderdate.Text));
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);
            OrderGridView.DataSource = ds;
            OrderGridView.DataBind();
            con.Close();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            OrderGridView.DataSource = orderBll.GetOrderList();
            OrderGridView.DataBind();

            /*
             * List<ClassInfo> clsList = clsBll.GetClassList();
             * StringBuilder sbOpts = new StringBuilder();
             * foreach (ClassInfo cls in clsList)
             * {
             *  //这个班级作为默认选项
             *  if (stu.ClassId == cls.Id)
             *  {
             *      sbOpts.Append("<option value='" + cls.Id + "'selected='selected'>" + cls.Name + "</option>");
             *  }
             *  else
             *  {
             *      sbOpts.Append("<option value='" + cls.Id + "'>" + cls.Name + "</option>");
             *  }
             *
             * }
             * html = html.Replace("{@stuClass}", sbOpts.ToString());
             */
            List <ProductInfo> proInfo = proBll.GetProductList();
            StringBuilder      sbOpts  = new StringBuilder();

            foreach (ProductInfo cls in proInfo)
            {
                if (ops.Length == 0)
                {
                    ops = "<option selected='selected'>请选择你要的商品</option>";
                }
                else
                {
                    ops += "<option value='" + cls.cName + "'>" + cls.cName + "</option>";
                }
            }
        }
Пример #15
0
 private void Form1_Load(object sender, EventArgs e)
 {
     OrderGridView.AutoResizeColumns();
     OrderDetailGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
 }
Пример #16
0
 private void mtRefresh_Click(object sender, EventArgs e)
 {
     data = dti.getToDataTable("SELECT orders.orderID, orders.buyer, orders.orderDate FROM orders, orderitems, warehouse WHERE warehouse.itemNumber=orderitems.itemID AND orders.orderID=orderitems.orderID AND orders.shipped=0 GROUP BY orders.orderDate");
     OrderGridView.DataSource = data;
     OrderGridView.Refresh();
 }