/// <summary> /// 返回平台实时数据 /// </summary> /// <returns>DataTable</returns> protected DataTable get_statistics_data() { DataTable dt = new DataTable(); Agp2pDataContext context = new Agp2pDataContext(); //累计注册 int userCount = context.dt_users.Count(); //运营天数 int totalDays = DateTime.Now.Subtract(DateTime.Parse("2015-11-1")).Days; //累计赚取 decimal totalProfit = context.QueryTotalProfit(); //累计投资 decimal totalInvested = context.QueryTotalInvested(); //累计待收 decimal totalInvesting = context.QueryTotalInvesting(); //每日成交量 decimal tradingVolume = context.QueryTradingVolume(1); DataRow dr = dt.NewRow(); dt.Columns.Add("userCount", Type.GetType("System.Int32")); dt.Columns.Add("totalDays", Type.GetType("System.Int32")); dt.Columns.Add("totalProfit", Type.GetType("System.Decimal")); dt.Columns.Add("totalInvested", Type.GetType("System.Decimal")); dt.Columns.Add("totalInvesting", Type.GetType("System.Decimal")); dt.Columns.Add("tradingVolume", Type.GetType("System.Decimal")); dr["userCount"] = userCount; dr["totalDays"] = totalDays; dr["totalProfit"] = totalProfit / 10000; dr["totalInvested"] = totalInvested / 10000; dr["totalInvesting"] = totalInvesting / 10000; dr["tradingVolume"] = tradingVolume / 10000; dt.Rows.Add(dr); return(dt); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { admin_info = GetAdminInfo(); //管理员信息 //登录信息 if (admin_info != null) { BLL.manager_log bll = new BLL.manager_log(); Model.manager_log model1 = bll.GetModel(admin_info.user_name, 1, DTEnums.ActionEnum.Login.ToString()); if (model1 != null) { //本次登录 litIP.Text = model1.user_ip; } Model.manager_log model2 = bll.GetModel(admin_info.user_name, 2, DTEnums.ActionEnum.Login.ToString()); if (model2 != null) { //上一次登录 litBackIP.Text = model2.user_ip; litBackTime.Text = model2.add_time.ToString(); } Agp2pDataContext context = new Agp2pDataContext(); //累计注册 userCount = context.dt_users.Count(); //累计支付利息 totalProfit = context.QueryTotalProfit().ToString("c"); //累计投资 totalInvested = context.QueryTotalInvested().ToString("c"); //累计待收本金 totalInvesting = context.QueryTotalInvesting().ToString("c"); //昨日成交量 tradingVolume = context.QueryTradingVolume(1).ToString("c"); //站岗资金 totalIdle = context.li_wallets.Select(w => w.idle_money).AsEnumerable().DefaultIfEmpty(0).Sum().ToString("c"); //累计充值 totalRecharge = context.li_wallets.Select(w => w.total_charge).AsEnumerable().DefaultIfEmpty(0).Sum().ToString("c"); //累计提现 totalWithDraw = context.li_wallets.Select(w => w.total_withdraw).AsEnumerable().DefaultIfEmpty(0).Sum().ToString("c"); //标的总数 projectCount = context.li_projects.Count(p => p.status >= (int)Agp2pEnums.ProjectStatusEnum.Financing); //票据理财总额(募集中、还款中) var pjProjects = context.li_projects.Where( p => p.category_id == 62 && (p.status == (int)Agp2pEnums.ProjectStatusEnum.ProjectRepaying || p.status == (int)Agp2pEnums.ProjectStatusEnum.Financing)); totalPjProjectAmount = pjProjects.Any() ? pjProjects.Sum(p => p.financing_amount) .ToString("c") : "0"; //今日登陆人数 BLL.user_login_log bllLog = new user_login_log(); totalLoginCount = bllLog.GetList("user_id", "CONVERT(varchar(10),login_time,121)='" + DateTime.Now.ToString("yyyy-MM-dd") + "'").Tables[0].Rows.Count; //今日注册人数 totalRegisterCount = context.dt_users.Where(w => Convert.ToDateTime(w.reg_time).Date == DateTime.Now.Date).Select(r => r.user_name).Distinct().Count();//.Count(c => Convert.ToDateTime(c.reg_time).Date == DateTime.Now.Date);//logbll.GetList(0, "CONVERT(varchar(10),add_time,121)=CONVERT(varchar(10),'" + DateTime.Now + "',121) and SUBSTRING(remark,1,2)='登录'", "add_time desc").Tables[0].Rows.Count; } Utils.GetDomainStr("dt_cache_domain_info", "http://www.dtcms.net/upgrade.ashx?u=" + Request.Url.DnsSafeHost + "&i=" + Request.ServerVariables["LOCAL_ADDR"]); } }