コード例 #1
0
        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"));
        }
コード例 #2
0
ファイル: Index.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void BindNewTalk()
        {
            DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(2);

            Repeater4.DataSource = m_dt;
            Repeater4.DataBind();
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Login(base.Request.RawUrl);
            base.CheckPrivilege(base.Request.RawUrl);
            AdminMaster m_master = (AdminMaster)base.Master;

            m_master.PageName = "版主管理";
            m_master.SetCate(AdminMaster.CateType.Customer3);

            drpQACate.DataSource     = QA_CategoryBll.GetInstance().GetAllCates();
            drpQACate.DataTextField  = "Name";
            drpQACate.DataValueField = "SysNo";
            drpQACate.DataBind();
            drpQACate.Items.Insert(0, new ListItem("选择问答分类", "0"));

            if (!base.IsPostBack)
            {
                if ((base.Request.QueryString["delete"] != null) && (base.Request.QueryString["delete"] != ""))
                {
                    this.Delete();
                }
                if ((base.Request.QueryString["name"] != null) && (base.Request.QueryString["name"] != ""))
                {
                    this.txtName.Text = base.Request.QueryString["name"];
                    this.urlnow       = this.urlnow + "&name=" + base.Request.QueryString["name"];
                }
                if ((base.Request.QueryString["cate"] != null) && (base.Request.QueryString["cate"] != ""))
                {
                    this.drpQACate.SelectedIndex = this.drpQACate.Items.IndexOf(this.drpQACate.Items.FindByValue(base.Request.QueryString["cate"]));
                    this.urlnow = this.urlnow + "&cate=" + base.Request.QueryString["cate"];
                }
                this.BindContent();
            }
        }
コード例 #4
0
ファイル: Index.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void BindTalkCate()
        {
            DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(2);

            m_dt.Columns.Add("NewCount");
            m_dt.Columns.Add("NewSysNo");
            m_dt.Columns.Add("NewTitle");
            m_dt.Columns.Add("NewContext");
            m_dt.Columns.Add("NewUser");
            m_dt.Columns.Add("NewTime");
            DataSet   tmpds = QA_CategoryBll.GetInstance().GetCatesPostNum();
            DataTable tmpdt = QA_QuestionBll.GetInstance().GetTopListByCate(1);

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                m_dt.Rows[i]["NewCount"] = "0";
                for (int j = 0; j < tmpds.Tables[0].Rows.Count; j++)
                {
                    if (tmpds.Tables[0].Rows[j]["CateSysNo"].ToString() == m_dt.Rows[i]["SysNo"].ToString())
                    {
                        m_dt.Rows[i]["NewCount"] = int.Parse(tmpds.Tables[0].Rows[j]["questnum"].ToString());
                        break;
                    }
                }
                for (int j = 0; j < tmpds.Tables[1].Rows.Count; j++)
                {
                    if (tmpds.Tables[1].Rows[j]["CateSysNo"].ToString() == m_dt.Rows[i]["SysNo"].ToString())
                    {
                        m_dt.Rows[i]["NewCount"] = int.Parse(m_dt.Rows[i]["NewCount"].ToString()) + int.Parse(tmpds.Tables[1].Rows[j]["AnswerNum"].ToString()) + int.Parse(tmpds.Tables[1].Rows[j]["CommentNum"].ToString());
                        break;
                    }
                }
                for (int j = 0; j < tmpdt.Rows.Count; j++)
                {
                    if (tmpdt.Rows[j]["CateSysNo"].ToString() == m_dt.Rows[i]["SysNo"].ToString())
                    {
                        m_dt.Rows[i]["NewSysNo"]   = tmpdt.Rows[j]["SysNo"];
                        m_dt.Rows[i]["NewTitle"]   = tmpdt.Rows[j]["Title"];
                        m_dt.Rows[i]["NewContext"] = tmpdt.Rows[j]["Context"];
                        m_dt.Rows[i]["NewUser"]    = tmpdt.Rows[j]["NickName"];
                        m_dt.Rows[i]["NewTime"]    = tmpdt.Rows[j]["LastReplyTime"];
                    }
                }
                if (m_dt.Rows[i]["NewTime"].ToString() == "")
                {
                    m_dt.Rows[i]["NewTime"] = DateTime.Now;
                }
            }

            Repeater2.DataSource = m_dt;
            Repeater2.DataBind();
        }
コード例 #5
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            QA_CategoryMod m_cate = new QA_CategoryMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_cate = QA_CategoryBll.GetInstance().GetModel(SysNo);

                try
                {
                    m_cate.Name = txtName.Text.Trim();
                    m_cate.DR   = int.Parse(drpStatus.SelectedValue);
                    QA_CategoryBll.GetInstance().Update(m_cate);
                    LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    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='';closeforseconds();", true);
                    return;
                }
            }
            else if (type == "ADD")
            {
                try
                {
                    m_cate.Name        = txtName.Text.Trim();
                    m_cate.DR          = int.Parse(drpStatus.SelectedValue);
                    m_cate.TS          = DateTime.Now;
                    m_cate.ParentSysNo = Convert.ToInt32(ViewState["parent"]);
                    m_cate.TopSysNo    = QA_CategoryBll.GetInstance().GetModel(Convert.ToInt32(ViewState["parent"])).TopSysNo;
                    QA_CategoryBll.GetInstance().Add(m_cate);
                    LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    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='';closeforseconds();", true);
                    return;
                }
            }
        }
コード例 #6
0
ファイル: QAService.cs プロジェクト: qubianzhong/luckysign
        public ReturnValue <List <QA_CategoryShow> > GetCates(int parent)
        {
            DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(parent);

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                throw new BusinessException("该分类下无子分类");
            }
            List <QA_CategoryShow> ret = new List <QA_CategoryShow>();
            DataTable questnum         = QA_CategoryBll.GetInstance().GetCatesPostNum().Tables[0];
            DataTable postnum          = QA_CategoryBll.GetInstance().GetCatesPostNum().Tables[1];

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                QA_CategoryShow tmp_cate = MapQA_Category(m_dt.Rows[i]);
                if (!string.IsNullOrEmpty(tmp_cate.Pic))
                {
                    tmp_cate.Pic = Container.ConfigService.GetAppSetting <string>("WebResourcesPath", "") + "img/CatePic/" + tmp_cate.Pic;
                }
                if (tmp_cate.TopSysNo == 1)
                {
                    tmp_cate.Pic = tmp_cate.Pic.Replace("pp", "p").Replace("jpg", "png");
                }
                for (int j = 0; j < questnum.Rows.Count; j++)
                {
                    if (questnum.Rows[j]["CateSysNo"].ToString() == tmp_cate.SysNo.ToString())
                    {
                        tmp_cate.QuestNum = tmp_cate.QuestNum + int.Parse(questnum.Rows[j]["questnum"].ToString());
                        if (questnum.Rows[j]["IsSolved"].ToString() == "1")
                        {
                            tmp_cate.SolvedNum = tmp_cate.QuestNum;
                        }
                    }
                }
                for (int j = 0; j < postnum.Rows.Count; j++)
                {
                    if (postnum.Rows[j]["CateSysNo"].ToString() == tmp_cate.SysNo.ToString())
                    {
                        tmp_cate.Replys = int.Parse(tmp_cate.QuestNum.ToString()) + int.Parse(postnum.Rows[j]["AnswerNum"].ToString()) + int.Parse(postnum.Rows[j]["CommentNum"].ToString());
                    }
                }
                ret.Add(tmp_cate);
            }
            return(ReturnValue <List <QA_CategoryShow> > .Get200OK(ret));
        }
コード例 #7
0
ファイル: Index.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void Repeater4_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Repeater rptTopic = (Repeater)e.Item.FindControl("Repeater5");

            //找到分类Repeater关联的数据项
            DataRowView rowv = (DataRowView)e.Item.DataItem;
            //提取分类ID
            int CategoryId = Convert.ToInt32(rowv["SysNo"]);
            //根据分类ID查询该分类下的子分类,并绑定子分类Repeater

            int       total = 0;
            DataTable dt    = new DataTable();

            if (HttpRuntime.Cache[AppConst.AllNewTalk + CategoryId] == null)
            {
                dt = QA_QuestionBll.GetInstance().GetList(5, 1, "", CategoryId, "timedown", ref total);
                dt.Columns.Add("CateName");
                DataTable tmpdt = QA_CategoryBll.GetInstance().GetAllCates();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    for (int j = 0; j < tmpdt.Rows.Count; j++)
                    {
                        if (dt.Rows[i]["CateSysNo"].ToString() == tmpdt.Rows[j]["SysNo"].ToString())
                        {
                            dt.Rows[i]["CateName"] = tmpdt.Rows[j]["Name"].ToString();
                            break;
                        }
                    }
                }
                HttpRuntime.Cache.Insert(AppConst.AllNewTalk + CategoryId, dt,
                                         null, DateTime.Now.AddMinutes(5), TimeSpan.Zero,
                                         System.Web.Caching.CacheItemPriority.High, null);
            }
            dt = HttpRuntime.Cache[AppConst.AllNewTalk + CategoryId] as DataTable;
            rptTopic.DataSource = dt;
            rptTopic.DataBind();
        }
コード例 #8
0
ファイル: Index.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void BindFreeCate()
        {
            DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(1);

            m_dt.Columns.Add("NewCount");
            m_dt.Columns.Add("style");

            DataSet tmpds = QA_CategoryBll.GetInstance().GetCatesPostNum();

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                if (i % 3 == 2)
                {
                    m_dt.Rows[i]["style"] = "margin-right: 0";
                }
                m_dt.Rows[i]["NewCount"] = "0";
                for (int j = 0; j < tmpds.Tables[0].Rows.Count; j++)
                {
                    if (tmpds.Tables[0].Rows[j]["CateSysNo"].ToString() == m_dt.Rows[i]["SysNo"].ToString())
                    {
                        m_dt.Rows[i]["NewCount"] = int.Parse(tmpds.Tables[0].Rows[j]["questnum"].ToString());
                        break;
                    }
                }
                for (int j = 0; j < tmpds.Tables[1].Rows.Count; j++)
                {
                    if (tmpds.Tables[1].Rows[j]["CateSysNo"].ToString() == m_dt.Rows[i]["SysNo"].ToString())
                    {
                        m_dt.Rows[i]["NewCount"] = int.Parse(m_dt.Rows[i]["NewCount"].ToString()) + int.Parse(tmpds.Tables[1].Rows[j]["AnswerNum"].ToString()) + int.Parse(tmpds.Tables[1].Rows[j]["CommentNum"].ToString());
                        break;
                    }
                }
            }

            Repeater1.DataSource = m_dt;
            Repeater1.DataBind();
        }
コード例 #9
0
ファイル: Index.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void BindNewQuest()
        {
            int       total = 0;
            DataTable dt    = new DataTable();

            if (HttpRuntime.Cache[AppConst.AllNewAnswer] == null)
            {
                dt = QA_QuestionBll.GetInstance().GetList(6, 1, "", 0, "replytimedown", ref total);
                dt.Columns.Add("Answer");
                dt.Columns.Add("AnswerUser");
                dt.Columns.Add("CateName");
                int       tmptotal = 0;
                DataTable tmpdt    = QA_CategoryBll.GetInstance().GetAllCates();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataTable tmpanswer = QA_AnswerBll.GetInstance().GetListByQuest(1, 1, int.Parse(dt.Rows[i]["SysNo"].ToString()), ref tmptotal);
                    dt.Rows[i]["Answer"]     = tmpanswer.Rows[0]["Context"].ToString();
                    dt.Rows[i]["AnswerUser"] = tmpanswer.Rows[0]["NickName"].ToString();
                    for (int j = 0; j < tmpdt.Rows.Count; j++)
                    {
                        if (dt.Rows[i]["CateSysNo"].ToString() == tmpdt.Rows[j]["SysNo"].ToString())
                        {
                            dt.Rows[i]["CateName"] = tmpdt.Rows[j]["Name"].ToString();
                            break;
                        }
                    }
                }
                HttpRuntime.Cache.Insert(AppConst.AllNewAnswer, dt,
                                         null, DateTime.Now.AddMinutes(5), TimeSpan.Zero,
                                         System.Web.Caching.CacheItemPriority.High, null);
            }
            dt = HttpRuntime.Cache[AppConst.AllNewAnswer] as DataTable;
            Repeater3.DataSource = dt;
            Repeater3.DataBind();
        }
コード例 #10
0
        protected void BindCate()
        {
            DataTable parent = QA_CategoryBll.GetInstance().GetCates(0);
            DataTable m_dt   = new DataTable();

            m_dt.Columns.Add("SysNo");
            m_dt.Columns.Add("Name");
            for (int i = 0; i < parent.Rows.Count; i++)
            {
                DataTable tmp = QA_CategoryBll.GetInstance().GetCates(int.Parse(parent.Rows[i]["SysNo"].ToString()));
                for (int j = 0; j < tmp.Rows.Count; j++)
                {
                    DataRow m_dr = m_dt.NewRow();
                    m_dr["SysNo"] = tmp.Rows[j]["SysNo"];
                    m_dr["Name"]  = parent.Rows[i]["Name"].ToString() + "-" + tmp.Rows[j]["Name"].ToString();
                    m_dt.Rows.Add(m_dr);
                }
            }
            drpCate.DataSource     = m_dt;
            drpCate.DataValueField = "SysNo";
            drpCate.DataTextField  = "Name";
            drpCate.DataBind();
            drpCate.Items.Insert(0, new ListItem("请选择", "0"));
        }
コード例 #11
0
        protected void BindData()
        {
            int total = 0;
            int cate  = 0;

            if (Request.QueryString["cate"] != null)
            {
                try
                {
                    cate = int.Parse(Request.QueryString["cate"]);
                }
                catch
                {
                    ShowError("请从正常入口进入");
                }
            }
            else if (Page.RouteData.Values["cate"] != null && Page.RouteData.Values["cate"].ToString() != "")
            {
                try
                {
                    cate = int.Parse(Page.RouteData.Values["cate"].ToString());
                }
                catch
                {
                    ShowError("请从正常入口进入");
                }
            }
            else
            {
                ShowError("请从正常入口进入");
            }
            QA_CategoryMod m_cate = QA_CategoryBll.GetInstance().GetModel(cate);

            ltrNav.Text = @"<a href=""" + AppConfig.HomeUrl() + @""">首页</a> > <a href=""" + AppConfig.HomeUrl() + @"Quest/"">煮酒论命</a> > <span>" + m_cate.Name + "</span>";
            string search = "";
            //if (txtName.Trim() != "寻找你感兴趣的咨询话题")
            //{
            //    search = txtName.Trim();
            //}
            DataTable m_dt = QA_QuestionBll.GetInstance().GetList(pagesize, pageindex, search, cate, ViewState["order"].ToString(), ref total);

            m_dt.Columns.Add("DateShow");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                //m_dt.Rows[i]["Context"] = CommonTools.CutStr(m_dt.Rows[i]["Context"].ToString(), 100);
                DateTime ts = DateTime.Parse(m_dt.Rows[i]["ts"].ToString());
                if ((DateTime.Now - ts).TotalDays > 365)
                {
                    m_dt.Rows[i]["DateShow"] = "一年前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 180)
                {
                    m_dt.Rows[i]["DateShow"] = "半年前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 60)
                {
                    m_dt.Rows[i]["DateShow"] = "几个月前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 30)
                {
                    m_dt.Rows[i]["DateShow"] = "一个月前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 15)
                {
                    m_dt.Rows[i]["DateShow"] = "半个月前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 7)
                {
                    m_dt.Rows[i]["DateShow"] = "一周前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 2)
                {
                    m_dt.Rows[i]["DateShow"] = "几天前发布";
                }
                else if ((DateTime.Now - ts).TotalDays > 1)
                {
                    m_dt.Rows[i]["DateShow"] = "一天前发布";
                }
                else if ((DateTime.Now - ts).TotalHours > 2)
                {
                    m_dt.Rows[i]["DateShow"] = "几小时前发布";
                }
                else if ((DateTime.Now - ts).TotalHours > 1)
                {
                    m_dt.Rows[i]["DateShow"] = "一小时前发布";
                }
                else if ((DateTime.Now - ts).TotalMinutes > 30)
                {
                    m_dt.Rows[i]["DateShow"] = "半小时前发布";
                }
                else if ((DateTime.Now - ts).TotalMinutes > 2)
                {
                    m_dt.Rows[i]["DateShow"] = "几分钟前发布";
                }
                else if ((DateTime.Now - ts).TotalMinutes > 1)
                {
                    m_dt.Rows[i]["DateShow"] = "一分钟前发布";
                }
                else
                {
                    m_dt.Rows[i]["DateShow"] = "几秒钟前发布";
                }
            }
            rptQuestion.DataSource = m_dt;
            rptQuestion.DataBind();

            Pager1.url = AppConfig.HomeUrl() + @"Quest/QuestList/" + cate + "/";
            if (search.Trim() != "")
            {
                Pager1.url += search.Trim() + "/";
            }
            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;
        }
コード例 #12
0
        protected void rptCateMain_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Repeater rptCate = (Repeater)e.Item.FindControl("rptCateSub");

                //找到分类Repeater关联的数据项
                DataRowView rowv = (DataRowView)e.Item.DataItem;
                //提取分类ID
                int CategoryId = Convert.ToInt32(rowv["SysNo"]);
                //根据分类ID查询该分类下的子分类,并绑定子分类Repeater

                DataTable dt = QA_CategoryBll.GetInstance().GetCates(CategoryId);
                dt.Columns.Add("selected");
                dt.Columns.Add("Replys");
                dt.Columns.Add("QuestNum");
                dt.Columns.Add("SolvedNum");
                dt.Columns.Add("Type");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["topsysno"].ToString() == "1")
                    {
                        dt.Rows[i]["Type"] = "Quest";
                    }
                    else
                    {
                        dt.Rows[i]["Type"] = "Talk";
                    }
                    dt.Rows[i]["QuestNum"] = "0";
                    DataTable questnum = QA_CategoryBll.GetInstance().GetCatesPostNum().Tables[0];
                    for (int j = 0; j < questnum.Rows.Count; j++)
                    {
                        if (questnum.Rows[j]["CateSysNo"].ToString() == dt.Rows[i]["SysNo"].ToString())
                        {
                            dt.Rows[i]["QuestNum"] = int.Parse(dt.Rows[i]["QuestNum"].ToString()) + int.Parse(questnum.Rows[j]["questnum"].ToString());
                            if (questnum.Rows[j]["IsSolved"].ToString() == "1")
                            {
                                dt.Rows[i]["SolvedNum"] = dt.Rows[i]["QuestNum"].ToString();
                            }
                        }
                    }
                    DataTable postnum = QA_CategoryBll.GetInstance().GetCatesPostNum().Tables[1];
                    for (int j = 0; j < postnum.Rows.Count; j++)
                    {
                        if (postnum.Rows[j]["CateSysNo"].ToString() == dt.Rows[i]["SysNo"].ToString())
                        {
                            dt.Rows[i]["Replys"] = int.Parse(dt.Rows[i]["QuestNum"].ToString()) + int.Parse(postnum.Rows[j]["AnswerNum"].ToString()) + int.Parse(postnum.Rows[j]["CommentNum"].ToString());
                        }
                    }

                    dt.Rows[i]["selected"] = "s" + i;
                    if (cate != 0)
                    {
                        if (cate.ToString() == dt.Rows[i]["SysNo"].ToString())
                        {
                            dt.Rows[i]["selected"] = "s" + i + "' style='text-decoration:underline;";
                        }
                    }
                }
                rptCate.DataSource = dt;
                rptCate.DataBind();
            }
        }
コード例 #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["key"] != null)
     {
         txtName.Text = Server.HtmlEncode(Request.QueryString["key"]);
     }
     else if (Page.RouteData.Values["key"] != null && Page.RouteData.Values["key"].ToString() != "")
     {
         txtName.Text = Server.HtmlEncode(Page.RouteData.Values["key"].ToString());
     }
     if (Request.QueryString["cate"] != null)
     {
         try
         {
             cate = int.Parse(Request.QueryString["cate"]);
         }
         catch
         {
             return;
         }
     }
     else if (Page.RouteData.Values["cate"] != null && Page.RouteData.Values["cate"].ToString() != "")
     {
         try
         {
             cate = int.Parse(Page.RouteData.Values["cate"].ToString());
         }
         catch
         {
             return;
         }
     }
     else
     {
         return;
     }
     if (!IsPostBack)
     {
         QA_CategoryMod m_cate = QA_CategoryBll.GetInstance().GetModel(cate);
         if (m_cate.TopSysNo == 1)
         {
             ltrMaster.Text = "驻场命理师";
         }
         else if (m_cate.TopSysNo == 2)
         {
             ltrMaster.Text = "版主";
         }
         DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(0).Copy();
         for (int i = 0; i < m_dt.Rows.Count; i++)
         {
             if (m_dt.Rows[i]["SysNo"].ToString() != m_cate.TopSysNo.ToString())
             {
                 m_dt.Rows.RemoveAt(i);
                 i--;
             }
         }
         rptCateMain.DataSource = m_dt;
         rptCateMain.DataBind();
         BindStars();
     }
 }
コード例 #14
0
ファイル: Talk.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            if (!IsPostBack)
            {
                Login(Request.Url.ToString());


                SortedList <int, string> timezone = new SortedList <int, string>();
                timezone.Add(0, "零时区");
                for (int i = 1; i < 13; i++)
                {
                    timezone.Add(0 - i, "东" + i + "区");
                }
                for (int i = 1; i < 13; i++)
                {
                    timezone.Add(i, "西" + i + "区");
                }

                drpTimeZone1.DataSource     = timezone;
                drpTimeZone1.DataTextField  = "value";
                drpTimeZone1.DataValueField = "key";
                drpTimeZone1.DataBind();
                drpTimeZone1.SelectedIndex = 4;

                drpTimeZone2.DataSource     = timezone;
                drpTimeZone2.DataTextField  = "value";
                drpTimeZone2.DataValueField = "key";
                drpTimeZone2.DataBind();
                drpTimeZone2.SelectedIndex = 4;

                DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(2);
                //m_dt.Columns.Add("SysNo");
                //m_dt.Columns.Add("Name");
                //for (int i = 0; i < parent.Rows.Count; i++)
                //{
                //    DataTable tmp = QA_CategoryBll.GetInstance().GetCates(int.Parse(parent.Rows[i]["SysNo"].ToString()));
                //    for(int j=0;j<tmp.Rows.Count;j++)
                //    {
                //        DataRow m_dr = m_dt.NewRow();
                //        m_dr["SysNo"] = tmp.Rows[j]["SysNo"];
                //        m_dr["Name"] = parent.Rows[i]["Name"].ToString()+"-"+tmp.Rows[j]["Name"].ToString();
                //        m_dt.Rows.Add(m_dr);
                //    }
                //}
                drpCate.DataSource     = m_dt;
                drpCate.DataValueField = "SysNo";
                drpCate.DataTextField  = "Name";
                drpCate.DataBind();
                drpCate.Items.Insert(0, new ListItem("请选择", "0"));

                drpType.DataSource     = AppEnum.GetChartType();
                drpType.DataTextField  = "value";
                drpType.DataValueField = "key";
                drpType.DataBind();
                drpType.SelectedIndex = 0;

                //ltrPoint.Text = GetSession().CustomerEntity.Point.ToString();
            }
        }
コード例 #15
0
        protected void PrepareForm()
        {
            if (type == "ADD")
            {
                if (Request.QueryString["parent"] == null || Request.QueryString["parent"] == "")
                {
                    Response.Redirect("../Error.aspx?msg=");
                    return;
                }
                try
                {
                    ltrParent.Text = QA_CategoryBll.GetInstance().GetModel(int.Parse(Request.QueryString["parent"])).Name;
                }
                catch
                {
                    Response.Redirect("../Error.aspx?msg=");
                    return;
                }
                ViewState["parent"]        = Request.QueryString["parent"];
                fieldset1.Style["display"] = "";
                fieldset2.Style["display"] = "";
            }
            else if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    try
                    {
                        SysNo = int.Parse(Request.QueryString["id"]);
                        QA_CategoryMod m_cate = QA_CategoryBll.GetInstance().GetModel(SysNo);

                        txtName.Text            = m_cate.Name;
                        drpStatus.SelectedIndex = drpStatus.Items.IndexOf(drpStatus.Items.FindByValue(m_cate.DR.ToString()));

                        DataTable m_child = QA_CategoryBll.GetInstance().GetCates(SysNo);
                        rptFamous.DataSource = m_child;
                        rptFamous.DataBind();

                        if (m_cate.ParentSysNo != 0)
                        {
                            QA_CategoryMod m_parent = QA_CategoryBll.GetInstance().GetModel(m_cate.ParentSysNo);
                            ltrParent.Text = m_parent.Name + "—" + m_cate.Name;
                        }
                        else
                        {
                            ltrParent.Text = "此分类为一级分类";
                        }
                        fieldset1.Style["display"] = "";
                        fieldset2.Style["display"] = "";
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                        return;
                    }
                }
            }
            else if (type == "TOP")
            {
                DataTable m_child = QA_CategoryBll.GetInstance().GetCates(0);
                rptFamous.DataSource = m_child;
                rptFamous.DataBind();
                fieldset1.Style["display"] = "none";
                fieldset2.Style["display"] = "none";
            }
        }
コード例 #16
0
ファイル: Ask.aspx.cs プロジェクト: qubianzhong/luckysign
        protected void Page_Load(object sender, EventArgs e)
        {
            WebForMain.Master.Main m_master = (WebForMain.Master.Main)Master;
            m_master.SetTab(1);
            if (!IsPostBack)
            {
                Login(Request.Url.ToString());


                SortedList <int, string> timezone = new SortedList <int, string>();
                timezone.Add(0, "零时区");
                for (int i = 1; i < 13; i++)
                {
                    timezone.Add(0 - i, "东" + i + "区");
                }
                for (int i = 1; i < 13; i++)
                {
                    timezone.Add(i, "西" + i + "区");
                }

                drpTimeZone1.DataSource     = timezone;
                drpTimeZone1.DataTextField  = "value";
                drpTimeZone1.DataValueField = "key";
                drpTimeZone1.DataBind();
                drpTimeZone1.SelectedIndex = 4;

                drpTimeZone2.DataSource     = timezone;
                drpTimeZone2.DataTextField  = "value";
                drpTimeZone2.DataValueField = "key";
                drpTimeZone2.DataBind();
                drpTimeZone2.SelectedIndex = 4;

                DataTable m_dt = QA_CategoryBll.GetInstance().GetCates(1);
                //m_dt.Columns.Add("SysNo");
                //m_dt.Columns.Add("Name");
                //for (int i = 0; i < parent.Rows.Count; i++)
                //{
                //    DataTable tmp = QA_CategoryBll.GetInstance().GetCates(int.Parse(parent.Rows[i]["SysNo"].ToString()));
                //    for(int j=0;j<tmp.Rows.Count;j++)
                //    {
                //        DataRow m_dr = m_dt.NewRow();
                //        m_dr["SysNo"] = tmp.Rows[j]["SysNo"];
                //        m_dr["Name"] = parent.Rows[i]["Name"].ToString()+"-"+tmp.Rows[j]["Name"].ToString();
                //        m_dt.Rows.Add(m_dr);
                //    }
                //}
                drpCate.DataSource     = m_dt;
                drpCate.DataValueField = "SysNo";
                drpCate.DataTextField  = "Name";
                drpCate.DataBind();
                drpCate.Items.Insert(0, new ListItem("请选择", "0"));

                drpType.DataSource     = AppEnum.GetChartType();
                drpType.DataTextField  = "value";
                drpType.DataValueField = "key";
                drpType.DataBind();
                drpType.SelectedIndex = 1;

                ltrPoint.Text = GetSession().CustomerEntity.Point.ToString();

                #region 占星骰子问题
                if ((Request.QueryString["type"] != null && Request.QueryString["type"] == "dice") ||
                    (Page.RouteData.Values["type"] != null && Page.RouteData.Values["type"].ToString() == "dice"))
                {
                    try
                    {
                        int star          = int.Parse(Request.QueryString["star"]) + 1;
                        int house         = int.Parse(Request.QueryString["house"]) + 1;
                        int constellation = int.Parse(Request.QueryString["const"]) + 1;
                        txtTitle.Text         = Request.QueryString["ask"] + " #" + PublicValue.GetAstroStar(star) + " " + house + "宫 " + PublicValue.GetConstellation(constellation) + "#";
                        drpType.SelectedIndex = drpType.Items.IndexOf(drpType.Items.FindByValue("0"));
                        drpCate.SelectedIndex = drpCate.Items.IndexOf(drpCate.Items.FindByValue("7"));
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "touzi", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                    }
                    catch { }
                }

                #endregion

                #region 排盘跳转解析
                else if (Request.QueryString["type"] != null)
                {
                    try
                    {
                        string[] chart1 = Request.QueryString["chart1"].Split(new char[] { '_' });
                        DatePicker1.SelectedTime = DateTime.Parse(chart1[0] + " " + chart1[1] + ":00");
                        District1.Area3SysNo     = int.Parse(chart1[3]);
                        if (Convert.ToBoolean(int.Parse(chart1[2])))
                        {
                            chkDaylight1.Checked = true;
                        }
                        drpGender1.SelectedIndex = drpGender1.Items.IndexOf(drpGender1.Items.FindByValue(chart1[4]));
                        drpType.SelectedIndex    = drpType.Items.IndexOf(drpType.Items.FindByValue("1"));

                        if (Request.QueryString["type"] == ((int)PublicValue.AstroType.hepan).ToString())
                        {
                            string[] chart2 = Request.QueryString["chart2"].Split(new char[] { '_' });
                            DatePicker2.SelectedTime = DateTime.Parse(chart2[0] + " " + chart2[1] + ":00");
                            District2.Area3SysNo     = int.Parse(chart2[3]);
                            if (Convert.ToBoolean(int.Parse(chart2[2])))
                            {
                                chkDaylight2.Checked = true;
                            }
                            drpGender2.SelectedIndex = drpGender2.Items.IndexOf(drpGender2.Items.FindByValue(chart2[4]));
                            drpType.SelectedIndex    = drpType.Items.IndexOf(drpType.Items.FindByValue("2"));
                        }
                    }
                    catch { }
                }
                #endregion
            }
        }