Пример #1
0
        public async Task <Role_Menu> AddAsync(RoleMenuDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var role = await db.Role_Menus.Where(x => x.MenuId == dto.MenuId && x.RolesId == dto.RoleId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (role != null)
                {
                    role.LastOperationTime   = dto.OperationTime;
                    role.LastOperationUserId = dto.OperationUserId;
                    await db.SaveChangesAsync(token);

                    return(role);
                }
                role = new Role_Menu
                {
                    MenuId                = dto.MenuId,
                    RolesId               = dto.RoleId,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    IsDeleted             = false
                };
                db.Role_Menus.Add(role);
                await db.SaveChangesAsync(token);

                return(role);
            }
        }
Пример #2
0
        public async Task <WeiXinUser> AddAsync(WeiXinUserDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var weiXinUser = await db.WeiXinUsers.Where(x => x.Unionid == dto.Unionid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (weiXinUser != null)
                {
                    weiXinUser.City                = dto.City;
                    weiXinUser.Country             = dto.Country;
                    weiXinUser.Groupid             = dto.Groupid;
                    weiXinUser.Headimgurl          = dto.Headimgurl;
                    weiXinUser.Language            = dto.Language;
                    weiXinUser.Nickname            = dto.Nickname;
                    weiXinUser.OpenId              = dto.Openid;
                    weiXinUser.Province            = dto.Province;
                    weiXinUser.Qr_scene            = dto.Qr_scene;
                    weiXinUser.Qr_scene_str        = dto.Qr_scene_str;
                    weiXinUser.Remark              = dto.Remark;
                    weiXinUser.Sex                 = dto.Sex;
                    weiXinUser.Subscribe           = dto.Subscribe;
                    weiXinUser.Subscribe_scene     = dto.Subscribe_scene;
                    weiXinUser.Subscribe_time      = dto.Subscribe_time;
                    weiXinUser.Tagid_list          = dto.Tagid_list;
                    weiXinUser.LastOperationTime   = dto.OperationTime;
                    weiXinUser.LastOperationUserId = dto.OperationUserId;
                    await db.SaveChangesAsync(token);

                    return(weiXinUser);
                }
                var entity = db.WeiXinUsers.Add(new WeiXinUser
                {
                    City                  = dto.City,
                    Country               = dto.Country,
                    Groupid               = dto.Groupid,
                    Headimgurl            = dto.Headimgurl,
                    Language              = dto.Language,
                    Nickname              = dto.Nickname,
                    OpenId                = dto.Openid,
                    Province              = dto.Province,
                    Qr_scene              = dto.Qr_scene,
                    Qr_scene_str          = dto.Qr_scene_str,
                    Remark                = dto.Remark,
                    Sex                   = dto.Sex,
                    Subscribe             = dto.Subscribe,
                    Subscribe_scene       = dto.Subscribe_scene,
                    Subscribe_time        = dto.Subscribe_time,
                    Tagid_list            = dto.Tagid_list,
                    Unionid               = dto.Unionid,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #3
0
        public async Task UpdateAsync(CommunityDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("社区信息不正确!");
                }
                var community = await db.Communities.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (community == null)
                {
                    throw new NotImplementedException("该社区不存在!");
                }

                if (await db.Communities.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.StreetOfficeId == community.StreetOfficeId && x.Id != uid).FirstOrDefaultAsync(token) != null)
                {
                    throw new NotImplementedException("该社区名称已存在!");
                }
                community.Name = dto.Name;
                community.LastOperationTime   = dto.OperationTime;
                community.LastOperationUserId = dto.OperationUserId;
                await OnUpdate(db, community, token);

                await db.SaveChangesAsync(token);
            }
        }
Пример #4
0
        public async Task <VoteRecord> AddAsync(VoteRecordDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.VoteId, out var voteId))
                {
                    throw new NotImplementedException("投票Id信息不正确!");
                }
                var vote = await db.Votes.Where(x => x.Id == voteId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (vote == null)
                {
                    throw new NotImplementedException("投票信息不存在!");
                }

                var entity = db.VoteRecords.Add(new VoteRecord
                {
                    Feedback              = dto.Feedback,
                    VoteId                = dto.VoteId,
                    OwnerCertificationId  = dto.OwnerCertificationId,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #5
0
        public async Task <StreetOffice> AddAsync(StreetOfficeDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var streetOffice = await db.StreetOffices.Where(x => x.Name == dto.Name && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (streetOffice != null)
                {
                    throw new NotImplementedException("该街道办已存在!");
                }
                var entity = db.StreetOffices.Add(new StreetOffice
                {
                    Name   = dto.Name,
                    City   = dto.City,
                    Region = dto.Region,
                    State  = dto.State,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #6
0
        public async Task UpdateAsync(VipOwnerCertificationConditionDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("高级认证申请条件Id信息不正确!");
                }
                var vipOwnerCertificationCondition = await db.VipOwnerCertificationConditions.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (vipOwnerCertificationCondition == null)
                {
                    throw new NotImplementedException("该高级认证申请条件不存在!");
                }
                if (await db.VipOwnerCertificationConditions.Where(x => x.Title == dto.Title && x.IsDeleted == false && x.Id != vipOwnerCertificationCondition.Id).FirstOrDefaultAsync(token) != null)
                {
                    throw new NotImplementedException("该高级认证申请条件名称已存在!");
                }

                vipOwnerCertificationCondition.Title               = dto.Title;
                vipOwnerCertificationCondition.Description         = dto.Description;
                vipOwnerCertificationCondition.LastOperationTime   = dto.OperationTime;
                vipOwnerCertificationCondition.LastOperationUserId = dto.OperationUserId;

                await db.SaveChangesAsync(token);
            }
        }
Пример #7
0
        public async Task <Building> AddAsync(BuildingDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.SmallDistrictId, out var smallDistrictId))
                {
                    throw new NotImplementedException("小区信息不正确!");
                }
                var smallDistricts = await db.SmallDistricts.Where(x => x.Id == smallDistrictId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (smallDistricts == null)
                {
                    throw new NotImplementedException("小区信息不存在!");
                }

                var duilding = await db.Buildings.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.SmallDistrictId == smallDistrictId).FirstOrDefaultAsync(token);

                if (duilding != null)
                {
                    throw new NotImplementedException("该楼宇信息已存在!");
                }
                var entity = db.Buildings.Add(new Building
                {
                    Name                  = dto.Name,
                    SmallDistrictId       = smallDistrictId,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #8
0
        public async Task DeleteAsync(SmallDistrictDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("小区信息不正确!");
                }
                var smallDistrict = await db.SmallDistricts.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (smallDistrict == null)
                {
                    throw new NotImplementedException("该小区不存在!");
                }
                if (await OnDelete(db, dto, token))
                {
                    throw new NotImplementedException("该小区下存在下级业务数据");
                }
                smallDistrict.LastOperationTime   = dto.OperationTime;
                smallDistrict.LastOperationUserId = dto.OperationUserId;
                smallDistrict.DeletedTime         = dto.OperationTime;
                smallDistrict.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #9
0
        public async Task DeleteAsync(OwnerDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业主信息不正确!");
                }
                var owner = await db.Owners.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (owner == null)
                {
                    throw new NotImplementedException("该业主信息不存在!");
                }
                if (owner.IsLegalize)
                {
                    throw new NotImplementedException("业主已认证不允许删除!");
                }
                if (await OnDelete(db, dto, token))
                {
                    throw new NotImplementedException("该业主信息下存在下级数据");
                }

                owner.LastOperationTime   = dto.OperationTime;
                owner.LastOperationUserId = dto.OperationUserId;
                owner.DeletedTime         = dto.OperationTime;
                owner.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #10
0
        public async Task UpdateAsync(OwnerDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业主信息不正确!");
                }
                var owner = await db.Owners.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (owner == null)
                {
                    throw new NotImplementedException("该业主不存在!");
                }

                if (await db.Owners.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.IndustryId == owner.IndustryId && x.Id != uid).FirstOrDefaultAsync(token) != null)
                {
                    throw new NotImplementedException("该业主名称已存在!");
                }
                var ownerCertificationRecord = await db.OwnerCertificationRecords.Where(x => x.OwnerId.ToString() == dto.Id && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (ownerCertificationRecord == null)
                {
                    owner.Birthday = dto.Birthday;
                    owner.Gender   = dto.Gender;
                    owner.IDCard   = dto.IDCard;
                    owner.Name     = dto.Name;
                }
                owner.PhoneNumber         = dto.PhoneNumber;
                owner.LastOperationTime   = dto.OperationTime;
                owner.LastOperationUserId = dto.OperationUserId;

                await db.SaveChangesAsync(token);
            }
        }
Пример #11
0
        public async Task <VipOwnerStructure> AddAsync(VipOwnerStructureDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var community = await db.VipOwnerStructures.Where(x => x.Name == dto.Name && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (community != null)
                {
                    throw new NotImplementedException("该业委会职能已存在!");
                }
                var entity = db.VipOwnerStructures.Add(new VipOwnerStructure
                {
                    Name                  = dto.Name,
                    Description           = dto.Description,
                    IsReview              = dto.IsReview.Value,
                    Weights               = dto.Weights,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #12
0
        public async Task UpdateAsync(VipOwnerStructureDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业委会职能信息不正确!");
                }
                var vipOwnerStructure = await db.VipOwnerStructures.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (vipOwnerStructure == null)
                {
                    throw new NotImplementedException("该业委会职能不存在!");
                }

                if (await db.VipOwnerStructures.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.Id != uid).FirstOrDefaultAsync(token) != null)
                {
                    throw new NotImplementedException("该业委会职能已存在!");
                }
                vipOwnerStructure.Name                = dto.Name;
                vipOwnerStructure.Description         = dto.Description;
                vipOwnerStructure.Weights             = dto.Weights;
                vipOwnerStructure.IsReview            = dto.IsReview.Value;
                vipOwnerStructure.LastOperationTime   = dto.OperationTime;
                vipOwnerStructure.LastOperationUserId = dto.OperationUserId;
                await OnUpdateAsync(db, vipOwnerStructure, token);

                await db.SaveChangesAsync(token);
            }
        }
Пример #13
0
        public async Task <OwnerCertificationRecord> UpdateStatusAsync(OwnerCertificationRecordDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("认证信息Id不正确!");
                }
                var ownerCertificationRecord = await db.OwnerCertificationRecords.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (ownerCertificationRecord == null)
                {
                    throw new NotImplementedException("该认证信息不存在!");
                }
                if (Guid.TryParse(dto.OwnerId, out var ownerId))
                {
                    //throw new NotImplementedException("业主Id信息不正确!");
                    ownerCertificationRecord.OwnerId = ownerId;
                }
                //ownerCertificationRecord.OwnerName = dto.OwnerName;
                ownerCertificationRecord.CertificationStatusName  = dto.CertificationStatusName;
                ownerCertificationRecord.CertificationStatusValue = dto.CertificationStatusValue;
                ownerCertificationRecord.CertificationResult      = dto.CertificationResult;
                ownerCertificationRecord.LastOperationTime        = dto.OperationTime;
                ownerCertificationRecord.LastOperationUserId      = dto.OperationUserId;
                ownerCertificationRecord.CertificationTime        = dto.OperationTime;
                OnUpdate(db, dto, token);
                await db.SaveChangesAsync(token);

                return(ownerCertificationRecord);
            }
        }
        public async Task <OwnerCertificationAnnex> AddAsync(OwnerCertificationAnnexDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (Guid.TryParse(dto.ApplicationRecordId, out Guid applicationRecordId))
                {
                }
                var entity = db.OwnerCertificationAnnices.Add(new OwnerCertificationAnnex
                {
                    ApplicationRecordId = applicationRecordId,
                    OwnerCertificationAnnexTypeValue = dto.OwnerCertificationAnnexTypeValue,
                    AnnexContent          = dto.AnnexContent,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                });
                if (!Guid.TryParse(dto.AnnexContent, out var annexContent))
                {
                    throw new NotImplementedException("业主认证附件id信息不正确!");
                }
                var upload = db.Uploads.Where(x => x.Id == annexContent).FirstOrDefault();
                entity.AnnexId      = annexContent;
                entity.AnnexContent = upload.Agreement + upload.Host + upload.Domain + upload.Directory + upload.File;
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #15
0
        public async Task DeleteAsync(CommunityDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("社区信息不正确!");
                }
                var community = await db.Communities.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (community == null)
                {
                    throw new NotImplementedException("该社区不存在!");
                }

                if (await OnDelete(db, dto, token))
                {
                    throw new NotImplementedException("该社区下存在下级小区数据");
                }

                community.LastOperationTime   = dto.OperationTime;
                community.LastOperationUserId = dto.OperationUserId;
                community.DeletedTime         = dto.OperationTime;
                community.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #16
0
        public async Task UpdateAsync(IndustryDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业户信息不正确!");
                }
                var industrie = await db.Industries.Include(x => x.BuildingUnit.Building.SmallDistrict.Community.StreetOffice).Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (industrie == null)
                {
                    throw new NotImplementedException("该业户不存在!");
                }

                if (await db.Industries.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.BuildingUnit.BuildingId == industrie.BuildingUnit.BuildingId && x.Id != uid && x.BuildingUnitId.ToString() == dto.BuildingUnitId).FirstOrDefaultAsync(token) != null)
                {
                    throw new NotImplementedException("该业户名称已存在!");
                }
                industrie.Name = dto.Name;
                industrie.LastOperationTime   = dto.OperationTime;
                industrie.LastOperationUserId = dto.OperationUserId;
                //await OnUpdateAsync(db, dto, token);
                await db.SaveChangesAsync(token);
            }
        }
Пример #17
0
        public async Task DeleteAsync(IndustryDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业户Id信息不正确!");
                }
                var industrie = await db.Industries.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (industrie == null)
                {
                    throw new NotImplementedException("该业户不存在!");
                }

                if (await OnDeleteAsync(db, dto, token))
                {
                    throw new NotImplementedException("该业户下存在下级数据");
                }

                industrie.LastOperationTime   = dto.OperationTime;
                industrie.LastOperationUserId = dto.OperationUserId;
                industrie.DeletedTime         = dto.OperationTime;
                industrie.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #18
0
        public async Task <VipOwner> AddAsync(VipOwnerDto dto, CancellationToken token = default)
        {
            //TODO检查是否存在未竞选业委会信息
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.SmallDistrictId, out var smallDistrictId))
                {
                    throw new NotImplementedException("小区信息不正确!");
                }
                var smallDistrict = await db.SmallDistricts.Where(x => x.Id == smallDistrictId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (smallDistrict == null)
                {
                    throw new NotImplementedException("小区信息不存在!");
                }

                var entity = db.VipOwners.Add(new VipOwner
                {
                    Name                  = smallDistrict.Name + dto.Name,
                    RemarkName            = dto.RemarkName,
                    SmallDistrictId       = smallDistrictId,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #19
0
        public async Task UpdateVoteAsync(VipOwnerApplicationRecordDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("申请记录Id信息不正确!");
                }
                var vipOwnerApplicationRecord = await db.VipOwnerApplicationRecords.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (vipOwnerApplicationRecord == null)
                {
                    throw new NotImplementedException("该申请记录不存在!");
                }

                vipOwnerApplicationRecord.VoteId               = dto.VoteId;
                vipOwnerApplicationRecord.VoteQuestionId       = dto.VoteQuestionId;
                vipOwnerApplicationRecord.VoteQuestionOptionId = dto.VoteQuestionOptionId;
                vipOwnerApplicationRecord.LastOperationTime    = dto.OperationTime;
                vipOwnerApplicationRecord.LastOperationUserId  = dto.OperationUserId;
                vipOwnerApplicationRecord.IsInvalid            = true;
                vipOwnerApplicationRecord.VipOwnerId           = dto.VipOwnerId;
                vipOwnerApplicationRecord.VipOwnerName         = dto.VipOwnerName;
                await db.SaveChangesAsync(token);
            }
        }
Пример #20
0
        public async Task UpdateIsElectionAsync(VipOwnerDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业委会Id信息不正确!");
                }
                var vipOwner = await db.VipOwners.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (vipOwner == null)
                {
                    throw new NotImplementedException("该业委会不存在!");
                }
                var entity = await db.VipOwners.Where(x => x.Name == dto.Name && x.IsDeleted == false && x.SmallDistrictId.ToString() == dto.SmallDistrictId && x.Id != uid).FirstOrDefaultAsync(token);

                if (entity != null)
                {
                    throw new NotImplementedException("该业委会已存在!");
                }
                vipOwner.IsElection          = true;
                vipOwner.LastOperationTime   = dto.OperationTime;
                vipOwner.LastOperationUserId = dto.OperationUserId;
                await OnUpdateAsync(db, vipOwner, token);

                await db.SaveChangesAsync(token);
            }
        }
Пример #21
0
        public async Task DeleteAsync(BuildingDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("楼宇信息不正确!");
                }
                var building = await db.Buildings.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (building == null)
                {
                    throw new NotImplementedException("该楼宇不存在!");
                }

                if (await OnDeleteAsync(db, dto, token))
                {
                    throw new NotImplementedException("该楼宇信息存在下级数据!");
                }

                building.LastOperationTime   = dto.OperationTime;
                building.LastOperationUserId = dto.OperationUserId;
                building.DeletedTime         = dto.OperationTime;
                building.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #22
0
        public async Task UpdateInvalidAsync(VipOwnerDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("业委会Id信息不正确!");
                }
                var vipOwner = await db.VipOwners.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (vipOwner == null)
                {
                    throw new NotImplementedException("该业委会不存在!");
                }

                await db.VipOwnerCertificationRecords.Where(x => x.VipOwnerId == dto.Id).UpdateAsync(x => new VipOwnerCertificationRecord {
                    IsInvalid = true
                });

                vipOwner.IsValid             = false;
                vipOwner.LastOperationTime   = dto.OperationTime;
                vipOwner.LastOperationUserId = dto.OperationUserId;
                await OnUpdateAsync(db, vipOwner, token);

                await db.SaveChangesAsync(token);
            }
        }
Пример #23
0
        public async Task <VipOwnerCertificationCondition> AddAsync(VipOwnerCertificationConditionDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var vipOwnerCertificationCondition = await db.VipOwnerCertificationConditions.Where(x => x.Title == dto.Title && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (vipOwnerCertificationCondition != null)
                {
                    throw new NotImplementedException("高级认证申请条件已存在!");
                }
                var entity = db.VipOwnerCertificationConditions.Add(new VipOwnerCertificationCondition
                {
                    Title                 = dto.Title,
                    Description           = dto.Description,
                    TypeName              = dto.TypeName,
                    TypeValue             = dto.TypeValue,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #24
0
        public async Task DeleteAsync(OrderDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("订单Id信息不正确!");
                }
                var order = await db.Orders.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (order == null)
                {
                    throw new NotImplementedException("该订单信息不存在!");
                }
                if (order.OrderStatusValue != OrderStatus.Finish.Value)
                {
                    throw new NotImplementedException("订单未完成不能删除!");
                }


                order.LastOperationTime   = dto.OperationTime;
                order.LastOperationUserId = dto.OperationUserId;
                order.DeletedTime         = dto.OperationTime;
                order.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #25
0
        public async Task <Announcement> AddAsync(AnnouncementDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var entity = db.Announcements.Add(new Announcement
                {
                    Content            = dto.Content,
                    SmallDistrictArray = dto.SmallDistrictArray,
                    DepartmentName     = dto.DepartmentName,
                    DepartmentValue    = dto.DepartmentValue,
                    Summary            = dto.Summary,
                    Title = dto.Title,
                    CreateOperationTime   = dto.OperationTime,
                    CreateOperationUserId = dto.OperationUserId,
                    LastOperationTime     = dto.OperationTime,
                    LastOperationUserId   = dto.OperationUserId,
                    CommunityId           = dto.CommunityId,
                    CommunityName         = dto.CommunityName,
                    SmallDistrictId       = dto.SmallDistrictId,
                    SmallDistrictName     = dto.SmallDistrictName,
                    StreetOfficeId        = dto.StreetOfficeId,
                    StreetOfficeName      = dto.StreetOfficeName
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }
        }
Пример #26
0
        public async Task UpdateAsync(OrderDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var ID))
                {
                    throw new NotImplementedException("订单ID无效!");
                }
                var order = await db.Orders.Where(item => item.Id == ID).FirstOrDefaultAsync(token);

                if (order == null)
                {
                    throw new NotImplementedException("订单不存在!");
                }

                order.OrderStatusName     = dto.OrderStatusName;
                order.OrderStatusValue    = dto.OrderStatusValue;
                order.LastOperationTime   = dto.OperationTime;
                order.LastOperationUserId = dto.OperationUserId;
                if (await db.SaveChangesAsync(token) <= 0)
                {
                    throw new NotImplementedException("数据执行失败。");
                }
            }
        }
Пример #27
0
        public async Task DeleteAsync(StreetOfficeDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("街道办信息不正确!");
                }
                var streetOffice = await db.StreetOffices.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (streetOffice == null)
                {
                    throw new NotImplementedException("该街道办不存在!");
                }
                if (await OnDelete(db, dto, token))
                {
                    throw new NotImplementedException("该街道办存在下级社区数据!");
                }
                streetOffice.LastOperationTime   = dto.OperationTime;
                streetOffice.LastOperationUserId = dto.OperationUserId;
                streetOffice.DeletedTime         = dto.OperationTime;
                streetOffice.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #28
0
        public async Task <Order> UpdatePaymentStatusAsync(string id, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(id, out var ID))
                {
                    throw new NotImplementedException("订单ID无效!");
                }
                var order = await db.Orders.Where(item => item.Id == ID).FirstOrDefaultAsync(token);

                if (order == null)
                {
                    throw new NotImplementedException("订单不存在!");
                }

                order.PaymentStatusValue = PaymentStatus.Paid.Value;
                order.PaymentStatusName  = PaymentStatus.Paid.Name;
                order.OrderStatusName    = OrderStatus.WaitingAccept.Name;
                order.OrderStatusValue   = OrderStatus.WaitingAccept.Value;

                if (await db.SaveChangesAsync(token) <= 0)
                {
                    throw new NotImplementedException("数据执行失败。" + id);
                }
                return(order);
            }
        }
Пример #29
0
        public async Task DeleteAsync(ShopCommodityDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("商品Id信息不正确!");
                }
                var shopCommodity = await db.ShopCommodities.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (shopCommodity == null)
                {
                    throw new NotImplementedException("该商品不存在!");
                }
                if (shopCommodity.SalesTypeValue == SalesType.Shelf.Value)
                {
                    throw new NotImplementedException("该商品为销售状态不允许删除!");
                }

                shopCommodity.LastOperationTime   = dto.OperationTime;
                shopCommodity.LastOperationUserId = dto.OperationUserId;
                shopCommodity.DeletedTime         = dto.OperationTime;
                shopCommodity.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Пример #30
0
        public async Task UpdateCalculationMethodAsync(VoteDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("投票Id信息不正确!");
                }
                var vote = await db.Votes.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (vote == null)
                {
                    throw new NotImplementedException("该投票不存在!");
                }
                if (vote.VoteTypeValue == VoteTypes.VipOwnerElection.Value)
                {
                    throw new NotImplementedException("业委会改选不能进行此操作");
                }
                vote.CalculationMethodValue = CalculationMethod.Opposition.Value;
                vote.CalculationMethodName  = CalculationMethod.Opposition.Name;
                vote.LastOperationTime      = dto.OperationTime;
                vote.LastOperationUserId    = dto.OperationUserId;
                await db.SaveChangesAsync(token);
            }
        }