protected void btnSearch_Click(object sender, EventArgs e) { String supplierName = ddlSupplierName.SelectedItem.Text; if (String.IsNullOrEmpty(txtPODate.Text)) { PODetailGrid.DataSource = upControl.getPOListBySupplier(supplierName); PODetailGrid.DataBind(); } else { String dt = txtPODate.Text + " 12:00:00 AM"; try { DateTime PODate = DateTime.ParseExact(dt, "MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture); PODetailGrid.DataSource = upControl.getPOListBySuppAndDate(supplierName, PODate); PODetailGrid.DataBind(); } catch (Exception ex) { lblStatus.ForeColor = System.Drawing.Color.Red; lblStatus.Text = "Please enter the date in correct format"; } } }
protected void PODetailGrid_RowDeleting(object sender, GridViewDeleteEventArgs e) { dt = (DataTable)Session["data"]; int index = e.RowIndex; dt.Rows.RemoveAt(index); PODetailGrid.DataSource = dt; PODetailGrid.DataBind(); }
protected void btnUpdate_Click(object sender, EventArgs e) { dt = (DataTable)Session["data"]; foreach (DataRow row in dt.Rows) { int dtKey = Convert.ToInt32(row["key"]); int grdKey = Convert.ToInt32(lblKey.Text); if (dtKey == grdKey) { row["MinReorderQty"] = Convert.ToInt32(txtReorderQty.Text); row["Supplier"] = ddlSupplierName.SelectedItem.Text; row["Price"] = Convert.ToDouble(lblDBPrice.Text); row.EndEdit(); dt.AcceptChanges(); } } PODetailGrid.DataSource = dt; PODetailGrid.DataBind(); Session["data"] = dt; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <Stock> stockList = cpControl.getItemsBelowReorder(); dt = cpControl.calculateReorderQty(stockList); Session["data"] = dt; if (dt != null) { PODetailGrid.DataSource = dt; PODetailGrid.DataBind(); } else { lblStatus.Text = "Currently no items are below reorder level"; } lblDBItemCode.Visible = false; ddlCategory.DataSource = cpControl.getItemCategory(); ddlCategory.DataBind(); } }
protected void btnPopupAddItems_Click(object sender, EventArgs e) { dt = (DataTable)Session["data"]; int key; foreach (GridViewRow r in ItemDetailsGrid.Rows) { CheckBox chk = (CheckBox)r.FindControl("chkAdd"); if (chk.Checked) { if (dt.Rows.Count == 0) { key = 1; } else { DataRow dr = dt.Rows[dt.Rows.Count - 1]; key = Convert.ToInt32(dr["key"]) + 1; } DataRow row = dt.NewRow(); row["key"] = key; row["ItemCode"] = r.Cells[1].Text; row["ItemCategory"] = r.Cells[2].Text; row["ItemDescription"] = r.Cells[3].Text.ToString(); row["UnitOfMeasure"] = r.Cells[4].Text; row["MinReorderQty"] = Convert.ToInt32(r.Cells[5].Text); row["Supplier"] = ""; row["Price"] = 0.00; dt.Rows.Add(row); dt.AcceptChanges(); } } PODetailGrid.DataSource = dt; PODetailGrid.DataBind(); mpe1.Hide(); Session["data"] = dt; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["RefUrl"] = Request.UrlReferrer.ToString(); ddlOrderStatus.DataSource = upControl.getPOStatus(); ddlOrderStatus.DataBind(); lblDBPONumber.Text = Session["PONumber"].ToString(); int PONumber = Convert.ToInt32(lblDBPONumber.Text); PurchaseOrder po = upControl.getPO(PONumber); lblDBSupplier.Text = po.Supplier.ToString(); lblDBPODate.Text = po.DateRaised.Value.ToString("dd/MM/yyyy"); lblDBTotalAmount.Text = po.TotalAmount.ToString(); String POStatus = po.POStatus; ddlOrderStatus.Text = POStatus; PODetailGrid.DataSource = upControl.getPODetail(PONumber); PODetailGrid.DataBind(); if ((POStatus.Equals("Cancel")) || (POStatus.Equals("Delivered"))) { if (POStatus.Equals("Delivered")) { txtDeliveryDate.Text = po.DeliveryDate.Value.ToString("dd/MM/yyyy"); txtDeliveryOrderNumber.Text = po.DeliveryNo.ToString(); } txtRemarks.Text = po.Comments; txtDeliveryDate.Enabled = false; txtDeliveryOrderNumber.Enabled = false; txtRemarks.Enabled = false; btnUpdate.Enabled = false; btnCancel.Enabled = false; ddlOrderStatus.Enabled = false; } } }