Example #1
0
    protected void Btn_Create_Click(object sender, EventArgs e)
    {
        GV_WriteCache();
        string strResult = string.Empty;
        ErrorMsgLabel.Text = "";

        if (Session["PUR101_" + PageTimeStamp.Value] == null)
        {
            ErrorMsgLabel.Text = "無資料可供建立,請重新查詢";
            return;
        }
        DataTable dtData = (DataTable)Session["PUR101_" + PageTimeStamp.Value];
        if (dtData.Rows.Count == 0)
        {
            ErrorMsgLabel.Text = "無資料可供建立,請重新查詢";
            return;
        }
        DataTable dtTemp = DT_Filter(dtData, "Sel='1'");
        if (dtTemp.Rows.Count > 0)
        {
            BCO.PUR10_BCO bco = new PUR10_BCO(ConntionDB);
            strResult = bco.CreateData(Session["UID"].ToString(), DateTime.Now.ToString("yyyy/MM/dd"), dtTemp);

            ErrorMsgLabel.Text = "採購單建立完成";
            Session["PUR101_" + PageTimeStamp.Value] = null;
            GridView1.DataSource = null;
            GridView1.DataBind();
        }
        else
        {
            ErrorMsgLabel.Text = "[選取]欄位,至少需勾選一筆";
        }

    }