private void Clear() { DataTable dt = new DataTable(); txtLeakTestNo.Text = ""; txtProdOrderNo.Text = ""; txtPatrolDate.Text = ""; ddlType.SelectedIndex = 0; txtItemNumber.Text = ""; txtDescription.Text = ""; txtCustomer.Text = ""; txtSaleOrder.Text = ""; txtQtyTested.Text = ""; ddlOperator.SelectedIndex = 0; txtRemarks.Text = ""; gridLeakTest.DataSource = dt; gridLeakTest.DataBind(); GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); ddlType.Enabled = true; txtProdOrderNo.Enabled = true; txtItemNumber.Enabled = true; txtDescription.Enabled = true; txtCustomer.Enabled = true; txtSaleOrder.Enabled = true; }
protected void GridViewPopUp_PageIndexChanging(object sender, GridViewPageEventArgs e) { DataSet ds = (DataSet)Cache["CacheForPatrolSerialNoList"]; GridViewPopUp.PageIndex = e.NewPageIndex; GridViewPopUp.DataSource = ds; GridViewPopUp.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DateTime currentDate = DateTime.UtcNow; txtPatrolDate.Text = Convert.ToString(currentDate.ToString("MM/dd/yyyy")); var userDto = UsersDTO.Instance; Label lblUserName = (Label)this.Master.FindControl("lblUserName"); lblUserName.Text = userDto.UserName; FillSubLocationMaster(); FillOperatorMaster(); btnSubmit.Visible = false; GridViewPopUp.DataSource = new DataTable(); GridViewPopUp.DataBind(); } }
protected void txtLeakTestNo_TextChanged(object sender, EventArgs e) { try { // Get Patrol Master DataSet ds = _DBObj.GetLeakTestMaster(txtLeakTestNo.Text.Trim()); if (ds != null && ds.Tables[0].Rows.Count > 0) { lblMessage.Visible = false; DateTime patrolDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["LeakTestDate"]); txtPatrolDate.Text = Convert.ToString(patrolDate.ToString("MM/dd/yyyy")); ddlType.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["SubLocationCode"]); txtProdOrderNo.Text = Convert.ToString(ds.Tables[0].Rows[0]["ProdOrderNo"]); txtQtyTested.Text = Convert.ToString(ds.Tables[0].Rows[0]["LeakTestQty"]); ddlOperator.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["OperatorCode"]); txtRemarks.Text = Convert.ToString(ds.Tables[0].Rows[0]["Remarks"]); var OrderExist = txtProdOrderNo.Text.Trim().Substring(0, 1); if (OrderExist == "4") { ds = _DBObj.GetMISOrderStatusForPatrol(txtProdOrderNo.Text.Trim()); if (ds != null && ds.Tables[0].Rows.Count > 0) { txtItemNumber.Text = Convert.ToString(ds.Tables[0].Rows[0]["Item"]); txtDescription.Text = Convert.ToString(ds.Tables[0].Rows[0]["Description"]); txtCustomer.Text = Convert.ToString(ds.Tables[0].Rows[0]["CustomerName"]); txtSaleOrder.Text = Convert.ToString(ds.Tables[0].Rows[0]["OrderNo"]) + "-" + Convert.ToString(ds.Tables[0].Rows[0]["Pos"]); } } else if (OrderExist != "4") { DataSet ds1 = _DBObj.GetWIPAllFromProdOrderNo(txtProdOrderNo.Text.Trim()); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { txtItemNumber.Text = Convert.ToString(ds1.Tables[0].Rows[0]["ItemNumber"]); txtDescription.Text = Convert.ToString(ds1.Tables[0].Rows[0]["Description"]); txtCustomer.Text = ""; txtSaleOrder.Text = ""; } } // Get Serial No Grid View Details DataSet ds2 = _DBObj.GetLeakTestSerial(txtLeakTestNo.Text.Trim()); var query = ds2.Tables[0].AsEnumerable(); // Or datatable.Select(); var sorted = query .Where(u => (string)u["SerialNo"] != "") .OrderBy(u => u["SerialNo"]).ToArray(); if (sorted != null && sorted.ToList().Count > 0) { GridViewPopUp.DataSource = ds2; GridViewPopUp.DataBind(); } // Get Leak Test Details GetLeakTestDetails(txtLeakTestNo.Text.Trim());// todo ddlType.Enabled = false; txtProdOrderNo.Enabled = false; txtItemNumber.Enabled = false; txtDescription.Enabled = false; txtCustomer.Enabled = false; txtSaleOrder.Enabled = false; btnGenerate.Enabled = true; btnDelete.Enabled = true; btnPopDelete.Visible = true; btnUpdate.Visible = true; txtQtyTested.Enabled = false; btnSubmit.Visible = false; } else { lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Invalid Leak Test Number!"; return; } } catch (Exception ex) { LogError(ex, "Exception from fetching leak test details."); } }
protected void btnPopDelete_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); int Count = 0; foreach (GridViewRow row in GridViewPopUp.Rows) { if (row.RowType == DataControlRowType.DataRow) { bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked; if (isChecked) { string serialNo = (row.Cells[0].FindControl("lblCheckListSerial") as Label).Text; selectedSerialNoList = selectedSerialNoList + serialNo + ","; Count = Count + 1; } } } var updatedCount = Convert.ToUInt32(GridViewPopUp.Rows.Count - Count); ViewState["selectedSerialNoList"] = selectedSerialNoList.ToString(); if (!string.IsNullOrEmpty(Convert.ToString(ViewState["selectedSerialNoList"])) && updatedCount >= 0) { ViewState["selectedSerialNoCount"] = Convert.ToString(updatedCount); // Patrol Serial if (selectedSerialNoList != null) { var split = selectedSerialNoList.ToString().Split(','); for (int i = 0; i < split.Length; i++) { if (split[i].Trim() != string.Empty) { _DBObj.DeleteLeakTestSerials(txtLeakTestNo.Text, split[i].Trim(), 0, 0); } } // Updating the Patrol Qty Count From Patrol Inspection Master _DBObj.DeleteLeakTestSerials(txtLeakTestNo.Text, "", Convert.ToInt32(updatedCount), 1); // Get Serial No Grid View Details DataSet ds2 = _DBObj.GetLeakTestSerial(txtLeakTestNo.Text.Trim()); GridViewPopUp.DataSource = ds2; GridViewPopUp.DataBind(); btnUpdate.Visible = true; // todo ViewState["DeletedSerialNoList"] = Convert.ToString(updatedCount); //SetInitialRow(selectedSerialNoList, 0); // 0 means Prod Order Starting with '4' digits //lblMessage.Visible = true; //lblMessage.ForeColor = System.Drawing.Color.Green; //lblMessage.Text = "Selected serial no has been removed successfully."; } } else { lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Select Serial no's to delete"; return; } } catch (Exception ex) { LogError(ex, "Exception from deleting leak test details."); } //txtLeakTestNo_TextChanged(sender, e); //// Get Serial No Grid View Details //_DBObj.GetLeakTestSerial(txtLeakTestNo.Text.Trim()); }
protected void txtProdOrderNo_TextChanged(object sender, EventArgs e) { var LeakTestNumber = string.Empty; DataSet ds = new DataSet(); DataTable dt = new DataTable(); int PatrolQtyCount = 0; int ReleaseQtyCount = 0; lblMessage.Text = ""; // Empty Row Setting Up Main Grid gridLeakTest.DataSource = dt; gridLeakTest.DataBind(); btnUpdate.Visible = false; var ProdOrderNo = txtProdOrderNo.Text.Trim(); if (string.IsNullOrEmpty(ProdOrderNo)) { GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); return; } if (ddlType.SelectedIndex != 0) { LeakTestNumber = GetLeakTestNumber(); if (!string.IsNullOrEmpty(LeakTestNumber)) { lblMessage.Text = ""; txtLeakTestNo.Text = LeakTestNumber; } } else { lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Invalid Type Selection"; txtLeakTestNo.Text = ""; txtProdOrderNo.Text = ""; return; } var OrderExist = ProdOrderNo.Substring(0, 1); if (OrderExist == "4") { DataSet ds1 = new DataSet(); ds1 = _DBObj.GetProductionReleaseNewForLeakTestWithSerial(ProdOrderNo, ddlType.SelectedValue); if (ds1 != null && ds1.Tables[0].Rows.Count == 0) { ds1 = _DBObj.GetProductionReleaseNewForLeakTestWithOutSerial(ProdOrderNo, ddlType.SelectedValue); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { if (ds1.Tables[0].Rows[0]["PatrolQty"].ToString() != string.Empty) { PatrolQtyCount = Convert.ToInt32(ds1.Tables[0].Rows[0]["PatrolQty"].ToString()); } if (ds1.Tables[0].Rows[0]["ProdReleaseqty"].ToString() != string.Empty) { ReleaseQtyCount = Convert.ToInt32(ds1.Tables[0].Rows[0]["ProdReleaseqty"].ToString()); } var globalPatrolQty = Convert.ToInt16(ReleaseQtyCount - PatrolQtyCount); ViewState["CurrentPatrolQtyCount"] = globalPatrolQty; txtQtyTested.Enabled = true; txtQtyTested.Text = ""; GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); //btnGenerate.Enabled = true; //if (globalPatrolQty > Convert.ToInt32(txtPatrolQty.Text.Trim())) //{ // //// Need to show the error message //} } else { GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); } } else { txtQtyTested.Enabled = false; Cache["CacheForPatrolSerialNoList"] = ds1; ViewState["CurrentPatrolQtyCount"] = 0; GridViewPopUp.DataSource = ds1; GridViewPopUp.DataBind(); btnSubmit.Visible = true; //btnGenerate.Enabled = false; } ds = _DBObj.GetMISOrderStatusForPatrol(txtProdOrderNo.Text.Trim()); if (ds != null && ds.Tables[0].Rows.Count > 0) { txtItemNumber.Text = Convert.ToString(ds.Tables[0].Rows[0]["Item"]); txtDescription.Text = Convert.ToString(ds.Tables[0].Rows[0]["Description"]); txtCustomer.Text = Convert.ToString(ds.Tables[0].Rows[0]["CustomerName"]); txtSaleOrder.Text = Convert.ToString(ds.Tables[0].Rows[0]["OrderNo"]) + "-" + Convert.ToString(ds.Tables[0].Rows[0]["Pos"]); } else { txtItemNumber.Text = ""; txtDescription.Text = ""; txtCustomer.Text = ""; txtSaleOrder.Text = ""; } txtLeakTestNo.Enabled = false; btnDelete.Enabled = false; } // Prod Order Not Starting From '4' if (OrderExist != "4") { DataSet ds2 = new DataSet(); btnSubmit.Visible = false; ds2 = _DBObj.GetProductionReleaseNewForLeakTest(ProdOrderNo, ddlType.SelectedValue); if (ds2 != null && ds2.Tables[0].Rows.Count > 0) { txtQtyTested.Text = ""; txtQtyTested.Enabled = true; //btnGenerate.Enabled = true; if (ds2.Tables[0].Rows[0]["PatrolQty"].ToString() != string.Empty) { PatrolQtyCount = Convert.ToInt32(ds2.Tables[0].Rows[0]["PatrolQty"].ToString()); } if (ds2.Tables[0].Rows[0]["ProdReleaseqty"].ToString() != string.Empty) { ReleaseQtyCount = Convert.ToInt32(ds2.Tables[0].Rows[0]["ProdReleaseqty"].ToString()); } var globalPatrolQty = Convert.ToInt16(ReleaseQtyCount - PatrolQtyCount); ViewState["CurrentPatrolQtyCount"] = globalPatrolQty; GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); } else { txtQtyTested.Text = ""; txtQtyTested.Enabled = true; ViewState["CurrentPatrolQtyCount"] = 0; GridViewPopUp.DataSource = dt; GridViewPopUp.DataBind(); btnSubmit.Visible = false; } ds = _DBObj.GetWIPAllFromProdOrderNo(ProdOrderNo); if (ds != null && ds.Tables[0].Rows.Count > 0) { txtItemNumber.Text = Convert.ToString(ds.Tables[0].Rows[0]["ItemNumber"]); txtDescription.Text = Convert.ToString(ds.Tables[0].Rows[0]["Description"]); txtCustomer.Text = ""; txtSaleOrder.Text = ""; } else { txtItemNumber.Text = ""; txtDescription.Text = ""; txtCustomer.Text = ""; txtSaleOrder.Text = ""; } txtLeakTestNo.Enabled = false; btnDelete.Enabled = false; //todo } }