Пример #1
0
        public void SetAward(QA_AnswerMod m_answer, QA_QuestionMod m_quest, int score)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if (m_answer.Award == AppConst.IntNull)
                {
                    m_answer.Award = score;
                }
                else
                {
                    m_answer.Award += score;
                }
                QA_AnswerBll.GetInstance().Update(m_answer);

                USR_CustomerBll.GetInstance().AddPoint(score, m_answer.CustomerSysNo);
                USR_CustomerBll.GetInstance().AddCount(m_answer.CustomerSysNo, 0, 0, 1, 0, 0, 0, 0, 0, 0);
                int usedAward = QA_AnswerBll.GetInstance().GetUsedAward(m_quest.SysNo);
                if (score == m_quest.Award - usedAward)
                {
                    m_quest.EndTime = DateTime.Now;
                    QA_QuestionBll.GetInstance().Update(m_quest);
                }
                scope.Complete();
            }
        }
Пример #2
0
        public void SetOrder(QA_OrderMod order, QA_AnswerMod answer)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                int sysno = QA_AnswerBll.GetInstance().AddAnswer(answer);
                USR_CustomerBll.GetInstance().AddCount(answer.CustomerSysNo, 0, 0, 0, 0, 0, 0, 1, 0, 0);

                order.AnswerSysNo = sysno;
                Add(order);

                QA_QuestionMod m_qa = QA_QuestionBll.GetInstance().GetModel(order.QuestionSysNo);
                m_qa.OrderCount++;
                QA_QuestionBll.GetInstance().Update(m_qa);

                AppMod.User.USR_RecordMod m_record = new AppMod.User.USR_RecordMod();
                m_record.CustomerSysNo = order.CustomerSysNo;
                m_record.TargetSysNo   = sysno;
                m_record.TS            = DateTime.Now;
                m_record.Type          = (int)AppEnum.ActionType.SetOrder;
                User.USR_RecordBll.GetInstance().Add(m_record);

                scope.Complete();
            }
        }
Пример #3
0
        public int AddAnswer(QA_AnswerMod model)
        {
            bool isquest = false;
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                int sysno = Add(model);

                QA_QuestionMod m_qa = QA_QuestionBll.GetInstance().GetModel(model.QuestionSysNo);
                m_qa.ReplyCount++;
                m_qa.LastReplyUser = model.CustomerSysNo;
                m_qa.LastReplyTime = DateTime.Now;
                QA_QuestionBll.GetInstance().Update(m_qa);
                if (QA_CategoryBll.GetInstance().GetModel(m_qa.CateSysNo).TopSysNo == 1)
                {
                    isquest = true;
                }

                AppMod.User.USR_RecordMod m_record = new AppMod.User.USR_RecordMod();
                m_record.CustomerSysNo = model.CustomerSysNo;
                m_record.TargetSysNo   = sysno;
                m_record.TS            = DateTime.Now;
                m_record.Type          = (int)AppEnum.ActionType.ReplyQuest;
                User.USR_RecordBll.GetInstance().Add(m_record);

                User.USR_CustomerBll.GetInstance().AddPoint(AppConst.AnswerPoint, model.CustomerSysNo);
                User.USR_CustomerBll.GetInstance().AddExp(AppConst.AnswerExp, model.CustomerSysNo);
                if (model.CustomerSysNo != m_qa.CustomerSysNo)
                {
                    AppMod.User.USR_MessageMod m_notice = new AppMod.User.USR_MessageMod();
                    m_notice.CustomerSysNo = m_qa.CustomerSysNo;
                    m_notice.Context       = "";
                    m_notice.DR            = 0;
                    m_notice.IsRead        = 0;
                    m_notice.Title         = AppConst.AnswerReport.Replace("@url", AppConfig.HomeUrl() + "Quest/Question.aspx?id=" + m_qa.SysNo).Replace("@question", m_qa.Title);
                    m_notice.TS            = DateTime.Now;
                    m_notice.Type          = (int)AppEnum.MessageType.notice;
                    User.USR_MessageBll.GetInstance().AddMessage(m_notice);
                    if (isquest)
                    {
                        User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 0, 1, 0, 0, 0, 0, 0, 0, 0);
                    }
                    else
                    {
                        User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 0, 0, 0, 0, 0, 1, 0, 0, 0);
                    }
                }
                else
                {
                    User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 0, 0, 0, 0, 0, 1, 0, 0, 0);
                }
                scope.Complete();
                return(sysno);
            }
        }
Пример #4
0
 public static QA_QuestionBll GetInstance()
 {
     if (_instance == null)
     {
         _instance = new QA_QuestionBll();
     }
     return(_instance);
 }
Пример #5
0
 public static QA_QuestionBll GetInstance()
 {
     if (_instance == null)
     {
         _instance = new QA_QuestionBll();
     }
     return _instance;
 }
Пример #6
0
        public bool IfReplyed(int answersysno, int questsysno)
        {
            bool           ret      = false;
            QA_QuestionMod m_qa     = QA_QuestionBll.GetInstance().GetModel(questsysno);
            QA_AnswerMod   m_answer = QA_AnswerBll.GetInstance().GetModel(answersysno);
            DataTable      m_dt     = GetListByAnswer(answersysno);

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qa.CustomerSysNo.ToString())
                {
                    ret = true;
                    break;
                }
            }
            return(ret);
        }