Beispiel #1
0
        public ReturnValue <PageInfo <QA_AnswerShow> > GetAnswerByQuest(int pagesize, int pageindex, int sysno)
        {
            int                      total = 0;
            DataTable                m_dt  = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, sysno, ref total);
            List <QA_AnswerShow>     ret   = new List <QA_AnswerShow>();
            PageInfo <QA_AnswerShow> rett  = new PageInfo <QA_AnswerShow>();

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                rett.List        = ret;
                rett.Total       = total;
                rett.HasNextPage = false;
                return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett));
            }

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                QA_AnswerShow    tmp_answer = MapQA_AnswerShow(m_dt.Rows[i]);
                USR_CustomerShow tmpu       = new USR_CustomerShow();
                USR_CustomerBll.GetInstance().GetModel(tmp_answer.CustomerSysNo).MemberwiseCopy(tmpu);
                tmp_answer.Customer = tmpu;
                DataTable tmp_dt = QA_CommentBll.GetInstance().GetListByAnswer(tmp_answer.SysNo);
                if (tmp_dt != null && tmp_dt.Rows.Count > 0)
                {
                    List <QA_CommentShow> commentlist = new List <QA_CommentShow>();
                    for (int j = 0; j < tmp_dt.Rows.Count && j <= 3; j++)
                    {
                        QA_CommentShow       tmp_comment = MapQA_CommentShow(tmp_dt.Rows[j]);
                        USR_CustomerMaintain tmpuu       = new USR_CustomerMaintain();
                        USR_CustomerBll.GetInstance().GetModel(tmp_comment.CustomerSysNo).MemberwiseCopy(tmpuu);
                        tmp_comment.Customer = tmpuu;
                        commentlist.Add(tmp_comment);
                    }
                    tmp_answer.TopComments = commentlist;
                    tmp_answer.ToalComment = tmp_dt.Rows.Count;
                    if (tmp_dt.Rows.Count > 3)
                    {
                        tmp_answer.HasMoreComment = true;
                    }
                    else
                    {
                        tmp_answer.HasMoreComment = false;
                    }
                }
                ret.Add(tmp_answer);
            }

            rett.List  = ret;
            rett.Total = total;
            if (pagesize * pageindex >= total)
            {
                rett.HasNextPage = false;
            }
            else
            {
                rett.HasNextPage = true;
            }
            return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett));
        }
Beispiel #2
0
        protected void Repeater3_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            QA_CommentMod m_comment = QA_CommentBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));

            m_comment.DR = (int)AppEnum.State.deleted;
            QA_CommentBll.GetInstance().Update(m_comment);
            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('成功删除该评论!');", true);
            BindList();
        }
Beispiel #3
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                e.Item.FindControl("LinkButton1").Visible = true;
                if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString())
                {
                    e.Item.FindControl("LinkButton1").Visible = false;
                }
                e.Item.FindControl("LinkButton5").Visible = true;
                e.Item.FindControl("Literal1").Visible    = true;
            }
            else
            {
                e.Item.FindControl("LinkButton1").Visible = false;
                if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) ||
                    GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
                {
                    e.Item.FindControl("LinkButton5").Visible = true;
                    e.Item.FindControl("Literal1").Visible    = true;
                }
            }

            Repeater  m_rpt = (Repeater)e.Item.FindControl("Repeater3");
            DataTable m_dt  = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString()));

            if (m_dt != null)
            {
                m_dt.Columns.Add("color");
                for (int i = 0; i < m_dt.Rows.Count; i++)
                {
                    if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString())
                    {
                        m_dt.Rows[i]["color"] = "color: #A5534C";
                    }
                }
                m_rpt.DataSource = m_dt;
                m_rpt.DataBind();
            }
            Repeater  m_rpt1 = (Repeater)e.Item.FindControl("Repeater4");
            DataTable m_dt1  = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0);

            if (m_dt1 != null)
            {
                m_rpt1.DataSource = m_dt1;
                m_rpt1.DataBind();
            }
        }
Beispiel #4
0
        public ReturnValue <bool> RemoveComment(int CommentSysNo)
        {
            QA_CommentMod m_comment = QA_CommentBll.GetInstance().GetModel(CommentSysNo);

            if (m_comment != null)
            {
                m_comment.DR = (int)AppEnum.State.deleted;
                QA_CommentBll.GetInstance().Update(m_comment);

                return(ReturnValue <bool> .Get200OK(true));
            }
            else
            {
                throw new BusinessException("该评论不存在!");
            }
        }
Beispiel #5
0
        public ReturnValue <USR_CustomerShow> AddComment(int AnswerSysNo, int CustomerSysNo, int QuestionSysNo, string Context)
        {
            QA_CommentMod m_comment = new QA_CommentMod();

            m_comment.AnswerSysNo   = AnswerSysNo;
            m_comment.Context       = AppCmn.CommonTools.SystemInputFilter(Context.DoTrim());
            m_comment.DR            = (int)AppEnum.State.normal;
            m_comment.QuestionSysNo = QuestionSysNo;
            m_comment.TS            = DateTime.Now;
            m_comment.CustomerSysNo = CustomerSysNo;
            QA_CommentBll.GetInstance().AddComment(m_comment);

            USR_CustomerShow ret = new USR_CustomerShow();

            USR_CustomerBll.GetInstance().GetModel(CustomerSysNo).MemberwiseCopy(ret);
            return(ReturnValue <USR_CustomerShow> .Get200OK(ret));
        }
Beispiel #6
0
        public ReturnValue <List <QA_CommentShow> > GetCommentByAnswer(int sysno)
        {
            DataTable             m_dt = QA_CommentBll.GetInstance().GetListByAnswer(sysno);
            List <QA_CommentShow> ret  = new List <QA_CommentShow>();

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                return(ReturnValue <List <QA_CommentShow> > .Get200OK(ret));
            }

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                QA_CommentShow tmp_comment = MapQA_CommentShow(m_dt.Rows[i]);
                ret.Add(tmp_comment);
            }

            return(ReturnValue <List <QA_CommentShow> > .Get200OK(ret));
        }
Beispiel #7
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                //e.Item.FindControl("LinkButton1").Visible = true;
                //if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString())
                //{
                //    e.Item.FindControl("LinkButton1").Visible = false;
                //}
                e.Item.FindControl("LinkButton5").Visible = true;
                e.Item.FindControl("Literal1").Visible    = true;
            }
            else
            {
                //e.Item.FindControl("LinkButton1").Visible = false;
                if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) ||
                    GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
                {
                    e.Item.FindControl("LinkButton5").Visible = true;
                    e.Item.FindControl("Literal1").Visible    = true;
                }
            }
            #region 绑定评论列表
            Repeater  m_rpt = (Repeater)e.Item.FindControl("Repeater3");
            DataTable m_dt  = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString()));
            if (m_dt != null)
            {
                m_dt.Columns.Add("color");
                for (int i = 0; i < m_dt.Rows.Count; i++)
                {
                    if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString())
                    {
                        m_dt.Rows[i]["color"] = "color: #A5534C";
                    }
                }
                m_rpt.DataSource = m_dt;
                m_rpt.DataBind();
            }
            #endregion
            #region 绑定用户奖章
            Repeater  m_rpt1 = (Repeater)e.Item.FindControl("Repeater4");
            DataTable m_dt1  = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0);
            if (m_dt1 != null)
            {
                m_rpt1.DataSource = m_dt1;
                m_rpt1.DataBind();
            }
            #endregion

            #region 设置报价单权限
            DataRowView rowv = (DataRowView)e.Item.DataItem;
            if (rowv["Price"] != null && rowv["Price"].ToString() != "")
            {
                if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) //求测者
                {
                    e.Item.FindControl("LinkButton5").Visible = false;            //报价单无法删除
                    if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforepay).ToString())
                    {
                        e.Item.FindControl("buyicon").Visible = true;
                    }
                    else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforeconfirm).ToString())
                    {
                        e.Item.FindControl("confirmicon").Visible = true;
                        DateTime replytime = DateTime.Parse(rowv["replytime"].ToString());
                        if (replytime != AppConst.DateTimeNull)
                        {
                            TimeSpan m_span = replytime.AddHours(AppConst.ConsultConfirmTime) - DateTime.Now;
                            string   tmpstr = "";
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Days + "天";
                            }
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Hours + "小时";
                            }
                            ((Literal)e.Item.FindControl("Literal4")).Text = tmpstr;
                        }
                    }
                    else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString())
                    {
                        e.Item.FindControl("buyedtip").Visible = true;
                        DateTime paytime = ORD_CashBll.GetInstance().GetPayTimeByQAOrder(int.Parse(rowv["ordersysno"].ToString()));
                        if (paytime != AppConst.DateTimeNull)
                        {
                            TimeSpan m_span = paytime.AddHours(AppConst.ConsultReplyTime) - DateTime.Now;
                            string   tmpstr = "";
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Days + "天";
                            }
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Hours + "小时";
                            }
                            ((Literal)e.Item.FindControl("Literal3")).Text = tmpstr;
                        }
                        else
                        {
                            ShowError("");
                        }
                    }
                }
                if (GetSession().CustomerEntity.SysNo == Convert.ToInt32(rowv["CustomerSysNo"]))//占卜师
                {
                    if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString())
                    {
                        e.Item.FindControl("replyicon").Visible = true;
                    }
                }
            }
            #endregion
        }
Beispiel #8
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Login(Request.Url.ToString());
            if (e.CommandName == "Love")
            {
                if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString())))
                {
                    QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
                    m_answer.Love++;
                    QA_AnswerBll.GetInstance().Update(m_answer);
                    SetCommentCookies(int.Parse(e.CommandArgument.ToString()));
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您对该回答表示了赞同!');", true);
                    BindList();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true);
                }
            }
            else if (e.CommandName == "Hate")
            {
                if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString())))
                {
                    QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
                    m_answer.Hate++;
                    QA_AnswerBll.GetInstance().Update(m_answer);
                    SetCommentCookies(int.Parse(e.CommandArgument.ToString()));
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('您对该回答表示了不赞同!');", true);
                    BindList();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true);
                }
            }
            //else if (e.CommandName == "Award")
            //{
            //    QA_QuestionMod m_quest = QA_QuestionBll.GetInstance().GetModel(SysNo);
            //    int usedAward = QA_AnswerBll.GetInstance().GetUsedAward(SysNo);
            //    ltrMax.Text = "该问题的总悬赏积分为:" + (m_quest.Award - usedAward).ToString();
            //    HiddenField1.Value = e.CommandArgument.ToString();
            //    ModalPopupExtender1.Show();
            //}
            else if (e.CommandName == "Reply")
            {
                if (((TextBox)e.Item.FindControl("txtRe")).Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('请输入您的回复信息!');", true);
                    return;
                }
                try
                {
                    QA_CommentMod m_comment = new QA_CommentMod();
                    m_comment.AnswerSysNo   = int.Parse(e.CommandArgument.ToString());
                    m_comment.Context       = AppCmn.CommonTools.SystemInputFilter(((TextBox)e.Item.FindControl("txtRe")).Text.Trim());
                    m_comment.DR            = (int)AppEnum.State.normal;
                    m_comment.QuestionSysNo = SysNo;
                    m_comment.TS            = DateTime.Now;
                    m_comment.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    QA_CommentBll.GetInstance().AddComment(m_comment);
                    RefreshSession();
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('发表看法成功!');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('系统故障,请联系管理员');", true);
                }
                BindList();
            }
            else if (e.CommandName == "Del")
            {
                QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
                m_answer.DR = (int)AppEnum.State.deleted;
                QA_AnswerBll.GetInstance().Update(m_answer);
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('成功删除该回答!');", true);
                BindList();
            }
            else if (e.CommandName == "buy")
            {
                //生成订单
                QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
                ORD_CashMod m_mod   = new ORD_CashMod();
                m_mod.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                m_mod.CurrentID     = "";
                m_mod.Discount      = 0;

                m_mod.PayAmount    = m_order.Price;
                m_mod.PayType      = AppConst.IntNull;
                m_mod.Price        = m_order.Price;
                m_mod.ProductSysNo = m_order.SysNo;
                m_mod.Status       = (int)AppEnum.CashOrderStatus.beforepay;
                m_mod.ProductType  = (int)AppEnum.CashOrderType.consultpay;;
                m_mod.TS           = DateTime.Now;

                m_mod.OrderID = "C" + m_mod.ProductType.ToString("0") + m_mod.TS.ToString("yyyyMMdd") + m_mod.ProductSysNo + CommonTools.ThrowRandom(0, 99999).ToString("00000");
                m_mod.SysNo   = ORD_CashBll.GetInstance().Add(m_mod);
                //m_qustion.BuyCount++;//支付成功后修改订单购买数
                QA_QuestionBll.GetInstance().Update(m_qustion);

                Response.Redirect(AppConfig.HomeUrl() + "Order/ConsultOrder.aspx?order=" + m_mod.SysNo);
            }
            else if (e.CommandName == "score")
            {
                string score = ((HiddenField)e.Item.FindControl("HiddenField3")).Value;
                if (score == "")
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "score", "alert('请先选择评价!');", true);
                    return;
                }
                else
                {
                    QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
                    m_order.Score  = int.Parse(score);
                    m_order.Status = (int)AppEnum.ConsultOrderStatus.confirmed;
                    QA_OrderBll.GetInstance().Update(m_order);
                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "score", "alert('已评价成功!');", true);
                    BindList();
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 任务实体
        /// </summary>
        /// <param name="lastExecuteTime"></param>
        public override void Execute(DateTime?lastExecuteTime)
        {
            try
            {
                LogService.Info("任务开始", LogInfoCategory);

                DataTable m_dt = QA_QuestionBll.GetInstance().GetToEndList();
                if (m_dt != null && m_dt.Rows.Count > 0)
                {
                    int total = 0;
                    for (int i = 0; i < m_dt.Rows.Count; i++)
                    {
                        int       sysno    = int.Parse(m_dt.Rows[i]["sysno"].ToString());
                        DataTable m_answer = QA_AnswerBll.GetInstance().GetListByQuest(1, 10000, sysno, ref total);
                        m_answer.Columns.Add("commcount");
                        m_answer.Columns.Add("score");
                        int totalcomm  = 0;
                        int totallenth = 0;
                        int totallove  = 0;
                        int[,] tmpresult = new int[3, 2];
                        for (int j = 0; j < m_answer.Rows.Count; j++)
                        {
                            totallenth += m_answer.Rows[j]["Context"].ToString().Length;
                            totallove  += int.Parse(m_answer.Rows[j]["Love"].ToString());
                            DataTable m_comm = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(m_answer.Rows[j]["SysNo"].ToString()));
                            totalcomm += m_comm.Rows.Count;
                            m_answer.Rows[j]["commcount"] = m_comm.Rows.Count.ToString();
                            m_answer.Rows[j]["score"]     = 0;
                        }

                        for (int j = 0; j < m_answer.Rows.Count; j++)
                        {
                            double tmp = Convert.ToDouble(m_answer.Rows[j]["Context"].ToString().Length *m_answer.Rows.Count) / Convert.ToDouble(totallenth);
                            tmp -= 1;
                            if (tmp > 0)
                            {
                                m_answer.Rows[j]["score"] = int.Parse(m_answer.Rows[j]["score"].ToString()) + Math.Floor(tmp * 10) * Math.Floor(tmp * 10) * 10;
                            }

                            tmp  = Convert.ToDouble(m_answer.Rows[j]["Love"].ToString()) * Convert.ToDouble(m_answer.Rows.Count) / Convert.ToDouble(totallove);
                            tmp -= 1;
                            if (tmp > 0)
                            {
                                m_answer.Rows[j]["score"] = int.Parse(m_answer.Rows[j]["score"].ToString()) + Math.Floor(tmp * 10) * Math.Floor(tmp * 10) * 5;
                            }

                            tmp  = Convert.ToDouble(m_answer.Rows[j]["commcount"].ToString()) * Convert.ToDouble(m_answer.Rows.Count) / Convert.ToDouble(totalcomm);
                            tmp -= 1;
                            if (tmp > 0)
                            {
                                m_answer.Rows[j]["score"] = int.Parse(m_answer.Rows[j]["score"].ToString()) + Math.Floor(tmp * 10) * Math.Floor(tmp * 10) * 3;
                            }
                        }

                        TransactionOptions options = new TransactionOptions();
                        options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                        options.Timeout        = TransactionManager.DefaultTimeout;

                        using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                        {
                            m_answer.DefaultView.Sort = "award asc, score desc";
                            DataTable dtTemp = m_answer.DefaultView.ToTable();
                            if (dtTemp.Rows.Count == 1)
                            {
                                QA_AnswerBll.GetInstance().SetAward(QA_AnswerBll.GetInstance().GetModel(int.Parse(dtTemp.Rows[0]["SysNo"].ToString())), QA_QuestionBll.GetInstance().GetModel(int.Parse(m_dt.Rows[i]["SysNo"].ToString())), int.Parse(m_dt.Rows[i]["Award"].ToString()) - QA_AnswerBll.GetInstance().GetUsedAward(int.Parse(dtTemp.Rows[0]["SysNo"].ToString())));
                            }
                            else
                            {
                                int awardremain = int.Parse(m_dt.Rows[i]["Award"].ToString()) - QA_AnswerBll.GetInstance().GetUsedAward(int.Parse(dtTemp.Rows[0]["SysNo"].ToString()));
                                int award1      = awardremain * int.Parse(m_dt.Rows[0]["score"].ToString()) / (int.Parse(m_dt.Rows[0]["score"].ToString()) + int.Parse(m_dt.Rows[1]["score"].ToString()));
                                int award2      = awardremain - award1;
                                QA_AnswerBll.GetInstance().SetAward(QA_AnswerBll.GetInstance().GetModel(int.Parse(dtTemp.Rows[0]["SysNo"].ToString())), QA_QuestionBll.GetInstance().GetModel(int.Parse(m_dt.Rows[i]["SysNo"].ToString())), award1);
                                QA_AnswerBll.GetInstance().SetAward(QA_AnswerBll.GetInstance().GetModel(int.Parse(dtTemp.Rows[1]["SysNo"].ToString())), QA_QuestionBll.GetInstance().GetModel(int.Parse(m_dt.Rows[i]["SysNo"].ToString())), award2);
                            }

                            USR_MessageMod m_notice = new USR_MessageMod();
                            m_notice.CustomerSysNo = int.Parse(m_dt.Rows[i]["CustomerSysNo"].ToString());
                            m_notice.Title         = AppConst.AutoSendAward.Replace("@url", Container.ConfigService.GetAppSetting <string>("HomeUrl", "") + "Quest/Question.aspx?id=" + m_dt.Rows[i]["SysNo"].ToString())
                                                     .Replace("@question", m_dt.Rows[i]["Title"].ToString());
                            m_notice.DR      = 0;
                            m_notice.IsRead  = 0;
                            m_notice.Context = "";
                            m_notice.TS      = DateTime.Now;
                            m_notice.Type    = (int)AppEnum.MessageType.notice;
                            USR_MessageBll.GetInstance().AddMessage(m_notice);

                            scope.Complete();
                            //EventLog.WriteEntry("Hi,I'm wiseman");
                        }
                    }
                }
                LogService.Info("任务结束", LogInfoCategory);
            }
            catch (Exception ex)
            {
                LogService.Error("RewardTask 任务失败", LogInfoCategory);
                LogService.Error(ex, LogInfoCategory);
            }
            finally
            {
                this.NextExecuteTime = DateTime.Now.AddHours(1);
            }
        }
Beispiel #10
0
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Love")
     {
         if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString())))
         {
             QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
             m_answer.Love++;
             QA_AnswerBll.GetInstance().Update(m_answer);
             SetCommentCookies(int.Parse(e.CommandArgument.ToString()));
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您对该回答表示了赞同!');", true);
             BindList();
         }
         else
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true);
         }
     }
     else if (e.CommandName == "Hate")
     {
         if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString())))
         {
             QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
             m_answer.Hate++;
             QA_AnswerBll.GetInstance().Update(m_answer);
             SetCommentCookies(int.Parse(e.CommandArgument.ToString()));
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('您对该回答表示了不赞同!');", true);
             BindList();
         }
         else
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true);
         }
     }
     else if (e.CommandName == "Award")
     {
         QA_QuestionMod m_quest   = QA_QuestionBll.GetInstance().GetModel(SysNo);
         int            usedAward = QA_AnswerBll.GetInstance().GetUsedAward(SysNo);
         ltrMax.Text        = "该问题的总悬赏积分为:" + (m_quest.Award - usedAward).ToString();
         HiddenField1.Value = e.CommandArgument.ToString();
         ModalPopupExtender1.Show();
     }
     else if (e.CommandName == "Reply")
     {
         if (((TextBox)e.Item.FindControl("txtRe")).Text.Trim() == "")
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('请输入您的回复信息!');", true);
             return;
         }
         try
         {
             QA_CommentMod m_comment = new QA_CommentMod();
             m_comment.AnswerSysNo   = int.Parse(e.CommandArgument.ToString());
             m_comment.Context       = AppCmn.CommonTools.SystemInputFilter(((TextBox)e.Item.FindControl("txtRe")).Text.Trim());
             m_comment.DR            = (int)AppEnum.State.normal;
             m_comment.QuestionSysNo = SysNo;
             m_comment.TS            = DateTime.Now;
             m_comment.CustomerSysNo = GetSession().CustomerEntity.SysNo;
             QA_CommentBll.GetInstance().AddComment(m_comment);
             RefreshSession();
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('发表看法成功!');", true);
         }
         catch
         {
             ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('系统故障,请联系管理员');", true);
         }
         BindList();
     }
     else if (e.CommandName == "Del")
     {
         QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString()));
         m_answer.DR = (int)AppEnum.State.deleted;
         QA_AnswerBll.GetInstance().Update(m_answer);
         ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('成功删除该回答!');", true);
         BindList();
     }
 }