protected void Page_Load(object sender, EventArgs e)
    {
        Master.HeadingMessage = "Daily Fitup Report";

        if (!WebTools.UserInRole("PIP_WIC_UPDATE"))
        {
            NotificationBox.show_error("Access Denied!");
            btnSubmit.Enabled = false;
            return;
        }

        if (!IsPostBack)
        {
            unqPartField.Value = WebTools.GetExpr("NVL(UNIQUE_PART,'N')", "PROJECT_SETTING", "PROJECT_ID=" + Session["PROJECT_ID"].ToString());
        }
    }
    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 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();
        }
    }