Пример #1
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(); }
    }
Пример #2
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(); }
    }
Пример #3
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(); }
    }
Пример #4
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
    }