/// <summary>
    /// 頁面狀態設定
    /// </summary>
    private void Page_Status_LOAD()
    {
        string s_Model = string.Empty;

        try
        { s_Model = Session["POP_CRM01A2_Mode"].ToString(); }
        catch
        { throw new Exception("載入頁面錯誤!"); }
        #region INSERT
        if (s_Model == "INSERT")
        {
            this.but_Store_Chain.Visible = true;
            this.slp_ACT_DATE.Text = DateTime.Now.ToShortDateString();
            this.slp_CREATEUID.Text = Session["UID"].ToString();
        }
        #endregion
        #region EDIT
        else if (s_Model == "EDIT")
        {
            try
            { string s_CRM011_CODE = Session["POP_CRM01A2_CRM011_CODE"].ToString(); }
            catch
            { throw new Exception("載入頁面錯誤!"); }

            this.but_Store_Chain.Visible = false;

            DataSet ds_Return = new DataSet();

            #region 從資料庫撈取資料

            ArrayList ParameterList = new ArrayList();//20091118
            ParameterList.Clear();
            ParameterList.Add(Session["POP_CRM01A2_CRM011_CODE"].ToString());
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(DateTime.Now);

            BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
            ds_Return.Tables.Add(bco.QueryCRMRecordByCode(ParameterList).Copy());

            #endregion

            #region 使用XML放置到前端資料


            xml_MessageOLDData.InnerHtml = ds_Return.GetXml();

            #endregion

            #region 設定初始頁面

            this.slp_ACT_DATE.Text = ds_Return.Tables["VDS_CRM_MESSAGE"].Rows[0]["ACT_DATE"].ToString();
            this.slp_CREATEUID.Text = ds_Return.Tables["VDS_CRM_MESSAGE"].Rows[0]["CREATEUID"].ToString();
            this.slp_CHAN_NO.Text = ds_Return.Tables["VDS_CRM_MESSAGE"].Rows[0]["CHAN_NO"].ToString();
            this.txt_MESSAGE.Text = ds_Return.Tables["VDS_CRM_MESSAGE"].Rows[0]["MESSAGE"].ToString();

            this.slp_ACT_DATE.ReadOnly = true;
            this.slp_CREATEUID.ReadOnly = true;
            this.slp_CHAN_NO.ReadOnly = true;
            this.txt_MESSAGE.ReadOnly = false;

            #endregion
        }
        #endregion
        else
        { throw new Exception("載入頁面錯誤!"); }

    }
    /// <summary>
    /// 按下Button [存檔]
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Save_Click(object sender, EventArgs e)
    {
        //System.Threading.Thread.Sleep(2000);
        try
        {

            ArrayList ParameterList = new ArrayList();//20091118
            bool b_Check_GridView = false;

            if (Session["POP_CRM01A2_Mode"].ToString() == "INSERT")
            {
                #region 檢查必填欄位是否輸入
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                if (this.slp_ACT_DATE.Text.Trim() == string.Empty)
                { sb.Append("[日期]欄位不可空白\\r\\n"); }
                if (this.txt_MESSAGE.Text.Trim() == string.Empty)
                { sb.Append("[訊息內容]欄位不可空白\\r\\n"); }
                if (this.slp_CREATEUID.Text.Trim() == string.Empty)
                { sb.Append("[維護者]欄位不可空白\\r\\n"); }
                if (this.slp_CHAN_NO.Text.Trim() == string.Empty)
                {
                    foreach (GridViewRow dRow in this.gv_Store_Chain.Rows)
                    {
                        CheckBox chb = ((CheckBox)dRow.FindControl("chb_Store_Chain"));
                        if (chb.Checked == true)
                        {
                            b_Check_GridView = true;
                            break;
                        }
                    }

                    //if (b_Check_GridView == false)
                    //{ sb.Append("[通路代號]至少需有一筆被勾選"); }
                }

                if (sb.ToString() != string.Empty)
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('" + sb.ToString() + "');", true);
                    return;
                }

                #endregion

                #region 取得 VDS_CRM_MESSAGE 的 SCHEMA

                ParameterList.Clear();
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(DateTime.Now);

                DataTable dt_VDS_CRM_MESSAGE = new DataTable();

                BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
                dt_VDS_CRM_MESSAGE = bco.GET_VDS_CRM_MESSAGE_SCHEMA(ParameterList);

                #endregion

                #region 取得畫面上 [@日期]、[@訊息內容]、[@維護者]、[@通路]

                DateTime d_Now = DateTime.Now;
                DateTime d_ACT_DATE = DateTime.ParseExact(this.slp_ACT_DATE.Text.Trim(), "yyyy/MM/dd", null);//日期
                string s_MESSAGE = this.txt_MESSAGE.Text.Trim();
                string s_CREATEUID = this.slp_CREATEUID.Text.Trim();
                string s_CHAN_NO = this.slp_CHAN_NO.Text.Trim();

                #endregion

                if (this.slp_CHAN_NO.Text.Trim() == string.Empty)
                {
                    #region 儲存多筆新增資料

                    foreach (GridViewRow gvRow in this.gv_Store_Chain.Rows)
                    {
                        CheckBox chb = (CheckBox)gvRow.FindControl("chb_Store_Chain");

                        if (b_Check_GridView == true)
                        {
                            if (chb.Checked == true)
                            {
                                DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow();
                                dRow["CREATEDATE"] = d_Now;
                                dRow["CREATEUID"] = s_CREATEUID;
                                dRow["UPDATEDATE"] = d_Now;
                                dRow["UPDATEUID"] = s_CREATEUID;
                                dRow["ENABLE"] = 1;
                                dRow["ACT_DATE"] = d_ACT_DATE;
                                dRow["CHAN_NO"] = chb.Text.Trim();
                                dRow["MESSAGE"] = s_MESSAGE;
                                dt_VDS_CRM_MESSAGE.Rows.Add(dRow);
                            }
                        }
                        else
                        {
                                DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow();
                                dRow["CREATEDATE"] = d_Now;
                                dRow["CREATEUID"] = s_CREATEUID;
                                dRow["UPDATEDATE"] = d_Now;
                                dRow["UPDATEUID"] = s_CREATEUID;
                                dRow["ENABLE"] = 1;
                                dRow["ACT_DATE"] = d_ACT_DATE;
                                dRow["CHAN_NO"] = chb.Text.Trim();
                                dRow["MESSAGE"] = s_MESSAGE;
                                dt_VDS_CRM_MESSAGE.Rows.Add(dRow);
                            
                        }

                    }
                    #endregion
                }
                else
                {
                    #region 儲存單筆新增資料

                    DataRow dRow = dt_VDS_CRM_MESSAGE.NewRow();

                    dRow["CREATEDATE"] = d_Now;
                    dRow["CREATEUID"] = s_CREATEUID;
                    dRow["UPDATEDATE"] = d_Now;
                    dRow["UPDATEUID"] = s_CREATEUID;
                    dRow["ENABLE"] = 1;
                    dRow["ACT_DATE"] = d_ACT_DATE;
                    dRow["CHAN_NO"] = s_CHAN_NO;
                    dRow["MESSAGE"] = s_MESSAGE;

                    dt_VDS_CRM_MESSAGE.Rows.Add(dRow);

                    #endregion
                }

                #region 將資料寫入資料庫

                ParameterList.Clear();
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(DateTime.Now);

                bco.CreateCRMMessage(ParameterList, null, dt_VDS_CRM_MESSAGE);

                #endregion

                System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('新增成功');window.close();", true);

            }
            else if (Session["POP_CRM01A2_Mode"].ToString() == "EDIT")
            {
                #region 檢查必填欄位

                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                if (this.slp_ACT_DATE.Text.Trim() == string.Empty)
                { sb.Append("[日期]欄位不可空白\\r\\n"); }
                if (this.slp_CREATEUID.Text.Trim() == string.Empty)
                { sb.Append("[維護者]欄位不可空白\\r\\n"); }
                if (this.slp_CHAN_NO.Text.Trim() == string.Empty)
                { sb.Append("[通路]欄位不可空白\\r\\n"); }
                if (this.txt_MESSAGE.Text.Trim() == string.Empty)
                { sb.Append("[訊息內容]欄位不可空白\\r\\n"); }

                if (sb.ToString() != string.Empty)
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this.up_Button, this.GetType(), "TO_CRM01A.aspx", "alert('" + sb.ToString() + "')", true);
                    return;
                }

                #endregion

                #region 儲存單筆修改資料

                #region 使用XML轉回DataSet

                DataSet ds_OldData = new DataSet();

                System.IO.StringReader sr_OldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml);
                ds_OldData.ReadXml(sr_OldData);

                #endregion

                #region 將資料寫入 ParameterList

                BCO.CRMCommon CRMComm = new BCO.CRMCommon();

                //新資料
                ParameterList.Clear();
                ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_ACT_DATE.Text, "date", false));//日期
                ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CREATEUID.Text, "string", false));//維護者
                ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_CHAN_NO.Text, "string", false));//通路
                ParameterList.Add(CRMComm.GetValueSetParameter(this.txt_MESSAGE.Text, "string", false));//訊息內容
                ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
                ParameterList.Add(DateTime.Now);

                //舊資料
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ID"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ID"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CODE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CODE"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CREATEDATE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CREATEDATE"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CREATEUID"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CREATEUID"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("UPDATEDATE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["UPDATEDATE"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("UPDATEUID"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["UPDATEUID"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ENABLE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ENABLE"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("ACT_DATE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["ACT_DATE"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("CHAN_NO"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["CHAN_NO"]); }
                else { ParameterList.Add(DBNull.Value); }
                if (ds_OldData.Tables["VDS_CRM_MESSAGE"].Columns.Contains("MESSAGE"))
                { ParameterList.Add(ds_OldData.Tables["VDS_CRM_MESSAGE"].Rows[0]["MESSAGE"]); }
                else { ParameterList.Add(DBNull.Value); }

                #endregion

                #region 儲存單筆修改資料

                BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
                bco.UpdateCRMMessage(ParameterList, null);

                #endregion

                #endregion

                System.Web.UI.ScriptManager.RegisterStartupScript(this.but_Save, this.GetType(), "TO_CRM01A.aspx", "alert('修改成功');window.close();", true);
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { }
    }
Example #3
0
    }//UC_RecPre

    #endregion Toolbar



    #region GridView gv_Message

    protected void gv_Message_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {

            ArrayList ParameterList = new ArrayList();//20091117

            if (this.hid_Page_Status.Value != "INSERT" && this.hid_Page_Status.Value != "EDIT")
            {
                if (e.CommandName == "del")
                {
                    //System.Threading.Thread.Sleep(2000); 
                    int i_GridView_Index_del = int.Parse(e.CommandArgument.ToString());

                    #region 使用XML轉回DataSet

                    DataSet ds_MessageOldData = new DataSet();

                    System.IO.StringReader sr_MessageOldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml);
                    ds_MessageOldData.ReadXml(sr_MessageOldData);

                    #endregion

                    #region 刪除所選取的資料

                    string s_CODE = string.Empty;
                    s_CODE = ((HiddenField)this.gv_Message.Rows[i_GridView_Index_del].FindControl("HiddenField1")).Value;

                    DataRow dRow = ds_MessageOldData.Tables[0].Select("CODE = '" + s_CODE + "'")[0];
                    //if (ds_MessageOldData.Tables.Count > 0)
                    //{  
                    //  DataRow[] Rows = ds_MessageOldData.Tables[0].Select("CODE = '" + s_CODE +"'");
                    //  dRow = Rows[0];//

                    //}

                    ParameterList.Clear();
                    ParameterList.Add(dRow["ID"]);
                    ParameterList.Add(dRow["CODE"]);
                    ParameterList.Add(dRow["CREATEDATE"]);
                    ParameterList.Add(dRow["CREATEUID"]);
                    ParameterList.Add(dRow["UPDATEDATE"]);
                    ParameterList.Add(dRow["UPDATEUID"]);
                    ParameterList.Add(dRow["ENABLE"]);
                    ParameterList.Add(dRow["ACT_DATE"]);
                    ParameterList.Add(dRow["CHAN_NO"]);
                    ParameterList.Add(dRow["MESSAGE"]);
                    ParameterList.Add(DateTime.Now);
                    ParameterList.Add(Session["UID"].ToString());

                    BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
                    bco.DeletCRMMessage(ParameterList, null);

                    #endregion

                    #region 重新讀取 gv_Message 資料

                    BCO.CRMCommon CRMComm = new BCO.CRMCommon();

                    ParameterList.Clear();
                    ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_Date.Text, "date", false));
                    ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_CHAN_NO.Text, "string", this.CheckBoxLikeSearch.Checked));
                    ParameterList.Add(CRMComm.GetValueSetParameter((this.TextBoxRowCountLimit.Text == "") ? "10" : (int.Parse(TextBoxRowCountLimit.Text) < 0) ? "10" : TextBoxRowCountLimit.Text, "int", false));
                    ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
                    ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));

                    DataSet ds_Return = new DataSet();
                    ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy());

                    #region 使用XML放置到前端資料

                    xml_MessageOLDData.InnerHtml = ds_Return.GetXml();

                    #endregion

                    //抓取本頁初次登記的時間
                    string SessionIDName = "CRM011_" + PageTimeStamp.Value;

                    Session["SessionID"] = SessionIDName;
                    Session[SessionIDName] = ds_Return.Tables[0];

                    this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView;
                    this.gv_Message.DataBind();

                    #endregion

                    this.RightMsgLabel.Text = "刪除成功";
                }
                else if (e.CommandName == "edi")
                {
                    int i_GridView_Index_edi = int.Parse(e.CommandArgument.ToString());

                    #region 處理Session

                    Session["POP_CRM01A2_Mode"] = null;
                    Session["POP_CRM01A2_CRM011_CODE"] = null;

                    Session["POP_CRM01A2_Mode"] = "EDIT";
                    Session["POP_CRM01A2_CRM011_CODE"] = ((HiddenField)this.gv_Message.Rows[i_GridView_Index_edi].FindControl("HiddenField1")).Value;

                    #endregion

                    //#region 設定 Url & Style
                    //string s_Url = string.Empty;
                    //string s_Style = string.Empty;
                    //s_Url = "../CRM/POP/POP_CRM01A.aspx";
                    //s_Style = "dialogWidth:800px;dialogHeight:600px;status=yes;help=no;center;scroll=yes;";
                    //#endregion

                    //ScriptManager.RegisterStartupScript(this.up_Message, typeof(UpdatePanel), "CRM011", "window.showModalDialog('" + s_Url + "','','" + s_Style + "');", true);
                    ScriptManager.RegisterStartupScript(this.up_Message, typeof(UpdatePanel), "CRM011", "POP_CRMMessage();", true);
                }
            }
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { GetPageDefault(); }
    }
Example #4
0
    /// <summary>
    /// 背景常駐AJAX程式
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void time_New_Msg_Tick(object sender, EventArgs e)
    {
        try
        {
            if (this.imgbut_New_Msg.Visible == false && this.lab_New_Msg.Visible == false)
            {
                #region 從資料庫讀取資料

                BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
                BCO.CRMCommon CRMComm = new BCO.CRMCommon();
                ArrayList ParameterList = new ArrayList();//20091117

                ParameterList.Clear();
                ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "date", false));
                ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "string", false));
                ParameterList.Add(CRMComm.GetValueSetParameter("20", "int", false));
                ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
                ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));

                DataSet ds_Return = new DataSet();
                ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy());

                #endregion

                if (ds_Return.Tables[0].Rows.Count > 0)
                {
                    #region 使用XML轉回DataSet

                    DataSet ds_OldData = new DataSet();

                    System.IO.StringReader sr_OldData = new System.IO.StringReader(xml_MessageOLDData.InnerHtml);
                    ds_OldData.ReadXml(sr_OldData);

                    #endregion

                    #region 比對資料

                    DateTime d_DataBaseFirst = DateTime.Parse(ds_Return.Tables[0].Rows[0]["UPDATEDATE"].ToString());//新資料

                    DateTime d_OldDataFirst = DateTime.Now.AddYears((DateTime.Now.Year * -1) + 1);
                    if (ds_OldData.Tables.Count > 0)
                    { d_OldDataFirst = DateTime.Parse(ds_OldData.Tables[0].Rows[0]["UPDATEDATE"].ToString()); }//舊資料 

                    if (d_DataBaseFirst != d_OldDataFirst)
                    {
                        this.lab_New_Msg.Visible = true;
                        this.imgbut_New_Msg.Visible = true;
                    }

                    #endregion
                }
            }

            //2010/10/19 added
            this.txt_ANSWER_TIME.Text = DateTime.Now.ToString("HH:mm");//接聽時間 yyyy/MM/dd HH:mm:ss
            up_Master.Update();
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { GetPageDefault(); }
    }
Example #5
0
    /// <summary>
    /// BUTTON 下面的查詢鈕
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void but_Down_Query_Click(object sender, EventArgs e)
    {
        try
        {
            #region 檢查條件

            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            //if (this.slp_Down_Date.Text.Trim() == string.Empty)
            //{ sb.Append("欄位[日期]為必填欄位<br/>"); }
            //if (this.slp_Down_CHAN_NO.Text.Trim() == string.Empty)
            //{ sb.Append("欄位[通路]為必填欄位<br/>"); }

            if (sb.ToString() != string.Empty)
            {
                this.ErrorMsgLabel.Text = sb.ToString();
                return;
            }

            #endregion

            #region 從資料庫讀取資料

            BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
            BCO.CRMCommon CRMComm = new BCO.CRMCommon();
            ArrayList ParameterList = new ArrayList();//20091117

            ParameterList.Clear();
            ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_Date.Text, "date", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(this.slp_Down_CHAN_NO.Text, "string", this.CheckBoxLikeSearch.Checked));
            ParameterList.Add(CRMComm.GetValueSetParameter((this.TextBoxRowCountLimit.Text == "") ? "10" : (int.Parse(TextBoxRowCountLimit.Text) < 0) ? "10" : TextBoxRowCountLimit.Text, "int", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));

            DataSet ds_Return = new DataSet();
            ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy());

            #endregion

            #region 使用XML放置到前端資料

            xml_MessageOLDData.InnerHtml = ds_Return.GetXml();

            #endregion

            #region 將資料與 GridView Binding

            //抓取本頁初次登記的時間
            string SessionIDName = "CRM011_" + PageTimeStamp.Value;

            Session["SessionID"] = SessionIDName;
            Session[SessionIDName] = ds_Return.Tables[0];

            this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView;
            this.gv_Message.PageSize = (this.TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            this.gv_Message.DataBind();

            #endregion

            #region 檢查回傳資料

            if (ds_Return.Tables[0].Rows.Count == 0)
            { this.ErrorMsgLabel.Text = "查無資料"; }

            #endregion

            this.lab_New_Msg.Visible = false;
            this.imgbut_New_Msg.Visible = false;
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally
        { GetPageDefault(); }
    }
Example #6
0
    }//設定各種模式預設值

    private void GetCustomerMessage()
    {
        #region 從資料庫讀取資料

        BCO.MaintainCRMessage bco = new BCO.MaintainCRMessage(ConntionDB);
        BCO.CRMCommon CRMComm = new BCO.CRMCommon();

        ArrayList ParameterList = new ArrayList();//20091117

        ParameterList.Clear();
        ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "date", false));
        ParameterList.Add(CRMComm.GetValueSetParameter(string.Empty, "string", false));
        ParameterList.Add(CRMComm.GetValueSetParameter("20", "int", false));
        ParameterList.Add(CRMComm.GetValueSetParameter(Session["UID"].ToString(), "string", false));
        ParameterList.Add(CRMComm.GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));

        DataSet ds_Return = new DataSet();
        ds_Return.Tables.Add(bco.QuerySwitch(BCO.MaintainCRMessage.QueryType.QueryCRMMessageByFind, ParameterList).Copy());

        #endregion

        #region 使用XML放置到前端資料


        xml_MessageOLDData.InnerHtml = ds_Return.GetXml();

        #endregion

        #region 將資料與 GridView Binding

        //抓取本頁初次登記的時間
        string SessionIDName = "CRM011_" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = ds_Return.Tables[0];

        this.gv_Message.DataSource = ds_Return.Tables[0].DefaultView;
        this.gv_Message.PageSize = 5;
        this.gv_Message.PageIndex = 0;
        this.gv_Message.DataBind();

        #endregion
    }