Beispiel #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int id = int.Parse(Request["id"].ToString());
        string empNo = this.currentUser.empNo;
        string empNm = this.currentUser.empNm;

        LForumAnswerData forumAnswerData = new LForumAnswerData();
        LForumAnswerBB forumAnswerBB = new LForumAnswerBB();
        try
        {
            forumAnswerData.questionId = id;
            forumAnswerData.answerEmpNo = empNo;
            forumAnswerData.answerEmpNm = empNm;
            forumAnswerData.answerDt = DateTime.Now.ToString();
            forumAnswerData.answerContent = this.txtAnswerContent.Text;

            forumAnswerBB.AddRecord(forumAnswerData);
        }
        finally
        {
            forumAnswerBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
Beispiel #2
0
    private void ShowIssue()
    {
        bool hasAddPermissions = false;
        bool hasAnswerPermissions = false;
        HEemployeeBB userBB = new HEemployeeBB();
        try
        {
            hasAddPermissions = (userBB.HasPermissions(this.currentUser.empId, this.itemNo, "add"));
            hasAnswerPermissions = (userBB.HasPermissions(this.currentUser.empId, this.itemNo, "answer"));
        }
        finally
        {
            userBB.Dispose();
        }

        DataSet ds = new DataSet();
        LForumQuestionBB forumQuestionBB = new LForumQuestionBB();
        try
        {
            ds = forumQuestionBB.GetList("");
            if (ds.Tables[0].Rows.Count == 0)
            {
                ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
            }
        }
        finally
        {
            forumQuestionBB.Dispose();
        }

        LForumAnswerBB forumAnswerBB = new LForumAnswerBB();
        DataSet dsAnswer = new DataSet();
        dsAnswer = forumAnswerBB.GetVList("");

        try
        {
            DataView dv = new DataView(ds.Tables[0], "", "id desc", DataViewRowState.CurrentRows);
            for (int i = 0; i < dv.Count; i++)
            {
                DataRowView row = dv[i];
                string id = row["id"].ToString();
                string questionTitle = row["questionTitle"].ToString();
                string questionContent = row["questionContent"].ToString();
                string questionEmpNm = row["questionEmpNm"].ToString();
                string questionDt = "";
                if (row["questionDt"] != DBNull.Value)
                {
                    questionDt = Convert.ToDateTime(row["questionDt"]).ToString("yyyy-MM-dd HH:mm");
                }

                sbHtml.Append("                <tr>\r\n");
                sbHtml.Append("                    <td valign=\"top\" style=\"background-color: #E3EEED\">\r\n");
                sbHtml.Append("                        <table width=\"95%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
                sbHtml.Append("                            <tr style=\"background-color:#e5e5e5\">\r\n");
                sbHtml.Append("                                <td style=\"height:31px\" colspan=\"4\">\r\n");
                sbHtml.Append("                                    <table width=\"92%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td style=\"width:40px; height:29px\" align=\"CENTER\">\r\n");
                sbHtml.Append("                                                <font size=\"-1\" color=\"#003300\">" + questionEmpNm + "</font></td>\r\n");
                sbHtml.Append("                                            <td style=\"width:260px; height:29px\">\r\n");
                sbHtml.Append("                                                留言日期:  " + questionDt + "</td>\r\n");
                sbHtml.Append("                                            <td style=\"width:120px; height:29px\">\r\n");
                if (hasAddPermissions)
                {
                    sbHtml.Append("                                                <strong><a href=\"javascript:openQuestion();\"><span style=\"color:#035998\">我要留言</span></a></strong>\r\n");
                }
                else
                {
                    sbHtml.Append("                                                <strong><span style=\"color:#035998\">我要留言</span></strong>\r\n");
                }
                sbHtml.Append("                                                &nbsp;&nbsp;\r\n");
                if (hasAnswerPermissions)
                {
                    sbHtml.Append("                                                <strong><a href=\"javascript:openAnswer('" + id.ToString() + "');\"><span style=\"color:#035998\">回复</span></a></strong>\r\n");
                }
                sbHtml.Append("                                                </td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");
                sbHtml.Append("                                    </table>\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                            <tr style=\"background-color:#E0E9ED\">\r\n");
                sbHtml.Append("                                <td style=\"width:4px; height:2px\">\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                                <td style=\"width:78px; height:2px\">\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                                <td style=\"width:4px; height:2px\">\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                                <td style=\"width:470px; height:2px\">\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                            <tr>\r\n");
                sbHtml.Append("                                <td valign=\"top\" style=\"background-color:#E3EEED\" colspan=\"4\">\r\n");
                sbHtml.Append("                                    <table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"\r\n");
                sbHtml.Append("                                        height=\"114\">\r\n");
                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td style=\"width:465px; height:20px\" valign=\"BOTTOM\" align=\"left\">\r\n");
                sbHtml.Append("                                                <font color=\"#FF6666\">主题:</font>" + questionTitle + "</td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");
                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td  style=\"height:1px\">\r\n");
                sbHtml.Append("                                            </td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");
                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td valign=\"top\"  style=\"width:465px; height:47px\" align=\"left\">\r\n");
                sbHtml.Append("                                                <font color=\"#669900\"><strong>\r\n");
                sbHtml.Append("                                                    <hr size=\"1\" color=\"#FFFFFF\">\r\n");
                sbHtml.Append("                                                    <img src=\"../../../Images/write.gif\" width=\"23\" height=\"24\">:</strong></font>" + questionContent + "</td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");
                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td  style=\"height:12px\">\r\n");
                sbHtml.Append("                                            </td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");

                DataView dvAnswer = new DataView(dsAnswer.Tables[0], "questionId='" + row["id"].ToString() + "'", "", DataViewRowState.CurrentRows);

                //显示答复内容
                if (dvAnswer.Count > 0)
                {
                    for (int j = 0; j < dvAnswer.Count; j++)
                    {
                        string answerContent = dvAnswer[j]["answerContent"].ToString();

                        sbHtml.Append("                                        <tr>\r\n");
                        sbHtml.Append("                                            <td style=\"height:36px\" valign=\"top\" bgcolor=\"#f2f2f2\" align=\"left\">\r\n");
                        sbHtml.Append("                                                <span style=\"color:red\"><strong>站方回复: </strong></span>" + answerContent + "\r\n");
                        sbHtml.Append("                                                <hr size=\"1\" color=\"#FFFFFF\">\r\n");
                        sbHtml.Append("                                            </td>\r\n");
                        sbHtml.Append("                                        </tr>\r\n");
                    }
                }
                else
                {
                    sbHtml.Append("                                        <tr>\r\n");
                    sbHtml.Append("                                            <td style=\"height:36px\" valign=\"top\" bgcolor=\"#f2f2f2\" align=\"left\">\r\n");
                    sbHtml.Append("                                                <span style=\"color:red\"><strong>站方回复: </strong></span>暂无回复暂\r\n");
                    sbHtml.Append("                                                <hr size=\"1\" color=\"#FFFFFF\">\r\n");
                    sbHtml.Append("                                            </td>\r\n");
                    sbHtml.Append("                                        </tr>\r\n");
                }

                sbHtml.Append("                                        <tr>\r\n");
                sbHtml.Append("                                            <td style=\"height:5px\">\r\n");
                sbHtml.Append("                                            </td>\r\n");
                sbHtml.Append("                                        </tr>\r\n");
                sbHtml.Append("                                    </table>\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                            <tr style=\"height:2px\" colspan=\"4\">\r\n");
                sbHtml.Append("                                <td>\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                        </table>\r\n");
                sbHtml.Append("                        <table style=\"width:95%; height:2px\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#666666\">\r\n");
                sbHtml.Append("                            <tr>\r\n");
                sbHtml.Append("                                <td>\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                        </table>\r\n");
                sbHtml.Append("                        <table style=\"width:95%; height:5px\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n");
                sbHtml.Append("                            <tr>\r\n");
                sbHtml.Append("                                <td>\r\n");
                sbHtml.Append("                                </td>\r\n");
                sbHtml.Append("                            </tr>\r\n");
                sbHtml.Append("                        </table>\r\n");
                sbHtml.Append("                    </td>\r\n");
                sbHtml.Append("                </tr>\r\n");

            }
        }
        finally
        {
            forumAnswerBB.Dispose();
        }
    }