protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated) //if not logged in { Response.Redirect("/"); } try { dsOrder = new OrdersDataSet(); prod_orderTableAdapter daOrder = new prod_orderTableAdapter(); daOrder.Fill(dsOrder.prod_order); if (Request.Cookies["ID"] != null) // Request the cookies which contaions the ID Of thr record that was carried over from the index page { id = Convert.ToInt32(Request.Cookies["ID"].Value); } if (Request.Cookies["Action"] != null && Request.Cookies["Action"].Value == "Delete") { pnlDeleteConfirm.Visible = true; lblTitle.Text = "Delete Sale"; } else { pnlDeleteConfirm.Visible = false; } } catch { return; } }
static NewOrderForm1() { prod_orderTableAdapter daOrder = new prod_orderTableAdapter(); try { daOrder.Fill(dsOrder.prod_order); } catch { } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { prod_orderTableAdapter prod = new prod_orderTableAdapter(); prod.Fill(dsInventory.prod_order); int ordNum = Convert.ToInt32(dsInventory.prod_order.Single().ItemArray[0].ToString()); Prod_Order order = new Prod_Order((ordNum + 1).ToString(), DateTime.Parse(txtDateOrdered.Text), true); Prod_Order.CreateProd_Order(order, out string status, out int id); foreach (On_Order line in onOrders) { line.prodorderID = id; On_Order.CreateOn_Order(line, out string onOrdStatus, out int onOrdId); } } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated) //if not logged in { Response.Redirect("/"); } try { dsOrder = new OrdersDataSet(); prod_orderTableAdapter daOrder = new prod_orderTableAdapter(); daOrder.Fill(dsOrder.prod_order); if (Request.Cookies["ID"] != null) // Request the cookies which contaions the ID Of thr record that was carried over from the index page { id = Convert.ToInt32(Request.Cookies["ID"].Value); } } catch { return; } if (!IsPostBack) { if (id != -1) { try { DataRow order = dsOrder.prod_order.FindByid(id); // Find the related Record and fill the fields in the page with the data if (order != null) { this.txtID.Text = order.ItemArray[0].ToString(); this.txtProdNumber.Text = order.ItemArray[1].ToString(); this.txtDate.Text = order.ItemArray[2].ToString(); this.cbo_Paid.Text = order.ItemArray[3].ToString(); } else { lblStatus.Text = "Please Try Again"; } } catch { lblStatus.Text = "Database Error"; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated) //if not logged in { Response.Redirect("/"); } try { dsOrder = new OrdersDataSet(); prod_orderTableAdapter daOrder = new prod_orderTableAdapter(); daOrder.Fill(dsOrder.prod_order); rows = (Session["criteria"] != null) ? dsOrder.prod_order.Select(Session["criteria"].ToString()) : dsOrder.prod_order.Select(); DisplayOrder(); } catch (Exception ex) { } //data loaded successfully }
protected void btnDeleteConfirm_Click(object sender, EventArgs e) { if (id != -1) { try { prod_orderTableAdapter daOrder = new prod_orderTableAdapter(); daOrder.Fill(dsOrder.prod_order); DataRow record = dsOrder.prod_order.FindByid(id); // Find and add the record to tbe record variable record.Delete(); // Deletes the record in memory // table adapter to service table (Service adapter) daOrder.Update(record); // Call update method on the service adapter so it updates the table in memory ( All changes made are applied - CRUD) dsOrder.AcceptChanges(); // Call accept method on the dataset so it update the chanmges to the database //Refresh the page to show the record being deleted Response.Redirect("Default.aspx"); } catch { lblStatus.Text = "Delete failed. Probably this Order assigned to some arrived Order in Database."; } } }