/// <summary> /// 前台发问题 /// </summary> /// <param name="model"></param> public void AddQuest(ref QA_QuestionMod model, bool isquest) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { using (SQLData m_data = new SQLData()) { model.SysNo = m_data.GetSequence("QA_Question_Seq"); } Add(model); AppMod.User.USR_RecordMod m_record = new AppMod.User.USR_RecordMod(); m_record.CustomerSysNo = model.CustomerSysNo; m_record.TargetSysNo = model.SysNo; m_record.TS = DateTime.Now; m_record.Type = (int)AppEnum.ActionType.AddQuest; User.USR_RecordBll.GetInstance().Add(m_record); if (isquest) { User.USR_CustomerBll.GetInstance().AddPoint(0 - model.Award, model.CustomerSysNo); User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 1, 0, 0, 0, 0, 0, 0, 0, 0); } else { User.USR_CustomerBll.GetInstance().AddPoint(AppConst.TalkPoint, model.CustomerSysNo); User.USR_CustomerBll.GetInstance().AddCount(model.CustomerSysNo, 0, 0, 0, 0, 1, 0, 0, 0, 0); } User.USR_CustomerBll.GetInstance().AddExp(AppConst.TalkExp, model.CustomerSysNo); scope.Complete(); } }
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(); } }
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); } }
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; } }
public void AddCollection(BLG_CollectionMod model) { 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); 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 = 100 + model.Type * 10 + 1; User.USR_RecordBll.GetInstance().Add(m_record); scope.Complete(); } }
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(); } }