Ejemplo n.º 1
0
        public async Task update(int repairListId, RepairStatusEnum statusEnum)
        {
            var sql = $" update RepairList set Status = {(int)statusEnum} where Id = {repairListId} ";
            await DapperService.Execute(sql);

            var msg = "";

            if (statusEnum == RepairStatusEnum.Doing)
            {
                msg = "修理工已到达";
            }

            if (statusEnum == RepairStatusEnum.Down)
            {
                msg = "已完成,待评价";
            }

            if (statusEnum == RepairStatusEnum.Success)
            {
                msg = "完成";
            }
            var info = new RepairListInfo()
            {
                ListId = repairListId,
                Remake = msg,
                Status = (int)statusEnum
            };
            await _infoRepository.InsertAsync(info);
        }
Ejemplo n.º 2
0
        public async Task AppointRepairMan(int repairId, int repairManId)
        {
            var sql = $"update RepairList set RepairManId = {repairManId} ,status = 2 where Id = {repairId}";
            await DapperService.Execute(sql);

            var repair = await _userRepository.FirstOrDefultAsync(p => p.Id == repairManId);

            var info = new RepairListInfo()
            {
                ListId = repairId,
                Remake = $"系统派单,修理工:{repair.Name}({repair.Mobile})",
                Status = (int)RepairStatusEnum.Sure
            };
            await _infoRepository.InsertAsync(info);

            var repairList = await _repository.FirstOrDefultAsync(p => p.Id == repairId);

            var user = await _userRepository.FirstOrDefultAsync(p => p.Id == repairList.UserId);

            SmsHelper.sendUserMsg(user.Mobile, new { name = repair.Name, tel = repair.Mobile });
            Console.WriteLine("发送给用户:" + user.Mobile);

            var comm = await _communityRepository.FirstOrDefultAsync(p => p.Id == user.CommunityId);

            SmsHelper.sendRepairMsg(repair.Mobile, new { home = $"{comm.Name}-{user.HomeNum}" });
            Console.WriteLine("发送给维修工:" + repair.Mobile);
        }
Ejemplo n.º 3
0
        public async Task CancleRepairMan(int userId)
        {
            var sql = $"update Users set IsRepairMan = 0 where id = {userId}";
            await DapperService.Execute(sql);

            var sql2 = $"delete from RepairMan where UserId = {userId}";
            await DapperService.Execute(sql2);
        }
Ejemplo n.º 4
0
        public async Task SetCommuityAdmin(int commuityId, int userId)
        {
            var sql = $"update Community set AdminId = {userId} where Id = {commuityId} ";
            await DapperService.Execute(sql);

            var sql2 = $"update Users set IsAdmin = 1 where Id = {userId}";
            await DapperService.Execute(sql2);
        }
Ejemplo n.º 5
0
        public async Task DelCommunity(int id)
        {
            var sql = $" DELETE FROM Community WHERE Id = {id}  ";
            await DapperService.Execute(sql);

            var sql2 = $" DELETE FROM RepairList WHERE CommunityId = {id}; ";
            await DapperService.Execute(sql2);

            var sql3 = $" DELETE FROM RepairMan WHERE CommunityId = {id}; ";
            await DapperService.Execute(sql3);
        }
Ejemplo n.º 6
0
        public async Task CommRepairRemake(ComRepairDTO dto)
        {
            var sql = $" UPDATE RepairList SET `Status` = {(int)RepairStatusEnum.Success} WHERE Id = {dto.repairId} ;";
            await DapperService.Execute(sql);

            var info = new RepairListInfo()
            {
                ListId = dto.repairId,
                Remake = dto.str,
                Status = (int)RepairStatusEnum.Success
            };
            await _repository.InsertAsync(info);
        }
Ejemplo n.º 7
0
        public async Task SetCommuityRepairMan(int commuityId, int userId)
        {
            var sql = $"update Community set RepairManId = {userId} where Id = {commuityId} and RepairManId > 0 ";
            await DapperService.Execute(sql);

            var u = await _userRepository.FirstOrDefultAsync(p => p.Id == userId);

            var comm = await _repository.FirstOrDefultAsync(p => p.Id == commuityId);

            var man = new RepairMan()
            {
                CommunityId   = commuityId,
                UserId        = userId,
                RepairManName = u?.Name,
                CommunityName = comm?.Name
            };
            await _repairManRepository.InsertAsync(man);
        }
Ejemplo n.º 8
0
        public async Task MakeRepairMan(int userId, string communityIds)
        {
            var sql = $"update Users set IsRepairMan = 1 where id = {userId}";
            await DapperService.Execute(sql);

            //var hasMan = await _repairManRepository.CountAsync(p => p.UserId == userId);
            //if (hasMan > 0)
            //{
            //    var sql2 = $"update RepairMan set CommunityIds = '{communityIds}' ";
            //    await DapperService.Execute(sql2);
            //}
            //else
            //{
            //    var repairMan = new RepairMan()
            //    {
            //        UserId = userId,
            //        CommunityIds = communityIds
            //    };
            //    await _repairManRepository.InsertAsync(repairMan);
            //}
        }