protected void ContinueShoppingButton_Click(object sender, EventArgs e) { PartCatelogPanel.Visible = true; PurchaseInfoPanel.Visible = false; NavigationPanel.Visible = false; ViewCartPanel.Visible = false; PlaceOrderPanel.Visible = false; ProductGridView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var productSubCategoryId = Request.QueryString["ProductSubCategoryId"]; int id; //if (!int.TryParse(productSubCategoryId, out id)) { throw new ApplicationException("ID wasn't an integer."); } var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; // Unsafe string concat var sqlString = "SELECT * FROM Product WHERE ProductSubCategoryID = " + productSubCategoryId; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlString, conn)) { command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } /*//Paramatarised input * var sqlString = "SELECT * FROM Product WHERE ProductSubCategoryID = @ProductSubCategoryId"; * using (var conn = new SqlConnection(connString)) * { * using (var command = new SqlCommand(sqlString, conn)) * { * command.Parameters.Add("@ProductSubcategoryId", SqlDbType.VarChar).Value = productSubCategoryId; * command.Connection.Open(); * ProductGridView.DataSource = command.ExecuteReader(); * ProductGridView.DataBind(); * } * }*/ /*//Stored procedure input * var sqlString = "GetProducts"; * using (var conn = new SqlConnection(connString)) * { * using (var command = new SqlCommand(sqlString, conn)) * { * command.CommandType = CommandType.StoredProcedure; * command.Parameters.Add("@ProductSubcategoryId", SqlDbType.VarChar).Value = productSubCategoryId; * //command.Parameters.Add("@ProductSubcategoryId", SqlDbType.Int).Value = id; * command.Connection.Open(); * ProductGridView.DataSource = command.ExecuteReader(); * ProductGridView.DataBind(); * } * }*/ var dc = new InjectionEntities(); /*ProductGridView.DataSource = dc.Products.Where(p => p.ProductSubcategoryID == id).ToList(); * //ProductGridView.DataSource = dc.Products.Where(p => p.ProductSubcategoryID == productSubCategoryId).ToList(); * ProductGridView.DataBind();*/ ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("LoginForm.aspx"); } ProductGridView.DataSource = repo.getAllProducts(); ProductGridView.DataBind(); }
private void BindGridView() { Collection <MixERP.Net.Common.Models.Transactions.ProductDetailsModel> table = this.GetTable(); ProductGridView.DataSource = table; ProductGridView.DataBind(); this.ShowTotals(); }
protected void ProductDetailsViewSqlDataSource_Inserted(object sender, SqlDataSourceStatusEventArgs e) { System.Data.Common.DbCommand command = e.Command; ProductDetailsViewSqlDataSource.SelectParameters["ProductID"].DefaultValue = command.Parameters["@ProductID"].Value.ToString(); ProductGridView.DataBind(); ProductDetailsView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var productSubCategoryId = Request.QueryString["ProductSubCategoryId"]; string userAgent = Request.Headers.GetValues("User-Agent")[0]; var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var sqlUserAgentString = "SELECT * FROM UserAgents WHERE UserAgent = N'" + userAgent + "'"; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlUserAgentString, conn)) { command.Connection.Open(); SqlDataReader dr = command.ExecuteReader(); if (dr == null) { var insertString = "INSERT INTO [dbo].[UserAgents] ([UserAgent]) VALUES (N'" + userAgent + "')"; SqlCommand sc = new SqlCommand(insertString, new SqlConnection(connString)); sc.ExecuteNonQuery(); } } } if (productSubCategoryId != null) { //productSubCategoryId = productSubCategoryId.ToUpper().Replace("SELECT", ""); //productSubCategoryId = productSubCategoryId.ToUpper().Replace("UPDATE", ""); //productSubCategoryId = productSubCategoryId.ToUpper().Replace("INSERT", ""); //productSubCategoryId = productSubCategoryId.ToUpper().Replace("DELETE", ""); //productSubCategoryId = productSubCategoryId.ToUpper().Replace("WHERE", ""); //productSubCategoryId = productSubCategoryId.ToUpper().Replace("FROM", ""); injectionEntities ie = new injectionEntities(); int?pID = int.Parse(productSubCategoryId); ProductGridView.DataSource = ie.Products.Where(p => p.ProductSubcategoryID == pID).ToList(); ProductGridView.DataBind(); var sqlString = "SELECT Name, ProductNumber, ListPrice FROM Product WHERE ProductSubCategoryID = " + productSubCategoryId; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlString, conn)) { command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); } }
private void BindingProductData() { try { List <DataAccessLayer.Modelo.Product> listProduct = logicData.GetProductList(); ProductGridView.DataSource = listProduct; ProductGridView.DataBind(); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { Stopwatch loadWatch = new Stopwatch(); loadWatch.Start(); pageWatch.Start(); statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "Page Load:Start" }); //RegisterAsyncTask(new PageAsyncTask(LoadProductsAsync)); RegisterAsyncTask(new PageAsyncTask(async() => { statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProductsAsync():Start" }); ProductProxyService.ProductServiceClient client = new ProductProxyService.ProductServiceClient(); IList <ProductProxyService.Product> products = await client.GetProductsTaskAsync(); statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProductsAsync():End" }); ProductGridView.DataSource = products.Take(10); ProductGridView.DataBind(); ThreadGridView.DataSource = statistics; ThreadGridView.DataBind(); TimeSpan ts1 = pageWatch.Elapsed; PageElapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts1.Hours, ts1.Minutes, ts1.Seconds, ts1.Milliseconds / 10); })); statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "Page Load::End" }); TimeSpan ts = loadWatch.Elapsed; LoadElapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); }
private void LoadProducts() { statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProducts():Start" }); ProductProxyService.ProductServiceClient client = new ProductProxyService.ProductServiceClient(); IList <ProductProxyService.Product> products = client.GetProducts(); statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProducts():End" }); ProductGridView.DataSource = products.Take(10); ProductGridView.DataBind(); }
private void SaveButton_Click(object sender, EventArgs e) { try { context.products.AddRange( ((IEnumerable <EntityF.Product>) this.productsOfCategoryBindingSource.DataSource) .Except(context.products.Local)); context.SaveChanges(); }catch (Exception exception) { Console.WriteLine(exception.ToString()); } CategoriesGridView1.Refresh(); ProductGridView.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { var productSubCategoryId = Request.QueryString["ProductSubCategoryId"]; int id; if (!int.TryParse(productSubCategoryId, out id)) { throw new ApplicationException("ID wasn't an integer"); } var dc = new InjectionEntities(); ProductGridView.DataSource = dc.Products.Where(p => p.ProductSubcategoryID == id).ToList(); ProductGridView.DataBind(); ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); }
protected void Button1_Click(object sender, EventArgs e) { var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand("SearchProducts", conn)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@SearchTerm", SqlDbType.VarChar).Value = SearchTerm.Text; command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); SearchPanel.Visible = true; }
protected void btGo_Click(object sender, EventArgs e) { var productSubCategoryId = ddlCategory.SelectedValue; if (productSubCategoryId != null) { var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var sqlString = "SELECT * FROM Product WHERE ProductSubCategoryID = " + productSubCategoryId; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlString, conn)) { command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { var productSubCategoryId = Request.QueryString["ProductSubCategoryId"]; var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var sqlString = "SELECT * FROM Product WHERE ProductSubCategoryID = " + productSubCategoryId; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlString, conn)) { command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); }
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { //int productSubCategoryId = int.Parse(ddlCategory.SelectedValue); var productSubCategoryId = ddlCategory.SelectedValue; if (productSubCategoryId != null) { var connstring = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var sqlstring = "select * from product where productsubcategoryid = " + productSubCategoryId; using (var conn = new SqlConnection(connstring)) { using (var command = new SqlCommand(sqlstring, conn)) { command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { string CS = ConfigurationManager.ConnectionStrings["Conn"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("Select * from tblProduct; Select * from tblProductCategories", con); con.Open(); using (SqlDataReader rdr = cmd.ExecuteReader()) { ProductGridView.DataSource = rdr; ProductGridView.DataBind(); while (rdr.NextResult()) { CategoriesGridView.DataSource = rdr; CategoriesGridView.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { var productSubCategoryId = Request.QueryString["ProductSubCategoryId"]; var connString = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var sqlString = "GetProducts"; using (var conn = new SqlConnection(connString)) { using (var command = new SqlCommand(sqlString, conn)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@ProductSubCategoryID", SqlDbType.VarChar).Value = productSubCategoryId; command.Connection.Open(); ProductGridView.DataSource = command.ExecuteReader(); ProductGridView.DataBind(); } } ProductCount.Text = ProductGridView.Rows.Count.ToString("n0"); }
protected void Page_Load(object sender, EventArgs e) { MessageUserControl.TryRun(() => { //have your log in yte if (!Request.IsAuthenticated) { ProductGridView.Columns[0].Visible = false; ProductGridView.Columns[2].Visible = false; var controller = new SalesController(); AllPartsAmount.Text = controller.getAllPartsAmount().ToString(); } else { UserName.Value = User.Identity.Name; ProductGridView.Columns[0].Visible = true; ProductGridView.Columns[2].Visible = true; var controller = new SalesController(); AllPartsAmount.Text = controller.getAllPartsAmount().ToString(); ProductGridView.DataBind(); } }); }
private void LoadProducts() { statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProducts():Start" }); ProductProxyService.ProductServiceClient client = new ProductProxyService.ProductServiceClient(); IList <ProductProxyService.Product> products = client.GetProducts(); statistics.Add(new Statistic { ThreadId = Thread.CurrentThread.ManagedThreadId, Message = "LoadProducts():End" }); ProductGridView.DataSource = products.Take(10); ProductGridView.DataBind(); TimeSpan ts = pageWatch.Elapsed; PageElapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); }
protected void CartInfoGridView_RowCommand(object sender, GridViewCommandEventArgs e) { MessageUserControl.TryRun(() => { var controller = new SalesController(); var cartItemId = 0; switch (e.CommandName) { case "Delete": cartItemId = int.Parse(e.CommandArgument.ToString()); controller.DeleteCartItem(cartItemId); ProductGridView.DataBind(); break; case "Update": cartItemId = int.Parse(e.CommandArgument.ToString().Split(';')[0]); var idx = int.Parse(e.CommandArgument.ToString().Split(';')[1]); var quantity = int.Parse((CartInfoGridView.Rows[idx].FindControl("QutityChanged") as TextBox).Text); controller.UpdateCartItem(cartItemId, quantity); ProductGridView.DataBind(); break; } }); }
protected void ProductFormView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { ProductGridView.DataBind(); }
private void renderProductGridView() { ProductGridView.DataSource = OrganizationProducts; ProductGridView.DataBind(); }
protected void ProductDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { ProductGridView.DataBind(); }
private void LoadProducts(IList <ProductProxyService.Product> products) { ProductGridView.DataSource = products.Take(10); ProductGridView.DataBind(); }
protected void All_Click(object sender, EventArgs e) { Response.Redirect("~/Pages/Sales/Sales.aspx", true); ProductGridView.DataBind(); //QUESTION }