Exemple #1
0
    protected void Btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.hid_PageStatus.Value == "INSERT")
            {
                if (SaveCheck() == false)
                {
                    return;
                }
                CGDModel.CGD31_BCO BCO = new CGDModel.CGD31_BCO(ConnectionDB);

                string V_KIND = txtKIND.Text.TrimEnd();
                string V_KIND_DESC = txtKIND_DESC.Text.TrimEnd();
                string D_CREATEDATE = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string V_CREATEUID = Session["UID"].ToString();
                string D_UPDATEDATE = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string V_UPDATEUID = Session["UID"].ToString();
                string strOUTSOURCE_ID = string.Empty;

                ParameterList.Clear();
                ParameterList.Add(DBPara(V_KIND, ParaType.Varchar2));
                ParameterList.Add(DBPara(V_KIND_DESC, ParaType.Varchar2));
                ParameterList.Add(DBPara(D_CREATEDATE, ParaType.Date));
                ParameterList.Add(DBPara(V_CREATEUID, ParaType.Varchar2));
                ParameterList.Add(DBPara(D_UPDATEDATE, ParaType.Date));
                ParameterList.Add(DBPara(V_UPDATEUID, ParaType.Varchar2));

                BCO.InsertOne(ParameterList, out strOUTSOURCE_ID);

                ArrayList arl_Key = new ArrayList();
                arl_Key.Add(strOUTSOURCE_ID);
                Session["CGD31_SortKey" + this.PageTimeStamp.Value] = arl_Key;

                //用本頁新增的 PageTimeStamp
                Response.Redirect("CGD312.aspx?code=CGD31&MSG=NEW&mode=VIEW&OUTSOURCE_ID=" + strOUTSOURCE_ID + "&CGD312_PageTimeStamp=" + this.PageTimeStamp.Value, false);
            }
            else if (this.hid_PageStatus.Value == "EDIT")
            {
                if (SaveCheck() == false)
                {
                    return;
                }
                CGDModel.CGD31_BCO BCO = new CGDModel.CGD31_BCO(ConnectionDB);
                string strOUTSOURCE_ID = txtOUTSOURCE_ID.Text;
                string V_KIND = txtKIND.Text.TrimEnd();
                string V_KIND_DESC = txtKIND_DESC.Text.TrimEnd();
                string D_UPDATEDATE = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string V_UPDATEUID = Session["UID"].ToString();
                string D_OLD_UPDATEDATE = txtUpdateDate.Text;
                string V_UOLD_UPDATEUID = SLP_UpdateUID.Text;

                ParameterList.Clear();
                ParameterList.Add(DBPara(strOUTSOURCE_ID, ParaType.Number));
                ParameterList.Add(DBPara(V_KIND, ParaType.Varchar2));
                ParameterList.Add(DBPara(V_KIND_DESC, ParaType.Varchar2));
                ParameterList.Add(DBPara(D_UPDATEDATE, ParaType.Date));
                ParameterList.Add(DBPara(V_UPDATEUID, ParaType.Varchar2));
                ParameterList.Add(DBPara(D_OLD_UPDATEDATE, ParaType.Date));
                ParameterList.Add(DBPara(V_UOLD_UPDATEUID, ParaType.Varchar2));
                BCO.UpdateOne(ParameterList);

                //用查詢頁進來的 PageTimeStamp
                Response.Redirect("CGD312.aspx?code=CGD31&MSG=EDIT&mode=VIEW&OUTSOURCE_ID=" + strOUTSOURCE_ID + "&CGD312_PageTimeStamp=" + Request.QueryString["CGD312_PageTimeStamp"] + "&refreshid=" + Guid.NewGuid(), false);
            }

        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {

        }
    }
Exemple #2
0
    protected void Btn_Delete_Click(object sender, EventArgs e)
    {
        if (this.hid_PageStatus.Value == "VIEW")
        {
            ErrorMsgLabel.Text = "";

            CGDModel.CGD31_BCO BCO = new CGDModel.CGD31_BCO(ConnectionDB);
            string N_OUTSOURCE_ID = txtOUTSOURCE_ID.Text;
            string D_OLD_UPDATEDATE = txtUpdateDate.Text;
            string V_OLD_UPDATEUID = SLP_UpdateUID.Text;
            string D_NEW_UPDATEDATE = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            string V_NEW_UPDATEUID = Session["UID"].ToString();


            ParameterList.Clear();
            ParameterList.Add(DBPara(N_OUTSOURCE_ID, ParaType.Varchar2));
            ParameterList.Add(DBPara(D_OLD_UPDATEDATE, ParaType.Date));
            ParameterList.Add(DBPara(V_OLD_UPDATEUID, ParaType.Varchar2));
            ParameterList.Add(DBPara(D_NEW_UPDATEDATE, ParaType.Date));
            ParameterList.Add(DBPara(V_NEW_UPDATEUID, ParaType.Varchar2));

            BCO.DeleteOne(ParameterList);
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MSG", "alert('刪除完成');location.href='CGD311.aspx?code=CGD31';", true);

        }
    }
Exemple #3
0
    /// <summary>
    /// 繫結資料到畫面控制項
    /// </summary>
    private bool databind(string strOUTSOURCE_ID)
    {
        bool bResult = false; //false:無資料 true:有資料
        CGDModel.CGD31_BCO BCO = new CGDModel.CGD31_BCO(ConnectionDB);

        ParameterList.Clear();        
        ParameterList.Add(strOUTSOURCE_ID);
        ParameterList.Add(DBNull.Value);
        ParameterList.Add(DBNull.Value);
        DataTable dtData = BCO.DoQuery(ParameterList);
        if (dtData.Rows.Count == 0)
        {
            txtOUTSOURCE_ID.Text = strOUTSOURCE_ID;
            hiddenID.Value = strOUTSOURCE_ID;
            txtKIND.Text = "";
            txtKIND_DESC.Text = "";
            txtCreateDate.Text = "";
            SLP_CreateUID.Text = "";
            txtUpdateDate.Text = "";
            SLP_UpdateUID.Text = "";

            bResult = false;

            ErrorMsgLabel.Text = "此筆資料已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!";
        }
        else
        {
            txtOUTSOURCE_ID.Text = dtData.Rows[0]["OUTSOURCE_ID"].ToString();
            hiddenID.Value = dtData.Rows[0]["OUTSOURCE_ID"].ToString();

            txtKIND.Text = dtData.Rows[0]["KIND"].ToString();
            txtKIND_DESC.Text = dtData.Rows[0]["KIND_DESC"].ToString();
            txtCreateDate.Text = dtData.Rows[0]["CREATEDATE"].ToString();
            SLP_CreateUID.Text = dtData.Rows[0]["CREATEUID"].ToString();
            txtUpdateDate.Text = dtData.Rows[0]["UPDATEDATE"].ToString();
            SLP_UpdateUID.Text = dtData.Rows[0]["UPDATEUID"].ToString();

            bResult = true;
        }
        Session["CGD312_DT" + PageTimeStamp.Value] = dtData;
        return bResult;
    }//databind