Exemple #1
0
        public async Task <List <CaseModel> > GetAllCases()
        {
            context        = new MongoDataContext();
            caseRepository = new CaseRepository(context);

            IEnumerable <Case> cases = await caseRepository.GetAll();

            List <CaseModel> caseModel = cases.Select(x => new CaseModel
            {
                Id                          = x.Id,
                Engagement                  = x.Engagement,
                FirstName                   = x.FirstName,
                LastName                    = x.LastName,
                MiddleName                  = x.MiddleName,
                PersonId                    = x.PersonId,
                Este                        = x.Este,
                status                      = x.status,
                TaxModel                    = x.TaxModel,
                TaxYear                     = x.TaxYear,
                ExternalDocuments           = x.ExternalDocuments,
                OrganizerPDF                = x.organizerPDF,
                OrganizerXML                = x.organizerXML,
                UploadedDocumentsWithOCR    = x.UploadedDocumentsWithOCR,
                UploadedDocumentsWithoutOCR = x.UploadedDocumentsWithoutOCR
            }).ToList();

            return(caseModel);
        }
Exemple #2
0
        public Guid GetOwner(OptionSetValue caseOriginCode)
        {
            TeamRepository teamRepository = new TeamRepository(_service);
            Entity         team           = teamRepository.GetTeams(caseOriginCode.Value).Entities.FirstOrDefault();

            if (team == null)
            {
                return(Guid.Empty);
            }

            EntityReference teamEntityId = team.GetAttributeValue <EntityReference>("new_team");

            UsersRepository usersRepository = new UsersRepository(_service);

            var users = usersRepository.GetUsers(teamEntityId.Id);

            CaseRepository caseRepository = new CaseRepository(_service);

            Dictionary <Guid, int> keyValuePairs = new Dictionary <Guid, int>();

            for (int i = 0; i < users.Count; i++)
            {
                Guid id    = users[i].Id;
                int  count = caseRepository.GetCasesCountByUsers(id.ToString());
                keyValuePairs.Add(id, count);
            }

            int minValue = keyValuePairs.Values.Min();

            var newOwner = keyValuePairs.Where(q => q.Value == minValue).FirstOrDefault();

            return(newOwner.Key);
        }
Exemple #3
0
 public UnitOfWork(DataContext dataContext)
 {
     _dataContext               = dataContext;
     CaseRepository             = new CaseRepository(_dataContext);
     ChipsetRepository          = new ChipsetRepository(_dataContext);
     CoreSeriesRepository       = new CoreSeriesRepository(_dataContext);
     CoreSpeedRepository        = new CoreSpeedRepository(_dataContext);
     CPURepository              = new CPURepository(_dataContext);
     CPUCoolerRepository        = new CPUCoolerRepository(_dataContext);
     EfficiencyRatingRepository = new EfficiencyRatingRepository(_dataContext);
     FormFactorRepository       = new FormFactorRepository(_dataContext);
     InterfaceRepository        = new InterfaceRepository(_dataContext);
     ManufacturerRepository     = new ManufacturerRepository(_dataContext);
     MemorySpeedRepository      = new MemorySpeedRepository(_dataContext);
     MemoryTypeRepository       = new MemoryTypeRepository(_dataContext);
     ModuleRepository           = new ModuleRepository(_dataContext);
     MotherboardRepository      = new MotherboardRepository(_dataContext);
     NumbersRepository          = new NumbersRepository(_dataContext);
     PowerSupplyRepository      = new PowerSupplyRepository(_dataContext);
     ProtocolRepository         = new ProtocolRepository(_dataContext);
     RAMRepository              = new RAMRepository(_dataContext);
     SocketRepository           = new SocketRepository(_dataContext);
     StorageRepository          = new StorageRepository(_dataContext);
     StorageTypeRepository      = new StorageTypeRepository(_dataContext);
     VideoCardRepository        = new VideoCardRepository(_dataContext);
     WirelessAdapterRepository  = new WirelessAdapterRepository(_dataContext);
 }
 public UnitOfWork(AppDbContext context)
 {
     _context      = context;
     Courts        = new CourtRepository(context);
     Jurisdictions = new JurisdictionRepository(context);
     Cases         = new CaseRepository(context);
     Litigants     = new LitigantRepository(context);
 }
        public void CaseListIsEmpty()
        {
            ICaseRepository caseRepository = new CaseRepository();

            List <Case> listOfCases = caseRepository.GetListOfCases();

            Assert.AreEqual(0, listOfCases.Count);
        }
Exemple #6
0
 public StatsService()
 {
     caseRepository      = CaseRepository.Instance;
     specimenRepository  = SpecimenRepository.Instance;
     slideRepository     = SlideRepository.Instance;
     requestorRepository = RequestorRepository.Instance;
     patientRepository   = PatientRepository.Instance;
 }
 public CasesController()
 {
     db                 = new ApplicationDbContext();
     CaseRepository     = new CaseRepository();
     AttorneyRepository = new AttorneyRepository();
     CourtRepository    = new CourtRepository();
     PartyRepository    = new PartyRepository();
 }
Exemple #8
0
        public async Task <bool> updateResult(PatientLabOrder patientLabOrder)
        {
            try
            {
                SoapEntityRepository entityRepository   = SoapEntityRepository.GetService();
                mzk_patientorder     patientOrderEntity = (mzk_patientorder)entityRepository.GetEntity("mzk_patientorder", new Guid(patientLabOrder.Id)
                {
                },
                                                                                                       new Microsoft.Xrm.Sdk.Query.ColumnSet("mzk_orderstatus", "mzk_axcasetransrefrecid"));


                if (patientLabOrder.ResultStatus != string.Empty && patientLabOrder.ResultStatus != null)
                {
                    mzk_resultstatus resultStatus = mzk_resultstatus.Final;

                    switch (patientLabOrder.ResultStatus)
                    {
                    case "P":
                        resultStatus = mzk_resultstatus.Preliminary;
                        break;

                    case "C":
                        resultStatus = mzk_resultstatus.Corrected;
                        break;

                    case "f":
                        resultStatus = mzk_resultstatus.Final;
                        break;
                    }

                    patientOrderEntity.mzk_ResultStatus = new OptionSetValue((int)resultStatus);
                }

                if (patientLabOrder.LISLink != string.Empty && patientLabOrder.LISLink != null)
                {
                    patientOrderEntity.mzk_ReportURL = HttpUtility.UrlEncode(patientLabOrder.LISLink);
                }

                if (patientLabOrder.ReportPath != string.Empty && patientLabOrder.ReportPath != null)
                {
                    patientOrderEntity.mzk_ReportPath = patientLabOrder.ReportPath;
                }

                if (patientOrderEntity.mzk_AXCaseTransRefRecId.HasValue)
                {
                    CaseRepository caseRepo = new CaseRepository();

                    caseRepo.updateReportUrl((long)Convert.ToDecimal(patientOrderEntity.mzk_AXCaseTransRefRecId.Value), patientLabOrder.LISLink, patientLabOrder.ReportPath);
                }

                entityRepository.UpdateEntity(patientOrderEntity);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void CaseCreateFails()
        {
            // Arrange
            ICaseRepository caseRep = new CaseRepository();

            // Act
            CreateCase();
            // Assert
        }
        public void CaseListIsNotEmpty()
        {
            ICaseRepository caseRepository = new CaseRepository();

            caseRepository.AddCase(new Case());
            caseRepository.AddCase(new Case());

            List <Case> listOfCases = caseRepository.GetListOfCases();

            Assert.IsTrue(listOfCases.Count > 0);
        }
Exemple #11
0
        public async Task <string> createCaseInsurance(string caseId)
        {
            try
            {
                CaseRepository caseRepo = new CaseRepository();

                string caseInsuranceId = string.Empty;

                SoapEntityRepository repo  = SoapEntityRepository.GetService();
                QueryExpression      query = new QueryExpression(Incident.EntityLogicalName);

                query.Criteria.AddCondition("incidentid", ConditionOperator.Equal, new Guid(caseId));

                query.ColumnSet = new ColumnSet("incidentid");

                LinkEntity patient = new LinkEntity("incident", "contact", "customerid", "contactid", JoinOperator.Inner);
                patient.Columns     = new ColumnSet(false);
                patient.EntityAlias = "patient";

                LinkEntity patientInsurance = new LinkEntity("contact", "mzk_patientinsurancecarrier", "contactid", "mzk_customerid", JoinOperator.Inner);
                patientInsurance.Columns     = new ColumnSet("mzk_patientinsurancecarrierid");
                patientInsurance.EntityAlias = "patientInsurance";

                patient.LinkEntities.Add(patientInsurance);
                query.LinkEntities.Add(patient);

                EntityCollection entityCollection = repo.GetEntityCollection(query);

                if (entityCollection != null && entityCollection.Entities != null && entityCollection.Entities.Count > 0)
                {
                    SoapEntityRepository repository = SoapEntityRepository.GetService();

                    Entity caseInsurance = new Entity("mzk_caseinsurancecarrier");

                    if (entityCollection.Entities[0].Attributes.Contains("incidentid"))
                    {
                        caseInsurance["mzk_case"] = new EntityReference("incidentid", new Guid(entityCollection.Entities[0].Attributes["incidentid"].ToString()));
                    }
                    if (entityCollection.Entities[0].Attributes.Contains("patientInsurance.mzk_patientinsurancecarrierid"))
                    {
                        caseInsurance["mzk_patientinsurancecarrier"] = new EntityReference("mzk_patientinsurancecarrier", new Guid((entityCollection.Entities[0].Attributes["patientInsurance.mzk_patientinsurancecarrierid"] as AliasedValue).Value.ToString()));
                    }

                    caseInsuranceId = Convert.ToString(repository.CreateEntity(caseInsurance));
                }

                return(caseInsuranceId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void CheckIfListHasCorrectNumberOfCases()
        {
            ICaseRepository caseRepository = new CaseRepository();

            caseRepository.AddCase(new Case());
            caseRepository.AddCase(new Case());
            caseRepository.AddCase(new Case());

            List <Case> listOfCases = caseRepository.GetListOfCases();

            Assert.AreEqual(3, listOfCases.Count);
        }
Exemple #13
0
 public CaseService()
 {
     specimenRepository  = SpecimenRepository.Instance;
     specimenFactory     = SpecimenFactory.Instance;
     requestorRepository = RequestorRepository.Instance;
     requestorFactory    = RequestorFactory.Instance;
     patientRepository   = PatientRepository.Instance;
     patientFactory      = PatientFactory.Instance;
     caseRepository      = CaseRepository.Instance;
     caseFactory         = CaseFactory.Instance;
     slideFactory        = SlideFactory.Instance;
     slideRepository     = SlideRepository.Instance;
 }
Exemple #14
0
        public void FindAll()
        {
            var dbContext = SetUpThreeCases("test-find-all");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                var result = repository.FindAll();

                Assert.AreEqual(3, result.Count);
            }
        }
Exemple #15
0
        public void Delete()
        {
            var dbContext = SetUpThreeCases("test-delete");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                var before = repository.FindAll();

                Assert.AreEqual(3, before.Count);

                repository.Delete("test docket number two");

                var after = repository.FindAll();

                Assert.AreEqual(2, after.Count);
            }
        }
Exemple #16
0
        public void FindByDocketNumber()
        {
            var dbContext = SetUpThreeCases("test-find-by-docket-number");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                var result = repository.FindByDocketNumber("test docket number two");

                Assert.AreEqual(1, result.Count);

                Assert.AreEqual("2", result[0].Id);
                Assert.AreEqual("test docket number two", result[0].DocketNumber);
                Assert.AreEqual("test title two", result[0].Title);
                Assert.AreEqual("test description two", result[0].Description);
                Assert.AreEqual(_openDateTwo, result[0].OpenDate);
            }
        }
Exemple #17
0
        public void ShouldUpdateCustomerInEveryCase()
        {
            string old_fName   = "Jon";
            string old_lName   = "Doe";
            string old_email   = "*****@*****.**";
            string old_city    = "Odense";
            string old_address = "City Center, 10";
            string old_zipcode = "5200";
            string old_phoneNr = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(old_fName, old_lName, old_email, old_city, old_address, old_zipcode, old_phoneNr, old_phoneNr);

            CaseRepository cr = CaseRepository.Instance;

            Case case1 = new Case();

            case1.Customer   = customer;
            case1.CaseNumber = 1;

            Case case2 = new Case();

            case2.Customer   = customer;
            case2.CaseNumber = 2;

            cr.Add(case1);
            cr.Add(case2);

            string new_fName   = "Ben";
            string new_lName   = "Ten";
            string new_email   = "*****@*****.**";
            string new_city    = "Aarhus";
            string new_address = "City Center, 12";
            string new_zipcode = "8765";
            string new_phoneNr = "12131415";

            vc.Edit(new_fName, new_lName, new_email, new_city, new_address, new_zipcode, new_phoneNr, new_phoneNr, customer.Email);

            Assert.AreEqual(cr.Load(1).Customer.FirstName, cr.Load(2).Customer.FirstName);
        }
        static async Task Main(string[] args)
        {
            khbatlzvContext context = new khbatlzvContext();

            IUserRepository        userRepository        = new UserRepository(context);
            IAppointmentRepository appointmentRepository = new AppointmentRepository(context);
            INoteRepository        noteRepository        = new NoteRepository(context);
            ICaseRepository        caseRepository        = new CaseRepository(context, appointmentRepository, noteRepository, userRepository);
            ICaseStatusRepository  caseStatusRepository  = new CaseStatusRepository(context);
            IRoleRepository        roleRepository        = new RoleRepository(context);

            Console.WriteLine("Time to run some live tests!");
            Console.WriteLine();
            Console.WriteLine();

            await RunUserTests(userRepository, roleRepository);
            await RunUserWithCasesTest(userRepository, caseRepository, caseStatusRepository, roleRepository);
            await RunCaseWithAppointmentsTest(userRepository, caseRepository, caseStatusRepository, appointmentRepository, roleRepository);
            await RunCaseWithNotesTest(userRepository, caseRepository, caseStatusRepository, noteRepository, roleRepository);
        }
        public async Task <bool> markPhysicalDischarge(string caseGuid)
        {
            try
            {
                SoapEntityRepository entityRepository = SoapEntityRepository.GetService();

                xrm.Incident entity = (xrm.Incident)entityRepository.GetEntity(xrm.Incident.EntityLogicalName, new Guid(caseGuid), new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

                if (entity != null)
                {
                    if (entity.Attributes.Contains("mzk_casestatus"))
                    {
                        mzk_casestatus caseStatus = (mzk_casestatus)((OptionSetValue)entity.Attributes["mzk_casestatus"]).Value;

                        if (caseStatus != mzk_casestatus.FinanciallyDischarged)
                        {
                            throw new ValidationException("Only Financially discharged cases can be Physically discharged");
                        }

                        entity.mzk_casestatus = new OptionSetValue((int)mzk_casestatus.PhysicallyDischarged);

                        entityRepository.UpdateEntity(entity);

                        this.createStatusLog((int)mzk_casestatus.PhysicallyDischarged, caseGuid);

                        if (AppSettings.GetByKey("OperationsIntegration").ToLower() == true.ToString().ToLower())
                        {
                            CaseRepository caseRepo = new CaseRepository();

                            caseRepo.updateCaseStatus(caseGuid, HMCaseStatus.PhysicalDischarge);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(true);
        }
        static void Main(string[] args)
        {
            VolunteerRepository volunteerRepository = new VolunteerRepository();
            VolunteerService    volunteerService    = new VolunteerService(volunteerRepository);

            DonorRepository    donorRepository    = new DonorRepository();
            DonationRepository donationRepository = new DonationRepository();
            CaseRepository     caseRepository     = new CaseRepository();
            DonationService    donationService    = new DonationService(caseRepository, donorRepository, donationRepository);

            // Volunteer volunteer = volunteerRepository.FindOne("admin", "admin");
            // Console.WriteLine("voluntar: "+volunteer.Username);

            ServerService serverService = new ServerService(volunteerService, donationService);
            SerialServer  server        = new SerialServer("127.0.0.1", 55555, serverService);

            server.Start();
            Console.WriteLine("Server started... ");
            //Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Exemple #21
0
        private DbContextOptions <CaseContext> SetUpThreeCases(string databaseName)
        {
            var dbContext = new DbContextOptionsBuilder <CaseContext>()
                            .UseInMemoryDatabase(databaseName: databaseName)
                            .Options;

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                repository.Save(new Case
                {
                    Id           = "1",
                    DocketNumber = "test docket number one",
                    Title        = "test title one",
                    Description  = "test description one",
                    OpenDate     = _openDateOne
                });

                repository.Save(new Case
                {
                    Id           = "2",
                    DocketNumber = "test docket number two",
                    Title        = "test title two",
                    Description  = "test description two",
                    OpenDate     = _openDateTwo
                });

                repository.Save(new Case
                {
                    Id           = "3",
                    DocketNumber = "test docket number three",
                    Title        = "test title three",
                    Description  = "test description three",
                    OpenDate     = _openDateThree
                });
            }

            return(dbContext);
        }
Exemple #22
0
        public void Save()
        {
            var dbContext = SetUpThreeCases("test-save");

            using (var context = new CaseContext(dbContext))
            {
                var repository = new CaseRepository(context);

                repository.Save(new Case
                {
                    Id           = "4",
                    DocketNumber = "test docket number four",
                    Title        = "test title four",
                    Description  = "test description four",
                    OpenDate     = DateTime.Now
                });

                var result = repository.FindAll();

                Assert.AreEqual(4, result.Count);
            }
        }
Exemple #23
0
        public void CanLoadACaseFromCaseRepository()
        {
            Case case1 = new Case();

            case1.CaseNumber = 1;
            Case case2 = new Case();

            case2.CaseNumber = 2;

            CaseRepository cr = CaseRepository.Instance;

            cr.Add(case1);
            cr.Add(case2);


            ICase case1Loaded = cr.Load(1);
            ICase case2Loaded = cr.Load(2);


            Assert.IsTrue(case1.Equals(case1Loaded));
            Assert.IsTrue(case2.Equals(case2Loaded));
            Assert.IsFalse(case2.Equals(case1Loaded));
        }
        public void Execute(CaseEx request, CaseActionEnum action)
        {
            var fieldConfig = CaseRepository.GetFields(request.RecordType, action);
            var sfdcSetting = SfdcSetting.Setting(request.RecordType);

            if (sfdcSetting != null)
            {
                if (string.IsNullOrWhiteSpace(fieldConfig.AssemplyName))
                {
                    //make assumption that AssemplyName is the same as the current project's AssemplyName
                    fieldConfig.AssemplyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
                }
                if (string.IsNullOrWhiteSpace(fieldConfig.ClassName))
                {
                    //make assummption that a class a created under Gdot.Partner.Care.SFDC.Logic.RecordTypes namespace + recordtype
                    fieldConfig.ClassName = action == CaseActionEnum.Create
                        ? $"{fieldConfig.AssemplyName}.RecordTypes.{Path.GetFileNameWithoutExtension(sfdcSetting.CaseSettingPath)}"
                        : $"{fieldConfig.AssemplyName}.RecordTypes.{Path.GetFileNameWithoutExtension(sfdcSetting.UpdateCaseSettingPath)}";
                }
                var recordTypeObj = _createRecordTypeFunc(request.RecordType);
                recordTypeObj?.Execute(request);
            }
        }
Exemple #25
0
        internal static BaseEntityRepo GetRepo <T>(MIDASGBXEntities context)
        {
            BaseEntityRepo repo = null;

            if (typeof(T) == typeof(BO.Company))
            {
                repo = new CompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.Signup))
            {
                repo = new CompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.User))
            {
                repo = new UserRepository(context);
            }
            else if (typeof(T) == typeof(BO.OTP))
            {
                repo = new OTPRepository(context);
            }
            else if (typeof(T) == typeof(BO.PasswordToken))
            {
                repo = new PasswordTokenRepository(context);
            }
            else if (typeof(T) == typeof(BO.Location))
            {
                repo = new LocationRepository(context);
            }
            else if (typeof(T) == typeof(BO.Invitation))
            {
                repo = new InvitationRepository(context);
            }
            else if (typeof(T) == typeof(BO.SaveLocation))
            {
                repo = new LocationRepository(context);
            }
            else if (typeof(T) == typeof(BO.AddUser))
            {
                repo = new UserRepository(context);
            }
            else if (typeof(T) == typeof(BO.ValidateOTP))
            {
                repo = new OTPRepository(context);
            }
            else if (typeof(T) == typeof(BO.Specialty))
            {
                repo = new SpecialityRepository(context);
            }
            else if (typeof(T) == typeof(BO.SpecialtyDetails))
            {
                repo = new SpecialityDetailsRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanySpecialtyDetails))
            {
                repo = new CompanySpecialityDetailsRepository(context);
            }
            else if (typeof(T) == typeof(BO.Doctor))
            {
                repo = new DoctorRepository(context);
            }
            else if (typeof(T) == typeof(BO.DoctorSpeciality))
            {
                repo = new DoctorSpecialityRepository(context);
            }
            else if (typeof(T) == typeof(BO.RoomTest))
            {
                repo = new RoomTestRepository(context);
            }
            else if (typeof(T) == typeof(BO.Room))
            {
                repo = new RoomRepository(context);
            }
            else if (typeof(T) == typeof(BO.Schedule))
            {
                repo = new ScheduleRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserCompany))
            {
                repo = new UserCompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.DoctorLocationSchedule))
            {
                repo = new DoctorLocationScheduleRepository(context);
            }
            else if (typeof(T) == typeof(List <BO.DoctorLocationSchedule>))
            {
                repo = new DoctorLocationScheduleRepository(context);
            }
            //else if (typeof(T) == typeof(BO.Patient))
            //{
            //    repo = new PatientRepository(context);
            //}
            else if (typeof(T) == typeof(BO.Log))
            {
                repo = new LogRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserCompany))
            {
                repo = new UserCompanyRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.State))
            {
                repo = new StateRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.City))
            {
                repo = new CityRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.MaritalStatus))
            {
                repo = new MaritalStatusRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.Gender))
            {
                repo = new GenderRepository(context);
            }
            else if (typeof(T) == typeof(BO.Patient))
            {
                repo = new PatientRepository(context);
            }
            else if (typeof(T) == typeof(BO.Case))
            {
                repo = new CaseRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientInsuranceInfo))
            {
                repo = new PatientInsuranceInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientEmpInfo))
            {
                repo = new PatientEmpInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.PolicyOwner))
            {
                repo = new PolicyOwnerRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.InsuranceType))
            {
                repo = new InsuranceTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientAccidentInfo))
            {
                repo = new PatientAccidentInfoRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientFamilyMember))
            {
                repo = new PatientFamilyMemberRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.PatientType))
            {
                repo = new PatientTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.Relation))
            {
                repo = new RelationRepository(context);
            }
            else if (typeof(T) == typeof(BO.RefferingOffice))
            {
                repo = new RefferingOfficeRepository(context);
            }
            else if (typeof(T) == typeof(BO.AttorneyMaster))
            {
                repo = new AttorneyMasterRepository(context);
            }
            else if (typeof(T) == typeof(BO.CaseInsuranceMapping))
            {
                repo = new CaseInsuranceMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.CaseType))
            {
                repo = new CaseTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.CaseStatus))
            {
                repo = new CaseStatusRepository(context);
            }
            else if (typeof(T) == typeof(BO.AdjusterMaster))
            {
                repo = new AdjusterMasterRepository(context);
            }
            else if (typeof(T) == typeof(BO.InsuranceMaster))
            {
                repo = new InsuranceMasterRepository(context);
            }
            //else if (typeof(T) == typeof(BO.PatientVisit))
            //{
            //    repo = new PatientVisitRepository(context);
            //}
            //else if (typeof(T) == typeof(BO.PatientVisitEvent))
            //{
            //    repo = new PatientVisitEventRepository(context);
            //}
            else if (typeof(T) == typeof(BO.PatientVisit))
            {
                repo = new PatientVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.CalendarEvent))
            {
                repo = new CalendarEventRepository(context);
            }
            else if (typeof(T) == typeof(BO.CaseCompanyMapping))
            {
                repo = new CaseCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyCaseConsentApproval))
            {
                repo = new CompanyCaseConsentApprovalRepository(context);
            }
            //else if (typeof(T) == typeof(BO.Referral))
            //{
            //    repo = new ReferralRepository(context);
            //}
            else if (typeof(T) == typeof(BO.Document))
            {
                repo = new FileUploadRepository(context);
            }
            else if (typeof(T) == typeof(BO.Notification))
            {
                repo = new NotificationRepository(context);
            }
            else if (typeof(T) == typeof(BO.AddPatient))
            {
                repo = new PatientRepository(context);
            }
            else if (typeof(T) == typeof(BO.DiagnosisType))
            {
                repo = new DiagnosisTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.DiagnosisCode))
            {
                repo = new DiagnosisCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.ProcedureCode))
            {
                repo = new ProcedureCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyCaseConsentBase64))
            {
                repo = new CompanyCaseConsentApprovalRepository(context);
            }
            else if (typeof(T) == typeof(BO.DocumentNodeObjectMapping))
            {
                repo = new DocumentNodeObjectMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredMedicalProviderSignUp))
            {
                repo = new PreferredMedicalProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredAttorneyProviderSignUp))
            {
                repo = new PreferredAttorneyProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.UserPersonalSetting))
            {
                repo = new UserPersonalSettingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PendingReferral))
            {
                repo = new PendingReferralRepository(context);
            }
            else if (typeof(T) == typeof(BO.VisitReports))
            {
                repo = new ReportsRepository(context);
            }
            else if (typeof(T) == typeof(BO.Referral))
            {
                repo = new ReferralRepository(context);
            }
            else if (typeof(T) == typeof(BO.MergePDF) || typeof(T) == typeof(BO.Document) || typeof(T) == typeof(BO.Common.UploadInfo))
            {
                repo = new DocumentManagerRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.TemplateType))
            {
                repo = new TemplateTypeRepository(context);
            }
            else if (typeof(T) == typeof(BO.GeneralSetting))
            {
                repo = new GeneralSettingRepository(context);
            }
            else if (typeof(T) == typeof(BO.PreferredAncillarProviderSignUp))
            {
                repo = new PreferredAncillaryProviderRepository(context);
            }
            else if (typeof(T) == typeof(BO.ProcedureCodeCompanyMapping))
            {
                repo = new ProcedureCodeCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.CompanyICDTypeCode))
            {
                repo = new ICDTypeCodeRepository(context);
            }
            else if (typeof(T) == typeof(BO.IMEVisit))
            {
                repo = new IMEvisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.EOVisit))
            {
                repo = new EOVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.AttorneyVisit))
            {
                repo = new AttorneyVisitRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.LanguagePreference))
            {
                repo = new LanguagePreferenceRepository(context);
            }
            else if (typeof(T) == typeof(BO.Common.SocialMedia))
            {
                repo = new SocialMediaRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientVisitUnscheduled))
            {
                repo = new PatientVisitUnscheduledRepository(context);
            }
            else if (typeof(T) == typeof(BO.SchoolInformation))
            {
                repo = new SchoolInformationRepository(context);
            }
            else if (typeof(T) == typeof(BO.PlaintiffVehicle))
            {
                repo = new PlaintiffVehicleRepository(context);
            }
            else if (typeof(T) == typeof(BO.DefendantVehicle))
            {
                repo = new DefendantVehicleRepository(context);
            }
            else if (typeof(T) == typeof(BO.PatientPriorAccidentInjury))
            {
                repo = new PatientPriorAccidentInjuryRepository(context);
            }
            else if (typeof(T) == typeof(BO.OTPCompanyMapping))
            {
                repo = new OTPCompanyMappingRepository(context);
            }
            else if (typeof(T) == typeof(BO.ReferralVisitUnscheduled))
            {
                repo = new PatientVisitUnscheduledRepository(context);
            }

            return(repo);
        }
 public void SetUp()
 {
     _mockRepository = new MockRepository(MockBehavior.Strict);
     _databaseMock = _mockRepository.Create<CaseRepository.ICaseGateway>();
     _caseGateway = _databaseMock.Object;
     _assignmentScheduleMock = _mockRepository.Create<CaseRepository.IAssignmentSchedule>();
     _assignmentSchedule = _assignmentScheduleMock.Object;
     _userGatewayMock = _mockRepository.Create<CaseRepository.IUserGateway>();
     _userGateway = _userGatewayMock.Object;
     _caseRepository = new CaseRepository(_caseGateway, _userGateway, _assignmentSchedule);
 }
Exemple #27
0
        public override T Convert <T, U>(U entity)
        {
            if (entity is PatientVisitUnscheduled)
            {
                PatientVisitUnscheduled PatientVisitUnscheduledDB = entity as PatientVisitUnscheduled;

                if (PatientVisitUnscheduledDB == null)
                {
                    return(default(T));
                }

                BO.PatientVisitUnscheduled PatientVisitUnscheduledBO = new BO.PatientVisitUnscheduled();
                PatientVisitUnscheduledBO.ID                  = PatientVisitUnscheduledDB.Id;
                PatientVisitUnscheduledBO.CaseId              = PatientVisitUnscheduledDB.CaseId;
                PatientVisitUnscheduledBO.PatientId           = PatientVisitUnscheduledDB.PatientId;
                PatientVisitUnscheduledBO.EventStart          = PatientVisitUnscheduledDB.EventStart;
                PatientVisitUnscheduledBO.MedicalProviderName = PatientVisitUnscheduledDB.MedicalProviderName;
                PatientVisitUnscheduledBO.DoctorName          = PatientVisitUnscheduledDB.DoctorName;
                PatientVisitUnscheduledBO.Notes               = PatientVisitUnscheduledDB.Notes;
                PatientVisitUnscheduledBO.SpecialtyId         = PatientVisitUnscheduledDB.SpecialtyId;
                PatientVisitUnscheduledBO.RoomTestId          = PatientVisitUnscheduledDB.RoomTestId;
                PatientVisitUnscheduledBO.ReferralId          = PatientVisitUnscheduledDB.ReferralId;
                PatientVisitUnscheduledBO.Status              = "Completed";

                PatientVisitUnscheduledBO.IsDeleted      = PatientVisitUnscheduledDB.IsDeleted;
                PatientVisitUnscheduledBO.CreateByUserID = PatientVisitUnscheduledDB.CreateByUserID;
                PatientVisitUnscheduledBO.UpdateByUserID = PatientVisitUnscheduledDB.UpdateByUserID;

                if (PatientVisitUnscheduledDB.Patient != null)
                {
                    BO.Patient PatientBO = new BO.Patient();
                    using (PatientRepository patientRepo = new PatientRepository(_context))
                    {
                        PatientBO = patientRepo.Convert <BO.Patient, Patient>(PatientVisitUnscheduledDB.Patient);
                        PatientVisitUnscheduledBO.Patient = PatientBO;
                    }
                }

                if (PatientVisitUnscheduledDB.Specialty != null)
                {
                    BO.Specialty SpecialtyBO = new BO.Specialty();
                    using (SpecialityRepository specialtyRepo = new SpecialityRepository(_context))
                    {
                        SpecialtyBO = specialtyRepo.Convert <BO.Specialty, Specialty>(PatientVisitUnscheduledDB.Specialty);
                        PatientVisitUnscheduledBO.Specialty = SpecialtyBO;
                    }
                }

                if (PatientVisitUnscheduledDB.RoomTest != null)
                {
                    BO.RoomTest RoomTestBO = new BO.RoomTest();
                    using (RoomTestRepository roomTestRepo = new RoomTestRepository(_context))
                    {
                        RoomTestBO = roomTestRepo.Convert <BO.RoomTest, RoomTest>(PatientVisitUnscheduledDB.RoomTest);
                        PatientVisitUnscheduledBO.RoomTest = RoomTestBO;
                    }
                }

                if (PatientVisitUnscheduledDB.Case != null)
                {
                    BO.Case CaseBO = new BO.Case();
                    using (CaseRepository caseRepo = new CaseRepository(_context))
                    {
                        CaseBO = caseRepo.Convert <BO.Case, Case>(PatientVisitUnscheduledDB.Case);
                        PatientVisitUnscheduledBO.Case = CaseBO;

                        if (PatientVisitUnscheduledDB.Case.PatientAccidentInfoes != null && PatientVisitUnscheduledDB.Case.PatientAccidentInfoes.Count > 0)
                        {
                            List <BO.PatientAccidentInfo> PatientAccidentInfoBOList = new List <BO.PatientAccidentInfo>();
                            using (PatientAccidentInfoRepository patientAccidentInfoRepo = new PatientAccidentInfoRepository(_context))
                            {
                                foreach (PatientAccidentInfo eachPatientInsuranceInfo in PatientVisitUnscheduledDB.Case.PatientAccidentInfoes)
                                {
                                    if (eachPatientInsuranceInfo.IsDeleted.HasValue == false || (eachPatientInsuranceInfo.IsDeleted.HasValue == true && eachPatientInsuranceInfo.IsDeleted.Value == false))
                                    {
                                        PatientAccidentInfoBOList.Add(patientAccidentInfoRepo.Convert <BO.PatientAccidentInfo, PatientAccidentInfo>(eachPatientInsuranceInfo));
                                    }
                                }

                                PatientVisitUnscheduledBO.Case.PatientAccidentInfoes = PatientAccidentInfoBOList;
                            }
                        }
                    }
                }

                return((T)(object)PatientVisitUnscheduledBO);
            }

            return(default(T));
        }
Exemple #28
0
        public override T Convert <T, U>(U entity)
        {
            if (entity is AttorneyVisit)
            {
                AttorneyVisit AttorneyVisitDB = entity as AttorneyVisit;

                if (AttorneyVisitDB == null)
                {
                    return(default(T));
                }

                BO.AttorneyVisit AttorneyVisitBO = new BO.AttorneyVisit();
                AttorneyVisitBO.ID = AttorneyVisitDB.Id;
                AttorneyVisitBO.CalendarEventId = AttorneyVisitDB.CalendarEventId;
                AttorneyVisitBO.CaseId          = AttorneyVisitDB.CaseId;
                AttorneyVisitBO.PatientId       = AttorneyVisitDB.PatientId;
                AttorneyVisitBO.CompanyId       = AttorneyVisitDB.CompanyId;
                AttorneyVisitBO.AttorneyId      = AttorneyVisitDB.AttorneyId;
                AttorneyVisitBO.EventStart      = AttorneyVisitDB.EventStart;
                AttorneyVisitBO.EventEnd        = AttorneyVisitDB.EventEnd;
                AttorneyVisitBO.Subject         = AttorneyVisitDB.Subject;
                AttorneyVisitBO.VisitStatusId   = AttorneyVisitDB.VisitStatusId;
                AttorneyVisitBO.ContactPerson   = AttorneyVisitDB.ContactPerson;
                AttorneyVisitBO.Agenda          = AttorneyVisitDB.Agenda;

                AttorneyVisitBO.IsDeleted      = AttorneyVisitDB.IsDeleted;
                AttorneyVisitBO.CreateByUserID = AttorneyVisitDB.CreateByUserID;
                AttorneyVisitBO.UpdateByUserID = AttorneyVisitDB.UpdateByUserID;

                if (AttorneyVisitDB.Patient != null)
                {
                    BO.Patient PatientBO = new BO.Patient();
                    using (PatientRepository patientRepo = new PatientRepository(_context))
                    {
                        PatientBO = patientRepo.Convert <BO.Patient, Patient>(AttorneyVisitDB.Patient);
                        AttorneyVisitBO.Patient = PatientBO;

                        //if (AttorneyVisitDB.Patient.PatientInsuranceInfoes != null && AttorneyVisitDB.Patient.PatientInsuranceInfoes.Count > 0)
                        //{
                        //    List<BO.PatientInsuranceInfo> PatientInsuranceInfoBOList = new List<BO.PatientInsuranceInfo>();
                        //    using (PatientInsuranceInfoRepository patientInsuranceInfoRepo = new PatientInsuranceInfoRepository(_context))
                        //    {
                        //        foreach (PatientInsuranceInfo eachPatientInsuranceInfo in AttorneyVisitDB.Patient.PatientInsuranceInfoes)
                        //        {
                        //            if (eachPatientInsuranceInfo.IsDeleted.HasValue == false || (eachPatientInsuranceInfo.IsDeleted.HasValue == true && eachPatientInsuranceInfo.IsDeleted.Value == false))
                        //            {
                        //                PatientInsuranceInfoBOList.Add(patientInsuranceInfoRepo.Convert<BO.PatientInsuranceInfo, PatientInsuranceInfo>(eachPatientInsuranceInfo));
                        //            }
                        //        }

                        //        AttorneyVisitBO.Patient.PatientInsuranceInfoes = PatientInsuranceInfoBOList;
                        //    }
                        //}
                    }
                }

                if (AttorneyVisitDB.Case != null)
                {
                    BO.Case CaseBO = new BO.Case();
                    using (CaseRepository caseRepo = new CaseRepository(_context))
                    {
                        CaseBO = caseRepo.Convert <BO.Case, Case>(AttorneyVisitDB.Case);
                        AttorneyVisitBO.Case = CaseBO;

                        if (AttorneyVisitDB.Case.PatientAccidentInfoes != null && AttorneyVisitDB.Case.PatientAccidentInfoes.Count > 0)
                        {
                            List <BO.PatientAccidentInfo> PatientAccidentInfoBOList = new List <BO.PatientAccidentInfo>();
                            using (PatientAccidentInfoRepository patientAccidentInfoRepo = new PatientAccidentInfoRepository(_context))
                            {
                                foreach (PatientAccidentInfo eachPatientInsuranceInfo in AttorneyVisitDB.Case.PatientAccidentInfoes)
                                {
                                    if (eachPatientInsuranceInfo.IsDeleted.HasValue == false || (eachPatientInsuranceInfo.IsDeleted.HasValue == true && eachPatientInsuranceInfo.IsDeleted.Value == false))
                                    {
                                        PatientAccidentInfoBOList.Add(patientAccidentInfoRepo.Convert <BO.PatientAccidentInfo, PatientAccidentInfo>(eachPatientInsuranceInfo));
                                    }
                                }

                                AttorneyVisitBO.Case.PatientAccidentInfoes = PatientAccidentInfoBOList;
                            }
                        }
                    }
                }

                if (AttorneyVisitDB.Company != null)
                {
                    BO.Company boCompany = new BO.Company();
                    using (CompanyRepository cmp = new CompanyRepository(_context))
                    {
                        boCompany = cmp.Convert <BO.Company, Company>(AttorneyVisitDB.Company);
                        AttorneyVisitBO.Company = boCompany;
                    }
                }

                if (AttorneyVisitDB.CalendarEvent != null)
                {
                    AttorneyVisitBO.CalendarEvent = new BO.CalendarEvent();

                    using (CalendarEventRepository calEventRep = new CalendarEventRepository(_context))
                    {
                        AttorneyVisitBO.CalendarEvent = calEventRep.Convert <BO.CalendarEvent, CalendarEvent>(AttorneyVisitDB.CalendarEvent);
                    }
                }

                return((T)(object)AttorneyVisitBO);
            }
            else if (entity is CalendarEvent)
            {
                CalendarEvent CalendarEventDB = entity as CalendarEvent;

                if (CalendarEventDB == null)
                {
                    return(default(T));
                }

                BO.CalendarEvent CalendarEvent = new BO.CalendarEvent();
                using (CalendarEventRepository calEventRep = new CalendarEventRepository(_context))
                {
                    CalendarEvent = calEventRep.Convert <BO.CalendarEvent, CalendarEvent>(CalendarEventDB);
                }

                return((T)(object)CalendarEvent);
            }

            return(default(T));
        }
Exemple #29
0
 public void InitDB()
 {
     if (CaseRepository.GetAll().Count() == 0)
     {
         CaseRepository.Insert(new Case()
         {
             Caseid = 1, Name = "Все"
         });
         CaseRepository.Insert(new Case()
         {
             Caseid = 2, Name = "Уголовное"
         });
         CaseRepository.Insert(new Case()
         {
             Caseid = 3, Name = "Гражданское"
         });
         CaseRepository.Insert(new Case()
         {
             Caseid = 4, Name = "Административное"
         });
         CaseRepository.Insert(new Case()
         {
             Caseid = 5, Name = "Экономическое"
         });
         CaseRepository.Insert(new Case()
         {
             Caseid = 6, Name = "Дисциплинарный спор"
         });
         this.Save();
     }
     if (CourtRepository.GetAll().Count() == 0)
     {
         CourtRepository.Insert(new Court()
         {
             CourtId = 1, Name = "Все", BaseURL = "none", URLToDoc = "none", TypeSite = "none", TypeSiteId = 0, Encoding = "none"
         });
         CourtRepository.Insert(new Court()
         {
             CourtId = 2, Name = "Верховный Суд", BaseURL = "http://www.vsrf.ru", URLToDoc = "indexA.php?", TypeSite = "vsrf", TypeSiteId = 1, Encoding = "windows-1251"
         });
         CourtRepository.Insert(new Court()
         {
             CourtId = 3, Name = "Архангельский областной суд", BaseURL = "http://oblsud.arh.sudrf.ru", URLToDoc = "modules.php?", TypeSite = "sudrf", TypeSiteId = 2, Encoding = "windows-1251"
         });
         this.Save();
     }
     if (InstanceRepository.GetAll().Count() == 0)
     {
         InstanceRepository.Insert(new Instance()
         {
             InstanceId = 1, Name = "Все"
         });
         InstanceRepository.Insert(new Instance()
         {
             InstanceId = 2, Name = "Первая инстанция"
         });
         InstanceRepository.Insert(new Instance()
         {
             InstanceId = 3, Name = "Апелляция"
         });
         InstanceRepository.Insert(new Instance()
         {
             InstanceId = 4, Name = "Кассация"
         });
         InstanceRepository.Insert(new Instance()
         {
             InstanceId = 5, Name = "Надзор"
         });
         this.Save();
     }
     if (TypeDocRepository.GetAll().Count() == 0)
     {
         TypeDocRepository.Insert(new DocType()
         {
             DocTypeId = 1, Name = "Все"
         });
         TypeDocRepository.Insert(new DocType()
         {
             DocTypeId = 2, Name = "Решение"
         });
         TypeDocRepository.Insert(new DocType()
         {
             DocTypeId = 3, Name = "Приговор"
         });
         TypeDocRepository.Insert(new DocType()
         {
             DocTypeId = 4, Name = "Определение"
         });
         TypeDocRepository.Insert(new DocType()
         {
             DocTypeId = 5, Name = "Постановление"
         });
         this.Save();
     }
 }
 public ClaimController()
 {
     _caseRepository = new CaseRepository();
 }
        public async Task <long> createCase(string patientId, string clinicRecId, int caseType, string caseId, string caseNumber)
        {
            try
            {
                CaseRepository caseRepo = new CaseRepository();
                //string caseNumber = "";

                if (!string.IsNullOrEmpty(caseId))
                {
                    //QueryExpression query = new QueryExpression("incident");
                    //FilterExpression childFilter = query.Criteria.AddFilter(LogicalOperator.And);
                    //childFilter.AddCondition("incidentid", ConditionOperator.Equal, new Guid(caseId));

                    //query.ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(true);

                    //LinkEntity entityTypeDetails = new LinkEntity(xrm.Incident.EntityLogicalName, xrm.Contact.EntityLogicalName, "customerid", "contactid", JoinOperator.Inner);
                    //entityTypeDetails.EntityAlias = "contact";
                    //entityTypeDetails.Columns = new Microsoft.Xrm.Sdk.Query.ColumnSet("mzk_axrefrecid");

                    //query.LinkEntities.Add(entityTypeDetails);

                    //SoapEntityRepository entityRepository = SoapEntityRepository.GetService();
                    //EntityCollection entitycollection = entityRepository.GetEntityCollection(query);

                    //if(entitycollection != null && entitycollection.Entities != null && entitycollection.Entities.Count > 0)
                    //{
                    //    if (entitycollection.Entities[0].Attributes.Contains("contact.mzk_axrefrecid"))
                    //    {
                    //        patientRecId = Convert.ToInt64((entitycollection.Entities[0]["contact.mzk_axrefrecid"] as AliasedValue).Value);
                    //    }

                    //    if (entitycollection.Entities[0].Attributes.Contains("mzk_casetype"))
                    //    {
                    //        caseType = Convert.ToInt32((entitycollection.Entities[0]["mzk_casetype"] as OptionSetValue).Value);
                    //    }

                    //    if (entitycollection.Entities[0].Attributes.Contains("ticketnumber"))
                    //    {
                    //        caseNumber = (entitycollection.Entities[0]["ticketnumber"]).ToString();
                    //    }
                    //}
                }


                long    patientRecId = 0;
                Decimal decID;
                if (!string.IsNullOrEmpty(patientId))
                {
                    decID        = Convert.ToDecimal(patientId);
                    patientRecId = Convert.ToInt64(decID);
                }

                long caseRecId = caseRepo.createCase(patientRecId, Convert.ToInt64(clinicRecId), (HMCaseType)caseType, caseId, caseNumber);

                //Helper.Files.SaveToCSV(string.Format("{0}, {1}, {2}, {3}, {4}", caseRecId, patientRecId, Convert.ToInt64(clinicRecId), (HMCaseType)caseType, caseId), "test", DateTime.Now, DateTime.Now);

                return(caseRecId);
            }
            catch (Exception ex)
            {
                // Helper.Files.SaveToCSV(ex.Message, "test", DateTime.Now, DateTime.Now);

                throw ex;
            }
        }