Ejemplo n.º 1
0
 /// <summary>
 /// 重写父类的虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     Init         += Page_Init;
     goods_id      = DTRequest.GetQueryInt("id");
     order_count   = DTRequest.GetQueryInt("count");
     order_type    = DTRequest.GetQueryString("type");
     order_type_zh = order_type == "ag" ? "银色" : order_type == "gold" ? "金色" : order_type == "red" ? "红色" : " ";
     articleModel  = context.dt_article.SingleOrDefault(a => a.id == goods_id);
     articleDetail = articleModel.dt_article_attribute_value;
     articleAlbums = context.dt_article_albums.Where(a => a.article_id == goods_id && a.remark.Contains("结算")).FirstOrDefault();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            var dbContext = new Agp2pDataContext();

            id          = DTRequest.GetQueryInt("id");
            category_id = DTRequest.GetQueryInt("category_id");
            page        = DTRequest.GetQueryString("page");
            BLL.article bll = new BLL.article();

            if (0 < id) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(id))
                {
                    //HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    HttpContext.Current.Response.Redirect(linkurl("404"));
                    return;
                }
                model = bll.GetModel(id);
            }
            else if (!string.IsNullOrEmpty(page)) //否则检查设置的别名
            {
                if (!bll.Exists(page))
                {
                    HttpContext.Current.Response.Redirect(linkurl("404"));
                    return;
                }
                model = bll.GetModel(page);
            }
            else
            {
                return;
            }
            model.click += 1;
            bll.Update(model);

            categoryTitle = dbContext.dt_article_category.Single(c => c.id == model.category_id).title;

            article_attr = dbContext.dt_article_attribute_value.FirstOrDefault(u => u.article_id == model.id);
            if (article_attr == null)
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                return;
            }
            //跳转URL
            if (model.link_url != null)
            {
                model.link_url = model.link_url.Trim();
            }
            if (!string.IsNullOrEmpty(model.link_url))
            {
                HttpContext.Current.Response.Redirect(model.link_url);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 重写父类的虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     Init        += Page_Init;
     goods_id     = DTRequest.GetQueryInt("id");
     articleModel = context.dt_article.SingleOrDefault(a => a.id == goods_id);
     if (articleModel == null)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
         return;
     }
     articleDetail  = articleModel.dt_article_attribute_value;
     jiaxiquanValue = context.dt_article.Where(a => a.dt_article_category.call_index == "jiaxijuan").ToList();
     detailAlbums   = context.dt_article_albums.Where(a => a.article_id == goods_id && a.remark.Contains("首页")).FirstOrDefault();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 发布当天的兑付公告
        /// </summary>
        /// <param name="tasks"></param>
        /// <param name="context"></param>
        public static void SendRepayNotice(List <li_repayment_tasks> tasks, Agp2pDataContext context)
        {
            //找到兑付公告模板
            var temp = context.dt_mail_template.SingleOrDefault(te => te.call_index == "project_repay");

            if (temp != null)
            {
                //构造兑付项目表格
                var tableTemplate = "<table class='table table-bordered'><tbody><tr><th>序号</th><th>项目类别</th><th>项目名称</th><th>返回金额(元)</th><th>返回本金(元)</th><th>返回收益(元)</th></tr>{tr}</tbody></table>";
                var trTemplate    = "<tr><td>{no}</td><td>{project_type}</td><td>{project_name}</td><td>{amount}</td><td>{principal}</td><td>{interest}</td></tr>";

                var trAll = Enumerable.Range(0, tasks.Count).Select(i =>
                {
                    var t = tasks[i];
                    return(trTemplate.Replace("{no}", (i + 1).ToString())
                           .Replace("{project_type}", t.li_projects.dt_article_category.title)
                           .Replace("{project_name}", t.li_projects.title)
                           .Replace("{amount}", (t.repay_principal + t.repay_interest).ToString("N"))
                           .Replace("{principal}", t.repay_principal.ToString("N"))
                           .Replace("{interest}", t.repay_interest.ToString("N")));
                });

                var tableContent = tableTemplate.Replace("{tr}", string.Join("", trAll));

                var siteConfig = ConfigLoader.loadSiteConfig();
                var addTime    = DateTime.Now;
                var content    = temp.content.Replace("{today}", addTime.ToString("yyyy-MM-dd"))
                                 .Replace("{count}", tasks.Count.ToString())
                                 .Replace("{table}", tableContent)
                                 .Replace("{webtel}", siteConfig == null ? "" : siteConfig.webtel);

                //创建公告
                try
                {
                    var title  = addTime.ToString("yyyy年M月d日") + "项目兑付公告";
                    var notice = new dt_article
                    {
                        add_time     = addTime,
                        category_id  = 43,
                        channel_id   = 5,
                        title        = title,
                        seo_title    = title,
                        seo_keywords = "安广融合p2p,项目兑付公告",
                        content      = content
                    };

                    var noticeAttr = new dt_article_attribute_value
                    {
                        dt_article = notice,
                        author     = "安广融合",
                        source     = "安广融合理财平台"
                    };

                    context.dt_article.InsertOnSubmit(notice);
                    context.dt_article_attribute_value.InsertOnSubmit(noticeAttr);
                    context.SubmitChanges();
                }
                catch (Exception ex)
                {
                    context.AppendAdminLogAndSave("AutoRepay", "发送兑付公告失败:" + ex.Message);
                }
            }
        }
Ejemplo n.º 5
0
        protected void btnGenerate_OnClick(object sender, EventArgs e)
        {
            var publishTime = HttpContext.Current.Request["__EVENTARGUMENT"];

            if (string.IsNullOrWhiteSpace(publishTime))
            {
                JscriptMsg("发标时间不能不填", "");
                return;
            }

            var projIds =
                rptList1.Items.Cast <Control>()
                .Where(c => ((CheckBox)c.FindControl("chkId")).Checked)
                .Select(c => Convert.ToInt32(((HiddenField)c.FindControl("hidId")).Value))
                .ToArray();

            if (!projIds.Any())
            {
                JscriptMsg("请先选择项目", "");
                return;
            }

            var projects = context.li_projects.Where(p => projIds.Contains(p.id)).ToList();

            //构造兑付项目表格
            var tableTemplate = "<table class='table table-bordered'><tbody><tr><th>序号</th><th>项目类别</th><th>项目名称</th><th>项目金额</th><th>项目期限</th><th>预期年化率</th><th>还款方式</th><th>发标时间</th></tr>{trs}</tbody></table>";
            var trTemplate    = "<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td></tr>";

            var trAll = Enumerable.Range(0, projects.Count).Select(i =>
            {
                var p = projects[i];
                return(string.Format(trTemplate, i + 1, p.dt_article_category.title, p.title, p.financing_amount, p.repayment_term_span_count + p.GetProjectTermSpanEnumDesc(),
                                     (p.profit_rate_year / 100).ToString("p2"), p.GetProjectRepaymentTypeDesc(), publishTime));
            });

            var tableContent = tableTemplate.Replace("{trs}", string.Join("", trAll));

            var channelId  = context.dt_channel.Single(ch => ch.name == "content_project").id;
            var categoryId = context.dt_article_category.Single(c => c.call_index == "content_project_fabiao").id;

            var announcement = new dt_article
            {
                add_time    = DateTime.Now,
                content     = tableContent,
                title       = publishTime + "发标公告",
                channel_id  = channelId,
                category_id = categoryId,
                sort_id     = 99,
                is_sys      = 1,
                is_top      = 0,
                is_red      = 0,
                is_hot      = 0,
                is_msg      = 0,
                is_slide    = 0,
                user_name   = GetAdminInfo().user_name,
                status      = 0
            };

            var articleAttr = new dt_article_attribute_value
            {
                dt_article = announcement,
                author     = "安广融合",
                source     = "安广融合理财平台"
            };

            context.dt_article_attribute_value.InsertOnSubmit(articleAttr);
            context.dt_article.InsertOnSubmit(announcement);
            context.SubmitChanges();

            JscriptMsg("发布成功", "");
        }