12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections.Generic;
- using Library;
- using System.Linq;
- using MySystem.MainModels;
- namespace MySystem
- {
- public class UsersDbconn
- {
- public readonly static UsersDbconn Instance = new UsersDbconn();
- #region 获取单个字段
- public Users Get(int Id)
- {
- WebCMSEntities db = new WebCMSEntities();
- Users order = db.Users.FirstOrDefault(m => m.Id == Id);
- if (order != null)
- {
- }
- db.Dispose();
- return order;
- }
- //个人新增创客
- public int GetNewUserCount(int UserId, string TradeMonthOrDate = "")
- {
- int count = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(string.IsNullOrEmpty(TradeMonthOrDate))
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.SeoTitle == "self");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.SeoTitle == "self").Sum(m => m.RecUserAuthNum);
- }
- }
- else
- {
- if(TradeMonthOrDate.Length == 8)
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.StatDate == TradeMonthOrDate && m.SeoTitle == "self");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.StatDate == TradeMonthOrDate && m.SeoTitle == "self").Sum(m => m.RecUserAuthNum);
- }
- }
- else
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.StatMonth == TradeMonthOrDate && m.SeoTitle == "self");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.StatMonth == TradeMonthOrDate && m.SeoTitle == "self").Sum(m => m.RecUserAuthNum);
- }
- }
- }
- db.Dispose();
- return count;
- }
- //团队新增创客
- public int GetTeamNewUserCount(int UserId, string TradeMonthOrDate = "")
- {
- int count = 0;
- WebCMSEntities db = new WebCMSEntities();
- if(string.IsNullOrEmpty(TradeMonthOrDate))
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.SeoTitle == "team");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.SeoTitle == "team").Sum(m => m.RecUserAuthNum);
- }
- }
- else
- {
- if(TradeMonthOrDate.Length == 8)
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.StatDate == TradeMonthOrDate && m.SeoTitle == "team");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.StatDate == TradeMonthOrDate && m.SeoTitle == "team").Sum(m => m.RecUserAuthNum);
- }
- }
- else
- {
- bool check = db.PullnewSummary.Any(m => m.UserId == UserId && m.StatMonth == TradeMonthOrDate && m.SeoTitle == "team");
- if (check)
- {
- count = db.PullnewSummary.Where(m => m.UserId == UserId && m.StatMonth == TradeMonthOrDate && m.SeoTitle == "team").Sum(m => m.RecUserAuthNum);
- }
- }
- }
- db.Dispose();
- return count;
- }
- #endregion
- }
- }
|