Beispiel #1
0
        //POST
        public async Task <IHttpActionResult> Post(ProgramChoice progChoice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.ProgramChoice.Add(progChoice);
            await db.SaveChangesAsync();

            return(Created(progChoice));
        }
Beispiel #2
0
        //POST
        public async Task <IHttpActionResult> Post(ProgramChoice ProgramChoice)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            context.ProgramChoices.Add(ProgramChoice);
            await context.SaveChangesAsync();

            return(Created(ProgramChoice));
        }
Beispiel #3
0
        /// <summary>
        /// This is the function that occurs when the save button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveButton_Click_1(object sender, EventArgs e)
        {
            Country selectedCountry
                = (Country)countryComboBox.SelectedItem;


            Gender selectedGender
                = (Gender)genderComboBox.SelectedItem;


            ProvinceState selectedProvState
                = (ProvinceState)provStateComboBox.SelectedItem;


            Citizenship selectedCitizenship
                = (Citizenship)citizenshipComboBox.SelectedItem;


            Country selectedCitizenshipOther
                = (Country)citizenshipOtherComboBox.SelectedItem;


            Campus selectedCampus
                = (Campus)campusComboBox1.SelectedItem;


            NSCCApplicationFormDataLayer.Models.Program selectedProgram
                = (NSCCApplicationFormDataLayer.Models.Program)programsComboBox1.SelectedItem;

            Campus selectedCampus2
                = (Campus)campusComboBox2.SelectedItem;


            NSCCApplicationFormDataLayer.Models.Program selectedProgram2
                = (NSCCApplicationFormDataLayer.Models.Program)programsComboBox2.SelectedItem;


            if (makeApplication == false)
            {
                int counter = 0;

                if (firstNameTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In A First Name");
                }
                else if (lastNameTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In A Last Name");
                }
                else if (dateOfBirthTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In A Date Of Birth");
                }
                else if (IsCorrectDate(dateOfBirthTextBox.Text) == false)
                {
                    MessageBox.Show("Please Fill In A Valid Date Of Birth");
                }
                else if (selectedGender.Description == "<Select A Gender>")
                {
                    MessageBox.Show("Please Select A Gender");
                }
                else if (selectedCountry.Name == "<Select A Country>")
                {
                    MessageBox.Show("Please Select A Country");
                }
                else if (streetTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In A Street Address");
                }
                else if (cityTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In A City");
                }
                else if (selectedProvState.Name == "<Select A Province/State>" && provState == true)
                {
                    MessageBox.Show("Please Select A Province/State");
                }
                else if (provStateOtherTextBox.Text.Length == 0 && provStateOther == true)
                {
                    MessageBox.Show("Please Fill In A Province State Other");
                }
                else if (emailTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In An Email");
                }
                else if (IsValidEmail(emailTextBox.Text) == false)
                {
                    MessageBox.Show("Please Fill In A Valid Email");
                }

                if (selectedCitizenship.Description == "<Select A Citizenship>")
                {
                    MessageBox.Show("Please Select A Citizenship");
                }
                else
                {
                    citizenshipAnswerd = true;

                    counter += 1;
                }

                if (selectedCitizenshipOther.Name == "<Select A Citizenship Other>" && citizenshipOther == true)
                {
                    MessageBox.Show("Please Select A Citizenship Other");
                }
                else
                {
                    citizenshipAnswerd = true;

                    counter += 1;
                }


                if (selectedProgram.Name == "<Select A Program>")
                {
                    MessageBox.Show("Please Select A Program");
                }
                else if (selectedCampus.Name == "<Select A Campus>")
                {
                    MessageBox.Show("Please Select A Campus");
                }
                else if (selectedProgram2.Name == "<Select A Program>")
                {
                    MessageBox.Show("Please Select A Second Program");
                }
                else if (selectedCampus2.Name == "<Select A Campus>")
                {
                    MessageBox.Show("Please Select A Second Campus");
                }
                else if (phoneTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Please Fill In An Phone Number");
                }
                else if (IsValidPhone(phoneTextBox.Text) == false)
                {
                    MessageBox.Show("Please Fill In A Valid Phone Number");
                }



                if (firstLanguageOtherTextBox.Text.Length == 0 && firstLanguageOther == true)
                {
                    MessageBox.Show("Please Fill In A First Language Other");

                    firstLanguageOtherAnswerd = false;
                }

                else
                {
                    firstLanguageOtherAnswerd = true;

                    counter += 1;
                }


                if (counter == 3)
                {
                    makeApplication = true;
                }
            }

            if (makeApplication == true)
            {
                if (firstNameTextBox.Text.Length > 0 &&
                    lastNameTextBox.Text.Length > 0 &&
                    dateOfBirthTextBox.Text.Length > 0 &&
                    selectedGender.Description != "<Select A Gender>" &&
                    selectedCountry.Name != "<Select A Country>" &&
                    streetTextBox.Text.Length > 0 &&
                    cityTextBox.Text.Length > 0 &&
                    provStateAnswerd == true &&
                    emailTextBox.Text.Length > 0 &&
                    selectedCitizenship.Description != "<Select A Citizenship>" &&
                    citizenshipAnswerd == true &&
                    selectedProgram.Name != "<Select A Program>" &&
                    selectedCampus.Name != "<Select A Campus>" &&
                    selectedProgram2.Name != "<Select A Program>" &&
                    selectedCampus2.Name != "<Select A Campus>" &&
                    phoneTextBox.Text.Length > 0 &&
                    firstLanguageOtherAnswerd == true
                    )
                {
                    try
                    {
                        //Make and add applicant to database
                        Applicant newApplicant = new Applicant();

                        newApplicant.FirstName = firstNameTextBox.Text;

                        if (String.IsNullOrEmpty(middelNameTextBox.Text) == false)
                        {
                            newApplicant.MiddleName = middelNameTextBox.Text;
                        }

                        newApplicant.LastName = lastNameTextBox.Text;

                        newApplicant.DateOfBirth = DateTime.Parse(dateOfBirthTextBox.Text);

                        newApplicant.Gender = selectedGender.Code;

                        newApplicant.CountryCode = selectedCountry.Code;

                        newApplicant.StreetAddress1 = streetTextBox.Text;

                        newApplicant.City = cityTextBox.Text;

                        newApplicant.ProvinceStateCode = selectedProvState.Code;

                        newApplicant.ProvinceStateOther = provStateOtherTextBox.Text;

                        newApplicant.EmailAddress = emailTextBox.Text;

                        newApplicant.Citizenship = selectedCitizenship.Id;

                        newApplicant.CitizenshipOther = selectedCitizenshipOther.Code;

                        newApplicant.IsEnglishFirstLanguage = englishFirstCheckBox.Checked;

                        newApplicant.HasCriminalConvicition = pastCrimeCheckBox.Checked;

                        newApplicant.IsIndigenous = firstNationCheckBox.Checked;

                        newApplicant.IsAfricanCanadian = africanChildCheckBox.Checked;

                        newApplicant.HasDisability = disabilityCheckBox.Checked;

                        newApplicant.PhoneHome = phoneTextBox.Text;

                        newApplicant.FirstLanguageOther = firstLanguageOtherTextBox.Text;

                        service.AddToApplicants(newApplicant);

                        service.SaveChanges();


                        //Make and add application to database
                        NSCCApplicationFormDataLayer.Models.Application newApplication =
                            new NSCCApplicationFormDataLayer.Models.Application();

                        newApplication.ApplicantId = newApplicant.ApplicantId;

                        newApplication.SubmissionDate = DateTime.Now;

                        newApplication.ApplicationFee = 50;

                        newApplication.Paid = false;

                        service.AddToApplications(newApplication);

                        service.SaveChanges();


                        //Make and add program choice to database
                        ProgramChoice newProgramChoice = new ProgramChoice();

                        newProgramChoice.ApplicantId = newApplicant.ApplicantId;

                        newProgramChoice.ProgramId = selectedProgram.Id;

                        newProgramChoice.CampusId = selectedCampus.Id;

                        newProgramChoice.Preference = 1;

                        service.AddToProgramChoices(newProgramChoice);

                        service.SaveChanges();



                        //Make and add program choice to database
                        ProgramChoice newProgramChoice2 = new ProgramChoice();

                        newProgramChoice2.ApplicantId = newApplicant.ApplicantId;

                        newProgramChoice2.ProgramId = selectedProgram2.Id;

                        newProgramChoice2.CampusId = selectedCampus2.Id;

                        newProgramChoice2.Preference = 0;

                        service.AddToProgramChoices(newProgramChoice2);

                        service.SaveChanges();


                        //Reload all of the dropdowns and text boxes and check boxes

                        var applicantList1 = service.Applicants.Expand("ProvinceState,Country,TheCitizenship,CitizenshipOtherForApplicant").OrderBy(a => a.LastName).ToList();

                        //Display Programs

                        var programsList = service.Programs.Expand(p => p.Campuss).ToList();

                        programsList.Insert(0, new NSCCApplicationFormDataLayer.Models.Program
                        {
                            Name = "<Select A Program>"
                        });

                        programsComboBox1.DataSource = programsList;

                        programsComboBox1.DisplayMember = "Name";

                        var programsList2 = service.Programs.Expand(p => p.Campuss).ToList();

                        programsList2.Insert(0, new NSCCApplicationFormDataLayer.Models.Program
                        {
                            Name = "<Select A Program>"
                        });

                        programsComboBox2.DataSource = programsList2;

                        programsComboBox2.DisplayMember = "Name";



                        //Display Campus
                        var campusList = service.Campuses.OrderBy(p => p.Name).ToList();

                        campusList.Insert(0, new Campus {
                            Name = "<Select A Campus>"
                        });

                        campusComboBox1.DataSource = campusList;

                        campusComboBox1.DisplayMember = "Name";

                        var campusList2 = service.Campuses.OrderBy(p => p.Name).ToList();

                        campusList2.Insert(0, new Campus {
                            Name = "<Select A Campus>"
                        });

                        campusComboBox2.DataSource = campusList2;

                        campusComboBox2.DisplayMember = "Name";


                        //Display Genders
                        var genderList = service.Genders.OrderBy(p => p.Description).ToList();

                        genderList.Insert(0, new Gender {
                            Description = "<Select A Gender>"
                        });

                        genderComboBox.DataSource = genderList;

                        genderComboBox.DisplayMember = "Description";


                        //Display Country
                        var countryList = service.Countries.OrderBy(p => p.Name).ToList();

                        countryList.Insert(0, new Country {
                            Name = "<Select A Country>"
                        });

                        countryComboBox.DataSource = countryList;

                        countryComboBox.DisplayMember = "Name";



                        //Display Province State
                        var provStateList = service.ProvinceStates.OrderBy(p => p.Name).ToList();

                        provStateList.Insert(0, new ProvinceState {
                            Name = "<Select A Province/State>"
                        });

                        provStateComboBox.DataSource = provStateList;

                        provStateComboBox.DisplayMember = "Name";



                        //Display Citizenships
                        var citizenshipsList = service.Citizenships.OrderBy(p => p.Description).ToList();

                        citizenshipsList.Insert(0, new Citizenship {
                            Description = "<Select A Citizenship>"
                        });

                        citizenshipComboBox.DataSource = citizenshipsList;

                        citizenshipComboBox.DisplayMember = "Description";



                        //Display Citizenships Other
                        var citizenshipsOtherList = service.Countries.OrderBy(p => p.Name).ToList();

                        citizenshipsOtherList.Insert(0, new Country {
                            Name = "<Select A Citizenship Other>"
                        });

                        citizenshipOtherComboBox.DataSource = citizenshipsOtherList;

                        citizenshipOtherComboBox.DisplayMember = "Name";

                        firstNameTextBox.Text = "";

                        lastNameTextBox.Text = "";

                        middelNameTextBox.Text = "";

                        phoneTextBox.Text = "";

                        dateOfBirthTextBox.Text = "";

                        streetTextBox.Text = "";

                        cityTextBox.Text = "";

                        provStateOtherTextBox.Text = "";

                        emailTextBox.Text = "";

                        pastCrimeCheckBox.Checked = false;

                        childAbuseCheckBox.Checked = false;

                        pastDisciplinaryCheckBox.Checked = false;

                        africanChildCheckBox.Checked = false;

                        firstNationCheckBox.Checked = false;

                        currentALPCheckBox.Checked = false;

                        disabilityCheckBox.Checked = false;

                        englishFirstCheckBox.Checked = false;

                        MessageBox.Show("Thank you for filling out an application");


                        //Load up the applicants list box
                        List <Applicant> applicantList = service.Applicants.OrderBy(a => a.LastName).ToList();

                        applicantsListBox.DataSource = applicantList;

                        applicantsListBox.DisplayMember = "LastName";
                    }
                    catch
                    {
                        MessageBox.Show("An error has occured");
                    }
                }
            }
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            if (!CfiVerifier.Options.ParseCommandLine(String.Join(" ", args)))
            {
                return;
            }
            Utils.Assert(args.Length == 3, "Expecting three given arguments (<passes> <inputFile> <outputFile>)!");
            // Arguments: string inputFile, string outputFile
            Program inputProgram;

            Utils.ParseProgram(args[1], out inputProgram);
            Utils.Assert(inputProgram.Implementations.Count() == 1, "Expecting a single implementation in the program");
            string outputName     = args[2];
            string outputBasename = Path.GetFileName(args[2]);

            foreach (string choiceString in args[0].Split(','))
            {
                ProgramChoice choice = (ProgramChoice)Enum.Parse(typeof(ProgramChoice), choiceString);
                Console.WriteLine(choiceString);
                switch (choice)
                {
                case ProgramChoice.SLICE:
                    CLSlicer.Run(inputProgram);
                    break;

                case ProgramChoice.GRAPH_DGML:
                    CL_DGML_GraphEmitter.Run(inputProgram, outputBasename.Split('.')[0]);
                    break;

                case ProgramChoice.GRAPH_DOT:
                    CL_DOT_GraphEmitter.Run(inputProgram, outputBasename.Split('.')[0]);
                    break;

                case ProgramChoice.REMOVE_CODE_BRANCHES:
                    CLRemoveCodeBranches.Run(inputProgram);
                    break;

                case ProgramChoice.SPLIT_MEMORY:
                    CLMemorySplitter.Run(inputProgram);
                    break;

                case ProgramChoice.SLICE_PARTITIONS:
                    CLParitionSlicer.Run(inputProgram);
                    break;

                case ProgramChoice.SIMPLIFY_CONSTANT_EXPRS:
                    CLConstantExpressionSimplifier.Run(inputProgram);
                    break;

                case ProgramChoice.EXTRACT_LOADS:
                    CLLoadExtractor.Run(inputProgram);
                    break;

                case ProgramChoice.VERIFY:
                    CLVerifier.Run(inputProgram);
                    break;

                case ProgramChoice.SLICE_ASSUMES:
                    CLIndiscrimateAssumeSlicer.Run(inputProgram);
                    break;

                case ProgramChoice.ABSTRACT_MEM:
                    CLMemAbstractor.Run(inputProgram);
                    break;

                default:
                    throw new Exception("Not implemented");
                }
            }
            TokenTextWriter ttw = new TokenTextWriter(outputName);

            inputProgram.Emit(ttw);
            ttw.Close();
        }
        private void submitButton_Click(object sender, EventArgs e)
        {
            Applicant applicant = new Applicant();

            AppDBDatalayer.Models.Application application = new AppDBDatalayer.Models.Application();
            ProgramChoice programChoice  = new ProgramChoice();
            ProgramChoice programChoice2 = new ProgramChoice();

            if (dob == true && firstName == true && lastName == true && stAddy == true && city == true && IsItEmail == true && phNum == true)
            {
                // create applicant package to applicant table
                applicant.FirstName              = firstNameTextBox.Text;
                applicant.LastName               = lastNameTextBox.Text;
                applicant.DateOfBirth            = dobTimePicker.Value;
                applicant.Gender                 = ((Gender)genderComboBox.SelectedItem).Code;
                applicant.CountryCode            = ((Country)countryComboBox.SelectedItem).Code;
                applicant.StreetAddress1         = streetAddressTextBox.Text;
                applicant.City                   = cityTextBox.Text;
                applicant.ProvinceStateCode      = ((ProvinceState)provinceStateComboBox.SelectedItem).Code;
                applicant.ProvinceStateOther     = provinceStateOtherTextBox.Text;
                applicant.EmailAddress           = emailTextBox.Text;
                applicant.Citizenship            = ((Citizenship)citizenshipComboBox.SelectedItem).Id;
                applicant.CitizenshipOther       = ((Country)citizenshipOtherComboBox.SelectedItem).Code;
                applicant.IsEnglishFirstLanguage = IsEnglishFirstLanguage.Checked;
                applicant.FirstLanguageOther     = firstLanguageOtherTextBox.Text;
                applicant.HasCriminalRecord      = hasCriminalRecordCheckBox.Checked;
                applicant.IsIndigenous           = isIndigenousCheckBox.Checked;
                applicant.IsAfricanCanadian      = isAfricanCanadianCheckBox.Checked;
                applicant.HasDisability          = hasDisabilityCheckBox.Checked;
                applicant.PhoneHome              = phoneNumberTextBox.Text;

                // sending to Applicants Table
                service.AddToApplicants(applicant);

                // commit
                service.SaveChanges();

                // creating application package
                application.ApplicationId  = applicant.Applicantid;
                application.SubmissionDate = DateTime.Now;
                application.ApplicationFee = 50;
                application.Paid           = false;

                // sending to application table
                service.AddToApplications(application);

                // commit
                service.SaveChanges();

                // creating ProgramChoice Package 1
                programChoice.ApplicationId = application.ApplicationId;
                programChoice.ProgramId     = ((AppDBDatalayer.Models.Program)choiceOneProgramComboBox.SelectedItem).Id;
                programChoice.CampusId      = ((Campus)choiceOneCampusComboBox.SelectedItem).Id;
                programChoice.Preference    = 1;

                // sending package to ProgramChoice 1
                service.AddToProgramChoices(programChoice);

                // commit
                service.SaveChanges();

                // creating ProgramChoice Package 2
                programChoice2.ApplicationId = application.ApplicationId;
                programChoice2.ProgramId     = ((AppDBDatalayer.Models.Program)choiceTwoProgramComboBox.SelectedItem).Id;
                programChoice2.CampusId      = ((Campus)choiceTwoCampusComboBox.SelectedItem).Id;
                programChoice2.Preference    = 2;

                // sending package to ProgramChoice 2
                service.AddToProgramChoices(programChoice2);

                // commit
                service.SaveChanges();

                clearForm();
            }
            else
            {
                MessageBox.Show("You have invalid input in the form");
                clearForm();
            }
        }
Beispiel #6
0
        /// <summary>
        /// When submit button on form is clicked submit record
        /// to REST database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubmitBtn_Click(object sender, EventArgs e)
        {
            if (!FormInvalid())
            {
                Applicant newApplicant = new Applicant();
                newApplicant.FirstName      = FirstNameTxt.Text;
                newApplicant.MiddleName     = MiddleNameTxt.Text;
                newApplicant.LastName       = LastNameTxt.Text;
                newApplicant.DOB            = DataOfBirthDateTimePicker.Value;
                newApplicant.Gender         = GenderCbo.Text.Substring(0, 1);
                newApplicant.StreetAddress1 = StreetAddressTxt.Text;
                newApplicant.City           = CityTxt.Text;
                newApplicant.CountryCode    = ((Country)CountryCbo.SelectedItem).CountryCode;
                newApplicant.PhoneHome      = "5555555555";
                newApplicant.Email          = EmailTxt.Text;
                newApplicant.Citizenship    = ((Citizenship)CitizenshipCbo.SelectedItem).CitizenshipId;
                if (((Citizenship)CitizenshipCbo.SelectedItem).CitizenshipId == 5)
                {
                    newApplicant.CitizenshipOther = ((Country)CitizenshipOtherCbo.SelectedItem).CountryCode;
                }

                newApplicant.HasCriminalConviction = PastCriminalConvictionChk.Checked;
                newApplicant.OnChildAbuseRegistry  = ChildAbuseRegChk.Checked;
                newApplicant.HasDisciplinaryAction = PastDiscActionChk.Checked;
                newApplicant.IsAfricanCanadian     = AfricanCanadianChk.Checked;
                newApplicant.IsFirstNations        = FirstNationsChk.Checked;
                newApplicant.IsCurrentALP          = ALPStudentChk.Checked;
                newApplicant.HasDisability         = DocumentedDisabilityChk.Checked;
                newApplicant.Password = "******";
                try{
                    container.AddToApplicants(newApplicant);
                    container.SaveChanges();

                    NSCCModelDB.Application newApplication = new NSCCModelDB.Application();
                    newApplication.ApplicationDate = DateTime.Now;
                    newApplication.ApplicantId     = newApplicant.ApplicantId;
                    newApplication.Paid            = false;

                    container.AddToApplications(newApplication);
                    container.SaveChanges();

                    ProgramChoice newProgramChoice = new ProgramChoice();
                    newProgramChoice.ApplicationId = newApplication.ApplicationId;
                    newProgramChoice.CampusId      = ((ComboBoxItem)CampusChoice1Cbo.SelectedItem).Value;
                    // newProgramChoice.ProgramId = ((Program) ProgramChoice1Cbo.SelectedItem).ProgramId; //dont work?
                    newProgramChoice.ProgramId  = (int)ProgramChoice1Cbo.SelectedValue;
                    newProgramChoice.Preference = 1;
                    container.AddToProgramChoices(newProgramChoice);
                    container.SaveChanges();

                    ProgramChoice newProgramChoice2 = new ProgramChoice();
                    newProgramChoice2.ApplicationId = newApplication.ApplicationId;
                    newProgramChoice2.CampusId      = ((ComboBoxItem)CampusChoice2Cbo.SelectedItem).Value;
                    // newProgramChoice2.ProgramId = ((Program) ProgramChoice1Cbo.SelectedItem).ProgramId; //dont work?
                    newProgramChoice2.ProgramId  = (int)ProgramChoice2Cbo.SelectedValue;
                    newProgramChoice2.Preference = 2;
                    container.AddToProgramChoices(newProgramChoice2);
                    container.SaveChanges();
                    ErrorLbl.Text = "Successfully Added new Record";
                }
                catch (Exception ex)
                {
                    ErrorLbl.Text = ex.Message;
                }
            }
        }