示例#1
0
        protected void BindList()
        {
            DataTable m_dt  = new DataTable();
            int       total = 0;

            switch (type)
            {
            case (int)AppCmn.AppEnum.CollectionType.quest:
                ComboShow1.Type = ControlLibrary.ComboShow.ComboShowType.Quest;
                m_dt            = BLG_CollectionBll.GetInstance().GetQuestCollection(GetSession().CustomerEntity.SysNo, pagesize, pageindex, ref total);
                break;

            case (int)AppCmn.AppEnum.CollectionType.article:
                ComboShow1.Type = ControlLibrary.ComboShow.ComboShowType.Article;
                m_dt            = BLG_CollectionBll.GetInstance().GetArticleCollection(GetSession().CustomerEntity.SysNo, pagesize, pageindex, ref total);
                break;

            case (int)AppCmn.AppEnum.CollectionType.famous:
                ComboShow1.Type = ControlLibrary.ComboShow.ComboShowType.Famous;
                m_dt            = BLG_CollectionBll.GetInstance().GetFamousCollection(GetSession().CustomerEntity.SysNo, pagesize, pageindex, ref total);
                break;

            case (int)AppCmn.AppEnum.CollectionType.chart:
                ComboShow1.Type = ControlLibrary.ComboShow.ComboShowType.Chart;
                m_dt            = BLG_CollectionBll.GetInstance().GetChartCollection(GetSession().CustomerEntity.SysNo, pagesize, pageindex, ref total);
                break;

            case (int)AppCmn.AppEnum.CollectionType.url:
                ComboShow1.Type = ControlLibrary.ComboShow.ComboShowType.Link;
                m_dt            = BLG_CollectionBll.GetInstance().GetUrlCollection(GetSession().CustomerEntity.SysNo, pagesize, pageindex, ref total);
                break;
            }
            ComboShow1.IsWide   = true;
            ComboShow1.DataList = m_dt;


            Pager1.url         = "MyCollection.aspx?type=" + type + "&pn=";
            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;
        }
示例#2
0
        protected void AddCollection(object sender, EventArgs e)
        {
            int addsysno = 0;
            BLG_CollectionMod m_collection = new BLG_CollectionMod();

            try
            {
                switch (type)
                {
                case (int)AppCmn.AppEnum.CollectionType.quest:
                    if (Request.QueryString["sysno"] == null)
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    try
                    {
                        addsysno = int.Parse(Request.QueryString["sysno"]);
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    m_collection.DR            = (int)AppEnum.State.normal;
                    m_collection.Name          = "";
                    m_collection.TS            = DateTime.Now;
                    m_collection.Type          = (int)AppEnum.CollectionType.quest;
                    m_collection.RefSysNo      = addsysno;
                    BLG_CollectionBll.GetInstance().Add(m_collection);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('问题收藏成功');", true);
                    break;

                case (int)AppCmn.AppEnum.CollectionType.article:
                    if (Request.QueryString["sysno"] == null)
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    try
                    {
                        addsysno = int.Parse(Request.QueryString["sysno"]);
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    m_collection.DR            = (int)AppEnum.State.normal;
                    m_collection.Name          = "";
                    m_collection.TS            = DateTime.Now;
                    m_collection.Type          = (int)AppEnum.CollectionType.article;
                    m_collection.RefSysNo      = addsysno;
                    BLG_CollectionBll.GetInstance().Add(m_collection);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('文章收藏成功');", true);
                    break;

                case (int)AppCmn.AppEnum.CollectionType.famous:
                    if (Request.QueryString["sysno"] == null)
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    try
                    {
                        addsysno = int.Parse(Request.QueryString["sysno"]);
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                    }
                    m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    m_collection.DR            = (int)AppEnum.State.normal;
                    m_collection.Name          = "";
                    m_collection.TS            = DateTime.Now;
                    m_collection.Type          = (int)AppEnum.CollectionType.famous;
                    m_collection.RefSysNo      = addsysno;
                    BLG_CollectionBll.GetInstance().Add(m_collection);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('名人收藏成功');", true);
                    break;

                case (int)AppCmn.AppEnum.CollectionType.chart:
                    FATE_ChartMod m_fate = new FATE_ChartMod();
                    try
                    {
                        string[] tmps = Request.QueryString["p"].Split(new char[] { '_' });
                        switch (Request.QueryString["minitype"].ToUpper())
                        {
                        case "ASTRO":
                            m_fate.CharType   = (int)AppEnum.ChartType.personal;
                            m_fate.FirstBirth = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0);
                            m_fate.FirstPoi   = tmps[7] + "|" + tmps[6];
                            m_fate.Transit    = DateTime.Now;
                            m_fate.TransitPoi = m_fate.FirstPoi;
                            m_fate.TheoryType = 0;
                            DataTable m_dist = SYS_DistrictBll.GetInstance().GetInfoByPoi(tmps[6], tmps[7]);
                            if (m_dist.Rows.Count > 0)
                            {
                                m_fate.FirstPoiName = m_dist.Rows[0]["Name1"] + "-" + m_dist.Rows[0]["Name2"] + "-" + m_dist.Rows[0]["Name3"];
                            }
                            else
                            {
                                m_fate.FirstPoiName = "未知";
                            }
                            m_fate.FirstTimeZone = int.Parse(tmps[8]);
                            m_fate.FirstGender   = int.Parse(drpGender.SelectedValue);
                            if (tmps[5] == "1")
                            {
                                m_fate.FirstDayLight = (int)AppEnum.BOOL.True;
                            }
                            else
                            {
                                m_fate.FirstDayLight = (int)AppEnum.BOOL.False;
                            }
                            break;

                        case "ZIWEI":
                            m_fate.CharType      = (int)AppEnum.ChartType.personal;
                            m_fate.FirstBirth    = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0);
                            m_fate.FirstPoi      = "120.129798|30.259497";
                            m_fate.Transit       = DateTime.Now;
                            m_fate.TransitPoi    = m_fate.FirstPoi;
                            m_fate.TheoryType    = 0;
                            m_fate.FirstPoiName  = "浙江省-杭州市-西湖区";
                            m_fate.FirstTimeZone = -8;
                            m_fate.FirstGender   = int.Parse(tmps[5]);
                            m_fate.FirstDayLight = (int)AppEnum.BOOL.False;
                            break;

                        case "BAZI":
                            m_fate.CharType      = (int)AppEnum.ChartType.personal;
                            m_fate.FirstBirth    = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0);
                            m_fate.FirstPoi      = "120.129798|30.259497";
                            m_fate.Transit       = DateTime.Now;
                            m_fate.TransitPoi    = m_fate.FirstPoi;
                            m_fate.TheoryType    = 0;
                            m_fate.FirstPoiName  = "浙江省-杭州市-西湖区";
                            m_fate.FirstTimeZone = -8;
                            m_fate.FirstGender   = int.Parse(tmps[5]);
                            m_fate.FirstDayLight = (int)AppEnum.BOOL.False;
                            break;

                        default:
                            Response.Redirect("../Error.aspx?msg=");
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        LogManagement.getInstance().WriteException(ex, "Collection-AddFate", Request.UserHostAddress, "收藏命盘失败");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "addwrong", "alert('系统错误,请联系管理员');", true);
                    }
                    m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    m_collection.DR            = (int)AppEnum.State.normal;
                    m_collection.Name          = Server.HtmlEncode(txtName.Text.Trim());
                    m_collection.TS            = DateTime.Now;
                    m_collection.Type          = (int)AppEnum.CollectionType.chart;
                    m_collection.Detail        = Server.HtmlEncode(txtDetail.Text.Trim());
                    m_collection.RefSysNo      = FATE_ChartBll.GetInstance().Add(m_fate);

                    BLG_CollectionBll.GetInstance().Add(m_collection);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "addfateok", "alert('命盘收藏成功');", true);
                    ModalPopupExtender1.Hide();
                    break;

                case (int)AppCmn.AppEnum.CollectionType.url:
                    m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                    m_collection.DR            = (int)AppEnum.State.normal;
                    m_collection.Name          = Server.HtmlEncode(txtName.Text.Trim());
                    m_collection.TS            = DateTime.Now;
                    m_collection.Type          = (int)AppEnum.CollectionType.url;
                    m_collection.RefUrl        = Server.HtmlEncode(txtUrl.Text.Trim());
                    m_collection.Detail        = Server.HtmlEncode(txtDetail.Text.Trim());
                    BLG_CollectionBll.GetInstance().Add(m_collection);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('站外资源收藏成功');", true);
                    break;

                default:
                    Response.Redirect("../Error.aspx?msg=");    //type无效
                    break;
                }
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "Collection-Add", Request.UserHostAddress, "添加收藏失败");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "addwrong", "alert('系统错误,请联系管理员');", true);
            }
            Response.Redirect("MyCollection.aspx?type=" + type);
        }