//Method used for the bottom gridview for creating a new purchase order private void OrderBinding() { //Sets the datasource to be the data table that is stored in the view state GridViewOrder.DataSource = dt; //Calls for the page to be updated and a postback GridViewOrder.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { MyList = new List <CustomerOrder>(); MyList = Session["Mylist"] as List <CustomerOrder>; if (!IsPostBack) { try { GridViewOrder.DataSource = MyList; GridViewOrder.DataBind(); foreach (CustomerOrder ord in MyList) { GrandTotal = GrandTotal + ord.TPrice; } Session["GrandTotal"] = GrandTotal; txtTotalValueOrder.Text = Session["GrandTotal"].ToString(); } catch { } } if (MyList == null) { LblTotalValueOrder.Visible = false; txtTotalValueOrder.Visible = false; btnOrder.Visible = false; } }
protected void BindListView() { string query = "SELECT bt.book_code AS book_code , CONCAT(bt.c_firstname , ' ', bt.c_lastname) AS b_code, bt.travel_datetime AS t_time ,tt.th_name AS type_name, book_status.th_name FROM book_tour AS bt INNER JOIN tour AS t ON bt.tour_code = t.tour_code INNER JOIN type_tour AS tt ON tt.id = t.type_tour_id INNER JOIN book_status_history bsh ON bt.book_code = bsh.book_code INNER JOIN book_status ON bsh.status_id = book_status.id where bsh.created_at in (select max(created_at) from book_status_history group by book_code)"; /// keyword Search string SearchKeyWord = TextBoxSearch.Text; if (SearchKeyWord != "") { query += " and ( bt.c_firstname like '%" + SearchKeyWord + "%'"; query += " or bt.c_lastname like '%" + SearchKeyWord + "%' "; query += " or bt.book_code like '%" + SearchKeyWord + "%' )"; } /// type Filter string typeFilter = ""; foreach (ListItem type in CheckBoxListStatus.Items) { if (type.Selected) { if (typeFilter.Length == 0) { typeFilter += type.Value; } else { typeFilter += "," + type.Value; } } } string prefixType = " where "; if (query.IndexOf("where") > -1) { prefixType = " and "; } if (typeFilter.Length != 0) { query += prefixType + " bsh.status_id in (" + typeFilter + ")"; } string ConnectString = WebConfigurationManager.ConnectionStrings["jojoDBConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(ConnectString); SqlDataAdapter sda = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); sda.Fill(dt); GridViewOrder.DataSource = dt; GridViewOrder.DataBind(); }
public void ClearFrom() { gridOrderPlanning.DataSource = null; gridOrderPlanning.DataBind(); GridViewOrder.DataSource = null; GridViewOrder.DataBind(); ddlArticle.ClearSelection(); ddlSeason.ClearSelection(); ddlStyle.ClearSelection(); ddlPoOrder.ClearSelection(); ddlItemCategory.ClearSelection(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (ValidationUser.staffAcess(Convert.ToString(Session["loginidst"])) != null) { DataContextDataContext Dtx = new DataContextDataContext(); var Order = from b in Dtx.VW_Orders select b; GridViewOrder.DataSource = Order; GridViewOrder.DataBind(); } else { Response.Redirect(@"\Views\LoginAdmin.aspx"); } } }
protected void PostBack() { Staff clk = (Staff)Session["LoginStaff"]; string clerkID = clk.Staff_ID; List <OrderList> OrderList = POC.GetOrderListByOrderClerk(clerkID); if (OrderList.Count == 0) { LBDesc1.Text = "You have not any submitted orders"; LBDesc1.ForeColor = System.Drawing.Color.Blue; } else { LBDesc1.Text = "Orders you have made: "; } Session["OrderList"] = OrderList; GridViewOrder.DataSource = POC.CancelPurchaseOrderGridView(OrderList); GridViewOrder.DataBind(); }
//protected void txtBDTRate_TextChanged(object sender, EventArgs e) //{ // TextBox txt = (TextBox)sender; // GridViewRow gvRow = (GridViewRow)txt.Parent.Parent; // TextBox textqty = (TextBox)gvRow.FindControl("txtQty"); // Label lblTotalRs = (Label)gvRow.FindControl("lblBDTValue"); // if (textqty.Text == "") // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Request Qty')", true); // return; // } // try // { // lblTotalRs.Text = ((Convert.ToDecimal(txt.Text)) * (Convert.ToDecimal(textqty.Text))).ToString(); // } // catch { lblTotalRs.Text = "0"; txt.Text = "0"; } //} protected void GridViewOrder_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = GridViewOrder.Rows[e.RowIndex]; Label lblOrderPlanningId = (Label)row.FindControl("lblOrderPlanningId"); int id = Convert.ToInt16(lblOrderPlanningId.Text); _orderSheetbll.DeleteLOrderPlanningById(id); var result1 = _orderSheetbll.GetLCOrderPlanningByStyle(ddlStyle.Text.ToString()); if (result1.Count > 0) { GridViewOrder.DataSource = result1; GridViewOrder.DataBind(); } else { GridViewOrder.DataSource = null; GridViewOrder.DataBind(); } }
protected void BindGrid() { GridViewOrder.DataSource = ViewState["dt"] as DataTable; GridViewOrder.DataBind(); }