private double GetYF(Guid id, int type)
        {
            double s     = 0;
            string mouth = DateTime.Now.Month + "";

            if (DateTime.Now.Month + 1 < 10)
            {
                mouth = "0" + DateTime.Now.Month;
            }
            string date = DateTime.Now.Year + "-" + mouth;//本月

            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var qu = cc.GrabageWeightSon.Where(x => x.GrabageRoom.VillageId == id && x.IsDelete != "1" && x.AddTime.Contains(date) && x.GrabageRoomId != null);
                if (type == 1)
                {
                    qu = qu.Where(x => x.Type.Contains("1"));
                }
                else if (type == 2)
                {
                    qu = qu.Where(x => !x.Type.Contains("1"));
                }
                foreach (var item in qu.ToList())
                {
                    s += double.Parse(item.Weight);
                }
                return(s);
            }
        }
 public ShopController(RefuseClassificationContext dbContext, IMapper mapper, IOptions <MdDesEncrypt> mdDesEncrypt, IHostingEnvironment hostingEnvironment)
 {
     _dbContext          = dbContext;
     _mapper             = mapper;
     MdDesEncrypt        = mdDesEncrypt.Value;
     _hostingEnvironment = hostingEnvironment;
 }
示例#3
0
        /// <summary>
        /// 获取总服务次数
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private static int GetAllCount(Guid id)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                //var query = (from a in cc.VolunteerService
                //             where a.SystemUserUuid == id && a.IsDelete != "1"
                //             select a).ToList();
                //return query.Count().ToString();

                int count = 0;//打卡次数
                //搜索志愿者打卡次数
                var a = cc.Attendance.Where(x => x.Type == "1" && x.IsDelete != "1" && x.SystemUserUuid == id).ToList();
                foreach (var item in a)
                {
                    //上/下午有一次打卡记录就加1,一天最多2次
                    if (!string.IsNullOrEmpty(item.AmstartTime) || !string.IsNullOrEmpty(item.AmendTime))
                    {
                        count++;
                    }
                    if (!string.IsNullOrEmpty(item.PmstartTime) || !string.IsNullOrEmpty(item.PmendTime))
                    {
                        count++;
                    }
                }
                return(count);
            }
        }
 public RubbishController(RefuseClassificationContext dbContext, IMapper mapper, IOptions <MdDesEncrypt> mdDesEncrypt, IHostingEnvironment hostingEnvironment, ILogger <TestController> logger)
 {
     _dbContext          = dbContext;
     _mapper             = mapper;
     _hostingEnvironment = hostingEnvironment;
     _logger             = logger;
 }
        public GlobalController(RefuseClassificationContext dbContext, IMapper mapper, IHostingEnvironment ihhostingEnvironment)

        {
            _dbContext = dbContext;
            _mapper    = mapper;
            _hostEnv   = ihhostingEnvironment;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="mapper"></param>
 public UserController(RefuseClassificationContext dbContext, IMapper mapper, IOptions <MdDesEncrypt> mdDesEncrypt, IOptions <AppAuthenticationSettings> appSettings)
 {
     _appSettings = appSettings.Value;
     _dbContext   = dbContext;
     _mapper      = mapper;
     MdDesEncrypt = mdDesEncrypt.Value;
 }
示例#7
0
 //异常打卡次数
 private string GetPeople(Guid id)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         var query = (from a in cc.Attendance
                      where a.GarbageRoomUuid == id && a.IsDelete != "1" && (a.StartState == 0 || a.EndState == 0)
                      select a).ToList();
         return(query.Count().ToString());
     }
 }
示例#8
0
        private static int GetAllzyzScore(Guid id)
        {
            int s = 0;

            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var query = cc.Overallsituation.FirstOrDefault();
                //string t = GetServiceTime(id);
                s = query.HourScore * GetAllCount(id);
                return(s);
            }
        }
        private static string GraRoom(Guid guid, int type)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                //_logger.LogError(message: "66666666666");
                string s     = "";
                var    groom = "";

                if (type == 1)
                {
                    var ddquery = (from a in cc.SystemUser
                                   where a.GrabageRoomId == guid
                                   select new
                    {
                        a.SystemUserUuid
                    }).ToList();
                    for (int i = 0; i < ddquery.Count; i++)
                    {
                        groom = cc.SystemUser.FirstOrDefault(x => x.SystemUserUuid == ddquery[i].SystemUserUuid && x.IsDeleted != 1)?.RealName;
                    }
                }
                else
                {
                    var query = (from a in cc.GrabageWeightSon
                                 where a.GrabageRoomId == guid
                                 group a by a.CarUuid
                                 into b
                                 select new
                    {
                        b.Key
                    }).ToList();
                    for (int i = 0; i < query.Count; i++)
                    {
                        groom = cc.Car.FirstOrDefault(x => x.CarUuid == query[i].Key && x.IsDelete != 1)?.CarNum;
                    }
                }

                if (s == "")
                {
                    s = groom;
                }
                else
                {
                    s += "," + groom;
                }

                //_logger.LogError(message: "888888888");
                return(s);
            }
        }
示例#10
0
        /// <summary>
        /// 获取总服务时长
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private static string GetServiceTime(Guid id)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var query = (from a in cc.Attendance
                             where a.SystemUserUuid == id && a.IsDelete != "1" && a.Type == "1"
                             select a).ToList();
                TimeSpan s = new TimeSpan();
                foreach (var item in query)
                {
                    //上午
                    if (!string.IsNullOrEmpty(item.AmstartTime) || !string.IsNullOrEmpty(item.AmendTime))
                    {
                        //当天日期

                        //没有签退时间就默认为12:00
                        if (!string.IsNullOrEmpty(item.AmendTime))
                        {
                            s += (DateTime.Parse(item.AmendTime) - DateTime.Parse(item.AmstartTime));
                        }
                        else
                        {
                            string date = item.AmstartTime.Trim().Split(" ")[0];
                            s += (DateTime.Parse(date + " 12:00:00") - DateTime.Parse(item.AmstartTime));
                        }
                    }
                    //下午
                    if (!string.IsNullOrEmpty(item.PmstartTime) || !string.IsNullOrEmpty(item.PmendTime))
                    {
                        //没有签退时间就默认为24:00
                        if (!string.IsNullOrEmpty(item.PmendTime))
                        {
                            s += (DateTime.Parse(item.PmendTime) - DateTime.Parse(item.PmstartTime));
                        }
                        else
                        {
                            string date = item.PmstartTime.Trim().Split(" ")[0];
                            s += (DateTime.Parse(date + " 23:59:59") - DateTime.Parse(item.PmstartTime));
                        }
                    }
                    //if (!string.IsNullOrEmpty(item.Intime) && !string.IsNullOrEmpty(item.Outtime))
                    //{
                    //    s += (DateTime.Parse(item.Outtime) - DateTime.Parse(item.Intime));
                    //}
                }
                return(Math.Floor(s.TotalHours).ToString());
            }
        }
        private int YHjifen(string id)
        {
            string mouth = DateTime.Now.Month + "";

            if (DateTime.Now.Month + 1 < 10)
            {
                mouth = "0" + DateTime.Now.Month;
            }
            string date = DateTime.Now.Year + "-" + mouth;//本月

            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                int qu = cc.GrabageDisposal.Where(x => x.HomeAddressUuid == Guid.Parse(id) && x.IsDelete != "1" && x.AddTime.Contains(date)).Select(x => new { Integral = x.ScoreSettingUu.Integral }).Sum(x => x.Integral).Value;
                return(qu);
            }
        }
 private string getGoods(Guid id)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         string s   = "";
         var    req = cc.Goods.Where(x => x.ShopId == id && x.State != "1");
         if (req == null)
         {
             return("");
         }
         foreach (var item in req)
         {
             s += item.Gname + ",";
         }
         return(s.TrimEnd(','));
     }
 }
 //收运垃圾类型
 private string GetGarbage(Guid ljid)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         var query = (from a in cc.RubbishSyrecord
                      where a.CarUuid == ljid && a.IsDelete == "0"
                      select a).ToList();
         string s = "";
         foreach (var item in query)
         {
             if (!string.IsNullOrEmpty(item.RubbishType))
             {
                 s += item.RubbishType;
             }
         }
         return(s);
     }
 }
示例#14
0
 private double GetUsedScore(Guid ownid)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         var query = (from a in cc.GoodsExchange
                      where a.SystemUserUuid == ownid
                      select a).ToList();
         double s = 0;
         foreach (var item in query)
         {
             if (!string.IsNullOrEmpty(item.DeduceScore))
             {
                 s += double.Parse(item.DeduceScore);
             }
         }
         return(s);
     }
 }
示例#15
0
 /// <summary>
 /// 获取单个分数
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 private static int GetSingleScore(Guid id)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         int      hs    = cc.Overallsituation.FirstOrDefault().HourScore;
         int      s     = 0;
         string   t     = "";
         TimeSpan ts    = new TimeSpan();
         var      query = cc.VolunteerService.FirstOrDefault(x => x.VolunteerServiceUuid == id);
         if (!string.IsNullOrEmpty(query.Intime) && !string.IsNullOrEmpty(query.Outtime))
         {
             ts = (DateTime.Parse(query.Outtime) - DateTime.Parse(query.Intime));
         }
         t = Math.Floor(ts.TotalHours).ToString();
         s = hs * int.Parse(t);
         return(s);
     }
 }
 //垃圾房
 private string GetLj(Guid ljid)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         var query = (from a in cc.GrabageRoom
                      where a.CarId == ljid && a.IsDelete != "1"
                      select a).ToList();
         string s = "";
         foreach (var item in query)
         {
             if (!string.IsNullOrEmpty(item.Ljname))
             {
                 s += item.Ljname + "、";
             }
         }
         return(s.TrimEnd('、'));
     }
 }
 private static int score(string name)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         var num = (from g in cc.GrabageDisposal
                    join h in cc.HomeAddress
                    on g.HomeAddressUuid equals h.HomeAddressUuid
                    join s in cc.ScoreSetting
                    on g.ScoreSettingUuid equals s.ScoreUuid
                    where h.Ccmmunity == name && g.IsScore == "1" &&
                    g.IsDelete != "1"
                    select new
         {
             s.Integral
         }).Sum(x => x.Integral).Value;
         return(num);
     }
 }
示例#18
0
        //服务积分
        private static int GetAllFWScore(Guid id)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var query = (from a in cc.VolunteerService
                             where a.SystemUserUuid == id && a.IsDelete != "1"
                             select a).ToList();
                int s = 0;
                foreach (var item in query)
                {
                    if (!string.IsNullOrEmpty(item.Score))
                    {
                        s += int.Parse(item.Score);
                    }
                }

                return(s);
            }
        }
示例#19
0
        public static bool CreateSystemLog(string OperationContent, string Type)
        {
            using (var _dbContext = new RefuseClassificationContext())
            {
                var entity = new SystemLog();
                entity.AddPeople     = AuthContextService.CurrentUser.DisplayName;
                entity.AddTime       = DateTime.Now;
                entity.OperationTime = DateTime.Now;
                //entity.Ipaddress = model.Ipaddress;
                entity.IsDelete         = 1;
                entity.OperationContent = OperationContent;
                entity.Type             = Type;
                entity.UserId           = AuthContextService.CurrentUser.Guid.ToString();
                entity.UserName         = AuthContextService.CurrentUser.DisplayName;
                string UserType = AuthContextService.CurrentUser.UserType.ToString();
                if (UserType == "SuperAdministrator")
                {
                    entity.UserIdtype = 0;
                }
                else if (UserType == "Admin")
                {
                    entity.UserIdtype = 1;
                }
                else if (UserType == "GeneralUser")
                {
                    entity.UserIdtype = 2;
                }
                else if (UserType == "Parent")
                {
                    entity.UserIdtype = 3;
                }
                else
                {
                    entity.UserIdtype = 4;
                }
                _dbContext.SystemLog.Add(entity);
                _dbContext.SaveChanges();

                return(true);
            }
        }
        private string GetroleName(string ids)
        {
            string s = "";

            string[] temp = ids.TrimEnd(',').Split(',');
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    if (!string.IsNullOrEmpty(temp[i]))
                    {
                        var qu = cc.SystemRole.Where(x => x.SystemRoleUuid == Guid.Parse(temp[i])).Select(x => new { x.RoleName }).ToList();
                        if (!string.IsNullOrEmpty(qu[0].RoleName))
                        {
                            s += qu[0].RoleName + ",";
                        }
                    }
                }
                return(s.TrimEnd(','));
            }
        }
 /// <summary>
 /// 获取打卡次数
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 private int GetAllCount(Guid id)
 {
     using (RefuseClassificationContext cc = new RefuseClassificationContext())
     {
         int count = 0;//打卡次数
         //搜索志愿者打卡次数
         var a = cc.Attendance.Where(x => x.Type == "1" && x.IsDelete != "1" && x.SystemUserUuid == id).ToList();
         foreach (var item in a)
         {
             //上/下午有一次打卡记录就加1,一天最多2次
             if (!string.IsNullOrEmpty(item.AmstartTime) || !string.IsNullOrEmpty(item.AmendTime))
             {
                 count++;
             }
             if (!string.IsNullOrEmpty(item.PmstartTime) || !string.IsNullOrEmpty(item.PmendTime))
             {
                 count++;
             }
         }
         return(count);
     }
 }
示例#22
0
        private double GetAllScore(Guid ownid)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var query = from a in cc.GrabageDisposal
                            where a.HomeAddressUuid == ownid && a.IsScore == "1"
                            select new
                {
                    Score = a.ScoreSettingUu.Integral
                };
                double s = 0;
                foreach (var item in query)
                {
                    if (!string.IsNullOrEmpty(item.Score.ToString()))
                    {
                        s += (double)item.Score;
                    }
                }

                return(s);
            }
        }
示例#23
0
        //投放积分
        private static int GetAllTFScore(Guid ownid)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                var query = from a in cc.GrabageDisposal
                            where a.SystemUserUuid == ownid && a.IsDelete != "1"
                            select new
                {
                    Score = a.ScoreSettingUu.Integral
                };
                int s = 0;
                foreach (var item in query)
                {
                    if (!string.IsNullOrEmpty(item.Score.ToString()))
                    {
                        s += (int)item.Score;
                    }
                }

                return(s);
            }
        }
示例#24
0
        //单月易腐烂垃圾比例
        private string GetRubbishBL(Guid id, int type)
        {
            string date  = "0";
            double s     = 0;
            int    month = 0;

            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                if (month == 0)
                {
                    //(当月易腐烂垃圾的重量)
                    //var qu = cc.GrabageWeighting.Where(x => x.GrabageRoom.VillageId == id && x.IsDelete != "1");
                    //if (type == 1)
                    //    qu = qu.Where(x => x.Type.Contains("易腐"));
                    //foreach (var item in qu)
                    //{
                    //    s += double.Parse(item.Weight);
                    //}
                }
                else if (month == 13)
                {
                    for (int i = 1; i <= 13; i++)
                    {
                        if (i != 13)
                        {
                            var qu = cc.GrabageWeighting.Where(x => x.GrabageRoom.VillageId == id && x.IsDelete != "1" && x.AddTime.Contains(date));
                        }
                        else
                        {
                        }
                    }
                }
                else
                {
                }
                return(s.ToString());
            }
        }
        private static string GraRoom(Guid guid, int type)
        {
            using (RefuseClassificationContext cc = new RefuseClassificationContext())
            {
                string s     = "";
                var    groom = "";
                var    query = (from a in cc.GrabageWeightSon
                                where a.GrabageRoomId != null &&
                                a.CarUuid == guid
                                group a by a.GrabageRoomId
                                into b
                                select new
                {
                    b.Key
                }).ToList();
                for (int i = 0; i < query.Count; i++)
                {
                    if (type == 1)
                    {
                        groom = cc.GrabageRoom.FirstOrDefault(x => x.GarbageRoomUuid == query[i].Key && x.IsDelete != "1").Ljname;
                    }
                    else
                    {
                        groom = cc.GrabageRoom.FirstOrDefault(x => x.GarbageRoomUuid == query[i].Key && x.IsDelete != "1").WingId;
                    }

                    if (s == "")
                    {
                        s = groom;
                    }
                    else
                    {
                        s += "," + groom;
                    }
                }
                return(s);
            }
        }
 public StatisticsController(RefuseClassificationContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
 public ResponseController(RefuseClassificationContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
示例#28
0
 public HouseholdController(RefuseClassificationContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 public AccountController(RefuseClassificationContext dbContext)
 {
     _dbContext = dbContext;
 }
示例#30
0
 public GoodsController(RefuseClassificationContext db)
 {
     _dbContext = db;
 }