Example #1
0
    private void BindGridView()
    {
        #region FAQGridView 数据绑定

        _faqEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _faqEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _faqEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _faqEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _faqEntity.FAQDBEntity = new List<FAQDBEntity>();
        FAQDBEntity faqDBEntity = new FAQDBEntity();

        _faqEntity.FAQDBEntity.Add(faqDBEntity);
        DataSet dsResult = FAQBP.CommonSelect(_faqEntity).QueryResult;

        DataTable dtUser = dsResult.Tables[0];
        GridviewControl.GridViewDataBind(this.FAQGridView, dtUser);

        #endregion
    }
Example #2
0
    /// <summary>
    /// 点击删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void FAQGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string ID = FAQGridView.DataKeys[e.RowIndex].Value.ToString();
        _faqEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _faqEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _faqEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _faqEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _faqEntity.FAQDBEntity = new List<FAQDBEntity>();
        FAQDBEntity faqDBEntity = new FAQDBEntity();

        faqDBEntity.ID = Convert.ToInt32(ID);
        _faqEntity.FAQDBEntity.Add(faqDBEntity);     //增加一条到数据库中

        int iResult = FAQBP.Delete(_faqEntity);

        if (iResult == 1)//删除成功
        {
            string successText = Resources.MyGlobal.DeleteSuccessText;
            //commonDBEntity.Event_Result = successText;
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + successText + "');", true);

            BindGridView();//重新绑定显示的页面
        }
        else//表示失败
        {
            //string strFaild = GetLocalResourceObject("DeleteFaildText").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('删除失败!')", true);
        }
    }
Example #3
0
    protected void FAQGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string ID = FAQGridView.DataKeys[e.RowIndex].Value.ToString();

        _faqEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _faqEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _faqEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _faqEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        string strQuestion = ((TextBox)FAQGridView.Rows[e.RowIndex].FindControl("txtEditQuestion")).Text;
        string strAnswer = ((TextBox)FAQGridView.Rows[e.RowIndex].FindControl("txtEditAnswer")).Text;
        if ((strQuestion.Length > 100) || (string.IsNullOrEmpty(strQuestion)))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('问题不能为空,且总长度最多只能输入100个字符!');", true);
            return;
        }

        if ((strAnswer.Length > 300) || (string.IsNullOrEmpty(strAnswer)))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('答案不能为空,且答案的内容的总长度不能大于300个字符!');", true);
            return;
        }

        _faqEntity.FAQDBEntity = new List<FAQDBEntity>();
        FAQDBEntity faqDBEntity = new FAQDBEntity();

        faqDBEntity.ID = Convert.ToInt32(ID);
        faqDBEntity.QUSETION_HEAD = strQuestion;
        faqDBEntity.ANSWER_BODY = strAnswer;

        _faqEntity.FAQDBEntity.Add(faqDBEntity);
        int iResult = FAQBP.Update(_faqEntity);

        if (iResult == 1) //修改成功
        {
            string successText = Resources.MyGlobal.UpdateSuccessText;
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + successText + "');", true);

            FAQGridView.EditIndex = -1;
            BindGridView();//重新绑定显示的页面

            btnAdjust.Enabled = true;
        }
        else//表示修改失败
        {
            //string strFaild = GetLocalResourceObject("UpdateFaildText").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('修改失败!')", true);
        }
    }
Example #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strQuestion = this.txtQuestion.Text.Trim();
        string strAnswer = this.txtAnswer.Text.Trim();

        _faqEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _faqEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _faqEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _faqEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _faqEntity.FAQDBEntity = new List<FAQDBEntity>();
        FAQDBEntity faqDBEntity = new FAQDBEntity();
        int id = new CommonFunction().getMaxIDfromSeq("t_lm_qa_seq");

        int SeqMax = DbHelperOra.GetMaxID("SEQ", "t_lm_qa", false);

        faqDBEntity.ID = id;
        faqDBEntity.QUSETION_HEAD = strQuestion;
        faqDBEntity.ANSWER_BODY = strAnswer;
        faqDBEntity.SEQ = SeqMax;

        _faqEntity.FAQDBEntity.Add(faqDBEntity);
        FAQBP.Insert(_faqEntity);

        clearInputText();//清空已经输入的信息

        BindGridView();
    }