Ejemplo n.º 1
0
        public static void AddEmployee(DataSurfContext context, Employee model)
        {
            Models.TempWorksDB.Employee result = context.Employee.FirstOrDefault(result => result.employeeId == model.employeeId);
            bool addRec = false;

            if (result == null)
            {
                addRec = true;
                result = new Models.TempWorksDB.Employee();
            }

            result.employeeId           = model.employeeId;
            result.firstName            = model.firstName;
            result.lastName             = model.lastName;
            result.isActive             = model.isActive;
            result.isAssigned           = model.isAssigned;
            result.emailAddress         = model.emailAddress;
            result.postalCode           = model.postalCode;
            result.phoneNumber          = string.IsNullOrEmpty(model.cellPhoneNumber) ? model.phoneNumber : model.cellPhoneNumber;
            result.branchName           = model.branch;
            result.hasResumeOnFile      = model.hasResumeOnFile;
            result.emailAddress         = model.emailAddress;
            result.governmentPersonalId = model.governmentPersonalId;



            if (addRec)
            {
                context.Employee.Add(result);
            }
            else
            {
                context.Employee.Update(result);
            }
        }
Ejemplo n.º 2
0
        public static void AddEventRecord(DataSurfContext context, CovidTestEvents model)
        {
            CovidTestEvents result = context.CovidTestEvents.FirstOrDefault(result => result.SignupID == model.SignupID);

            if (result == null)
            {
                result             = new CovidTestEvents();
                result.SignupID    = model.SignupID;
                result.startdate   = model.startdate;
                result.enddate     = model.enddate;
                result.Title       = model.Title;
                result.TotalSlots  = model.TotalSlots;
                result.FilledSlots = model.FilledSlots;
                context.CovidTestEvents.Add(result);
            }
            else
            {
                result.startdate   = model.startdate;
                result.enddate     = model.enddate;
                result.Title       = model.Title;
                result.TotalSlots  = model.TotalSlots;
                result.FilledSlots = model.FilledSlots;
                context.CovidTestEvents.Update(result);
            }
            context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
        public static bool AddAssignment(DataSurfContext context, Models.TempWorks.Assignment model)
        {
            Models.TempWorksDB.Assignment result = context.Assignment.FirstOrDefault(result => result.assignmentId == model.assignmentId);
            bool addRec = false;

            if (result == null)
            {
                addRec = true;
                result = new Models.TempWorksDB.Assignment();
            }
            result.assignmentId          = model.assignmentId;
            result.activeStatus          = model.activeStatus;
            result.assignmentStatus      = model.assignmentStatus;
            result.assignmentStatusId    = model.assignmentStatusId;
            result.billRate              = Convert.ToDecimal(model.billRate);
            result.branchId              = model.branchId;
            result.branchName            = model.branchName;
            result.customerId            = model.customerId;
            result.customerName          = model.customerName;
            result.departmentName        = model.departmentName;
            result.employeeId            = model.employeeId;
            result.endDate               = DateTime.Parse(String.IsNullOrEmpty(model.endDate) ? "01/01/1900" : model.endDate);
            result.expectedEndDate       = DateTime.Parse(String.IsNullOrEmpty(model.expectedEndDate) ? "01/01/1900" : model.expectedEndDate);
            result.firstName             = model.firstName;
            result.isActive              = model.isActive;
            result.isDeleted             = model.isDeleted;
            result.isTimeclockOrder      = model.isTimeclockOrder;
            result.jobOrderId            = model.jobOrderId;
            result.jobTitle              = model.jobTitle;
            result.lastName              = model.lastName;
            result.middleName            = model.middleName;
            result.originalStartDate     = DateTime.Parse(String.IsNullOrEmpty(model.originalStartDate) ? "01/01/1900" : model.originalStartDate);
            result.payRate               = Convert.ToDecimal(model.payRate);
            result.performanceNote       = model.performanceNote;
            result.startDate             = DateTime.Parse(String.IsNullOrEmpty(model.startDate) ? "01/01/1900" : model.startDate);
            result.supervisor            = model.supervisor;
            result.supervisorContactInfo = model.supervisorContactInfo;

            if (addRec)
            {
                context.Assignment.Add(result);
            }
            else
            {
                context.Assignment.Update(result);
            }

            //      context.SaveChanges();

            return(true);
        }
Ejemplo n.º 4
0
 public static Models.CovidTestJson GetCovidJson(DataSurfContext context, Models.CovidTestSearch search)
 {
     Models.CovidTestJson       json      = MapModels(GetCovidRecord(context, search));
     Models.CovidQuestionsModel questions = context.CovidQuestions.FirstOrDefault(results => results.CovidTestId == Convert.ToInt32(json.CovidtestId));
     if (questions != null)
     {
         json.covid_in_household         = questions.covid_in_household == false ? "No" : "Yes";
         json.covid_positive             = questions.covid_positive == false ? "No" : "Yes";
         json.covid_recovered            = questions.covid_recovered == false ? "No" : "Yes";
         json.had_covid_contact          = questions.had_covid_contact == false ? "No" : "Yes";
         json.was_at_covid_risk_location = questions.was_at_covid_risk_location == false ? "No" : "Yes";
         json.traveled_outside_us        = questions.traveled_outside_us == false ? "No" : "Yes";
     }
     return(json);
 }
Ejemplo n.º 5
0
        public static bool AddBranch(DataSurfContext context, Models.TempWorks.Branch model)
        {
            Models.TempWorksDB.Branch result = context.Branch.FirstOrDefault(result => result.BranchId == model.BranchId);
            bool addRec = false;

            if (result == null)
            {
                addRec = true;
                result = new Models.TempWorksDB.Branch();
            }

            result.BranchId       = model.BranchId;
            result.BranchFullName = model.BranchFullName;
            result.BranchName     = model.BranchName;
            result.PhoneNumber    = model.PhoneNumber;
            result.IsActive       = model.IsActive;
            result.HierId         = model.HierId;
            result.Employer       = model.Employer;
            result.EmployerId     = model.EmployerId;
            result.EmailAddress   = model.EmailAddress;
            Models.TempWorksDB.Address add = new Models.TempWorksDB.Address()
            {
                Street1      = model.Address.Street1,
                Street2      = model.Address.Street2,
                PostalCode   = model.Address.PostalCode,
                Country      = model.Address.Country,
                Municipality = model.Address.Municipality,
                Region       = model.Address.Region,
                AttentionTo  = model.Address.AttentionTo
            };

            result.AddressId = AddAddress(context, add);

            if (addRec)
            {
                context.Branch.Add(result);
            }
            else
            {
                context.Branch.Update(result);
            }

            context.SaveChanges();


            return(true);
        }
Ejemplo n.º 6
0
        public static Models.CovidTestDBModel GetCovidRecord(DataSurfContext context, Models.CovidTestSearch search)
        {
            Models.CovidTestDBModel model = null;
            Int32 ID = 0;

            if (string.IsNullOrEmpty(search.CovidTestId))
            {
                ID = 0;
            }
            else
            {
                ID = Convert.ToInt32(search.CovidTestId);
            }


            if (ID != 0)
            {
                model = context.CovidTests.FirstOrDefault(results => results.CovidtestId == ID);
                if (model == null)
                {
                    model = context.CovidTests.FirstOrDefault(results => results.patient_first_name == search.patient_first_name &&
                                                              results.patient_last_name == search.patient_last_name
                                                              //&& results.patient_zip_code == search.patient_zip_code
                                                              && results.patient_email == search.patient_email);
                }
                if (model != null)
                {
                    return(model);
                }
            }
            else
            {
                model = context.CovidTests.FirstOrDefault(results => results.patient_first_name == search.patient_first_name &&
                                                          results.patient_last_name == search.patient_last_name
                                                          //&& results.patient_zip_code == search.patient_zip_code
                                                          && results.patient_email == search.patient_email);


                return(model);
            }

            return(null);
        }
Ejemplo n.º 7
0
        public static Models.CovidTestJson GetCovidRecord(DataSurfContext context, int ID)
        {
            try
            {
                Models.CovidTestDBModel model = null;

                model = context.CovidTests.FirstOrDefault(result => result.CovidtestId == ID);

                if (model == null)
                {
                    model = context.CovidTests.FirstOrDefault(result => result.AppointmentID == ID);
                }

                if (model == null)
                {
                    return(null);
                }



                Models.CovidTestJson json = MapModels(model);

                Models.CovidQuestionsModel questions = null;
                questions = context.CovidQuestions.FirstOrDefault(result => result.CovidTestId == model.CovidtestId);
                if (questions != null)
                {
                    json.covid_in_household         = questions.covid_in_household == false ? "No" : "Yes";
                    json.covid_positive             = questions.covid_positive == false ? "No" : "Yes";
                    json.covid_recovered            = questions.covid_recovered == false ? "No" : "Yes";
                    json.had_covid_contact          = questions.had_covid_contact == false ? "No" : "Yes";
                    json.was_at_covid_risk_location = questions.was_at_covid_risk_location == false ? "No" : "Yes";
                    json.traveled_outside_us        = questions.traveled_outside_us == false ? "No" : "Yes";
                }



                return(json);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        //public void InitializeAsync(IServiceProvider service, Models.CovidTestJson model)
        //{

        //    AddCovidRecord(service.GetRequiredService<DataSurfContext>(), model);

        //}

        public static bool AddGeniueSignup(DataSurfContext context, Models.CovidTestGenieJSon model)
        {
            Models.CovidTestDBModel find = context.CovidTests.FirstOrDefault(rec => rec.patient_first_name == model.firstname && rec.patient_last_name == model.lastname && rec.patient_email == model.email);
            if (find != null) // we don't want to override the record in this case
            {
                return(false);
            }

            find = new CovidTestDBModel();
            find.patient_email         = model.email;
            find.patient_first_name    = model.firstname;
            find.patient_last_name     = model.lastname;
            find.patient_phone_number  = model.phone;
            find.patient_schedule_date = DateTime.Parse(model.startdatestring);
            find.time_slot             = model.time_slot;
            find.AppointmentID         = Convert.ToInt32(model.itemnumberid);
            find.consent_date          = DateTime.MinValue;

            context.CovidTests.Add(find);
            context.SaveChanges();
            return(true);
        }
Ejemplo n.º 9
0
        public static int AddAddress(DataSurfContext context, DataLayer.Models.TempWorksDB.Address model)
        {
            if (String.IsNullOrEmpty(model.Street1))
            {
                return(0);
            }

            Models.TempWorksDB.Address result = context.Address.FirstOrDefault(result => result.Street1 == model.Street1 && result.PostalCode == model.PostalCode);
            bool addRec = false;

            if (result == null)
            {
                addRec = true;
                result = new Models.TempWorksDB.Address();
            }
            result.Street1      = model.Street1;
            result.Street2      = model.Street2;
            result.PostalCode   = model.PostalCode;
            result.Region       = model.Region;
            result.Municipality = model.Municipality;
            result.AttentionTo  = model.AttentionTo;
            result.Country      = model.Country;

            if (addRec)
            {
                context.Address.Add(result);
            }
            else
            {
                context.Address.Update(result);
            }

            context.SaveChanges();

            return(result.AddressId);
        }
Ejemplo n.º 10
0
        public static bool AddCustomer(DataSurfContext context, DataLayer.Models.TempWorks.Customer model)
        {
            Models.TempWorksDB.Customer result = context.Customer.FirstOrDefault(results => results.CustomerId == model.CustomerId);
            bool addRec = false;

            if (result == null)
            {
                addRec = true;
                result = new Models.TempWorksDB.Customer();
            }
            result.CustomerId       = model.CustomerId;
            result.CustomerName     = model.CustomerName;
            result.CustomerStatus   = model.CustomerStatus;
            result.CustomerStatusId = model.CustomerStatusId;
            result.DateActivated    = DateTime.Parse(model.DateActivated);
            result.DepartmentName   = model.DepartmentName;
            //result.ParentCustomerId = model.ParentCustomerId;
            result.RootCustomerId = model.RootCustomerId;


            Models.TempWorksDB.Address add = new Models.TempWorksDB.Address();
            add.Street1      = model.BillingAddress.Street1;
            add.Street2      = model.BillingAddress.Street2;
            add.PostalCode   = model.BillingAddress.PostalCode;
            add.Municipality = model.BillingAddress.Municipality;
            add.Region       = model.BillingAddress.Region;
            add.AttentionTo  = model.BillingAddress.AttentionTo;
            add.Country      = model.BillingAddress.Country;

            result.BillingAddressID = AddAddress(context, add);

            add.Street1      = model.WorksiteAddress.Street1;
            add.Street2      = model.WorksiteAddress.Street2;
            add.Municipality = model.WorksiteAddress.Municipality;
            add.PostalCode   = model.WorksiteAddress.PostalCode;
            add.Region       = model.WorksiteAddress.Region;
            add.AttentionTo  = model.WorksiteAddress.AttentionTo;
            add.Country      = model.WorksiteAddress.Country;

            result.WorksiteAddressID = AddAddress(context, add);


            result.BranchId   = model.BranchId;
            result.BranchName = model.BranchName;



            if (addRec)
            {
                context.Customer.Add(result);
            }
            else
            {
                context.Customer.Update(result);
            }

            context.SaveChanges();


            return(true);
        }
Ejemplo n.º 11
0
        public static bool AddCovidRecord(DataSurfContext context, Models.CovidTestJson model)
        {
            Models.CovidTestSearch search = new Models.CovidTestSearch();
            if (!string.IsNullOrEmpty(model.AppointmentID))
            {
                search.CovidTestId = model.AppointmentID;
            }
            else
            {
                search.CovidTestId = model.CovidtestId;
            }

            search.patient_first_name = model.patient_first_name;
            search.patient_last_name  = model.patient_last_name;
            search.patient_email      = model.patient_email;



            Models.CovidTestDBModel save = null;
            save = GetCovidRecord(context, search);
            //Models.CovidTestDBModel save = new Models.CovidTestDBModel();



            if (save == null)
            {
                save = new Models.CovidTestDBModel();
                save.AppointmentID = 0;
                save.CovidtestId   = 0;
            }

            save.appointmentLocationID      = 0;
            save.sample_collection_date     = DateTime.UtcNow;
            save.patient_first_name         = model.patient_first_name;
            save.patient_last_name          = model.patient_last_name;
            save.patient_phone_number       = model.patient_phone_number;
            save.patient_sex                = model.patient_sex;
            save.patient_state              = model.patient_state;
            save.patient_city               = model.patient_city;
            save.patient_street_address     = model.patient_street_address;
            save.patient_zip_code           = model.patient_zip_code;
            save.patient_bill_city          = model.patient_bill_city;
            save.patient_bill_name          = model.patient_bill_name;
            save.patient_bill_state         = model.patient_bill_state;
            save.patient_bill_street        = model.patient_bill_street;
            save.patient_bill_zip           = model.patient_bill_zip;
            save.patient_date_of_birth      = Convert.ToDateTime(model.patient_date_of_birth);
            save.patient_email              = model.patient_email;
            save.sample_1_container_barcode = model.sample_1_container_barcode;
            save.identifier                                = model.sample_1_container_barcode;
            save.sample_1_collected_by                     = "Maricopa Technician";
            save.sample_1_container_type                   = "TUBE";
            save.identifier                                = model.sample_1_container_barcode;
            save.sample_1_state_position                   = "A01";
            save.test_panel_code                           = "IDT-COVID-19";
            save.sample_1_identifier                       = "CLINTEST01";
            save.num_samples                               = 1;
            save.provider_npi                              = "1639369036";
            save.institutional_bill_name                   = model.institutional_bill_name;
            save.primary_insurance_id_number               = model.primary_insurance_id_number;
            save.primary_insurance_insurance_provider      = model.primary_insurance_insurance_provider;
            save.primary_insurance_relationship_to_insured = model.primary_insurance_relationship_to_insured;
            save.bill_type = string.IsNullOrEmpty(save.primary_insurance_insurance_provider) ? "Institutional Bill" : "Insurance";
            save.patient_bill_phone_number = model.patient_bill_phone_number;
            save.provider_account          = model.provider_account;
            save.SSN            = model.SSN;
            save.identification = model.identification;
            save.last_mod_dt    = DateTime.Now;
            save.consent_date   = model.patient_consent.ToLower() == "yes" ? DateTime.Now:DateTime.MinValue;

            if (save.CovidtestId == 0)
            {
                context.CovidTests.Add(save);
            }
            else
            {
                context.CovidTests.Update(save);
            }



            Models.CovidQuestionsModel questions = context.CovidQuestions.FirstOrDefault(result => result.CovidTestId == save.CovidtestId);
            if (questions == null)
            {
                questions                            = new Models.CovidQuestionsModel();
                questions.CovidTestId                = save.CovidtestId;
                questions.covid_in_household         = model.covid_in_household == "Yes" ? true:false;
                questions.traveled_outside_us        = model.traveled_outside_us == "Yes" ? true : false;
                questions.covid_positive             = model.covid_positive == "Yes" ? true: false;
                questions.covid_recovered            = model.covid_recovered == "Yes" ? true: false;
                questions.had_covid_contact          = model.had_covid_contact == "Yes" ? true : false;
                questions.was_at_covid_risk_location = model.was_at_covid_risk_location == "Yes" ? true : false;

                context.CovidQuestions.Add(questions);
            }
            else
            {
                questions.CovidTestId                = save.CovidtestId;
                questions.covid_in_household         = model.covid_in_household == "Yes" ? true : false;
                questions.traveled_outside_us        = model.traveled_outside_us == "Yes" ? true : false;
                questions.covid_positive             = model.covid_positive == "Yes" ? true : false;
                questions.covid_recovered            = model.covid_recovered == "Yes" ? true : false;
                questions.had_covid_contact          = model.had_covid_contact == "Yes" ? true : false;
                questions.was_at_covid_risk_location = model.was_at_covid_risk_location == "Yes" ? true : false;
                context.CovidQuestions.Update(questions);
            }

            context.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 12
0
        public static Models.CovidTestEvents GetCovidTestEvents(DataSurfContext context, int ID)
        {
            CovidTestEvents results = context.CovidTestEvents.FirstOrDefault(results => results.SignupEventId == ID);

            return(results);
        }