コード例 #1
0
    protected void btnSaveItems_Click(object sender, EventArgs e)
    {
        try
        {
            if (Quotation_ID == -1 && Contract_ID < 1)
            {
                int sts = BLL_PURC_CTP.Insert_Ctp_CreateNewContract(Catalogue_code, Dept_ID, (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], Convert.ToInt32(Session["userid"].ToString()));
                if (sts > -1)
                {
                    btnSaveItems.Enabled  = false;
                    AddItems_Saved_Status = true;
                    btnCancel.Enabled     = false;

                    Contract_ID = sts;
                }
            }
            else if (Quotation_ID > 0 || Contract_ID > 0)
            {
                int sts = BLL_PURC_CTP.Insert_Ctp_QuotationItems(Quotation_ID, (DataTable)ViewState["vsdtSelected_Items"], (DataTable)ViewState["vsdtSelected_SubCatalogue"], (DataTable)ViewState["vsdtSelected_SubCatalogue_items"], Convert.ToInt32(Session["userid"].ToString()), Contract_ID);
            }
        }
        catch (Exception ex)
        {
        }
    }
コード例 #2
0
    protected void btnAddToNewContract_Click(object sender, EventArgs e)
    {
        try
        {
            SaveItemsSelection();
            if (((DataTable)ViewState["vsdtSelected_Items"]).Rows.Count > 0)
            {
                DataTable dtSelected = (DataTable)ViewState["vsdtSelected_Items"];

                DataTable dtSelected_SubCatalogue = new DataTable();
                dtSelected_SubCatalogue.Columns.Add("id");


                DataTable vsdtSelected_SubCatalogue_items = new DataTable();
                vsdtSelected_SubCatalogue_items.Columns.Add("id");


                int Contract_ID = BLL_PURC_CTP.Insert_Ctp_CreateNewContract(ddlCatalogue.SelectedValue, Convert.ToInt32(cmbDept.SelectedValue), dtSelected, dtSelected_SubCatalogue, vsdtSelected_SubCatalogue_items, Convert.ToInt32(Session["userid"].ToString()));
                if (Contract_ID > 0)
                {
                    btnAddItemToExistingContract.Enabled = false;
                    btnAddToNewContract.Enabled          = false;
                    uc_Purc_Ctp_Send_RFQSupp.Contract_ID = Contract_ID;
                    mlvCTP.ActiveViewIndex = 1;
                }
                else
                {
                    String msg1 = String.Format("alert('failed to create contract !')");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg12865", msg1, true);
                }
            }
            else
            {
                lblmsg.Text = "Please select Item !";
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }