protected void PrepareForm()
        {
            if (Request.QueryString["user"] != null && Request.QueryString["user"] != "")
            {
                try
                {
                    rptFamous.DataSource = REL_Customer_CategoryBll.GetInstance().GetListByCustomer(int.Parse(Request.QueryString["user"]), (int)AppEnum.CategoryType.QA);
                    rptFamous.DataBind();
                }
                catch
                {
                    Response.Redirect("../Error.aspx?msg=");
                    return;
                }
            }
            else
            {
                Response.Redirect("../Error.aspx?msg=");
                return;
            }

            drpQACate.DataSource     = QA_CategoryBll.GetInstance().GetAllCates();
            drpQACate.DataTextField  = "Name";
            drpQACate.DataValueField = "SysNo";
            drpQACate.DataBind();
            drpQACate.Items.Insert(0, new ListItem("选择问答分类", "0"));
        }
Beispiel #2
0
 protected void Delete()
 {
     try
     {
         REL_Customer_CategoryBll.GetInstance().Delete(int.Parse(base.Request.QueryString["delete"]));
         this.ltrNotice.Text = "该记录已删除!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
     }
     catch
     {
         this.ltrError.Text = "系统错误,删除失败!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
     }
 }
Beispiel #3
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                e.Item.FindControl("LinkButton1").Visible = true;
                if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString())
                {
                    e.Item.FindControl("LinkButton1").Visible = false;
                }
                e.Item.FindControl("LinkButton5").Visible = true;
                e.Item.FindControl("Literal1").Visible    = true;
            }
            else
            {
                e.Item.FindControl("LinkButton1").Visible = false;
                if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) ||
                    GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
                {
                    e.Item.FindControl("LinkButton5").Visible = true;
                    e.Item.FindControl("Literal1").Visible    = true;
                }
            }

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

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

            if (m_dt1 != null)
            {
                m_rpt1.DataSource = m_dt1;
                m_rpt1.DataBind();
            }
        }
Beispiel #4
0
        public ReturnValue <List <USR_CustomerShow> > GetStarsList(int catesysno)
        {
            DataTable m_dt = REL_Customer_CategoryBll.GetInstance().GetListByCate(catesysno, (int)AppEnum.CategoryType.QA);

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                throw new BusinessException("该分类下无版主");
            }
            List <USR_CustomerShow> ret = new List <USR_CustomerShow>();

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                CustomerService  m_service = new CustomerService();
                USR_CustomerShow tmp_star  = m_service.MapUSR_CustomerShow(m_dt.Rows[i]);
                ret.Add(tmp_star);
            }
            return(ReturnValue <List <USR_CustomerShow> > .Get200OK(ret));
        }
Beispiel #5
0
        // Methods
        protected void BindContent()
        {
            DataTable m_dt = REL_Customer_CategoryBll.GetInstance().GetList(this.txtName.Text.Trim(), int.Parse(drpQACate.SelectedValue), (int)AppEnum.CategoryType.QA);

            m_dt.Columns.Add("deleteurl");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                if (urlnow.Contains("?"))
                {
                    m_dt.Rows[i]["deleteurl"] = this.urlnow + "&delete=";
                }
                else
                {
                    m_dt.Rows[i]["deleteurl"] = this.urlnow + "?delete=";
                }
            }
            this.rptFamous.DataSource = m_dt;
            this.rptFamous.DataBind();
        }
Beispiel #6
0
 protected void BindStars()
 {
     //int count = 5;
     if (cate != 0)
     {
         try
         {
             DataTable m_dt = REL_Customer_CategoryBll.GetInstance().GetListByCate(cate, (int)AppEnum.CategoryType.QA);
             //DataTable m_dt = QA_StarBll.GetInstance().GetStarsList(count, 0);
             for (int i = 0; i < m_dt.Rows.Count; i++)
             {
                 m_dt.Rows[i]["intro"] = CommonTools.CutStr(m_dt.Rows[i]["intro"].ToString(), 80);
             }
             rptStars.DataSource = m_dt;
             rptStars.DataBind();
         }
         catch
         { }
     }
 }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            if (drpQACate.SelectedIndex == 0)
            {
                ltrError.Text = "请选择问答分类!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (REL_Customer_CategoryBll.GetInstance().HasRecord(int.Parse(Request.QueryString["user"]), int.Parse(drpQACate.SelectedValue), (int)AppEnum.CategoryType.QA))
            {
                ltrError.Text = "该用户已经是该分类的版主了!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            REL_Customer_CategoryMod m_medal = new REL_Customer_CategoryMod();

            m_medal.CustomerSysNo = int.Parse(Request.QueryString["user"]);
            m_medal.CategorySysNo = int.Parse(drpQACate.SelectedValue);
            m_medal.Type          = (int)AppEnum.CategoryType.QA;
            m_medal.TS            = DateTime.Now;
            m_medal.DR            = 0;
            try
            {
                REL_Customer_CategoryBll.GetInstance().Add(m_medal);
                LogManagement.getInstance().WriteTrace(m_medal.SysNo, "CustomerMedal.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                PrepareForm();
            }
            catch
            {
                ltrError.Text = "系统错误,添加失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Beispiel #8
0
 protected void Repeater3_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString() || REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA))
     {
         e.Item.FindControl("LinkButton5").Visible = true;
         e.Item.FindControl("Literal1").Visible    = true;
     }
 }
Beispiel #9
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
            {
                //e.Item.FindControl("LinkButton1").Visible = true;
                //if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString())
                //{
                //    e.Item.FindControl("LinkButton1").Visible = false;
                //}
                e.Item.FindControl("LinkButton5").Visible = true;
                e.Item.FindControl("Literal1").Visible    = true;
            }
            else
            {
                //e.Item.FindControl("LinkButton1").Visible = false;
                if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) ||
                    GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
                {
                    e.Item.FindControl("LinkButton5").Visible = true;
                    e.Item.FindControl("Literal1").Visible    = true;
                }
            }
            #region 绑定评论列表
            Repeater  m_rpt = (Repeater)e.Item.FindControl("Repeater3");
            DataTable m_dt  = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString()));
            if (m_dt != null)
            {
                m_dt.Columns.Add("color");
                for (int i = 0; i < m_dt.Rows.Count; i++)
                {
                    if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString())
                    {
                        m_dt.Rows[i]["color"] = "color: #A5534C";
                    }
                }
                m_rpt.DataSource = m_dt;
                m_rpt.DataBind();
            }
            #endregion
            #region 绑定用户奖章
            Repeater  m_rpt1 = (Repeater)e.Item.FindControl("Repeater4");
            DataTable m_dt1  = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0);
            if (m_dt1 != null)
            {
                m_rpt1.DataSource = m_dt1;
                m_rpt1.DataBind();
            }
            #endregion

            #region 设置报价单权限
            DataRowView rowv = (DataRowView)e.Item.DataItem;
            if (rowv["Price"] != null && rowv["Price"].ToString() != "")
            {
                if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) //求测者
                {
                    e.Item.FindControl("LinkButton5").Visible = false;            //报价单无法删除
                    if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforepay).ToString())
                    {
                        e.Item.FindControl("buyicon").Visible = true;
                    }
                    else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforeconfirm).ToString())
                    {
                        e.Item.FindControl("confirmicon").Visible = true;
                        DateTime replytime = DateTime.Parse(rowv["replytime"].ToString());
                        if (replytime != AppConst.DateTimeNull)
                        {
                            TimeSpan m_span = replytime.AddHours(AppConst.ConsultConfirmTime) - DateTime.Now;
                            string   tmpstr = "";
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Days + "天";
                            }
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Hours + "小时";
                            }
                            ((Literal)e.Item.FindControl("Literal4")).Text = tmpstr;
                        }
                    }
                    else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString())
                    {
                        e.Item.FindControl("buyedtip").Visible = true;
                        DateTime paytime = ORD_CashBll.GetInstance().GetPayTimeByQAOrder(int.Parse(rowv["ordersysno"].ToString()));
                        if (paytime != AppConst.DateTimeNull)
                        {
                            TimeSpan m_span = paytime.AddHours(AppConst.ConsultReplyTime) - DateTime.Now;
                            string   tmpstr = "";
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Days + "天";
                            }
                            if (m_span.Days > 0)
                            {
                                tmpstr += m_span.Hours + "小时";
                            }
                            ((Literal)e.Item.FindControl("Literal3")).Text = tmpstr;
                        }
                        else
                        {
                            ShowError("");
                        }
                    }
                }
                if (GetSession().CustomerEntity.SysNo == Convert.ToInt32(rowv["CustomerSysNo"]))//占卜师
                {
                    if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString())
                    {
                        e.Item.FindControl("replyicon").Visible = true;
                    }
                }
            }
            #endregion
        }