コード例 #1
0
ファイル: PUR091.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    //GridView管制/理貨鈕
    protected void rdoPICK_SELECT_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton btn = sender as RadioButton;
        GridViewRow gr = (btn.BindingContainer as GridViewRow);
        int i = gr.RowIndex;

        string Item_Name = ((TextBox)GridView1.Rows[i].FindControl("txtVIRTUAL_NAME")).Text;

        ParameterList.Clear();
        ParameterList.Add(((TextBox)GridView1.Rows[i].FindControl("txtVIRTUAL_CODE")).Text);
        ParameterList.Add(((TextBox)GridView1.Rows[i].FindControl("txt_PERIOD")).Text);
        ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
        ParameterList.Add(txtPICK_BATCH.Text);

        PURModel.PUR09_BCO BCO = new PURModel.PUR09_BCO(ConntionDB);
        DataTable Dt = BCO.LoadChannelPick(ParameterList);

        DataTable dt = (DataTable)Session["PUR091_Pick" + PageTimeStamp.Value];
        if (dt != null)
            if (dt.Rows.Count > 0)
            {
                DataRow[] drs = dt.Select("VIRTUAL_CODE='" + ((TextBox)GridView1.Rows[i].FindControl("txtVIRTUAL_CODE")).Text + "' and PERIOD='" + ((TextBox)GridView1.Rows[i].FindControl("txt_PERIOD")).Text + "'");
                if (drs.Length != 0)
                    foreach (DataRow dr in drs)
                        dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                else
                {
                    foreach (DataRow dr in Dt.Rows)
                        dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                    dt.Merge(Dt);
                }
                Session["PUR091_Pick" + PageTimeStamp.Value] = dt;
            }
            else
            {
                foreach (DataRow dr in Dt.Rows)
                    dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
                Session["PUR091_Pick" + PageTimeStamp.Value] = Dt;
            }
        else
        {
            foreach (DataRow dr in Dt.Rows)
                dr["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
            Session["PUR091_Pick" + PageTimeStamp.Value] = Dt;
        }

        if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked)
        {
            ((Button)GridView1.Rows[i].FindControl("btn_GV2_Set")).Enabled = true;
            ((Label)GridView1.Rows[i].FindControl("PICK_SELECT")).Text = "2";
        }
        else if (((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT2")).Checked)
        {
            ((Button)GridView1.Rows[i].FindControl("btn_GV2_Set")).Enabled = true;
            ((Label)GridView1.Rows[i].FindControl("PICK_SELECT")).Text = "1";
        }
        DataTable DetailDt = (DataTable)Session["PUR091_MST" + PageTimeStamp.Value];
        DataRow[] Drs;
        if (panAdd.Visible == true)
            Drs = DetailDt.Select("VIRTUAL_CODE=''");
        else
            Drs = DetailDt.Select("VIRTUAL_CODE='" + ((TextBox)GridView1.Rows[i].FindControl("txtVIRTUAL_CODE")).Text + "' and PERIOD='" + ((TextBox)GridView1.Rows[i].FindControl("txt_PERIOD")).Text + "'");

        Drs[0]["PICK_SELECT"] = ((RadioButton)GridView1.Rows[i].FindControl("rdoPICK_SELECT1")).Checked ? "2" : "1";
        Session["PUR091_MST" + PageTimeStamp.Value] = DetailDt;

        string outPick = "", outRestrain = "";
        getGridPickCnt(out outPick, out outRestrain);
        LabelQueryRecordCount.Text = "品項數:理貨品:" + outPick + " 筆 管制品:" + outRestrain + " 筆";
    }
コード例 #2
0
    private DataTable LoadChannelData()
    {
        ParameterList.Clear();
        ParameterList.Add(this.SLP_ITEM.Text);
        ParameterList.Add(this.SLP_PERIOD.Text);
        ParameterList.Add(vACCEPT_DATE);
        ParameterList.Add(vPICK_BATCH);

        PURModel.PUR09_BCO BCO = new PURModel.PUR09_BCO(ConnectionDB);
        DataTable dt = BCO.LoadChannelPick(ParameterList);

        return dt;
    }