protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string bolt_len;

        if (txtBoltLength.Text == "")
        {
            bolt_len = "0";
        }
        else
        {
            bolt_len = txtBoltLength.Text;
        }
        PIP_MAT_STOCKTableAdapter stock = new PIP_MAT_STOCKTableAdapter();

        try
        {
            stock.InsertQuery(decimal.Parse(Session["PROJECT_ID"].ToString()),
                              txtMatCode1.Text, txtMatCode2.Text,
                              txtsizeDesc.Text.Trim(), txtSize1.Text, txtSize2.Text, txtSchDesc.Text,
                              txtSch1.Text, txtSch2.Text, decimal.Parse(cboItem.SelectedValue.ToString()),
                              decimal.Parse(cboUOM.SelectedValue.ToString()), decimal.Parse(bolt_len), txtDesc.Text, txtlength.Text, decimal.Parse(txtlen1.Text), decimal.Parse(txtlen2.Text), ddlProfile.SelectedValue.ToString());
            Master.show_success(txtMatCode1.Text + " Saved!");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
        finally
        {
            stock.Dispose();
        }
    }
Exemple #2
0
    protected void StockDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        PIP_MAT_STOCKTableAdapter stock_adapter = new PIP_MAT_STOCKTableAdapter();
        //dsMainTablesATableAdapters.PIP_MAT_STOCKTableAdapter stock = new PIP_MAT_STOCKTableAdapter();
        TextBox matcode1 = (TextBox)StockDetailsView.FindControl("txtMatcode1");
        TextBox matcode2 = (TextBox)StockDetailsView.FindControl("txtMatcode2");
        TextBox sizeDesc = (TextBox)StockDetailsView.FindControl("txtSizeDesc");

        RadAutoCompleteBox txtSize1 = (RadAutoCompleteBox)StockDetailsView.FindControl("txtSize1");
        RadAutoCompleteBox txtSize2 = (RadAutoCompleteBox)StockDetailsView.FindControl("txtSize2");

        RadAutoCompleteBox txtSch1 = (RadAutoCompleteBox)StockDetailsView.FindControl("txtSch1");
        RadAutoCompleteBox txtSch2 = (RadAutoCompleteBox)StockDetailsView.FindControl("txtSch2");
        TextBox            schDesc = (TextBox)StockDetailsView.FindControl("txtSchDesc");
        TextBox            unitwt  = (TextBox)StockDetailsView.FindControl("txtUnitwt");

        TextBox length = (TextBox)StockDetailsView.FindControl("txtlength");
        TextBox len1   = (TextBox)StockDetailsView.FindControl("txtlen1");
        TextBox len2   = (TextBox)StockDetailsView.FindControl("txtlen2");

        RadDropDownList profile = (RadDropDownList)StockDetailsView.FindControl("ddlProfile");
        DropDownList    item    = (DropDownList)StockDetailsView.FindControl("ddlitem");
        DropDownList    uom     = (DropDownList)StockDetailsView.FindControl("ddlUOM");

        TextBox mat_type  = (TextBox)StockDetailsView.FindControl("txtMatType");
        TextBox ptCode    = (TextBox)StockDetailsView.FindControl("txtPtCode");
        TextBox mClass    = (TextBox)StockDetailsView.FindControl("txtClass");
        TextBox shortDesc = (TextBox)StockDetailsView.FindControl("txtShortDescr");
        TextBox matDescr  = (TextBox)StockDetailsView.FindControl("txtMatDescr");

        string sch  = getSch();
        string size = getSize();

        stock_adapter.UpdateQuery(matcode1.Text, matcode2.Text, size, txtSize1.Entries[0].Text, txtSize2.Entries[0].Text, sch, txtSch1.Entries[0].Text,
                                  txtSch2.Entries[0].Text, decimal.Parse(unitwt.Text), decimal.Parse(item.SelectedValue.ToString()), decimal.Parse(uom.SelectedValue.ToString()), mat_type.Text,
                                  mClass.Text, ptCode.Text, shortDesc.Text, matDescr.Text, length.Text, decimal.Parse(len1.Text), decimal.Parse(len2.Text), profile.SelectedValue.ToString(), decimal.Parse(ListBox1.SelectedValue.ToString()));



        e.Cancel = true;

        StockDetailsView.ChangeMode(StockDetailsView.DefaultMode);
        StockDetailsView.DataBind();
    }