protected void BindList()
        {
            int total = 0;

            if (m_qustion.CustomerSysNo == AppConst.IntNull)
            {
                m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
            }
            DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, SysNo, ref total);

            Repeater1.DataSource = m_dt;
            Repeater1.DataBind();
            Pager1.url         = AppConfig.HomeUrl() + "Quest/Question/" + SysNo + "/";
            Pager1.totalrecord = total;
            if (total % AppConst.PageSize == 0)
            {
                this.Pager1.total = total / pagesize;
            }
            else
            {
                this.Pager1.total = total / pagesize + 1;
            }
            this.Pager1.index    = pageindex;
            this.Pager1.numlenth = 3;
            if (IsPostBack)
            {
                UpdatePanel1.Update();
            }
        }
Exemple #2
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();
            }
        }
        /// <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();
            }
        }
        protected void Button5_Click(object sender, EventArgs e)
        {
            int score = 0;

            try
            {
                score = int.Parse(txtScore.Text.Trim());
            }
            catch
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addAward", "alert('您输入的积分数不正确,请重新输入!');", true);
                ModalPopupExtender1.Show();
            }
            QA_QuestionMod m_quest   = QA_QuestionBll.GetInstance().GetModel(SysNo);
            int            usedAward = QA_AnswerBll.GetInstance().GetUsedAward(SysNo);

            if (score > m_quest.Award - usedAward)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addAward", "alert('您输入的积分数不可超过" + (m_quest.Award - usedAward) + ",请重新输入!');", true);
                ModalPopupExtender1.Show();
                return;
            }

            try
            {
                QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(HiddenField1.Value));
                QA_AnswerBll.GetInstance().SetAward(m_answer, m_quest, score);
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addAward", "alert('悬赏分配成功!');", true);
            }
            catch
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addAward", "alert('系统故障,请联系管理员');", true);
            }
            BindList();
        }
Exemple #5
0
        /// <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();
            }
        }
Exemple #6
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();
            }
        }
Exemple #7
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);
            }
        }
Exemple #8
0
        public bool SetPaySucc(ORD_CashMod m_mod)
        {
            TransactionOptions options = new TransactionOptions();

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

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                m_mod.CurrentID = "";
                m_mod.PayTime   = DateTime.Now;
                m_mod.Status    = (int)AppEnum.CashOrderStatus.succed;
                ORD_CashBll.GetInstance().Update(m_mod);
                switch (m_mod.ProductType)
                {
                case (int)AppEnum.CashOrderType.consultpay:    //咨询订单
                    QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(m_mod.ProductSysNo);
                    m_order.Status = (int)AppEnum.ConsultOrderStatus.payed;
                    QA_OrderBll.GetInstance().Update(m_order);

                    //生成收款单
                    if (m_mod.ProductType == (int)AppEnum.CashOrderType.consultpay)
                    {
                        ORD_CashMod rec_order = new ORD_CashMod();
                        QA_OrderMod tmp_order = QA_OrderBll.GetInstance().GetModel(m_mod.ProductSysNo);
                        rec_order.CustomerSysNo = tmp_order.CustomerSysNo;
                        rec_order.CurrentID     = "";
                        rec_order.Discount      = 1 - AppConst.ConsultDiscount;

                        rec_order.PayAmount    = m_mod.Price * rec_order.Discount;
                        rec_order.PayType      = m_mod.PayType;
                        rec_order.Price        = m_mod.Price;
                        rec_order.ProductSysNo = m_mod.SysNo;
                        rec_order.Status       = (int)AppEnum.CashOrderStatus.confirming;
                        rec_order.ProductType  = (int)AppEnum.CashOrderType.consultget;
                        rec_order.TS           = DateTime.Now;

                        rec_order.OrderID = "C" + m_mod.ProductType.ToString("0") + DateTime.Now.ToString("yyyyMMdd") + m_mod.ProductSysNo + CommonTools.ThrowRandom(0, 99999).ToString("00000");
                        rec_order.SysNo   = ORD_CashBll.GetInstance().Add(rec_order);
                    }
                    //修改咨询购买数
                    QA_QuestionMod m_quest = new QA_QuestionMod();
                    m_quest = QA_QuestionBll.GetInstance().GetModel(m_order.QuestionSysNo);
                    m_quest.BuyCount++;
                    QA_QuestionBll.GetInstance().Update(m_quest);
                    break;
                }
                scope.Complete();
                return(true);
            }
        }
Exemple #9
0
        public ReturnValue <QA_QuestionShow <ZiWeiMod> > GetQuestionForZiWei(int sysno)
        {
            QA_QuestionMod             tmp = QA_QuestionBll.GetInstance().GetModel(sysno);
            QA_QuestionShow <ZiWeiMod> ret = new QA_QuestionShow <ZiWeiMod>();

            tmp.MemberwiseCopy(ret);

            USR_CustomerShow tmpu = new USR_CustomerShow();

            USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu);
            ret.Customer = tmpu;
            #region 设置命盘
            int[]         _paras  = { 1, 1, 0, 1 };
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo);
            if (m_chart != null)
            {
                ZiWeiMod m_ziwei = new ZiWeiMod();
                #region 设置实体各种参数
                //默认做太阳时修正
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_ziwei.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                     new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_ziwei.Gender      = (AppEnum.Gender) int.Parse(m_chart.FirstGender.ToString());
                m_ziwei.RunYue      = PublicValue.ZiWeiRunYue.dangxia;
                m_ziwei.TransitTime = new DateEntity(DateTime.Now);
                #endregion
                m_ziwei = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras);
                ret.Chart.Add(m_ziwei);

                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    ZiWeiMod m_ziwei1 = new ZiWeiMod();
                    #region 设置实体各种参数
                    tmplatlng          = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_ziwei1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                          new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_ziwei1.Gender      = (AppEnum.Gender) int.Parse(m_chart.SecondGender.ToString());
                    m_ziwei1.RunYue      = PublicValue.ZiWeiRunYue.dangxia;
                    m_ziwei1.TransitTime = new DateEntity(DateTime.Now);
                    #endregion
                    m_ziwei1 = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras);
                    ret.Chart.Add(m_ziwei1);
                }
            }
            #endregion
            return(ReturnValue <QA_QuestionShow <ZiWeiMod> > .Get200OK(ret));
        }
Exemple #10
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);
        }
Exemple #11
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Delete()
        {
            try
            {
                QA_QuestionMod m_famous = QA_QuestionBll.GetInstance().GetModel(int.Parse(Request.QueryString["delete"]));
                m_famous.DR = (int)AppEnum.State.deleted;
                QA_QuestionBll.GetInstance().Update(m_famous);

                ltrNotice.Text = "该记录已删除!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch
            {
                ltrError.Text = "系统错误,删除失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
            }
        }
Exemple #12
0
        public ReturnValue <QA_QuestionShow <BaZiMod> > GetQuestionForBaZi(int sysno)
        {
            QA_QuestionMod            tmp = QA_QuestionBll.GetInstance().GetModel(sysno);
            QA_QuestionShow <BaZiMod> ret = new QA_QuestionShow <BaZiMod>();

            tmp.MemberwiseCopy(ret);

            USR_CustomerShow tmpu = new USR_CustomerShow();

            USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu);
            ret.Customer = tmpu;
            #region 设置命盘
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo);
            if (m_chart != null)
            {
                BaZiMod  m_bazi    = new BaZiMod();
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                    new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_bazi.AreaName  = m_chart.FirstPoiName.ToString();
                m_bazi.Longitude = tmplatlng[0];
                m_bazi.Gender    = (AppEnum.Gender)m_chart.FirstGender;
                BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi);
                ret.Chart.Add(m_bazi);
                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    BaZiMod m_bazi1 = new BaZiMod();
                    tmplatlng         = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                         new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_bazi1.AreaName  = m_chart.SecondPoiName.ToString();
                    m_bazi1.Longitude = tmplatlng[0];
                    m_bazi1.Gender    = (AppEnum.Gender)m_chart.SecondGender;
                    BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1);
                    ret.Chart.Add(m_bazi1);
                }
            }
            #endregion
            return(ReturnValue <QA_QuestionShow <BaZiMod> > .Get200OK(ret));
        }
Exemple #13
0
        public ReturnValue <QA_QuestionShow <AstroMod> > GetQuestionForAstro(int sysno)
        {
            QA_QuestionMod             tmp = QA_QuestionBll.GetInstance().GetModel(sysno);
            QA_QuestionShow <AstroMod> ret = new QA_QuestionShow <AstroMod>();

            tmp.MemberwiseCopy(ret);

            USR_CustomerShow tmpu = new USR_CustomerShow();

            USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu);
            ret.Customer = tmpu;
            #region 设置星盘
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo);
            if (m_chart != null)
            {
                AstroMod tmpastro = new AstroMod();

                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.personal).ToString())
                {
                    #region 设置实体各种参数

                    tmpastro.type   = PublicValue.AstroType.benming;
                    tmpastro.birth  = DateTime.Parse(m_chart.FirstBirth.ToString());
                    tmpastro.Gender = (AppEnum.Gender)m_chart.FirstGender;
                    string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                    tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName);
                    if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString())
                    {
                        tmpastro.IsDayLight = AppEnum.BOOL.True;
                    }
                    else
                    {
                        tmpastro.IsDayLight = AppEnum.BOOL.False;
                    }
                    tmpastro.zone = int.Parse(m_chart.FirstTimeZone.ToString());

                    #endregion
                }
                else if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    #region 设置实体各种参数
                    tmpastro.type    = PublicValue.AstroType.hepan;
                    tmpastro.compose = PublicValue.AstroZuhe.bijiao;
                    tmpastro.Gender  = (AppEnum.Gender)m_chart.FirstGender;
                    tmpastro.Gender1 = (AppEnum.Gender)m_chart.SecondGender;
                    tmpastro.birth   = DateTime.Parse(m_chart.FirstBirth.ToString());
                    string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                    tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName);
                    if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString())
                    {
                        tmpastro.IsDayLight = AppEnum.BOOL.True;
                    }
                    else
                    {
                        tmpastro.IsDayLight = AppEnum.BOOL.False;
                    }
                    tmpastro.zone      = int.Parse(m_chart.FirstTimeZone.ToString());
                    tmpastro.birth1    = DateTime.Parse(m_chart.SecondBirth.ToString());
                    tmplatlng          = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    tmpastro.position1 = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName);
                    if (m_chart.SecondDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString())
                    {
                        tmpastro.IsDayLight1 = AppEnum.BOOL.True;
                    }
                    else
                    {
                        tmpastro.IsDayLight1 = AppEnum.BOOL.False;
                    }
                    tmpastro.zone1 = int.Parse(m_chart.SecondTimeZone.ToString());

                    #endregion
                }
                tmpastro.startsShow.Clear();
                for (int i = 1; i <= 30; i++)
                {
                    tmpastro.startsShow.Add(i, PublicValue.GetAstroStar((PublicValue.AstroStar)i));
                }
                tmpastro.aspectsShow.Clear();
                tmpastro.aspectsShow.Add(1, 0);
                tmpastro.aspectsShow.Add(2, 180);
                tmpastro.aspectsShow.Add(4, 120);
                tmpastro.aspectsShow.Add(3, 90);
                tmpastro.aspectsShow.Add(5, 60);
                tmpastro.graphicID = AstroBiz.GetInstance().SetGraphicID(tmpastro);
                if ((tmpastro.type == PublicValue.AstroType.hepan && tmpastro.compose == PublicValue.AstroZuhe.bijiao) || (tmpastro.type == PublicValue.AstroType.tuiyun && tmpastro.transit == PublicValue.AstroTuiyun.xingyun))
                {
                    AstroMod tmpinput = new AstroMod();
                    tmpinput.aspectsShow = tmpastro.aspectsShow;
                    tmpinput.startsShow  = tmpastro.startsShow;
                    tmpinput.birth       = tmpastro.birth;
                    tmpinput.position    = tmpastro.position;
                    tmpinput.IsDayLight  = tmpastro.IsDayLight;
                    tmpinput.zone        = tmpastro.zone;
                    AstroBiz.GetInstance().GetParamters(ref tmpinput);
                    tmpastro.Stars = tmpinput.Stars;

                    tmpinput             = new AstroMod();
                    tmpinput.aspectsShow = tmpastro.aspectsShow;
                    tmpinput.startsShow  = tmpastro.startsShow;
                    tmpinput.birth       = tmpastro.birth1;
                    tmpinput.position    = tmpastro.position1;
                    tmpinput.IsDayLight  = tmpastro.IsDayLight1;
                    tmpinput.zone        = tmpastro.zone1;
                    AstroBiz.GetInstance().GetParamters(ref tmpinput);
                    tmpastro.Stars1 = tmpinput.Stars;
                }
                else
                {
                    AstroBiz.GetInstance().GetParamters(ref tmpastro);
                    tmpastro.Stars1 = null;
                }
                ret.Chart.Add(tmpastro);
            }
            #endregion
            return(ReturnValue <QA_QuestionShow <AstroMod> > .Get200OK(ret));
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public QA_QuestionMod GetModel(int SysNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select SysNo, CateSysNo, CustomerSysNo, Title, Context, Award, EndTime, IsSecret, LastReplyTime, LastReplyUser, ReplyCount, ReadCount, DR, TS, SubQuest, OrderCount, BuyCount from dbo.QA_Question");
            strSql.Append(" where SysNo=@SysNo");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo", SqlDbType.Int, 4)
            };
            parameters[0].Value = SysNo;
            QA_QuestionMod model = new QA_QuestionMod();
            DataSet        ds    = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
                {
                    model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CateSysNo"].ToString() != "")
                {
                    model.CateSysNo = int.Parse(ds.Tables[0].Rows[0]["CateSysNo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "")
                {
                    model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString());
                }
                model.Title   = ds.Tables[0].Rows[0]["Title"].ToString();
                model.Context = ds.Tables[0].Rows[0]["Context"].ToString();
                if (ds.Tables[0].Rows[0]["Award"].ToString() != "")
                {
                    model.Award = int.Parse(ds.Tables[0].Rows[0]["Award"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EndTime"].ToString() != "")
                {
                    model.EndTime = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsSecret"].ToString() != "")
                {
                    model.IsSecret = int.Parse(ds.Tables[0].Rows[0]["IsSecret"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LastReplyTime"].ToString() != "")
                {
                    model.LastReplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastReplyTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LastReplyUser"].ToString() != "")
                {
                    model.LastReplyUser = int.Parse(ds.Tables[0].Rows[0]["LastReplyUser"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ReplyCount"].ToString() != "")
                {
                    model.ReplyCount = int.Parse(ds.Tables[0].Rows[0]["ReplyCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ReadCount"].ToString() != "")
                {
                    model.ReadCount = int.Parse(ds.Tables[0].Rows[0]["ReadCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
                {
                    model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
                {
                    model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
                }
                model.SubQuest = ds.Tables[0].Rows[0]["SubQuest"].ToString();
                if (ds.Tables[0].Rows[0]["OrderCount"].ToString() != "")
                {
                    model.OrderCount = int.Parse(ds.Tables[0].Rows[0]["OrderCount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BuyCount"].ToString() != "")
                {
                    model.BuyCount = int.Parse(ds.Tables[0].Rows[0]["BuyCount"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #15
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            Login(Request.Url.ToString());
            #region 判断输入项
            if (drpCate.SelectedIndex == 0)
            {
                CateTip.InnerHtml           = "请选择分类";
                CateTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim() == "")
            {
                TitleTip.InnerHtml           = "请输入标题";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim().Length > 200)
            {
                TitleTip.InnerHtml           = "您输入的标题太长,请控制在200字以内";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }

            #endregion

            try
            {
                QA_QuestionMod m_quest = new QA_QuestionMod();
                m_quest.Award         = 0;
                m_quest.CateSysNo     = int.Parse(drpCate.SelectedValue);
                m_quest.Context       = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(txtContext.Text.Trim()));
                m_quest.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                m_quest.LastReplyTime = DateTime.Now;
                m_quest.ReplyCount    = 0;
                m_quest.ReadCount     = 0;
                m_quest.BuyCount      = 0;
                m_quest.OrderCount    = 0;
                m_quest.Title         = AppCmn.CommonTools.SystemInputFilter(txtTitle.Text.Trim());
                m_quest.TS            = DateTime.Now;
                m_quest.DR            = (int)AppEnum.State.normal;

                int sysno = 0;

                QA_QuestionBll.GetInstance().AddQuest(ref m_quest, false);
                sysno = m_quest.SysNo;
                RefreshSession();

                FATE_ChartMod m_chart = new FATE_ChartMod();
                m_chart.CharType = int.Parse(drpType.SelectedValue);
                if (m_chart.CharType != (int)AppEnum.ChartType.nochart)
                {
                    m_chart.FirstBirth    = DatePicker1.SelectedTime;
                    m_chart.FirstPoi      = District1.lng + "|" + District1.lat;
                    m_chart.Transit       = DateTime.Now;
                    m_chart.TransitPoi    = m_chart.FirstPoi;
                    m_chart.TheoryType    = 0;
                    m_chart.FirstPoiName  = District1.Area1Name + "-" + District1.Area2Name + "-" + District1.Area3Name;
                    m_chart.FirstTimeZone = -8;
                    m_chart.FirstGender   = int.Parse(drpGender1.SelectedValue);
                    if (chkDaylight1.Checked)
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.True;
                    }
                    else
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.False;
                    }
                    if (m_chart.CharType == (int)AppEnum.ChartType.relation)
                    {
                        m_chart.SecondBirth    = DatePicker2.SelectedTime;
                        m_chart.SecondPoi      = District2.lng + "|" + District2.lat;
                        m_chart.SecondPoiName  = District2.Area1Name + "-" + District2.Area2Name + "-" + District2.Area3Name;
                        m_chart.SecondTimeZone = -8;
                        m_chart.SecondGender   = int.Parse(drpGender2.SelectedValue);
                        if (chkDaylight2.Checked)
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.True;
                        }
                        else
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.False;
                        }
                    }
                    m_chart.TS = DateTime.Now;
                    m_chart.DR = (int)AppEnum.State.normal;
                    int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart);

                    REL_Question_ChartMod m_qchart = new REL_Question_ChartMod();
                    m_qchart.Chart_SysNo    = fatesysno;
                    m_qchart.Question_SysNo = sysno;
                    REL_Question_ChartBll.GetInstance().Add(m_qchart);
                }



                LogManagement.getInstance().WriteTrace("前台话题", "Ask", "IP:" + Request.UserHostAddress + "|UID:" + GetSession().CustomerEntity.Email);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('话题发布成功!');", true);
                Response.Redirect(AppConfig.HomeUrl() + "Quest/Topic/" + sysno, false);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "QA-Add", Request.UserHostAddress, "发布话题失败");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('系统故障,请联系管理员!');", true);
            }
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            Login(Request.Url.ToString());
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null && Page.RouteData.Values["id"].ToString() != "")
            {
                try
                {
                    SysNo = int.Parse(Page.RouteData.Values["id"].ToString());
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                if (Request.QueryString["order"] != null)
                {
                    try
                    {
                        order = int.Parse(Request.QueryString["order"]);
                        old_order = QA_OrderBll.GetInstance().GetModel(order);
                        SysNo = old_order.QuestionSysNo;
                        m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                        //DataBind();
                    }
                    catch
                    {
                        ShowError("");
                    }
                }
                else if (Page.RouteData.Values["order"] != null && Page.RouteData.Values["order"].ToString() != "")
                {
                    try
                    {
                        order = int.Parse(Page.RouteData.Values["order"].ToString());
                        old_order = QA_OrderBll.GetInstance().GetModel(order);
                        SysNo = old_order.QuestionSysNo;
                        m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                        //DataBind();
                    }
                    catch
                    {
                        ShowError("");
                    }
                }
                else
                {
                    ShowError("");
                }
            }

            if (m_qustion.CateSysNo != 17)//不是付费咨询则弹出
            {
                ShowError("");
            }

            if (!IsPostBack)
            {
                BindData();
            }

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "SetDocument", "SetDocument();", true);
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    SysNo     = int.Parse(Request.QueryString["id"]);
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null && Page.RouteData.Values["id"].ToString() != "")
            {
                try
                {
                    SysNo     = int.Parse(Page.RouteData.Values["id"].ToString());
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                ShowError("");
            }

            if (m_qustion.CateSysNo != 17)//不是付费咨询则弹出
            {
                ShowError("");
            }

            if (Request.QueryString["pn"] != null)
            {
                try
                {
                    pageindex = int.Parse(Request.QueryString["pn"]);
                }
                catch
                { }
            }
            else if (Page.RouteData.Values["pn"] != null && Page.RouteData.Values["pn"].ToString() != "")
            {
                try
                {
                    pageindex = int.Parse(Page.RouteData.Values["pn"].ToString());
                }
                catch
                {
                    ShowError("");
                }
            }
            if (!IsPostBack)
            {
                BindData();
            }
            #region 登录状态判断
            if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull)
            {
                nologin.Style["display"] = "";
                txtReply2.Enabled        = false;
                Button3.Style["display"] = "none";
                IsLogined.Value          = "FALSE";
                Image2.ImageUrl          = AppConfig.WebResourcesPath() + "Images/tx_03.jpg";
            }
            else
            {
                nologin.Style["display"] = "none";
                txtReply2.Enabled        = true;
                Button3.Style["display"] = "";
                Image2.ImageUrl          = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + GetSession().CustomerEntity.Photo;
                IsLogined.Value          = "TRUE";
            }
            #endregion
            Right1.showsearch = false;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SetDocument", "SetDocument();", true);
            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "SetDocument", "SetDocument();", true);
        }
Exemple #18
0
        protected void BindList()
        {
            DataTable tmpdt = QA_AnswerBll.GetInstance().GetSimpleListByQuest(SysNo);
            tmpdt.Columns.Add("isorder");
            #region 绑定报价列表
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                myprice.Visible = false;
            }

            DataTable m_dt1 = QA_OrderBll.GetInstance().GetListByQuest(SysNo);
            m_dt1.Columns.Add("color");
            m_dt1.Columns.Add("floor");
            for (int i = 0; i < m_dt1.Rows.Count; i++)
            {
                switch (int.Parse(m_dt1.Rows[i]["status"].ToString()))
                {
                    case 1:
                        m_dt1.Rows[i]["color"] = "#000";
                        break;
                    case 2:
                    case 3:
                    case 4:
                        m_dt1.Rows[i]["color"] = "#008c03";
                        break;
                    case 0:
                    case 5:
                        m_dt1.Rows[i]["color"] = "#f00";
                        break;
                }
                //若已有报价单且未购买则不允许发布第二个价单
                if (m_dt1.Rows[i]["CustomerSysNo"].ToString() == GetSession().CustomerEntity.SysNo.ToString() && int.Parse(m_dt1.Rows[i]["status"].ToString()) == 1)
                {
                    myprice.Visible = false;
                }
                #region 设置锚点
                for (int j = 0; j < tmpdt.Rows.Count; j++)
                {
                    if (tmpdt.Rows[j]["SysNo"].ToString() == m_dt1.Rows[i]["answersysno"].ToString())
                    {
                        if (j >= pagesize)
                        {
                            Regex r = new Regex(@"pn\d+?&");
                            m_dt1.Rows[i]["floor"] = r.Replace(Request.Url.ToString(),"") + "&pn="+j/pageindex + "#f" + (j%pageindex).ToString();
                        }
                        else
                        {
                            m_dt1.Rows[i]["floor"] = "#f" + j.ToString();
                        }
                        tmpdt.Rows[j]["isorder"] = "1";
                        break;
                    }
                }
                #endregion
            }

            Repeater2.DataSource = m_dt1;
            Repeater2.DataBind();

            #endregion
            #region 绑定回答列表
            int total = 0;
            if (m_qustion.CustomerSysNo == AppConst.IntNull)
            {
                m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
            }
            DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuestForConsult(pagesize, pageindex, SysNo, ref total);
            m_dt.Columns.Add("hide");
            //m_dt.Columns.Add("hide1");
            //m_dt.Columns.Add("orderlink");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo || GetSession().CustomerEntity.SysNo == int.Parse(m_dt.Rows[i]["CustomerSysNo"].ToString()))
                {
                    m_dt.Rows[i]["hide"] = "display:none;";
                }
                else
                {
                    m_dt.Rows[i]["trial"] = "";
                    m_dt.Rows[i]["Context"] = "";
                    m_dt.Rows[i]["hide"] = "";
                }

            }
            Repeater1.DataSource = m_dt;
            Repeater1.DataBind();
            Pager1.url = AppConfig.HomeUrl() + "Quest/Consult/" + SysNo + "/";
            Pager1.totalrecord = total;
            if (total % AppConst.PageSize == 0)
            {
                this.Pager1.total = total / pagesize;
            }
            else
            {
                this.Pager1.total = total / pagesize + 1;
            }
            this.Pager1.index = pageindex;
            this.Pager1.numlenth = 3;
            if (IsPostBack)
            {
                UpdatePanel1.Update();
            }
            #endregion
        }
Exemple #19
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            Login(Request.Url.ToString());
            #region 判断输入项
            if (drpCate.SelectedIndex == 0)
            {
                CateTip.InnerHtml = "请选择分类";
                CateTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim() == "")
            {
                TitleTip.InnerHtml = "请输入标题";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim().Length > 200)
            {
                TitleTip.InnerHtml = "您输入的标题太长,请控制在200字以内";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }

            #endregion

            try
            {
                QA_QuestionMod m_quest = new QA_QuestionMod();
                m_quest.Award = 0;
                m_quest.CateSysNo = int.Parse(drpCate.SelectedValue);
                m_quest.Context = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(txtContext.Text.Trim()));
                m_quest.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                m_quest.LastReplyTime = DateTime.Now;
                m_quest.ReplyCount = 0;
                m_quest.ReadCount = 0;
                m_quest.BuyCount = 0;
                m_quest.OrderCount = 0;
                m_quest.Title = AppCmn.CommonTools.SystemInputFilter(txtTitle.Text.Trim());
                m_quest.TS = DateTime.Now;
                m_quest.DR = (int)AppEnum.State.normal;

                int sysno = 0;

                QA_QuestionBll.GetInstance().AddQuest(ref m_quest,false);
                sysno = m_quest.SysNo;
                RefreshSession();

                FATE_ChartMod m_chart = new FATE_ChartMod();
                m_chart.CharType = int.Parse(drpType.SelectedValue);
                if (m_chart.CharType != (int)AppEnum.ChartType.nochart)
                {
                    m_chart.FirstBirth = DatePicker1.SelectedTime;
                    m_chart.FirstPoi = District1.lng + "|" + District1.lat;
                    m_chart.Transit = DateTime.Now;
                    m_chart.TransitPoi = m_chart.FirstPoi;
                    m_chart.TheoryType = 0;
                    m_chart.FirstPoiName = District1.Area1Name + "-" + District1.Area2Name + "-" + District1.Area3Name;
                    m_chart.FirstTimeZone = -8;
                    m_chart.FirstGender = int.Parse(drpGender1.SelectedValue);
                    if (chkDaylight1.Checked)
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.True;
                    }
                    else
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.False;
                    }
                    if (m_chart.CharType == (int)AppEnum.ChartType.relation)
                    {
                        m_chart.SecondBirth = DatePicker2.SelectedTime;
                        m_chart.SecondPoi = District2.lng + "|" + District2.lat;
                        m_chart.SecondPoiName = District2.Area1Name + "-" + District2.Area2Name + "-" + District2.Area3Name;
                        m_chart.SecondTimeZone = -8;
                        m_chart.SecondGender = int.Parse(drpGender2.SelectedValue);
                        if (chkDaylight2.Checked)
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.True;
                        }
                        else
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.False;
                        }
                    }
                    m_chart.TS = DateTime.Now;
                    m_chart.DR = (int)AppEnum.State.normal;
                    int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart);

                    REL_Question_ChartMod m_qchart = new REL_Question_ChartMod();
                    m_qchart.Chart_SysNo = fatesysno;
                    m_qchart.Question_SysNo = sysno;
                    REL_Question_ChartBll.GetInstance().Add(m_qchart);
                }

                LogManagement.getInstance().WriteTrace("前台话题", "Ask", "IP:" + Request.UserHostAddress + "|UID:" + GetSession().CustomerEntity.Email);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('话题发布成功!');", true);
                Response.Redirect(AppConfig.HomeUrl()+"Quest/Topic/" + sysno,false);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "QA-Add", Request.UserHostAddress, "发布话题失败");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('系统故障,请联系管理员!');", true);
            }
        }
Exemple #20
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(QA_QuestionMod model)
 {
     dal.Add(model);
 }
 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();
     }
 }
Exemple #22
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(QA_QuestionMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("insert into QA_Question(");
     strSql.Append("SysNo,CateSysNo,CustomerSysNo,Title,Context,Award,EndTime,IsSecret,LastReplyTime,LastReplyUser,ReplyCount,ReadCount,DR,TS,SubQuest,OrderCount,BuyCount)");
     strSql.Append(" values (");
     strSql.Append("@SysNo,@CateSysNo,@CustomerSysNo,@Title,@Context,@Award,@EndTime,@IsSecret,@LastReplyTime,@LastReplyUser,@ReplyCount,@ReadCount,@DR,@TS,@SubQuest,@OrderCount,@BuyCount)");
     SqlCommand cmd = new SqlCommand(strSql.ToString());
     SqlParameter[] parameters = {
          new SqlParameter("@SysNo",SqlDbType.Int,4),
          new SqlParameter("@CateSysNo",SqlDbType.Int,4),
          new SqlParameter("@CustomerSysNo",SqlDbType.Int,4),
          new SqlParameter("@Title",SqlDbType.NVarChar,600),
          new SqlParameter("@Context",SqlDbType.Text,2147483647),
          new SqlParameter("@Award",SqlDbType.Int,4),
          new SqlParameter("@EndTime",SqlDbType.DateTime),
          new SqlParameter("@IsSecret",SqlDbType.TinyInt,1),
          new SqlParameter("@LastReplyTime",SqlDbType.DateTime),
          new SqlParameter("@LastReplyUser",SqlDbType.Int,4),
          new SqlParameter("@ReplyCount",SqlDbType.Int,4),
          new SqlParameter("@ReadCount",SqlDbType.Int,4),
          new SqlParameter("@DR",SqlDbType.TinyInt,1),
          new SqlParameter("@TS",SqlDbType.DateTime),
          new SqlParameter("@SubQuest",SqlDbType.NVarChar,1000),
          new SqlParameter("@OrderCount",SqlDbType.Int,4),
          new SqlParameter("@BuyCount",SqlDbType.Int,4)
      };
     if (model.SysNo != AppConst.IntNull)
         parameters[0].Value = model.SysNo;
     else
         parameters[0].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[0]);
     if (model.CateSysNo != AppConst.IntNull)
         parameters[1].Value = model.CateSysNo;
     else
         parameters[1].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[1]);
     if (model.CustomerSysNo != AppConst.IntNull)
         parameters[2].Value = model.CustomerSysNo;
     else
         parameters[2].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[2]);
     if (model.Title != AppConst.StringNull)
         parameters[3].Value = model.Title;
     else
         parameters[3].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[3]);
     if (model.Context != AppConst.StringNull)
         parameters[4].Value = model.Context;
     else
         parameters[4].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[4]);
     if (model.Award != AppConst.IntNull)
         parameters[5].Value = model.Award;
     else
         parameters[5].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[5]);
     if (model.EndTime != AppConst.DateTimeNull)
         parameters[6].Value = model.EndTime;
     else
         parameters[6].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[6]);
     if (model.IsSecret != AppConst.IntNull)
         parameters[7].Value = model.IsSecret;
     else
         parameters[7].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[7]);
     if (model.LastReplyTime != AppConst.DateTimeNull)
         parameters[8].Value = model.LastReplyTime;
     else
         parameters[8].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[8]);
     if (model.LastReplyUser != AppConst.IntNull)
         parameters[9].Value = model.LastReplyUser;
     else
         parameters[9].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[9]);
     if (model.ReplyCount != AppConst.IntNull)
         parameters[10].Value = model.ReplyCount;
     else
         parameters[10].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[10]);
     if (model.ReadCount != AppConst.IntNull)
         parameters[11].Value = model.ReadCount;
     else
         parameters[11].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[11]);
     if (model.DR != AppConst.IntNull)
         parameters[12].Value = model.DR;
     else
         parameters[12].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[12]);
     if (model.TS != AppConst.DateTimeNull)
         parameters[13].Value = model.TS;
     else
         parameters[13].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[13]);
     if (model.SubQuest != AppConst.StringNull)
         parameters[14].Value = model.SubQuest;
     else
         parameters[14].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[14]);
     if (model.OrderCount != AppConst.IntNull)
         parameters[15].Value = model.OrderCount;
     else
         parameters[15].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[15]);
     if (model.BuyCount != AppConst.IntNull)
         parameters[16].Value = model.BuyCount;
     else
         parameters[16].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[16]);
     SqlHelper.ExecuteNonQuery(cmd, parameters);
 }
Exemple #23
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(QA_QuestionMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update QA_Question set ");
     SqlCommand cmd = new SqlCommand();
     if (model.SysNo != AppConst.IntNull)
     {
         strSql.Append("SysNo=@SysNo,");
         SqlParameter param = new SqlParameter("@SysNo", SqlDbType.Int, 4);
         param.Value = model.SysNo;
         cmd.Parameters.Add(param);
     }
     if (model.CateSysNo != AppConst.IntNull)
     {
         strSql.Append("CateSysNo=@CateSysNo,");
         SqlParameter param = new SqlParameter("@CateSysNo", SqlDbType.Int, 4);
         param.Value = model.CateSysNo;
         cmd.Parameters.Add(param);
     }
     if (model.CustomerSysNo != AppConst.IntNull)
     {
         strSql.Append("CustomerSysNo=@CustomerSysNo,");
         SqlParameter param = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4);
         param.Value = model.CustomerSysNo;
         cmd.Parameters.Add(param);
     }
     if (model.Title != AppConst.StringNull)
     {
         strSql.Append("Title=@Title,");
         SqlParameter param = new SqlParameter("@Title", SqlDbType.NVarChar, 600);
         param.Value = model.Title;
         cmd.Parameters.Add(param);
     }
     if (model.Context != AppConst.StringNull)
     {
         strSql.Append("Context=@Context,");
         SqlParameter param = new SqlParameter("@Context", SqlDbType.Text, 2147483647);
         param.Value = model.Context;
         cmd.Parameters.Add(param);
     }
     if (model.Award != AppConst.IntNull)
     {
         strSql.Append("Award=@Award,");
         SqlParameter param = new SqlParameter("@Award", SqlDbType.Int, 4);
         param.Value = model.Award;
         cmd.Parameters.Add(param);
     }
     if (model.EndTime != AppConst.DateTimeNull)
     {
         strSql.Append("EndTime=@EndTime,");
         SqlParameter param = new SqlParameter("@EndTime", SqlDbType.DateTime);
         param.Value = model.EndTime;
         cmd.Parameters.Add(param);
     }
     if (model.IsSecret != AppConst.IntNull)
     {
         strSql.Append("IsSecret=@IsSecret,");
         SqlParameter param = new SqlParameter("@IsSecret", SqlDbType.TinyInt, 1);
         param.Value = model.IsSecret;
         cmd.Parameters.Add(param);
     }
     if (model.LastReplyTime != AppConst.DateTimeNull)
     {
         strSql.Append("LastReplyTime=@LastReplyTime,");
         SqlParameter param = new SqlParameter("@LastReplyTime", SqlDbType.DateTime);
         param.Value = model.LastReplyTime;
         cmd.Parameters.Add(param);
     }
     if (model.LastReplyUser != AppConst.IntNull)
     {
         strSql.Append("LastReplyUser=@LastReplyUser,");
         SqlParameter param = new SqlParameter("@LastReplyUser", SqlDbType.Int, 4);
         param.Value = model.LastReplyUser;
         cmd.Parameters.Add(param);
     }
     if (model.ReplyCount != AppConst.IntNull)
     {
         strSql.Append("ReplyCount=@ReplyCount,");
         SqlParameter param = new SqlParameter("@ReplyCount", SqlDbType.Int, 4);
         param.Value = model.ReplyCount;
         cmd.Parameters.Add(param);
     }
     if (model.ReadCount != AppConst.IntNull)
     {
         strSql.Append("ReadCount=@ReadCount,");
         SqlParameter param = new SqlParameter("@ReadCount", SqlDbType.Int, 4);
         param.Value = model.ReadCount;
         cmd.Parameters.Add(param);
     }
     if (model.DR != AppConst.IntNull)
     {
         strSql.Append("DR=@DR,");
         SqlParameter param = new SqlParameter("@DR", SqlDbType.TinyInt, 1);
         param.Value = model.DR;
         cmd.Parameters.Add(param);
     }
     if (model.TS != AppConst.DateTimeNull)
     {
         strSql.Append("TS=@TS,");
         SqlParameter param = new SqlParameter("@TS", SqlDbType.DateTime);
         param.Value = model.TS;
         cmd.Parameters.Add(param);
     }
     if (model.SubQuest != AppConst.StringNull)
     {
         strSql.Append("SubQuest=@SubQuest,");
         SqlParameter param = new SqlParameter("@SubQuest", SqlDbType.NVarChar, 1000);
         param.Value = model.SubQuest;
         cmd.Parameters.Add(param);
     }
     if (model.OrderCount != AppConst.IntNull)
     {
         strSql.Append("OrderCount=@OrderCount,");
         SqlParameter param = new SqlParameter("@OrderCount", SqlDbType.Int, 4);
         param.Value = model.OrderCount;
         cmd.Parameters.Add(param);
     }
     if (model.BuyCount != AppConst.IntNull)
     {
         strSql.Append("BuyCount=@BuyCount,");
         SqlParameter param = new SqlParameter("@BuyCount", SqlDbType.Int, 4);
         param.Value = model.BuyCount;
         cmd.Parameters.Add(param);
     }
     strSql.Remove(strSql.Length - 1, 1);
     strSql.Append(" where SysNo=@SysNo ");
     cmd.CommandText = strSql.ToString();
     return SqlHelper.ExecuteNonQuery(cmd, null);
 }
Exemple #24
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public QA_QuestionMod GetModel(int SysNo)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select SysNo, CateSysNo, CustomerSysNo, Title, Context, Award, EndTime, IsSecret, LastReplyTime, LastReplyUser, ReplyCount, ReadCount, DR, TS, SubQuest, OrderCount, BuyCount from dbo.QA_Question");
     strSql.Append(" where SysNo=@SysNo");
     SqlParameter[] parameters = {
       new SqlParameter("@SysNo", SqlDbType.Int,4 )
      		};
     parameters[0].Value = SysNo;
     QA_QuestionMod model = new QA_QuestionMod();
     DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
         {
             model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
         }
         if (ds.Tables[0].Rows[0]["CateSysNo"].ToString() != "")
         {
             model.CateSysNo = int.Parse(ds.Tables[0].Rows[0]["CateSysNo"].ToString());
         }
         if (ds.Tables[0].Rows[0]["CustomerSysNo"].ToString() != "")
         {
             model.CustomerSysNo = int.Parse(ds.Tables[0].Rows[0]["CustomerSysNo"].ToString());
         }
         model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
         model.Context = ds.Tables[0].Rows[0]["Context"].ToString();
         if (ds.Tables[0].Rows[0]["Award"].ToString() != "")
         {
             model.Award = int.Parse(ds.Tables[0].Rows[0]["Award"].ToString());
         }
         if (ds.Tables[0].Rows[0]["EndTime"].ToString() != "")
         {
             model.EndTime = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["IsSecret"].ToString() != "")
         {
             model.IsSecret = int.Parse(ds.Tables[0].Rows[0]["IsSecret"].ToString());
         }
         if (ds.Tables[0].Rows[0]["LastReplyTime"].ToString() != "")
         {
             model.LastReplyTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastReplyTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["LastReplyUser"].ToString() != "")
         {
             model.LastReplyUser = int.Parse(ds.Tables[0].Rows[0]["LastReplyUser"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ReplyCount"].ToString() != "")
         {
             model.ReplyCount = int.Parse(ds.Tables[0].Rows[0]["ReplyCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["ReadCount"].ToString() != "")
         {
             model.ReadCount = int.Parse(ds.Tables[0].Rows[0]["ReadCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
         {
             model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
         {
             model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
         }
         model.SubQuest = ds.Tables[0].Rows[0]["SubQuest"].ToString();
         if (ds.Tables[0].Rows[0]["OrderCount"].ToString() != "")
         {
             model.OrderCount = int.Parse(ds.Tables[0].Rows[0]["OrderCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["BuyCount"].ToString() != "")
         {
             model.BuyCount = int.Parse(ds.Tables[0].Rows[0]["BuyCount"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(QA_QuestionMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update QA_Question set ");
            SqlCommand cmd = new SqlCommand();

            if (model.SysNo != AppConst.IntNull)
            {
                strSql.Append("SysNo=@SysNo,");
                SqlParameter param = new SqlParameter("@SysNo", SqlDbType.Int, 4);
                param.Value = model.SysNo;
                cmd.Parameters.Add(param);
            }
            if (model.CateSysNo != AppConst.IntNull)
            {
                strSql.Append("CateSysNo=@CateSysNo,");
                SqlParameter param = new SqlParameter("@CateSysNo", SqlDbType.Int, 4);
                param.Value = model.CateSysNo;
                cmd.Parameters.Add(param);
            }
            if (model.CustomerSysNo != AppConst.IntNull)
            {
                strSql.Append("CustomerSysNo=@CustomerSysNo,");
                SqlParameter param = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4);
                param.Value = model.CustomerSysNo;
                cmd.Parameters.Add(param);
            }
            if (model.Title != AppConst.StringNull)
            {
                strSql.Append("Title=@Title,");
                SqlParameter param = new SqlParameter("@Title", SqlDbType.NVarChar, 600);
                param.Value = model.Title;
                cmd.Parameters.Add(param);
            }
            if (model.Context != AppConst.StringNull)
            {
                strSql.Append("Context=@Context,");
                SqlParameter param = new SqlParameter("@Context", SqlDbType.Text, 2147483647);
                param.Value = model.Context;
                cmd.Parameters.Add(param);
            }
            if (model.Award != AppConst.IntNull)
            {
                strSql.Append("Award=@Award,");
                SqlParameter param = new SqlParameter("@Award", SqlDbType.Int, 4);
                param.Value = model.Award;
                cmd.Parameters.Add(param);
            }
            if (model.EndTime != AppConst.DateTimeNull)
            {
                strSql.Append("EndTime=@EndTime,");
                SqlParameter param = new SqlParameter("@EndTime", SqlDbType.DateTime);
                param.Value = model.EndTime;
                cmd.Parameters.Add(param);
            }
            if (model.IsSecret != AppConst.IntNull)
            {
                strSql.Append("IsSecret=@IsSecret,");
                SqlParameter param = new SqlParameter("@IsSecret", SqlDbType.TinyInt, 1);
                param.Value = model.IsSecret;
                cmd.Parameters.Add(param);
            }
            if (model.LastReplyTime != AppConst.DateTimeNull)
            {
                strSql.Append("LastReplyTime=@LastReplyTime,");
                SqlParameter param = new SqlParameter("@LastReplyTime", SqlDbType.DateTime);
                param.Value = model.LastReplyTime;
                cmd.Parameters.Add(param);
            }
            if (model.LastReplyUser != AppConst.IntNull)
            {
                strSql.Append("LastReplyUser=@LastReplyUser,");
                SqlParameter param = new SqlParameter("@LastReplyUser", SqlDbType.Int, 4);
                param.Value = model.LastReplyUser;
                cmd.Parameters.Add(param);
            }
            if (model.ReplyCount != AppConst.IntNull)
            {
                strSql.Append("ReplyCount=@ReplyCount,");
                SqlParameter param = new SqlParameter("@ReplyCount", SqlDbType.Int, 4);
                param.Value = model.ReplyCount;
                cmd.Parameters.Add(param);
            }
            if (model.ReadCount != AppConst.IntNull)
            {
                strSql.Append("ReadCount=@ReadCount,");
                SqlParameter param = new SqlParameter("@ReadCount", SqlDbType.Int, 4);
                param.Value = model.ReadCount;
                cmd.Parameters.Add(param);
            }
            if (model.DR != AppConst.IntNull)
            {
                strSql.Append("DR=@DR,");
                SqlParameter param = new SqlParameter("@DR", SqlDbType.TinyInt, 1);
                param.Value = model.DR;
                cmd.Parameters.Add(param);
            }
            if (model.TS != AppConst.DateTimeNull)
            {
                strSql.Append("TS=@TS,");
                SqlParameter param = new SqlParameter("@TS", SqlDbType.DateTime);
                param.Value = model.TS;
                cmd.Parameters.Add(param);
            }
            if (model.SubQuest != AppConst.StringNull)
            {
                strSql.Append("SubQuest=@SubQuest,");
                SqlParameter param = new SqlParameter("@SubQuest", SqlDbType.NVarChar, 1000);
                param.Value = model.SubQuest;
                cmd.Parameters.Add(param);
            }
            if (model.OrderCount != AppConst.IntNull)
            {
                strSql.Append("OrderCount=@OrderCount,");
                SqlParameter param = new SqlParameter("@OrderCount", SqlDbType.Int, 4);
                param.Value = model.OrderCount;
                cmd.Parameters.Add(param);
            }
            if (model.BuyCount != AppConst.IntNull)
            {
                strSql.Append("BuyCount=@BuyCount,");
                SqlParameter param = new SqlParameter("@BuyCount", SqlDbType.Int, 4);
                param.Value = model.BuyCount;
                cmd.Parameters.Add(param);
            }
            strSql.Remove(strSql.Length - 1, 1);
            strSql.Append(" where SysNo=@SysNo ");
            cmd.CommandText = strSql.ToString();
            return(SqlHelper.ExecuteNonQuery(cmd, null));
        }
Exemple #26
0
 protected void BindList()
 {
     int total = 0;
     if (m_qustion.CustomerSysNo == AppConst.IntNull)
     {
         m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
     }
     DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, SysNo, ref total);
     Repeater1.DataSource = m_dt;
     Repeater1.DataBind();
     Pager1.url = AppConfig.HomeUrl()+"Quest/Question/" + SysNo + "/";
     Pager1.totalrecord = total;
     if (total % AppConst.PageSize == 0)
     {
         this.Pager1.total = total / pagesize;
     }
     else
     {
         this.Pager1.total = total / pagesize + 1;
     }
     this.Pager1.index = pageindex;
     this.Pager1.numlenth = 3;
     if (IsPostBack)
     {
         UpdatePanel1.Update();
     }
 }
Exemple #27
0
        public ReturnValue <USR_CustomerShow> AddQuestionWithChart(Stream openPageData)
        {
            QA_QuestionInput <FATE_ChartMod> input;
            //try
            //{
            int          nReadCount = 0;
            MemoryStream ms         = new MemoryStream();

            byte[] buffer = new byte[1024];
            while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0)
            {
                ms.Write(buffer, 0, nReadCount);
            }
            byte[] byteJson = ms.ToArray();
            string textJson = System.Text.Encoding.UTF8.GetString(byteJson);

            input = XMS.Core.Json.JsonSerializer.Deserialize <QA_QuestionInput <FATE_ChartMod> >(textJson);

            if (input == null)
            {
                throw new BusinessException("参数有误");
            }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            #region 判断输入项
            if (input.CateSysNo == 0 || input.CateSysNo == AppConst.IntNull)
            {
                throw new BusinessException("请选择分类");
            }
            if (input.Title.DoTrim() == "")
            {
                throw new BusinessException("请输入标题");
            }
            if (input.Title.DoTrim().Length > 30)
            {
                throw new BusinessException("您输入的标题太长,请控制在30字以内");
            }
            int point = USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).Point;
            if (input.Award > point && point != AppConst.IntNull)
            {
                throw new BusinessException("您最多可用" + point + "积分");
            }

            #endregion

            //try
            //{
            QA_QuestionMod m_quest = new QA_QuestionMod();
            m_quest.Award         = input.Award;
            m_quest.CateSysNo     = input.CateSysNo;
            m_quest.Context       = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(input.Context));
            m_quest.CustomerSysNo = input.CustomerSysNo;
            m_quest.LastReplyTime = DateTime.Now;
            m_quest.ReplyCount    = 0;
            m_quest.ReadCount     = 0;
            m_quest.BuyCount      = 0;
            m_quest.OrderCount    = 0;
            m_quest.Title         = AppCmn.CommonTools.SystemInputFilter(input.Title);
            m_quest.TS            = DateTime.Now;
            m_quest.DR            = (int)AppEnum.State.normal;

            int sysno = 0;

            QA_QuestionBll.GetInstance().AddQuest(ref m_quest, true);
            sysno = m_quest.SysNo;
            if (input.Chart.Count > 0)
            {
                FATE_ChartMod m_chart = new FATE_ChartMod();
                m_chart.CharType = input.Chart[0].CharType;;
                if (m_chart.CharType != (int)AppEnum.ChartType.nochart)
                {
                    m_chart.FirstBirth    = input.Chart[0].FirstBirth;
                    m_chart.FirstPoi      = input.Chart[0].FirstPoi;
                    m_chart.Transit       = DateTime.Now;
                    m_chart.TransitPoi    = input.Chart[0].FirstPoi;
                    m_chart.TheoryType    = 0;
                    m_chart.FirstPoiName  = input.Chart[0].FirstPoiName;
                    m_chart.FirstTimeZone = -8;
                    m_chart.FirstGender   = input.Chart[0].FirstGender;
                    m_chart.FirstDayLight = input.Chart[0].FirstDayLight;
                    if (m_chart.CharType == (int)AppEnum.ChartType.relation)
                    {
                        m_chart.SecondBirth    = input.Chart[0].SecondBirth;
                        m_chart.SecondPoi      = input.Chart[0].SecondPoi;
                        m_chart.SecondPoiName  = input.Chart[0].SecondPoiName;
                        m_chart.SecondTimeZone = -8;
                        m_chart.SecondGender   = input.Chart[0].SecondGender;
                        m_chart.SecondDayLight = input.Chart[0].SecondDayLight;
                    }
                    m_chart.TS = DateTime.Now;
                    m_chart.DR = (int)AppEnum.State.normal;
                    int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart);

                    REL_Question_ChartMod m_qchart = new REL_Question_ChartMod();
                    m_qchart.Chart_SysNo    = fatesysno;
                    m_qchart.Question_SysNo = sysno;
                    REL_Question_ChartBll.GetInstance().Add(m_qchart);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            USR_CustomerShow ret = new USR_CustomerShow();
            USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).MemberwiseCopy(ret);
            return(ReturnValue <USR_CustomerShow> .Get200OK(ret));
        }
Exemple #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null && Page.RouteData.Values["id"].ToString() != "")
            {
                try
                {
                    SysNo = int.Parse(Page.RouteData.Values["id"].ToString());
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                ShowError("");
            }

            if (m_qustion.CateSysNo != 17)//不是付费咨询则弹出
            {
                ShowError("");
            }

            if (Request.QueryString["pn"] != null)
            {
                try
                {
                    pageindex = int.Parse(Request.QueryString["pn"]);
                }
                catch
                { }
            }
            else if (Page.RouteData.Values["pn"] != null && Page.RouteData.Values["pn"].ToString() != "")
            {
                try
                {
                    pageindex = int.Parse(Page.RouteData.Values["pn"].ToString());
                }
                catch
                {
                    ShowError("");
                }
            }
            if (!IsPostBack)
            {
                BindData();
            }
            #region 登录状态判断
            if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull)
            {
                nologin.Style["display"] = "";
                txtReply2.Enabled = false;
                Button3.Style["display"] = "none";
                IsLogined.Value = "FALSE";
                Image2.ImageUrl = AppConfig.WebResourcesPath()+"Images/tx_03.jpg";
            }
            else
            {
                nologin.Style["display"] = "none";
                txtReply2.Enabled = true;
                Button3.Style["display"] = "";
                Image2.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + GetSession().CustomerEntity.Photo;
                IsLogined.Value = "TRUE";
            }
            #endregion
            Right1.showsearch = false;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SetDocument", "SetDocument();", true);
            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "SetDocument", "SetDocument();", true);
        }
Exemple #29
0
        public bool SetPaySucc(ORD_CashMod m_mod)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                m_mod.CurrentID = "";
                m_mod.PayTime = DateTime.Now;
                m_mod.Status = (int)AppEnum.CashOrderStatus.succed;
                ORD_CashBll.GetInstance().Update(m_mod);
                switch (m_mod.ProductType)
                {
                    case (int)AppEnum.CashOrderType.consultpay://咨询订单
                        QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(m_mod.ProductSysNo);
                        m_order.Status = (int)AppEnum.ConsultOrderStatus.payed;
                        QA_OrderBll.GetInstance().Update(m_order);

                        //生成收款单
                        if (m_mod.ProductType == (int)AppEnum.CashOrderType.consultpay)
                        {
                            ORD_CashMod rec_order = new ORD_CashMod();
                            QA_OrderMod tmp_order = QA_OrderBll.GetInstance().GetModel(m_mod.ProductSysNo);
                            rec_order.CustomerSysNo = tmp_order.CustomerSysNo;
                            rec_order.CurrentID = "";
                            rec_order.Discount = 1 - AppConst.ConsultDiscount;

                            rec_order.PayAmount = m_mod.Price * rec_order.Discount;
                            rec_order.PayType = m_mod.PayType;
                            rec_order.Price = m_mod.Price;
                            rec_order.ProductSysNo = m_mod.SysNo;
                            rec_order.Status = (int)AppEnum.CashOrderStatus.confirming;
                            rec_order.ProductType = (int)AppEnum.CashOrderType.consultget;
                            rec_order.TS = DateTime.Now;

                            rec_order.OrderID = "C" + m_mod.ProductType.ToString("0") + DateTime.Now.ToString("yyyyMMdd") + m_mod.ProductSysNo + CommonTools.ThrowRandom(0, 99999).ToString("00000");
                            rec_order.SysNo = ORD_CashBll.GetInstance().Add(rec_order);
                        }
                        //修改咨询购买数
                        QA_QuestionMod m_quest = new QA_QuestionMod();
                        m_quest = QA_QuestionBll.GetInstance().GetModel(m_order.QuestionSysNo);
                        m_quest.BuyCount++;
                        QA_QuestionBll.GetInstance().Update(m_quest);
                        break;
                }
                scope.Complete();
                return true;
            }
        }
Exemple #30
0
        protected void BindList()
        {
            DataTable tmpdt = QA_AnswerBll.GetInstance().GetSimpleListByQuest(SysNo);

            tmpdt.Columns.Add("isorder");
            #region 绑定报价列表
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                myprice.Visible = false;
            }

            DataTable m_dt1 = QA_OrderBll.GetInstance().GetListByQuest(SysNo);
            m_dt1.Columns.Add("color");
            m_dt1.Columns.Add("floor");
            for (int i = 0; i < m_dt1.Rows.Count; i++)
            {
                switch (int.Parse(m_dt1.Rows[i]["status"].ToString()))
                {
                case 1:
                    m_dt1.Rows[i]["color"] = "#000";
                    break;

                case 2:
                case 3:
                case 4:
                    m_dt1.Rows[i]["color"] = "#008c03";
                    break;

                case 0:
                case 5:
                    m_dt1.Rows[i]["color"] = "#f00";
                    break;
                }
                //若已有报价单且未购买则不允许发布第二个价单
                if (m_dt1.Rows[i]["CustomerSysNo"].ToString() == GetSession().CustomerEntity.SysNo.ToString() && int.Parse(m_dt1.Rows[i]["status"].ToString()) == 1)
                {
                    myprice.Visible = false;
                }
                #region 设置锚点
                for (int j = 0; j < tmpdt.Rows.Count; j++)
                {
                    if (tmpdt.Rows[j]["SysNo"].ToString() == m_dt1.Rows[i]["answersysno"].ToString())
                    {
                        if (j >= pagesize)
                        {
                            Regex r = new Regex(@"pn\d+?&");
                            m_dt1.Rows[i]["floor"] = r.Replace(Request.Url.ToString(), "") + "&pn=" + j / pageindex + "#f" + (j % pageindex).ToString();
                        }
                        else
                        {
                            m_dt1.Rows[i]["floor"] = "#f" + j.ToString();
                        }
                        tmpdt.Rows[j]["isorder"] = "1";
                        break;
                    }
                }
                #endregion
            }

            Repeater2.DataSource = m_dt1;
            Repeater2.DataBind();

            #endregion
            #region 绑定回答列表
            int total = 0;
            if (m_qustion.CustomerSysNo == AppConst.IntNull)
            {
                m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
            }
            DataTable m_dt = QA_AnswerBll.GetInstance().GetListByQuestForConsult(pagesize, pageindex, SysNo, ref total);
            m_dt.Columns.Add("hide");
            //m_dt.Columns.Add("hide1");
            //m_dt.Columns.Add("orderlink");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo || GetSession().CustomerEntity.SysNo == int.Parse(m_dt.Rows[i]["CustomerSysNo"].ToString()))
                {
                    m_dt.Rows[i]["hide"] = "display:none;";
                }
                else
                {
                    m_dt.Rows[i]["trial"]   = "";
                    m_dt.Rows[i]["Context"] = "";
                    m_dt.Rows[i]["hide"]    = "";
                }
            }
            Repeater1.DataSource = m_dt;
            Repeater1.DataBind();
            Pager1.url         = AppConfig.HomeUrl() + "Quest/Consult/" + SysNo + "/";
            Pager1.totalrecord = total;
            if (total % AppConst.PageSize == 0)
            {
                this.Pager1.total = total / pagesize;
            }
            else
            {
                this.Pager1.total = total / pagesize + 1;
            }
            this.Pager1.index    = pageindex;
            this.Pager1.numlenth = 3;
            if (IsPostBack)
            {
                UpdatePanel1.Update();
            }
            #endregion
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public void Add(QA_QuestionMod model)
        {
            dal.Add(model);
        }
Exemple #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            Login(Request.Url.ToString());
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    SysNo     = int.Parse(Request.QueryString["id"]);
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null && Page.RouteData.Values["id"].ToString() != "")
            {
                try
                {
                    SysNo     = int.Parse(Page.RouteData.Values["id"].ToString());
                    m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                    //DataBind();
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                if (Request.QueryString["order"] != null)
                {
                    try
                    {
                        order     = int.Parse(Request.QueryString["order"]);
                        old_order = QA_OrderBll.GetInstance().GetModel(order);
                        SysNo     = old_order.QuestionSysNo;
                        m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                        //DataBind();
                    }
                    catch
                    {
                        ShowError("");
                    }
                }
                else if (Page.RouteData.Values["order"] != null && Page.RouteData.Values["order"].ToString() != "")
                {
                    try
                    {
                        order     = int.Parse(Page.RouteData.Values["order"].ToString());
                        old_order = QA_OrderBll.GetInstance().GetModel(order);
                        SysNo     = old_order.QuestionSysNo;
                        m_qustion = QA_QuestionBll.GetInstance().GetModel(SysNo);
                        //DataBind();
                    }
                    catch
                    {
                        ShowError("");
                    }
                }
                else
                {
                    ShowError("");
                }
            }

            if (m_qustion.CateSysNo != 17)//不是付费咨询则弹出
            {
                ShowError("");
            }

            if (!IsPostBack)
            {
                BindData();
            }

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "SetDocument", "SetDocument();", true);
        }
Exemple #33
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();
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public void Update(QA_QuestionMod model)
        {
            dal.Update(model);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(QA_QuestionMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into QA_Question(");
            strSql.Append("SysNo,CateSysNo,CustomerSysNo,Title,Context,Award,EndTime,IsSecret,LastReplyTime,LastReplyUser,ReplyCount,ReadCount,DR,TS,SubQuest,OrderCount,BuyCount)");
            strSql.Append(" values (");
            strSql.Append("@SysNo,@CateSysNo,@CustomerSysNo,@Title,@Context,@Award,@EndTime,@IsSecret,@LastReplyTime,@LastReplyUser,@ReplyCount,@ReadCount,@DR,@TS,@SubQuest,@OrderCount,@BuyCount)");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo",         SqlDbType.Int,                4),
                new SqlParameter("@CateSysNo",     SqlDbType.Int,                4),
                new SqlParameter("@CustomerSysNo", SqlDbType.Int,                4),
                new SqlParameter("@Title",         SqlDbType.NVarChar,         600),
                new SqlParameter("@Context",       SqlDbType.Text,      2147483647),
                new SqlParameter("@Award",         SqlDbType.Int,                4),
                new SqlParameter("@EndTime",       SqlDbType.DateTime),
                new SqlParameter("@IsSecret",      SqlDbType.TinyInt,            1),
                new SqlParameter("@LastReplyTime", SqlDbType.DateTime),
                new SqlParameter("@LastReplyUser", SqlDbType.Int,                4),
                new SqlParameter("@ReplyCount",    SqlDbType.Int,                4),
                new SqlParameter("@ReadCount",     SqlDbType.Int,                4),
                new SqlParameter("@DR",            SqlDbType.TinyInt,            1),
                new SqlParameter("@TS",            SqlDbType.DateTime),
                new SqlParameter("@SubQuest",      SqlDbType.NVarChar,        1000),
                new SqlParameter("@OrderCount",    SqlDbType.Int,                4),
                new SqlParameter("@BuyCount",      SqlDbType.Int, 4)
            };
            if (model.SysNo != AppConst.IntNull)
            {
                parameters[0].Value = model.SysNo;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.CateSysNo != AppConst.IntNull)
            {
                parameters[1].Value = model.CateSysNo;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.CustomerSysNo != AppConst.IntNull)
            {
                parameters[2].Value = model.CustomerSysNo;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.Title != AppConst.StringNull)
            {
                parameters[3].Value = model.Title;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            if (model.Context != AppConst.StringNull)
            {
                parameters[4].Value = model.Context;
            }
            else
            {
                parameters[4].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[4]);
            if (model.Award != AppConst.IntNull)
            {
                parameters[5].Value = model.Award;
            }
            else
            {
                parameters[5].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[5]);
            if (model.EndTime != AppConst.DateTimeNull)
            {
                parameters[6].Value = model.EndTime;
            }
            else
            {
                parameters[6].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[6]);
            if (model.IsSecret != AppConst.IntNull)
            {
                parameters[7].Value = model.IsSecret;
            }
            else
            {
                parameters[7].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[7]);
            if (model.LastReplyTime != AppConst.DateTimeNull)
            {
                parameters[8].Value = model.LastReplyTime;
            }
            else
            {
                parameters[8].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[8]);
            if (model.LastReplyUser != AppConst.IntNull)
            {
                parameters[9].Value = model.LastReplyUser;
            }
            else
            {
                parameters[9].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[9]);
            if (model.ReplyCount != AppConst.IntNull)
            {
                parameters[10].Value = model.ReplyCount;
            }
            else
            {
                parameters[10].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[10]);
            if (model.ReadCount != AppConst.IntNull)
            {
                parameters[11].Value = model.ReadCount;
            }
            else
            {
                parameters[11].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[11]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[12].Value = model.DR;
            }
            else
            {
                parameters[12].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[12]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[13].Value = model.TS;
            }
            else
            {
                parameters[13].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[13]);
            if (model.SubQuest != AppConst.StringNull)
            {
                parameters[14].Value = model.SubQuest;
            }
            else
            {
                parameters[14].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[14]);
            if (model.OrderCount != AppConst.IntNull)
            {
                parameters[15].Value = model.OrderCount;
            }
            else
            {
                parameters[15].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[15]);
            if (model.BuyCount != AppConst.IntNull)
            {
                parameters[16].Value = model.BuyCount;
            }
            else
            {
                parameters[16].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[16]);
            SqlHelper.ExecuteNonQuery(cmd, parameters);
        }
Exemple #36
0
        public ReturnValue<USR_CustomerShow> AddQuestionWithChart(Stream openPageData)
        {
            QA_QuestionInput<FATE_ChartMod> input;
            //try
            //{
            int nReadCount = 0;
            MemoryStream ms = new MemoryStream();
            byte[] buffer = new byte[1024];
            while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0)
            {
                ms.Write(buffer, 0, nReadCount);
            }
            byte[] byteJson = ms.ToArray();
            string textJson = System.Text.Encoding.UTF8.GetString(byteJson);

            input = XMS.Core.Json.JsonSerializer.Deserialize<QA_QuestionInput<FATE_ChartMod>>(textJson);

            if (input == null)
            {
                throw new BusinessException("参数有误");
            }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            #region 判断输入项
            if (input.CateSysNo == 0 || input.CateSysNo == AppConst.IntNull)
            {
                throw new BusinessException("请选择分类");
            }
            if (input.Title.DoTrim() == "")
            {
                throw new BusinessException("请输入标题");
            }
            if (input.Title.DoTrim().Length > 30)
            {
                throw new BusinessException("您输入的标题太长,请控制在30字以内");
            }
            int point = USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).Point;
            if (input.Award > point && point != AppConst.IntNull)
            {
                throw new BusinessException("您最多可用" + point + "积分");
            }

            #endregion

            //try
            //{
            QA_QuestionMod m_quest = new QA_QuestionMod();
            m_quest.Award = input.Award;
            m_quest.CateSysNo = input.CateSysNo;
            m_quest.Context = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(input.Context));
            m_quest.CustomerSysNo = input.CustomerSysNo;
            m_quest.LastReplyTime = DateTime.Now;
            m_quest.ReplyCount = 0;
            m_quest.ReadCount = 0;
            m_quest.BuyCount = 0;
            m_quest.OrderCount = 0;
            m_quest.Title = AppCmn.CommonTools.SystemInputFilter(input.Title);
            m_quest.TS = DateTime.Now;
            m_quest.DR = (int)AppEnum.State.normal;

            int sysno = 0;

            QA_QuestionBll.GetInstance().AddQuest(ref m_quest, true);
            sysno = m_quest.SysNo;
            if (input.Chart.Count > 0)
            {
                FATE_ChartMod m_chart = new FATE_ChartMod();
                m_chart.CharType = input.Chart[0].CharType; ;
                if (m_chart.CharType != (int)AppEnum.ChartType.nochart)
                {
                    m_chart.FirstBirth = input.Chart[0].FirstBirth;
                    m_chart.FirstPoi = input.Chart[0].FirstPoi;
                    m_chart.Transit = DateTime.Now;
                    m_chart.TransitPoi = input.Chart[0].FirstPoi;
                    m_chart.TheoryType = 0;
                    m_chart.FirstPoiName = input.Chart[0].FirstPoiName;
                    m_chart.FirstTimeZone = -8;
                    m_chart.FirstGender = input.Chart[0].FirstGender;
                    m_chart.FirstDayLight = input.Chart[0].FirstDayLight;
                    if (m_chart.CharType == (int)AppEnum.ChartType.relation)
                    {
                        m_chart.SecondBirth = input.Chart[0].SecondBirth;
                        m_chart.SecondPoi = input.Chart[0].SecondPoi;
                        m_chart.SecondPoiName = input.Chart[0].SecondPoiName;
                        m_chart.SecondTimeZone = -8;
                        m_chart.SecondGender = input.Chart[0].SecondGender;
                        m_chart.SecondDayLight = input.Chart[0].SecondDayLight;
                    }
                    m_chart.TS = DateTime.Now;
                    m_chart.DR = (int)AppEnum.State.normal;
                    int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart);

                    REL_Question_ChartMod m_qchart = new REL_Question_ChartMod();
                    m_qchart.Chart_SysNo = fatesysno;
                    m_qchart.Question_SysNo = sysno;
                    REL_Question_ChartBll.GetInstance().Add(m_qchart);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}

            USR_CustomerShow ret = new USR_CustomerShow();
            USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).MemberwiseCopy(ret);
            return ReturnValue<USR_CustomerShow>.Get200OK(ret);
        }
Exemple #37
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(QA_QuestionMod model)
 {
     dal.Update(model);
 }