public void TextSlipNo_TextChanged(object sender, EventArgs e) { try { string SlipNo = TextSlipNo.Text; string MatchEmpIDPattern = "^([0-9]{5})$"; if (SlipNo != null) { if (Regex.IsMatch(SlipNo, MatchEmpIDPattern)) { alert_box.Visible = false; OracleConnection conn = new OracleConnection(strConnString); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select WB_SLIP_NO from MF_PURCHASE_IMPROT where WB_SLIP_NO = '" + SlipNo + "'"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Weight Slip Number is not available</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Red; TextSlipNo.Focus(); BtnAdd.Attributes.Add("aria-disabled", "false"); BtnAdd.Attributes.Add("class", "btn btn-primary disabled"); } else { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa fa-check'></i> Weight Slip Number is available</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Green; TextContainerNo.Focus(); BtnAdd.Attributes.Add("aria-disabled", "true"); BtnAdd.Attributes.Add("class", "btn btn-primary active"); } } else { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Enter Weight Slip Number is 5 digit only</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Red; TextSlipNo.Focus(); BtnAdd.Attributes.Add("aria-disabled", "false"); BtnAdd.Attributes.Add("class", "btn btn-primary disabled"); } } } catch { Response.Redirect("~/ParameterError.aspx"); } }
public void TextSlipNo_TextChanged(object sender, EventArgs e) { string SlipNo = TextSlipNo.Text; string MatchEmpIDPattern = "^([0-9]{6})$"; if (SlipNo != null) { if (Regex.IsMatch(SlipNo, MatchEmpIDPattern)) { alert_box.Visible = false; OracleConnection conn = new OracleConnection(strConnString); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "select SLIP_NO from PF_PURCHASE_JW where SLIP_NO = '" + Convert.ToInt32(SlipNo) + "'"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Slip Number is not available</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Red; TextSlipNo.Focus(); BtnAdd.Attributes.Add("aria-disabled", "false"); BtnAdd.Attributes.Add("class", "btn btn-primary disabled"); } else { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa fa-check'></i> Slip Number is available</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Green; DropDownSupplierID.Focus(); BtnAdd.Attributes.Add("aria-disabled", "true"); BtnAdd.Attributes.Add("class", "btn btn-primary active"); } } else { CheckSlipNo.Text = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Enter Slip Number is 6 digit only</label>"; CheckSlipNo.ForeColor = System.Drawing.Color.Red; TextSlipNo.Focus(); BtnAdd.Attributes.Add("aria-disabled", "false"); BtnAdd.Attributes.Add("class", "btn btn-primary disabled"); } } }
protected void BtnUpdate_Click(object sender, EventArgs e) { // try // { if (IS_EDIT_ACTIVE == "Enable") { OracleConnection conn = new OracleConnection(strConnString); conn.Open(); int userID = Convert.ToInt32(Session["USER_ID"]); int PrchaseImportID = Convert.ToInt32(TextPrchaseImportID.Text); int SupplierID = Convert.ToInt32(DropDownSupplierID.Text); string SlipNo = TextSlipNo.Text; int ContainerSizeID = Convert.ToInt32(DropDownContainerSizeID.Text); int ItemID = Convert.ToInt32(DropDownItemID.Text); int ItemBinID = Convert.ToInt32(Request.Form[DropDownItemBinID.UniqueID]); double Mat1stWeightMf = Convert.ToDouble(TextMat1stWeightMf.Text.Trim()); double Mat2ndWeightMf = Convert.ToDouble(TextMat2ndWeightMf.Text.Trim()); double ItemWtWb = Mat1stWeightMf - Mat2ndWeightMf; string ISActive = CheckIsActive.Checked ? "Enable" : "Disable"; string MakeEntryDate = EntryDate.Text; string[] MakeEntryDateSplit = MakeEntryDate.Split('-'); String EntryDateTemp = MakeEntryDateSplit[0].Replace("/", "-"); DateTime EntryDateNewD = DateTime.ParseExact(EntryDateTemp, "dd-MM-yyyy", CultureInfo.InvariantCulture); string EntryDateNew = EntryDateNewD.ToString("dd-MM-yyyy"); string u_date = System.DateTime.Now.ToString("dd-MM-yyyy h:mm:ss tt"); string delete_pack = " delete from MF_MATERIAL_PACKING_HISTORY where WB_SLIP_NO = '" + TextSlipNo.Text + "'"; cmdi = new OracleCommand(delete_pack, conn); cmdi.ExecuteNonQuery(); cmdi.Parameters.Clear(); cmdi.Dispose(); if (DropDownPacking1.Text != "0") { string insert_packing = "insert into MF_MATERIAL_PACKING_HISTORY (WB_SLIP_NO, PACKING_ID, NUMBER_OF_PACK, PACK_PER_WEIGHT, TOTAL_WEIGHT, CREATE_DATE, C_USER_ID ) values ( :NoSlipID, :NoDropDownPacking1, :NoOfPacking1, :NoPerWtPacking1, :NoWtTotalPacking1, TO_DATE(:c_date, 'DD-MM-YYYY HH:MI:SS AM'), :NoCuserID )"; cmdi = new OracleCommand(insert_packing, conn); OracleParameter[] objPr = new OracleParameter[7]; objPr[0] = cmdi.Parameters.Add("NoSlipID", TextSlipNo.Text); objPr[1] = cmdi.Parameters.Add("NoDropDownPacking1", Convert.ToInt32(DropDownPacking1.Text)); objPr[2] = cmdi.Parameters.Add("NoOfPacking1", Convert.ToInt32(TextNoOfPacking1.Text)); objPr[3] = cmdi.Parameters.Add("NoPerWtPacking1", Convert.ToDouble(TextNoPerWtPacking1.Text)); objPr[4] = cmdi.Parameters.Add("NoWtTotalPacking1", Convert.ToDouble(TextWtTotalPacking1.Text)); objPr[5] = cmdi.Parameters.Add("c_date", u_date); objPr[6] = cmdi.Parameters.Add("NoCuserID", userID); cmdi.ExecuteNonQuery(); cmdi.Parameters.Clear(); cmdi.Dispose(); } string update_user = "******"; cmdi = new OracleCommand(update_user, conn); OracleParameter[] objPrm = new OracleParameter[15]; objPrm[0] = cmdi.Parameters.Add("NoSlipID", SlipNo); objPrm[1] = cmdi.Parameters.Add("NoPartyID", SupplierID); objPrm[2] = cmdi.Parameters.Add("NoContainerNo", TextContainerNo.Text); objPrm[3] = cmdi.Parameters.Add("NoContainerSizeID", ContainerSizeID); objPrm[4] = cmdi.Parameters.Add("NoItemID", ItemID); objPrm[5] = cmdi.Parameters.Add("NoItemBinID", ItemBinID); objPrm[6] = cmdi.Parameters.Add("NoMat1stWeightMf", Mat1stWeightMf); objPrm[7] = cmdi.Parameters.Add("NoMat2ndWeightMf", Mat2ndWeightMf); objPrm[8] = cmdi.Parameters.Add("NoItemWtWb", ItemWtWb); objPrm[9] = cmdi.Parameters.Add("NoItemWeight", Convert.ToDouble(TextItemWeightEx.Text)); objPrm[10] = cmdi.Parameters.Add("EntryDate", EntryDateNew); objPrm[11] = cmdi.Parameters.Add("u_date", u_date); objPrm[12] = cmdi.Parameters.Add("NoCuserID", userID); objPrm[13] = cmdi.Parameters.Add("TextIsActive", ISActive); objPrm[14] = cmdi.Parameters.Add("NoPrchaseImportID", PrchaseImportID); cmdi.ExecuteNonQuery(); cmdi.Parameters.Clear(); cmdi.Dispose(); conn.Close(); alert_box.Visible = true; alert_box.Controls.Add(new LiteralControl("Container & Weight Slip Data Update Successfully")); alert_box.Attributes.Add("class", "alert alert-success alert-dismissible"); clearText(); TextSlipNo.Focus(); Display(); DisplaySummary(); } else { Response.Redirect("~/PagePermissionError.aspx"); } // } // catch // { // Response.Redirect("~/ParameterError.aspx"); // } }
protected void Page_Load(object sender, EventArgs e) { if (Session["USER_NAME"] != null) { string requestedFile = Path.GetFileName(Request.Path); OracleConnection conn = new OracleConnection(strConnString); conn.Open(); string makeSQL = " SELECT NUPP.IS_PAGE_ACTIVE, NUPP.IS_ADD_ACTIVE, NUPP.IS_EDIT_ACTIVE, NUPP.IS_DELETE_ACTIVE, NUPP.IS_VIEW_ACTIVE, NUPP.IS_REPORT_ACTIVE, NUPP.IS_PRINT_ACTIVE FROM NRC_USER_PAGE_PERMISSION NUPP LEFT JOIN NRC_USER_PAGES NUP ON NUP.USER_PAGE_ID = NUPP.USER_PAGE_ID WHERE NUPP.USER_ID = '" + Session["USER_ID"] + "' AND NUP.IS_ACTIVE = 'Enable' AND NUP.PAGE_URL = '" + requestedFile + "' "; cmdl = new OracleCommand(makeSQL); oradata = new OracleDataAdapter(cmdl.CommandText, conn); dt = new DataTable(); oradata.Fill(dt); RowCount = dt.Rows.Count; for (int i = 0; i < RowCount; i++) { IS_PAGE_ACTIVE = dt.Rows[i]["IS_PAGE_ACTIVE"].ToString(); IS_ADD_ACTIVE = dt.Rows[i]["IS_ADD_ACTIVE"].ToString(); IS_EDIT_ACTIVE = dt.Rows[i]["IS_EDIT_ACTIVE"].ToString(); IS_DELETE_ACTIVE = dt.Rows[i]["IS_DELETE_ACTIVE"].ToString(); IS_VIEW_ACTIVE = dt.Rows[i]["IS_VIEW_ACTIVE"].ToString(); IS_REPORT_ACTIVE = dt.Rows[i]["IS_REPORT_ACTIVE"].ToString(); IS_PRINT_ACTIVE = dt.Rows[i]["IS_PRINT_ACTIVE"].ToString(); } if (IS_PAGE_ACTIVE == "Enable") { if (!IsPostBack) { DataTable dtSupplierID = new DataTable(); DataSet ds = new DataSet(); string makeSupplierSQL = " SELECT PARTY_ID, PARTY_ID || ' - ' || PARTY_NAME || ' - ' || PARTY_VAT_NO AS PARTY_NAME FROM MF_PARTY WHERE IS_ACTIVE = 'Enable' AND IS_PURCHASE_ACTIVE = 'Enable' ORDER BY PARTY_NAME ASC"; ds = ExecuteBySqlString(makeSupplierSQL); dtSupplierID = (DataTable)ds.Tables[0]; DropDownSupplierID.DataSource = dtSupplierID; DropDownSupplierID.DataValueField = "PARTY_ID"; DropDownSupplierID.DataTextField = "PARTY_NAME"; DropDownSupplierID.DataBind(); DropDownSupplierID.Items.Insert(0, new ListItem("Select Supplier", "0")); DataTable dtItemID = new DataTable(); DataSet dsi = new DataSet(); string makeItemSQL = " SELECT ITEM_ID, ITEM_CODE || ' : ' || ITEM_NAME AS ITEM_FULL_NAME FROM MF_ITEM WHERE IS_ACTIVE = 'Enable' AND IS_PURCHASE_ACTIVE = 'Enable' ORDER BY ITEM_ID ASC"; dsi = ExecuteBySqlString(makeItemSQL); dtItemID = (DataTable)dsi.Tables[0]; DropDownItemID.DataSource = dtItemID; DropDownItemID.DataValueField = "ITEM_ID"; DropDownItemID.DataTextField = "ITEM_FULL_NAME"; DropDownItemID.DataBind(); DropDownItemID.Items.Insert(0, new ListItem("Select Item", "0")); /* DropDownItemID1.DataSource = dtItemID; * DropDownItemID1.DataValueField = "ITEM_ID"; * DropDownItemID1.DataTextField = "ITEM_NAME"; * DropDownItemID1.DataBind(); * DropDownItemID1.Items.Insert(0, new ListItem("All Item", "0")); */ DataTable dtContainerID = new DataTable(); DataSet dsc = new DataSet(); string makeDropDownContainerSQL = " SELECT CONTAINER_SIZE_ID, CONTAINER_SIZE || '- (' || CONTAINER_SIZE_INWORDS || ')' AS CONTAINER_SIZE FROM NRC_CONTAINER_SIZE WHERE IS_ACTIVE = 'Enable' ORDER BY CONTAINER_SIZE_ID ASC"; dsc = ExecuteBySqlString(makeDropDownContainerSQL); dtContainerID = (DataTable)dsc.Tables[0]; DropDownContainerSizeID.DataSource = dtContainerID; DropDownContainerSizeID.DataValueField = "CONTAINER_SIZE_ID"; DropDownContainerSizeID.DataTextField = "CONTAINER_SIZE"; DropDownContainerSizeID.DataBind(); DataTable dtPacking1ID = new DataTable(); DataSet dsp = new DataSet(); string makeDropDownPacking1SQL = " SELECT * FROM NRC_PACKING_LIST WHERE IS_ACTIVE = 'Enable' ORDER BY PACKING_ID ASC"; dsp = ExecuteBySqlString(makeDropDownPacking1SQL); dtPacking1ID = (DataTable)dsp.Tables[0]; DropDownPacking1.DataSource = dtPacking1ID; DropDownPacking1.DataValueField = "PACKING_ID"; DropDownPacking1.DataTextField = "PACKING_NAME"; DropDownPacking1.DataBind(); DropDownPacking1.Items.Insert(0, new ListItem("Select Packing List", "0")); DropDownPacking1.Items.FindByValue("1").Selected = true; TextSlipNo.Focus(); TextWtTotalPacking1.Attributes.Add("readonly", "readonly"); Display(); DisplaySummary(); alert_box.Visible = false; } IsLoad = false; } else { Response.Redirect("~/PagePermissionError.aspx"); } } else { Response.Redirect("~/Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["USER_NAME"] != null) { string requestedFile = Path.GetFileName(Request.Path); OracleConnection conn = new OracleConnection(strConnString); conn.Open(); string makeSQL = " SELECT NUPP.IS_PAGE_ACTIVE, NUPP.IS_ADD_ACTIVE, NUPP.IS_EDIT_ACTIVE, NUPP.IS_DELETE_ACTIVE, NUPP.IS_VIEW_ACTIVE, NUPP.IS_REPORT_ACTIVE FROM NRC_USER_PAGE_PERMISSION NUPP LEFT JOIN NRC_USER_PAGES NUP ON NUP.USER_PAGE_ID = NUPP.USER_PAGE_ID WHERE NUPP.USER_ID = '" + Session["USER_ID"] + "' AND NUP.IS_ACTIVE = 'Enable' AND NUP.PAGE_URL = '" + requestedFile + "' "; cmdl = new OracleCommand(makeSQL); oradata = new OracleDataAdapter(cmdl.CommandText, conn); dt = new DataTable(); oradata.Fill(dt); RowCount = dt.Rows.Count; for (int i = 0; i < RowCount; i++) { IS_PAGE_ACTIVE = dt.Rows[i]["IS_PAGE_ACTIVE"].ToString(); IS_ADD_ACTIVE = dt.Rows[i]["IS_ADD_ACTIVE"].ToString(); IS_EDIT_ACTIVE = dt.Rows[i]["IS_EDIT_ACTIVE"].ToString(); IS_DELETE_ACTIVE = dt.Rows[i]["IS_DELETE_ACTIVE"].ToString(); IS_VIEW_ACTIVE = dt.Rows[i]["IS_VIEW_ACTIVE"].ToString(); IS_REPORT_ACTIVE = dt.Rows[i]["IS_REPORT_ACTIVE"].ToString(); } if (IS_PAGE_ACTIVE == "Enable") { if (!IsPostBack) { DataTable dtSupplierID = new DataTable(); DataSet ds = new DataSet(); string makeSupplierSQL = " SELECT * FROM PF_PARTY WHERE IS_ACTIVE = 'Enable' ORDER BY PARTY_NAME ASC"; ds = ExecuteBySqlStringEmpType(makeSupplierSQL); dtSupplierID = (DataTable)ds.Tables[0]; DropDownSupplierID.DataSource = dtSupplierID; DropDownSupplierID.DataValueField = "PARTY_ID"; DropDownSupplierID.DataTextField = "PARTY_NAME"; DropDownSupplierID.DataBind(); DropDownSupplierID.Items.Insert(0, new ListItem("Select Supplier", "0")); DropDownSupplierID2.DataSource = dtSupplierID; DropDownSupplierID2.DataValueField = "PARTY_ID"; DropDownSupplierID2.DataTextField = "PARTY_NAME"; DropDownSupplierID2.DataBind(); DropDownSupplierID2.Items.Insert(0, new ListItem("Select Supplier", "0")); DataTable dtSupervisorID = new DataTable(); DataSet dsd = new DataSet(); string makeSupervisorSQL = " SELECT * FROM PF_SUPERVISOR WHERE IS_ACTIVE = 'Enable' ORDER BY SUPERVISOR_NAME ASC"; dsd = ExecuteBySqlStringEmpType(makeSupervisorSQL); dtSupplierID = (DataTable)dsd.Tables[0]; DropDownSupervisorID.DataSource = dtSupplierID; DropDownSupervisorID.DataValueField = "SUPERVISOR_ID"; DropDownSupervisorID.DataTextField = "SUPERVISOR_NAME"; DropDownSupervisorID.DataBind(); DropDownSupervisorID.Items.Insert(0, new ListItem("Select Supervisor", "0")); DataTable dtItemID = new DataTable(); DataSet dsi = new DataSet(); string makeDropDownItemSQL = " SELECT * FROM PF_ITEM WHERE IS_ACTIVE = 'Enable' ORDER BY ITEM_ID ASC"; dsi = ExecuteBySqlStringEmpType(makeDropDownItemSQL); dtItemID = (DataTable)dsi.Tables[0]; DropDownItemID.DataSource = dtItemID; DropDownItemID.DataValueField = "ITEM_ID"; DropDownItemID.DataTextField = "ITEM_NAME"; DropDownItemID.DataBind(); DropDownItemID.Items.Insert(0, new ListItem("Select Item", "0")); DropDownItemID1.DataSource = dtItemID; DropDownItemID1.DataValueField = "ITEM_ID"; DropDownItemID1.DataTextField = "ITEM_NAME"; DropDownItemID1.DataBind(); DropDownItemID1.Items.Insert(0, new ListItem("All Item", "0")); DataTable dtSubItemID = new DataTable(); DataSet dss = new DataSet(); string makeDropDownSubItemSQL = " SELECT * FROM PF_SUB_ITEM WHERE IS_ACTIVE = 'Enable' ORDER BY SUB_ITEM_ID ASC"; dss = ExecuteBySqlStringEmpType(makeDropDownSubItemSQL); dtSubItemID = (DataTable)dss.Tables[0]; DropDownSubItemID.DataSource = dtSubItemID; DropDownSubItemID.DataValueField = "SUB_ITEM_ID"; DropDownSubItemID.DataTextField = "SUB_ITEM_NAME"; DropDownSubItemID.DataBind(); DropDownSubItemID.Items.Insert(0, new ListItem("Select Sub Item", "0")); TextSlipNo.Focus(); Display(); alert_box.Visible = false; } IsLoad = false; } else { Response.Redirect("~/PagePermissionError.aspx"); } } else { Response.Redirect("~/Default.aspx"); } }