/// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationRepository{T}"/> class.
 /// </summary>
 /// <param name="dataContext">The data context.</param>
 /// <param name="cryptoService">The cryptography service with which to encrypt or decrypt values.</param>
 public ConfigurationRepository(Repositories.DataContext dataContext, IConfigurationCryptoService cryptoService)
 {
     this.dataContext   = dataContext;
     this.cryptoService = cryptoService;
     this.properties    = typeof(T).GetProperties().ToList();
     this.sectionName   = typeof(T).GetCustomAttribute <ConfigurationSectionAttribute>().ConfigurationSection;
 }
Beispiel #2
0
        public static void ThrowErrorIfEntityNotExist(EntityType entityType,
                                                      Repositories.DataContext context,
                                                      string OfficialId, bool checkArchived = false, bool archived = true)
        {
            ThrowErrorIfNotValidId(OfficialId);

            if (context != null)
            {
                if (entityType == EntityType.patinet)
                {
                    using (var patient = context.Patients.FirstOrDefaultAsync(p => checkArchived == true ? p.OfficialId == OfficialId && p.Archived == archived : p.OfficialId == OfficialId))
                    {
                        if (patient.Result == null)
                        {
                            throw new BadRequestException("Patient does not exists");
                        }
                    }
                }

                if (entityType == EntityType.doctor)
                {
                    using (var doctor = context.Doctors.FirstOrDefaultAsync(d => checkArchived == true ? d.OfficialId == OfficialId && d.Archived == archived : d.OfficialId == OfficialId))
                    {
                        if (doctor.Result == null)
                        {
                            throw new BadRequestException("Doctor does not exists");
                        }
                    }
                }
            }
            else
            {
                throw new InternalServerException("Context is null");
            }
        }
Beispiel #3
0
        public static void ThrowErrorIfEntiryExist(EntityType entityType,
                                                   Repositories.DataContext context,
                                                   int id, bool checkArchived = false, bool archived = false)
        {
            ThrowErrorIfNotValidId(id);

            if (context != null)
            {
                if (entityType == EntityType.patinet)
                {
                    using (var patient = context.Patients.FirstOrDefaultAsync(p => checkArchived ? p.Id == id && p.Archived == archived : p.Id == id))
                    {
                        if (patient.Result != null)
                        {
                            throw new BadRequestException("Patient already exists");
                        }
                    }
                }

                if (entityType == EntityType.doctor)
                {
                    using (var doctor = context.Doctors.FirstOrDefaultAsync(d => checkArchived ? d.Id == id && d.Archived == archived : d.Id == id))
                    {
                        if (doctor.Result != null)
                        {
                            throw new BadRequestException("Doctor already exists");
                        }
                    }
                }
            }
            else
            {
                throw new InternalServerException("Context is null");
            }
        }
Beispiel #4
0
 public DeleteServiceBase(Repositories.DataContext context) : base(context)
 {
 }
Beispiel #5
0
 public SettleBatchService(Repositories.DataContext context) : base(context)
 {
 }
Beispiel #6
0
 public InsertServiceBase(Repositories.DataContext context) : base(context)
 {
 }
Beispiel #7
0
 public RoyaltyService(Repositories.DataContext context) : base(context)
 {
 }
 public WorkGroupService(Repositories.DataContext context) : base(context)
 {
     memberService = new WorkGroupMemberService(this.Context);
 }
 public WorkGroupMemberService(Repositories.DataContext context) : base(context)
 {
 }