protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string WPS_NO = string.Empty;

        if (WPS_NO_RadAutoCompleteBox.Entries.Count > 0)
        {
            WPS_NO = WPS_NO_RadAutoCompleteBox.Entries[0].Text.ToString();
        }

        string WELD_PROCESS = string.Empty;

        if (WeldProcess_RadAutoCompleteBox.Entries.Count > 0)
        {
            WELD_PROCESS = WeldProcess_RadAutoCompleteBox.Entries[0].Text.ToString();
        }

        string date_ = txtWeldDate.SelectedDate.Value.ToString("dd-MMM-yyyy");

        VIEW_SPOOL_WELDINGTableAdapter spool_welding = new VIEW_SPOOL_WELDINGTableAdapter();

        try
        {
            spool_welding.InsertQuery(decimal.Parse(cboJoints.SelectedValue.ToString()),
                                      ddReworkCode.SelectedItem.Text,
                                      txtReportNo.Text,
                                      txtWeldDate.SelectedDate,
                                      txtInsp.Text,
                                      decimal.Parse(ddWelder.SelectedValue.ToString()),
                                      decimal.Parse(ddWelderPass.SelectedValue.ToString()),
                                      WELD_PROCESS
                                      );

            if (WPS_NO_RadAutoCompleteBox.Enabled == true && WPS_NO.Length > 0)
            {
                WebTools.ExeSql("UPDATE PIP_SPOOL_JOINTS SET WPS_NO='" + WPS_NO + "' WHERE JOINT_ID=" + cboJoints.SelectedValue.ToString());
                WPS_NO_RadAutoCompleteBox.Enabled = false;
            }

            RadGrid1.DataBind();

            NotificationBox.show_success(cboJoints.SelectedItem.Text + " Welding Saved");
        }
        catch (Exception ex)
        {
            NotificationBox.show_error(ex.Message);
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string joint_id = cboJoints.SelectedValue.ToString();
        string date_    = "TO_DATE('" + txtFitupDate.SelectedDate.Value.ToString("dd-MMM-yyyy") + "')";
        string rep_no   = "'" + txtReportNo.Text + "'";

        string insp = "'" + txtInsp.Text + "'";
        string sql;

        try
        {
            sql = "UPDATE PIP_SPOOL_JOINTS SET FITUP_DATE=" + date_ + ",FITUP_REP_NO=" + rep_no +
                  ",FITUP_INSP=" + insp;
            sql += (" WHERE JOINT_ID=" + joint_id);
            WebTools.ExeSql(sql);

            if (ddHeatNo1.SelectedValue.ToString().Length > 0 && ddHeatNo1.Enabled == true)
            {
                if (unqPartField.Value.ToString() == "Y")
                {
                    WebTools.ExeSql("UPDATE PIP_BOM SET HEAT_NO='" + ddHeatNo1.SelectedValue.ToString() + "' WHERE BOM_ID=" + bomId1Field.Value.ToString());
                }
                else
                {
                    WebTools.ExeSql("UPDATE PIP_SPOOL_JOINTS SET HEAT_NO1='" + ddHeatNo1.SelectedValue.ToString() + "' WHERE JOINT_ID=" + joint_id);
                }
            }
            if (ddHeatNo2.SelectedValue.ToString().Length > 0 && ddHeatNo2.Enabled == true)
            {
                if (unqPartField.Value.ToString() == "Y")
                {
                    WebTools.ExeSql("UPDATE PIP_BOM SET HEAT_NO='" + ddHeatNo2.SelectedValue.ToString() + "' WHERE BOM_ID=" + bomId2Field.Value.ToString());
                }
                else
                {
                    WebTools.ExeSql("UPDATE PIP_SPOOL_JOINTS SET HEAT_NO2='" + ddHeatNo2.SelectedValue.ToString() + "' WHERE JOINT_ID=" + joint_id);
                }
            }
            jointDetailsView.DataBind();

            NotificationBox.show_success(cboJoints.SelectedItem.Text + " fitup saved!");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
    }
    protected void btnUpdateWelders_Click(object sender, EventArgs e)
    {
        //New
        OracleConnection conn = WebTools.GetIpmsConnection();

        if (conn.State != ConnectionState.Open)
        {
            conn.Open();
        }
        OracleCommand cmd = new OracleCommand();

        cmd.CommandType = CommandType.Text;
        cmd.Connection  = conn;
        OracleCommand cmd2 = new OracleCommand();

        cmd2.CommandType = CommandType.Text;
        cmd2.Connection  = conn;

        //Root & Hot
        cmd.CommandText = "SELECT * FROM VIEW_JOINT_WELDERS_UPDATE WHERE ROOT_HOT_WELDER_UPDATE='Y'";
        OracleDataReader dr = cmd.ExecuteReader();

        while (dr.Read())
        {
            cmd2.CommandText =
                "UPDATE PIP_SPOOL_JOINTS SET ROOT_HOT_WELDER='" + dr["ROOT_HOT_WELDER_NEW"] + "' WHERE JOINT_ID=" + dr["JOINT_ID"];
            cmd2.ExecuteNonQuery();
        }

        //Fill & Cap
        cmd.CommandText = "SELECT * FROM VIEW_JOINT_WELDERS_UPDATE WHERE FILL_CAP_WELDER_UPDATE='Y'";
        dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            cmd2.CommandText =
                "UPDATE PIP_SPOOL_JOINTS SET FILL_CAP_WELDER='" + dr["FILL_CAP_WELDER_NEW"] + "' WHERE JOINT_ID=" + dr["JOINT_ID"];
            cmd2.ExecuteNonQuery();
        }

        //Finally
        cmd.Dispose();
        cmd2.Dispose();
        conn.Close();
        conn.Dispose();

        NotificationBox.show_success("Joint Welders Updated!");
    }
    protected void btnMbrs_Click(object sender, EventArgs e)
    {
        if (Selected_Supports.Items.Count == 0)
        {
            Master.ShowMessage("No Support selected!");
            return;
        }

        VIEW_ADP_SUPP_JC_DTTableAdapter supp_jc = new VIEW_ADP_SUPP_JC_DTTableAdapter();

        try
        {
            if (Selected_Supports.Items.Count > 0)
            {
                for (int i = 0; i < Selected_Supports.Items.Count; i++)
                {
                    //Save Support; QTY=1;
                    supp_jc.InsertQuery(decimal.Parse(Request.QueryString["JC_ID"]),
                                        decimal.Parse(Selected_Supports.Items[i].Value), decimal.Parse("1"));

                    //if (!arraylist2.Contains(Selected_Supports.Items[i]))
                    //{
                    //    arraylist2.Add(Selected_Supports.Items[i]);
                    //}
                }

                Selected_Supports.Items.Clear();
                btnSave.Enabled = false;
                NotificationBox.show_success("Saved!");
            }
            else
            {
                NotificationBox.show_info("No Support selected!");
                return;
            }
        }
        catch (Exception ex)
        {
            NotificationBox.show_error(ex.Message);
        }
        finally
        {
            supp_jc.Dispose();
        }
    }