protected void btnSubmit_Click(object sender, EventArgs e)
    {
        decimal mat_id = db_lookup.MAT_ID(txtMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));

        if (mat_id == 0)
        {
            Master.ShowWarn("Material Code not found!");
            return;
        }

        PIP_MAT_RETURN_LISTTableAdapter items = new PIP_MAT_RETURN_LISTTableAdapter();

        try
        {
            items.InsertQuery(
                Decimal.Parse(Request.QueryString["MAT_RET_ID"]),
                mat_id, txtHeatNo.Text,
                Decimal.Parse(txtQty.Text),
                txtPaintCode.Text,
                txtRemarks.Text);

            returnGridView.DataBind();

            Master.ShowMessage(txtMatCode.Text + " Saved!");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
        finally
        {
            items.Dispose();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //decimal mat_id = db_lookup.MAT_ID(ddlMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));
        //if (mat_id == 0)
        //{
        //    Master.ShowWarn("Material Code not found!");
        //    return;
        //}
        if (ddlReusable.SelectedValue.ToString() == "-1")
        {
            RadWindowManager1.RadAlert("Select Material Reusability", 300, 150, "Warning", "");
            return;
        }

        PIP_MAT_RETURN_LISTTableAdapter items = new PIP_MAT_RETURN_LISTTableAdapter();

        try
        {
            items.InsertQuery(
                Decimal.Parse(Request.QueryString["MAT_RET_ID"]),
                decimal.Parse(ddlMatCode.SelectedValue), decimal.Parse(ddlPo.SelectedValue), txtHeatNo.Text, txtDrumNo.Text,
                Decimal.Parse(txtQty.Text),
                txtPaintCode.Text,
                txtRemarks.Text);
            returnGridView.DataBind();
            RadWindowManager1.RadAlert("Material Added", 300, 150, "Success", "");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
        finally
        {
            items.Dispose();
        }
    }