예제 #1
0
    /// <summary>
    /// 資料更新
    /// </summary>
    protected bool Update()
    {
        RES_BANKDB myDB = new RES_BANKDB();

        try
        {
            //取KEY值
            string BANK_CODE = txtiBANK_CODE.Text.Trim();

            //是否有在正式資料中
            bool IsExisting = myDB.chkRES_BNAKDB(BANK_CODE);

            //把透過getModField取得的資料指定到info中
            //RES_BANKInfo iInfo = GetModFieldValue();
            RES_BANKInfo iInfo;
            GetModFieldValue(out iInfo);

            //把資料寫進db
            if (IsExisting)
            {
                myDB.UpdRES_BANK(iInfo);
                base.DoAlertinAjax(this, "SAVE", "更新完成!");
            }
            else
            {
                base.DoAlertinAjax(this, "SAVE", "資料不存在!");
                return(false);
            }
        }
        catch (Exception ex)
        {
            base.DoAlertinAjax(this, "SAVE", "遇到例外情況" + ex.ToString());
        }
        return(true);
    }
예제 #2
0
    //按下編輯時,檢查欄位狀態
    protected bool View(string BANK_CODE)
    {
        //初始化db
        RES_BANKDB myDB = new RES_BANKDB();

        //檢查資料是否存在
        bool isExisting = myDB.chkRES_BNAKDB(BANK_CODE);

        if (isExisting)
        {
            RES_BANKInfo myInfo;

            //檢查資料存不存在
            myDB.LoadBANKCODE(BANK_CODE, out myInfo);

            //透過load()得到的myinfo把資料傳進fillmodfile()
            //將資料填入UI中
            FillModFieldValue(myInfo);

            return(true);
        }
        else
        {
            //無該筆資料
            base.DoAlertinAjax(this, "SAVE", "該筆資料可能已被刪除,請重新查詢。");
            return(false);
        }
    }
예제 #3
0
    /// <summary>
    /// 查詢資料筆數
    /// </summary>
    public void DataListLoad()
    {
        RES_BANKDB myDB = new RES_BANKDB();

        string BANK_CODE = ddlqCode.SelectedValue;

        int TotalCount = 0;

        //透過getResBank_count取得DB資料
        DataTable CountDt = myDB.getResBank_count(BANK_CODE);

        //檢查CountDt內是否有資料
        if (CountDt != null && CountDt.Rows.Count > 0)
        {
            //取出ROW_COUNT內計算出來的資料筆數
            DataRow CountDr = CountDt.Rows[0];

            TotalCount = Convert.ToInt32(CountDr["ROW_COUNT"]);
        }

        //把資料筆數設到ucDataGridView1._TotalCoun
        //回到第一頁
        ucDataGridView1._TotalCount = TotalCount;
        ucDataGridView1.ToFirst();
    }
예제 #4
0
    /// <summary>
    /// 進行分頁處理
    /// </summary>
    protected void ucDataGridView1_ChangePageClick(int _OffsetCount, int _FetchCount)
    {
        string BANK_CODE = ddlqCode.SelectedValue;

        RES_BANKDB myDB = new RES_BANKDB();
        DataTable  dt   = myDB.getResBank_select(BANK_CODE, _OffsetCount, _FetchCount);

        repDataListBind(dt);
    }
예제 #5
0
    ///<summary>
    ///取得欄位預設資料內容
    ///<summary>
    //定義bind(),呼叫這個方法時 指定需要傳入 DropDownList這個class類別的資料
    protected void BindBankcode(DropDownList ddlqCode)
    {
        //設定一個空的table來接資料
        RES_BANKDB myDB = new RES_BANKDB();

        //透過getResBank()把取出的table放到Dt
        DataTable Dt = myDB.getResBank_distinct();

        //*Review*
        //把dt的內容放到ddlqCode相應的欄位裡面
        ddlqCode.DataSource     = Dt;
        ddlqCode.DataValueField = "BANK_CODE"; //user實際選的文字的值
        ddlqCode.DataTextField  = "BANK_CODE"; //顯示在畫面上的文字
        ddlqCode.DataBind();

        //加入顯示預設字串在0的位置
        ddlqCode.Items.Insert(0, new ListItem("請選擇", ""));
    }
예제 #6
0
    /// <summary>
    /// 資料刪除
    /// </summary>
    protected bool Delete()
    {
        RES_BANKDB myDB = new RES_BANKDB();

        try
        {
            //取KEY值
            string BANK_CODE = txtiBANK_CODE.Text.Trim();
            string BANK_NAME = txtiBANK_NAME.Text.Trim();

            //呼叫db
            bool DelDt = myDB.DelRES_BANK(BANK_CODE, BANK_NAME);

            base.DoAlertinAjax(this, "SAVE", "申請刪除完成!");
        }
        catch (Exception ex)
        {
            base.DoAlertinAjax(this, "SAVE", "遇到例外情況" + ex.ToString());
        }
        return(true);
    }
예제 #7
0
    /// <summary>
    /// 資料新增
    /// </summary>
    protected bool Insert()
    {
        RES_BANKDB myDB = new RES_BANKDB();

        try
        {
            //取KEY值
            string BANK_CODE = txtiBANK_CODE.Text.Trim();

            //把透過getModField取得的資料指定到info中
            //RES_BANKInfo InputInfo = GetModFieldValue();

            RES_BANKInfo iInfo;
            GetModFieldValue(out iInfo);

            //檢查是否有在正式資料中
            bool IsExisting = myDB.chkRES_BNAKDB(BANK_CODE);

            if (IsExisting)
            {
                base.DoAlertinAjax(this, "SAVE", "該資料已存在,請重新查詢。");
                return(false);
            }
            else
            {
                //把資料寫進db
                myDB.InsRES_BANK(iInfo);
                base.DoAlertinAjax(this, "SAVE", "儲存完成!");
                return(true);
            }
        }
        catch (Exception ex)
        {
            base.DoAlertinAjax(this, "SAVE", "遇到例外情況" + ex.ToString());
            return(false);
        }
    }