public bool SaveSurveys(List<Survey> surveys, Applicant applicant) {
			int applicantID = SaveApplicant(applicant);

			foreach (Survey survey in surveys) {
				SaveSurvey(survey, applicantID);
			}
			return true;
		}
		private int SaveApplicant(Applicant applicant) {
            ds = new DataSet();
            conn = new DBConn.DBConn();
			ds = conn.execSQLCommand("EXEC spSaveApplicant '" + applicant.FirstName + "', '" + applicant.LastName + "'");
            if (Convert.ToInt32(ds.Tables[0].Rows.Count) > 0)
                return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            else
                return 0;
		}
        private void LoadApplicantInfo(int applicantId)
        {
            var applicant = new Applicant();
            applicant.LoadApplicantInfo(applicantId);

            this.applicantName.Text = applicant.Name;
            this.applicantAddress1.Text = applicant.Address1;
            this.applicantAddress2.Text = applicant.Address2;
            this.applicantPostcode.Text = applicant.Postcode;
            this.applicantMobile.Text = applicant.Mobile;
            this.cv = applicant.Cv;
            this.cl = applicant.Cl;
        }
        //Must override, this is the important one.  This method is used to
        //bind our current data to your view holder.  Think of this as the equivalent
        //of GetView for regular Adapters.
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var viewHolder = holder as ReportRowHolder;

            ApplicantReport = _reportList[position];

            //Bind our data from our data source to our View References
            viewHolder.ID.Text = ApplicantReport.Id.ToString();
            viewHolder.FirstName.Text = ApplicantReport.FirstName;
            viewHolder.LastName.Text = ApplicantReport.LastName;
            viewHolder.Gender.Text = ApplicantReport.Gender;
            viewHolder.DateOfBirth.Text = ApplicantReport.DateOfBirth;

            //var photoBitmap = await _imageManager.GetScaledDownBitmapFromResourceAsync(currentReport.ProfileReportPhoto, 120, 120);
            //viewHolder.ReportProfilePhoto.SetImageBitmap(photoBitmap);
        }
        // GET: /Application/
        public ActionResult Index(int jobId = 1)
        {
            var job = new Job()
            {
                JobId = jobId,
                Position = "Sales Associate",
                Description = "Customer Service, Stocking, Cashier",
                FullPartTime = "Part-time",
                SalaryRange = "$8.00 - $10.00 hourly",
                QuestionnaireId = 1,
                HoursId = 1
            };

            var applicant = new Applicant();
            var applicantQuestionAnswer = new ApplicantQuestionAnswer();
            var educations = new List<Education>();
            var jobHistories = new List<JobHistory>();
            var hour = new Hour();
            var references = new List<Reference>();
            var user = new User();
            var personalInfo = new PersonalInfo();

            var viewModel = new ApplicationViewModel()
            {
                Application = new Models.EntityModels.Application()
                {
                    DateCreated = DateTime.Now.Date,
                    JobId = jobId,
                },
                
                Job = job,
                Applicant = applicant,
                ApplicantQuestionAnswer = applicantQuestionAnswer,
                Education = educations,
                JobHistory = jobHistories,
                Hour = hour,
                Reference = references,
                User = user,
                PersonalInfo = personalInfo
            };

            return View(viewModel);
        }
        public void add_applicant()
        {
            var newapp = new Applicant();
            newapp.Name = "qwr aaa";
            newapp.Rate = 234;
            List<Applicant> app = _session.Query<Applicant>().ToList();
            int beforeinsert = app.Count;
            int afterinsert= 0 ;
            using (ITransaction trans = _session.BeginTransaction())
            {
                _session.SaveOrUpdate(newapp);
                trans.Commit();
                List<Applicant> _app= _session.Query<Applicant>().ToList();
                afterinsert = _app.Count;

            }
            using (ITransaction trans = _session.BeginTransaction())
            {
                _session.Delete(newapp);
                trans.Commit();
            }
            Assert.AreEqual(afterinsert, beforeinsert+1);
        }
        public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Index", "Manage");
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (info == null)
                {
                    return View("ExternalLoginFailure");
                }
                var user = new Applicant { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user);
                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);
                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                        return RedirectToLocal(returnUrl);
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
Exemple #8
0
 public Applicant getApplicantClassByID(string pwalletID)
 {
     Applicant applicant = new Applicant();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM applicant WHERE log_staff='" + pwalletID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         applicant.ID = reader["ID"].ToString();
         applicant.xtype = reader["xtype"].ToString();
         applicant.xname = reader["xname"].ToString();
         applicant.tax_id_type = reader["tax_id_type"].ToString();
         applicant.tax_id_number = reader["tax_id_number"].ToString();
         applicant.individual_id_number = reader["individual_id_number"].ToString();
         applicant.nationality = reader["nationality"].ToString();
         applicant.addressID = reader["addressID"].ToString();
         applicant.log_staff = reader["log_staff"].ToString();
         applicant.reg_date = reader["reg_date"].ToString();
         applicant.visible = reader["visible"].ToString();
     }
     reader.Close();
     return applicant;
 }
Exemple #9
0
 public FeeValidation(Applicant applicant)
 {
     _applicant = applicant;
 }
Exemple #10
0
 public void AddApplicant(Applicant applicant)
 {
     _context.Applicant.Add(applicant);
     _context.SaveChanges();
 }
Exemple #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ReportProfilePageView);
            //Verify that this does not return an empty string or null
            var applicantReportJson = Intent.GetStringExtra ("Applicant");
            //Verify that this does not return null;  If it does, then your something wrong with your Applicant class
            _applicantReport = JsonConvert.DeserializeObject<Applicant> (applicantReportJson);

            FindViewById<TextView>(Resource.Id.txtReportProfilePageCreatedAt).Text = _applicantReport.CreatedAt;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageFirstName).Text = _applicantReport.FirstName;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageLastName).Text = _applicantReport.LastName;
            FindViewById<TextView> (Resource.Id.txtReportProfilePageGender).Text = _applicantReport.Gender;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageDOB).Text = _applicantReport.DateOfBirth;;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageTelephone).Text = _applicantReport.Telephone;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageMobile).Text = _applicantReport.Mobile;
            FindViewById<TextView>(Resource.Id.txtReportProfilePageCountry).Text = _applicantReport.Country;

            //_ProfilePhoto = FindViewById<ImageView>(Resource.Id.imgReportProfilePage);

            var index = Intent.GetIntExtra("index", -1);
            if(index < 0)
            {
                return;
            }

            /************TOOLBAR******************************************************/
            _toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            _leftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
            _rightDrawer = FindViewById<ListView>(Resource.Id.right_drawer);

            //tag left and right drawer for case statment when clicked
            _leftDrawer.Tag = 0;
            _rightDrawer.Tag = 1;
            //Set action support toolbar with private class variable
            SetSupportActionBar(_toolbar);

            //***********LEFT DATA SET******************************/
            //Left data set, these are the buttons you see when you click on the drawers
            _leftDataSet = new List<string>();
            //my_profile has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.main_menu));
            //log_out has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.log_out));
            _leftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _leftDataSet);
            _leftDrawer.Adapter = _leftAdapter;
            //click event for the left drawer
            this._leftDrawer.ItemClick += LeftDrawerRowClick;

            //***********RIGHT DATA SET******************************/
            _rightDataSet = new List<string>();
            //support has a string in the string xml file in values directory
            _rightDataSet.Add(GetString (Resource.String.help_popup));
            //rentproof has a string in the string xml file in values directory
            _rightDataSet.Add(GetString(Resource.String.support));
            _rightAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _rightDataSet);
            _rightDrawer.Adapter = _rightAdapter;
            this._rightDrawer.ItemClick += RightDrawerRowClick;

            //constructor for navigation bar
            _drawerToggle = new NavigationBar(
                this,							//Host Activity
                _drawerLayout,					//DrawerLayout
                Resource.String.openDrawer,		//Opened Message
                Resource.String.closeDrawer		//Closed Message
            );
            //set drawerlistener
            _drawerLayout.SetDrawerListener(_drawerToggle);
            //set home button
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            _drawerToggle.SyncState();

            if (bundle != null){
                if (bundle.GetString("DrawerState") == "Opened"){
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }

                else{
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }

            else{
                //This is the first the time the activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }
            //*****************END OF ONCREATE TOOLBAR***********
        }
Exemple #12
0
 partial void OnAfterDelete(Applicant applicant);
        public ActionResult <RequestValidator> AddApplicant([FromBody] Applicant applicant)
        {
            //used to return feedback to the user
            var gVal = new RequestValidator();

            try
            {
                if (string.IsNullOrEmpty(applicant.Name))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide applicant's Name.";
                    return(gVal);
                }

                if (applicant.Name.Length < 5)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Applicant's Name must not be less than 5 characters.";
                    return(gVal);
                }

                if (string.IsNullOrEmpty(applicant.FamilyName))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide applicant's Family Name.";
                    return(gVal);
                }

                if (applicant.FamilyName.Length < 5)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Applicant's Family Name must not be less than 5 characters.";
                    return(gVal);
                }

                if (string.IsNullOrEmpty(applicant.EmailAdress))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Applicant's Email Address.";
                    return(gVal);
                }

                if (!applicant.EmailAdress.Contains('@'))
                {
                    gVal.Code    = -1;
                    gVal.Message = "The provided Email Address is invalid.";
                    return(gVal);
                }

                //validate if the email Address is actually valid, not just checking if it contains the '@' character
                //using the in-built .net System.ComponentModel.DataAnnotations
                var isvalidEmail = new EmailAddressAttribute().IsValid(applicant.EmailAdress);
                if (!isvalidEmail)
                {
                    gVal.Code    = -1;
                    gVal.Message = "The provided Email Address is invalid.";
                    return(gVal);
                }

                if (string.IsNullOrEmpty(applicant.Address))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Applicant's Address.";
                    return(gVal);
                }

                if (applicant.Address.Length < 10)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Applicant's Address must not be less than 10 characters.";
                    return(gVal);
                }

                if (string.IsNullOrEmpty(applicant.CountryOfOrigin))
                {
                    gVal.Code    = -1;
                    gVal.Message = "Please provide Applicant's Country Of Origin.";
                    return(gVal);
                }

                if (applicant.Age < 20 || applicant.Age > 60)
                {
                    gVal.Code    = -1;
                    gVal.Message = "Applicant's Age must fall between 20 and 60 years";
                    return(gVal);
                }

                var status = _applicantService.AddApplicant(applicant);
                if (status < 1)
                {
                    gVal.Code    = -1;
                    gVal.Message = status == -3 ? "applicant record already exists" : "An unknown error was encountered. Please try again.";
                    return(gVal);
                }

                gVal.Code    = status;
                gVal.Message = "Applicant information was successfully Added";
                return(gVal);
            }
            catch (Exception ex)
            {
                gVal.Code    = -1;
                gVal.Message = ex.Message != null ? ex.Message + "\n" + ex.StackTrace : ex.InnerException != null ? ex.InnerException.Message + "\n" + ex.StackTrace : "An unknown error was encountered. Please try again.";

                _logger.LogInformation(gVal.Message);

                return(gVal);
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ReportListView);

            _applicantReport = JsonConvert.DeserializeObject<Applicant> (Intent.GetStringExtra ("Applicant"));

            _progressDialog = new ProgressDialog(this);
            _progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            _progressDialog.SetMessage("Loading  . . .");
            _progressDialog.Show();

            //If the device is portrait, then show the RecyclerView in a vertical list,
            //else show it in horizontal list.
            _layoutManager = Resources.Configuration.Orientation == Android.Content.Res.Orientation.Portrait
                ? new LinearLayoutManager(this, LinearLayoutManager.Vertical, false)
                : new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            //Experiement with a GridLayoutManger! You can create some cool looking UI!
            //This create a gridview with 2 rows that scrolls horizontally.
            //            _layoutManager = new GridLayoutManager(this, 2, GridLayoutManager.Horizontal, false);

            //Create a reference to our RecyclerView and set the layout manager;
            _recyclerView = FindViewById<RecyclerView>(Resource.Id.reportRecyclerListView);
            _recyclerView.SetLayoutManager(_layoutManager);

            //Get our crew member data. This could be a web service.

            _reportList.Add (_applicantReport);

            //Create the adapter for the RecyclerView with our crew data, and set
            //the adapter. Also, wire an event handler for when the user taps on each
            //individual item.
            _adapter = new ReportViewAdapter(_reportList,this.Resources);
            _adapter.ItemClick += OnItemClick;
            _recyclerView.SetAdapter(_adapter);

            _progressDialog.Dismiss();

            /************TOOLBAR******************************************************/
            _toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            _leftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
            _rightDrawer = FindViewById<ListView>(Resource.Id.right_drawer);

            //tag left and right drawer for case statment when clicked
            _leftDrawer.Tag = 0;
            _rightDrawer.Tag = 1;
            //Set action support toolbar with private class variable
            SetSupportActionBar(_toolbar);

            //***********LEFT DATA SET******************************/
            //Left data set, these are the buttons you see when you click on the drawers
            _leftDataSet = new List<string>();
            //my_profile has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.main_menu));
            //log_out has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.log_out));
            _leftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _leftDataSet);
            _leftDrawer.Adapter = _leftAdapter;
            //click event for the left drawer
            this._leftDrawer.ItemClick += LeftDrawerRowClick;

            //***********RIGHT DATA SET******************************/
            _rightDataSet = new List<string>();
            //support has a string in the string xml file in values directory
            _rightDataSet.Add(GetString (Resource.String.help_popup));
            //rentproof has a string in the string xml file in values directory
            _rightDataSet.Add(GetString(Resource.String.support));
            _rightAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _rightDataSet);
            _rightDrawer.Adapter = _rightAdapter;
            this._rightDrawer.ItemClick += RightDrawerRowClick;

            //constructor for navigation bar
            _drawerToggle = new NavigationBar(
                this,							//Host Activity
                _drawerLayout,					//DrawerLayout
                Resource.String.openDrawer,		//Opened Message
                Resource.String.closeDrawer		//Closed Message
            );
            //set drawerlistener
            _drawerLayout.SetDrawerListener(_drawerToggle);
            //set home button
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            _drawerToggle.SyncState();

            if (bundle != null){
                if (bundle.GetString("DrawerState") == "Opened"){
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }

                else{
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }

            else{
                //This is the first the time the activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }
            //*****************END OF ONCREATE TOOLBAR***********
        }
        /// <summary>
        /// Assign an Applicant to one country
        /// </summary>
        /// <param name="school">The Applicant to be assigned</param>
        /// <param name="iteration">The iteration of assignment (1 or 2)</param>
        /// <returns></returns>
        private bool applicantAssignedToOneCountry(Applicant school, int iteration)
        {
            //first iteration when preferences are taken into account
            if (iteration == 1)
            {
                foreach (Region pref in school.regions)
                {
                    foreach (Country country in countries)
                    {
                        if (country.region == pref && !country.isFull())
                        {
                            country.schools.Add(school);
                            return true;
                        }
                    }
                }
                return false;
            }

            //subsequent iterations when no preferences are taken into account
            else
            {
                foreach (Country country in countries)
                    if (!country.isFull())
                    {
                        country.schools.Add(school);
                        return true;
                    }
            }

            //Returning false here means there is an issue with the number of schools and number of available countries
            return false;
        }
Exemple #16
0
 public string addTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     string xID = "";
     this.addApplicant(c_app, c_app_addy, pwallet);
     xID = this.addMark(c_mark, pwallet);
     this.updateMarkReg(xID, c_mark.tm_typeID);
     this.addAos(c_aos, pwallet);
     this.addRepresentative(c_rep, c_rep_addy, pwallet);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
        /*protected override void OnPostCreate (Bundle savedInstanceState){
            base.OnPostCreate (savedInstanceState);
            mDrawerToggle.SyncState();
        }
        */
        private void OnItemClick(object sender, int position)
        {
            var reportIntent = new Intent(this ,typeof(ReportController));

            // Verify using the debugger that this is not null
            _applicantReport = _reportList [position];

            //Verify using the debugger that this is not null or an empty string.
            var appReportJson = JsonConvert.SerializeObject(_applicantReport);

            reportIntent.PutExtra("Applicant", appReportJson);

            StartActivity(reportIntent);
        }
Exemple #18
0
 public string addSoloApplicant(Applicant c_app, string addyID, string pwalletID)
 {
     if (c_app.xname == null)
     {
         c_app.xname = "";
     }
     if (c_app.nationality == null)
     {
         c_app.nationality = "";
     }
     string connectionString = this.Connect();
     string str5 = "";
     SqlConnection connection = new SqlConnection(connectionString);
     SqlCommand command = connection.CreateCommand();
     command.CommandText = "INSERT INTO applicant (xname,nationality,addressID,log_staff,reg_date,visible) VALUES (@xname,@nationality,@addressID,@log_staff,@reg_date,@visible) SELECT SCOPE_IDENTITY()";
     connection.Open();
     command.Parameters.Add("@xname", SqlDbType.VarChar);
     command.Parameters.Add("@nationality", SqlDbType.NVarChar, 50);
     command.Parameters.Add("@addressID", SqlDbType.VarChar, 50);
     command.Parameters.Add("@log_staff", SqlDbType.VarChar, 20);
     command.Parameters.Add("@reg_date", SqlDbType.VarChar, 10);
     command.Parameters.Add("@visible", SqlDbType.VarChar, 1);
     command.Parameters["@xname"].Value = c_app.xname;
     command.Parameters["@nationality"].Value = c_app.nationality;
     command.Parameters["@addressID"].Value = addyID;
     command.Parameters["@log_staff"].Value = pwalletID;
     command.Parameters["@reg_date"].Value = c_app.reg_date;
     command.Parameters["@visible"].Value = c_app.visible;
     str5 = command.ExecuteScalar().ToString();
     connection.Close();
     return str5;
 }
Exemple #19
0
 public string addCurrentTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     Stage s = getStageClassByUserID(pwallet);
     string xID = ""; string date = s.reg_date; string year = s.reg_date.Substring(0, 4);
     this.addCurrentApplicant(c_app, c_app_addy, pwallet, date);
     xID = this.addCurrentMark(c_mark, pwallet, date);
     this.updateCurrentMarkReg(xID, c_mark.tm_typeID, year);
     this.addCurrentAos(c_aos, pwallet, date);
     this.addCurrentRepresentative(c_rep, c_rep_addy, pwallet, date);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
Exemple #20
0
 public List<Applicant> getApplicantListByUserID(string ID)
 {
     List<Applicant> list = new List<Applicant>();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM applicant WHERE log_staff='" + ID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         Applicant item = new Applicant
         {
             ID = reader["ID"].ToString(),
             xtype = reader["xtype"].ToString(),
             xname = reader["xname"].ToString(),
             tax_id_type = reader["tax_id_type"].ToString(),
             tax_id_number = reader["tax_id_number"].ToString(),
             individual_id_number = reader["individual_id_number"].ToString(),
             nationality = reader["nationality"].ToString(),
             addressID = reader["addressID"].ToString(),
             log_staff = reader["log_staff"].ToString(),
             reg_date = reader["reg_date"].ToString(),
             visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }
Exemple #21
0
 partial void OnAfterGetById(Applicant Applicants, String applicantId);
        /// <summary>
        /// Assign an applicant to a school based on country preferences read from the input file
        /// </summary>
        /// <param name="school">The Applicant to assign</param>
        /// <returns>True if the assignment has been made, false otherwise</returns>
        private bool assignToCountry(Applicant school)
        {
            //Find the country from List<Country> that is equal to the preference
            //If that country is not full, add the person and return true
            //Otherwise continue looping!
            foreach (Country pref in school.prefs)
            {
                if (pref == null)
                {
                    Console.WriteLine("Input mismatch. " + school.name + " is unassigned");
                    return false;
                }

                if (!pref.isFull())
                {
                    pref.schools.Add(school);
                    return true;
                }

                //int i;
                /*i = countries.FindIndex(country => country.name.Equals(pref.name, StringComparison.OrdinalIgnoreCase));
                //assuming here there is no mismatch between person preferences country names and country names
                //example sln: throw alert box that says "person.name picked an unknown country person.pref.name which is not in the list
                //of possible choices"
                if (!countries[i].isFull())
                {
                    countries[i].schools.Add(person);
                    return true;
                }*/
            }
            return false;
        }
Exemple #23
0
 partial void OnAfterPut(Applicant applicant);
Exemple #24
0
        public string addApplicant(Applicant c_app)
        {
            string connectionString = this.Connect();
            string succ = "";
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand command = connection.CreateCommand();
            command.CommandText = "INSERT INTO applicant (xname,address,xemail,xmobile,nationality,log_staff,visible) VALUES (@xname,@address,@xemail,@xmobile,@nationality,@log_staff,@visible) SELECT SCOPE_IDENTITY()";
            connection.Open();
            command.Parameters.Add("@xname", SqlDbType.VarChar);
            command.Parameters.Add("@address", SqlDbType.Text);
            command.Parameters.Add("@xemail", SqlDbType.VarChar);
            command.Parameters.Add("@xmobile", SqlDbType.VarChar);
            command.Parameters.Add("@nationality", SqlDbType.VarChar, 50);
            command.Parameters.Add("@log_staff", SqlDbType.VarChar, 20);
            command.Parameters.Add("@visible", SqlDbType.VarChar, 10);

            command.Parameters["@xname"].Value = ConvertApos2Tab(c_app.xname);
            command.Parameters["@address"].Value = ConvertApos2Tab(c_app.address);
            command.Parameters["@xemail"].Value = ConvertApos2Tab(c_app.xemail);
            command.Parameters["@xmobile"].Value = c_app.xmobile;
            command.Parameters["@nationality"].Value = c_app.nationality;
            command.Parameters["@log_staff"].Value = c_app.log_staff;
            command.Parameters["@visible"].Value = c_app.visible;
            succ = command.ExecuteScalar().ToString();
            connection.Close();
            return succ;
        }
 // simple validation
 bool validationIsOk(Applicant applicant)
 {
     return(!string.IsNullOrEmpty(applicant.Name) && !string.IsNullOrEmpty(applicant.Title) &&
            !string.IsNullOrEmpty(applicant.Cv) && !string.IsNullOrEmpty(applicant.Position) &&
            !string.IsNullOrEmpty(applicant.Phone));
 }
Exemple #26
0
        public string updateApplicant(Applicant x)
        {
            string connectionString = this.Connect();
            string str2 = "";
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand command = connection.CreateCommand();
            command.CommandText = "UPDATE [dbo].[applicant] SET [xname] ='" + ConvertApos2Tab(x.xname) + "',[address] = '" + ConvertApos2Tab(x.address) + "',[xemail] = '" + ConvertApos2Tab(x.xemail) + "',[xmobile] = '" + x.xmobile + "',  ";
            command.CommandText += " [nationality] = '" + x.nationality + "',[log_staff] = '" + x.log_staff + "',[visible] = '" + x.visible + "' WHERE ID ='" + x.ID + "' ";

            connection.Open();
            str2 = command.ExecuteNonQuery().ToString();
            connection.Close();
            return str2;
        }
 public void Delete(Applicant applicant)
 {
     throw new NotImplementedException();
 }
Exemple #28
0
 public List<Applicant> getApplicantByvalidationID(string validationID)
 {
     List<Applicant> list = new List<Applicant>();
     new Applicant();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM applicant WHERE log_staff='" + validationID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         Applicant item = new Applicant
         {
             ID = reader["ID"].ToString(),
             xname = ConvertTab2Apos(reader["xname"].ToString()),
             address = ConvertTab2Apos(reader["address"].ToString()),
             xemail = ConvertTab2Apos(reader["xemail"].ToString()),
             xmobile = reader["xmobile"].ToString(),
             nationality = reader["nationality"].ToString(),
             log_staff = reader["log_staff"].ToString(),
             visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }
        public ActionResult Create(Applicant applicant)
        {
            applicant.CreatedOn = DateTime.Now;
            applicant.CreatedBy = Convert.ToInt32(Session["emp_id"]);
            try
            {
                applicant.Picture = "~/ProfilePics/" + string.Concat(applicant.FormNo, "_", applicant.ProfilePicture.FileName);
                applicant.ProfilePicture.SaveAs(Server.MapPath("~/ProfilePics") + "/" + string.Concat(applicant.FormNo, "_", applicant.ProfilePicture.FileName));
            }
            catch (Exception)
            {
                ModelState.AddModelError(string.Empty, "Profile pictuer is required.");
                count++;
                ErrorMessage += count + "-Profile pictuer is required.<br />";
            }

            try
            {
                db.Applicants.Add(applicant);
                try
                {
                    for (int i = 0; i < applicant.SelectedPrograms.Length; i++)
                    {
                        applicant.BatchProgramID = Convert.ToInt32(applicant.SelectedPrograms[i]);

                        ApplyForProgram afp = new ApplyForProgram();
                        afp.FormNo    = applicant.FormNo;
                        afp.ProgramID = Convert.ToInt32(applicant.SelectedPrograms[i]); //Using for BatchProgramID
                        afp.IsActive  = applicant.IsActive;
                        afp.CreatedBy = Convert.ToInt32(Session["emp_id"]);
                        afp.CreatedOn = DateTime.Now;
                        db.ApplyForPrograms.Add(afp);
                    }
                }
                catch (Exception)
                {
                    count++;
                    ErrorMessage += count + "-Please select Program(s).<br />";
                }

                try
                {
                    if (string.IsNullOrEmpty(ErrorMessage))
                    {
                        applicant.FormNo = Convert.ToString(Convert.ToInt32(db.Applicants.Max(a => a.FormNo)) + 1);
                        db.SaveChanges();
                        ViewBag.MessageType = "success";
                        ViewBag.Message     = "Data has been saved successfully.";
                        return(RedirectToAction("Index", "Applicants"));
                    }
                    else
                    {
                        ViewBag.MessageType = "error";
                        ViewBag.Message     = ErrorMessage;
                    }
                }
                catch (DbUpdateException ex)
                {
                    ViewBag.MessageType = "error";
                    ViewBag.Message     = ex.Message;
                    ModelState.AddModelError(string.Empty, ex.Message);
                }
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult validationResult in ex.EntityValidationErrors)
                {
                    string entityName = validationResult.Entry.Entity.GetType().Name;
                    foreach (DbValidationError error in validationResult.ValidationErrors)
                    {
                        ModelState.AddModelError(string.Empty, error.ErrorMessage);
                        count++;
                        ErrorMessage += count + "-" + string.Concat(error.PropertyName, " is required.") + "<br />";
                    }
                }
                ViewBag.MessageType = "error";
                ViewBag.Message     = ErrorMessage;
            }

            ViewBag.IsActive            = new SelectList(db.Options, "OptionDesc", "OptionDesc", applicant.IsActive);
            ViewBag.CityID              = new SelectList(db.Cities, "CityID", "CityName", applicant.CityID);
            ViewBag.CountryID           = new SelectList(db.Countries, "CountryID", "CountryName", applicant.CountryID);
            ViewBag.CurrentOccupationID = new SelectList(db.CurrentOccupations, "CurrentOccupationID", "CurrentOccupationName", applicant.CurrentOccupationID);
            ViewBag.GenderID            = new SelectList(db.Genders, "GenderID", "GenderName", applicant.GenderID);
            ViewBag.MaritalStatusID     = new SelectList(db.MaritalStatus, "MaritalStatusID", "MaritalStatusName", applicant.MaritalStatusID);
            ViewBag.NationalityID       = new SelectList(db.Nationalities, "NationalityID", "NationalityName", applicant.NationalityID);
            ViewBag.ProvinceID          = new SelectList(db.Provinces, "ProvinceID", "ProvinceName", applicant.ProvinceID);
            ViewBag.RelationTypeID      = new SelectList(db.RelationTypes, "RelationTypeID", "RelationTypeName", applicant.RelationTypeID);
            ViewBag.ReligionID          = new SelectList(db.Religions, "ReligionID", "ReligionName", applicant.ReligionID);
            ViewBag.SalutationID        = new SelectList(db.Salutations, "SalutationID", "SalutationName", applicant.SalutationID);
            ViewBag.StatusID            = new SelectList(db.Status, "StatusID", "StatusName", applicant.StatusID);
            ViewBag.SelectedPrograms    = new SelectList(db.GetBatchProgramNameConcat("", 0), "ID", "Name", applicant.BatchProgramID);
            ViewBag.FormNo              = applicant.FormNo;
            return(View(applicant));
        }
 public Instance(int n, int m)
 {
     Applicants = new Applicant[n];
     Posts = new Post[m + n];
     this.n = n;
     this.m = m;
 }
 private static IEnumerable<KeyValuePair<string, object>> ToKeyValuePairs(Applicant applicant)
 {
     return new Dictionary<string, object>
                {
                    {"证件号", applicant.证件号},
                    {"类型", applicant.类型},
                    {"中文名", applicant.中文名},
                    {"英文名", applicant.英文名},
                    {"简称", applicant.简称},
                    {"国家", applicant.国家},
                    {"省", applicant.省},
                    {"市区县", applicant.市区县},
                    {"中国地址", applicant.中国地址},
                    {"外国地址", applicant.外国地址},
                    {"邮编", applicant.邮编},
                    {"电话", applicant.电话},
                    {"传真", applicant.传真},
                    {"Email", applicant.Email}
                };
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView(Resource.Layout.ApplicantInfoInputView);
            _SubmitQueryInfo = FindViewById<Button>(Resource.Id.btntxtApplicantInfoInputSubmit);
            _SubmitQueryInfo.Click += async (sender, e) => {

                var model = new Applicant {

                    FirstName = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputFirstName).Text,
                    LastName = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputLastName).Text,
                    Gender = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputGender).Text,
                    DateOfBirth = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputDateOfBirth).Text,
                    Mobile = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputInputMobile).Text,
                    Country = FindViewById<EditText>(Resource.Id.txtApplicantInfoInputCountry).Text
                };

                try {
                    // create new applicant (applicant is returned with ID)
                    var applicant = await OnFido.API.OnFidoService.CreateApplicant(model);
                    applicant = await OnFido.API.OnFidoService.GetApplicantById(applicant.Id);
                    // pass applicant info to recycler view
                    var applicanInfo = new Intent(this, typeof (ReportMainController));
                    applicanInfo.PutExtra("Applicant",JsonConvert.SerializeObject(applicant));
                    this.StartActivity(applicanInfo);
                    //finish activity
                    Finish();

                } catch (Exception) {
                    throw;
                }
            };

            /************TOOLBAR******************************************************/
            _toolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            _drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            _leftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
            _rightDrawer = FindViewById<ListView>(Resource.Id.right_drawer);

            //tag left and right drawer for case statment when clicked
            _leftDrawer.Tag = 0;
            _rightDrawer.Tag = 1;
            //Set action support toolbar with private class variable
            SetSupportActionBar(_toolbar);

            //***********LEFT DATA SET******************************/
            //Left data set, these are the buttons you see when you click on the drawers
            _leftDataSet = new List<string>();
            //my_profile has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.main_menu));
            //log_out has a string in the string xml file in values directory
            _leftDataSet.Add(GetString(Resource.String.log_out));
            _leftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _leftDataSet);
            _leftDrawer.Adapter = _leftAdapter;
            //click event for the left drawer
            this._leftDrawer.ItemClick += LeftDrawerRowClick;

            //***********RIGHT DATA SET******************************/
            _rightDataSet = new List<string>();
            //support has a string in the string xml file in values directory
            _rightDataSet.Add(GetString (Resource.String.help_popup));
            //rentproof has a string in the string xml file in values directory
            _rightDataSet.Add(GetString(Resource.String.support));
            _rightAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, _rightDataSet);
            _rightDrawer.Adapter = _rightAdapter;
            this._rightDrawer.ItemClick += RightDrawerRowClick;

            //constructor for navigation bar
            _drawerToggle = new NavigationBar(
                this,							//Host Activity
                _drawerLayout,					//DrawerLayout
                Resource.String.openDrawer,		//Opened Message
                Resource.String.closeDrawer		//Closed Message
            );
            //set drawerlistener
            _drawerLayout.SetDrawerListener(_drawerToggle);
            //set home button
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            _drawerToggle.SyncState();

            if (bundle != null){
                if (bundle.GetString("DrawerState") == "Opened"){
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }

                else{
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }

            else{
                //This is the first the time the activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }
            //*****************END OF ONCREATE TOO
        }
        private void SetDefaultUploadTransmittal()
        {
            Transmittal result = new Transmittal();

            if (uploadType.SelectedValue == "UploadCensus")
            {
                result.Type = TransmittalType.UploadApplicants;

                result.Group           = new Group();
                result.Group.GroupName = _LastPortfolioName;

                Applicant employee = new Applicant();
                employee.Relationship = Relationship.Employee;
                employee.FirstName    = "TestFirst";
                employee.LastName     = "TestLast";
                employee.BirthDate    = new DateTime(1980, 12, 24);
                employee.Sex          = Gender.Male;

                employee.SSN = _LastEmployeeSSN;

                result.Applicants = new ApplicantCollection();
                result.Applicants.Add(employee);
            }
            else if (uploadType.SelectedValue == "UploadGroup")
            {
                result.Type = TransmittalType.UploadPortfolio;

                result.Portfolio             = new Portfolio();
                result.Portfolio.Name        = _LastPortfolioName;
                result.Portfolio.GroupNumber = "TESTXXXX";

                //Enrollment info
                result.Portfolio.EnrollmentStartDate = new DateTime(2010, 12, 1);
                result.Portfolio.EnrollmentEndDate   = new DateTime(2011, 2, 15);
                result.Portfolio.PlanYearStartDate   = new DateTime(2011, 1, 1);

                //Employer Info
                result.Portfolio.Employer      = new Employer();
                result.Portfolio.Employer.Name = "Test Employer";

                result.Portfolio.Employer.Address       = new Address();
                result.Portfolio.Employer.Address.Line1 = "123 Main Ln";
                result.Portfolio.Employer.Address.Line2 = null;
                result.Portfolio.Employer.Address.City  = "Chicago";
                result.Portfolio.Employer.Address.State = "IL";
                result.Portfolio.Employer.Address.Zip   = "54342";

                //Payroll provider
                result.Portfolio.PayrollProviders = new PayrollProviderCollection();

                PayrollProvider payrollProvider = new PayrollProvider();
                payrollProvider.Name = "Payroll Dept.";

                result.Portfolio.PayrollProviders.Add(payrollProvider);

                //Relationships included in enrollment
                result.Portfolio.DependentRelationships = new RelationshipCCCollection();

                result.Portfolio.DependentRelationships.Add(new RelationshipCC(Relationship.Employee));
                result.Portfolio.DependentRelationships.Add(new RelationshipCC(Relationship.Spouse));
                result.Portfolio.DependentRelationships.Add(new RelationshipCC(Relationship.Child));

                if (_LastPortfolioID != null)
                {
                    result.Portfolio.UniqueID = _LastPortfolioID;
                }
            }

            txtUploadTransmittalBox.Text = SerializationHelper.SerializeToString(result);
        }
Exemple #34
0
        public static async Task Initialize(ApplicationDbContext context, UserManager <ApplicationUser> userManager,
                                            RoleManager <ApplicationRole> roleManager,
                                            IHostingEnvironment hostingEnvironment)
        {
            context.Database.EnsureCreated();

            // Create default admin if not already in the database

            defaultAvatar =
                System.IO.File.ReadAllBytes(hostingEnvironment.ContentRootPath + "/wwwroot/images/avatar.webp");


            // Add the roles in the dictionary
            RoleDetails.Add("Admin", "Admin Details");
            RoleDetails.Add("HR", "HR Details");
            RoleDetails.Add("Operations", "Operations Details");
            RoleDetails.Add("Principal", "Principal Details");
            // Iterate through the array then save and check
            foreach (var role in RoleDetails)
            {
                if (await roleManager.FindByNameAsync(role.Key) == null)
                {
                    await roleManager.CreateAsync(new ApplicationRole(role.Key, role.Value, DateTime.Now));
                }
            }

            var admin = new ApplicationUser()
            {
                FirstName      = "Administrator",
                LastName       = "Root",
                Email          = "*****@*****.**",
                UserName       = "******",
                EmailConfirmed = true,
                DateCreated    = DateTime.Now
            };

            var hr = new ApplicationUser()
            {
                FirstName      = "John",
                LastName       = "Doe",
                Email          = "*****@*****.**",
                UserName       = "******",
                EmailConfirmed = true,
                DateCreated    = DateTime.Now
            };

            var operations = new ApplicationUser()
            {
                FirstName      = "Mark",
                LastName       = "Alvarez",
                Email          = "*****@*****.**",
                UserName       = "******",
                EmailConfirmed = true,
                DateCreated    = DateTime.Now
            };

            var principal = new ApplicationUser()
            {
                FirstName      = "Juan",
                LastName       = "Dela Cruz",
                Email          = "*****@*****.**",
                UserName       = "******",
                EmailConfirmed = true,
                DateCreated    = DateTime.Now
            };

            if (await userManager.FindByEmailAsync(admin.Email) == null)
            {
                var result = await userManager.CreateAsync(admin);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(admin, "P@$$w0rd");

                    await userManager.AddToRoleAsync(admin, "Admin");
                }
            }

            if (await userManager.FindByEmailAsync(hr.Email) == null)
            {
                var result = await userManager.CreateAsync(hr);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(hr, "P@$$w0rd");

                    await userManager.AddToRoleAsync(hr, "HR");
                }
            }

            if (await userManager.FindByEmailAsync(operations.Email) == null)
            {
                var result = await userManager.CreateAsync(operations);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(operations, "P@$$w0rd");

                    await userManager.AddToRoleAsync(operations, "Operations");
                }
            }

            if (await userManager.FindByEmailAsync(principal.Email) == null)
            {
                var result = await userManager.CreateAsync(principal);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(principal, "P@$$w0rd");

                    await userManager.AddToRoleAsync(principal, "Principal");
                }
            }

            var skillTypes = new List <SkillType>()
            {
                new SkillType()
                {
                    SkillName = "Firefighting",
                },
                new SkillType()
                {
                    SkillName = "Electronics"
                },
                new SkillType()
                {
                    SkillName = "Mechanical"
                },
                new SkillType()
                {
                    SkillName = "Telecommunications"
                }
            };

            if (!context.SkillTypes.Any())
            {
                foreach (var skillType in skillTypes)
                {
                    context.SkillTypes.Add(skillType);
                }

                await context.SaveChangesAsync();
            }

            var documentTypes = new List <DocumentType>()
            {
                new DocumentType()
                {
                    DocumentTypeName = "Birth Certificate",
                    Issuer           = "NSO"
                },
                new DocumentType()
                {
                    DocumentTypeName = "Passport",
                    Issuer           = "DFA"
                },
                new DocumentType()
                {
                    DocumentTypeName = "BST",
                    Issuer           = "IDK"
                },
                new DocumentType()
                {
                    DocumentTypeName = "Seaman's Book",
                    Issuer           = "IDK"
                },
                new DocumentType()
                {
                    DocumentTypeName = "Seafarers Registration Certificate",
                    Issuer           = "IDK"
                },
                new DocumentType()
                {
                    DocumentTypeName = "Visa",
                    Issuer           = "DFA"
                },
                new DocumentType()
                {
                    DocumentTypeName = "Medical Certificate",
                    Issuer           = "NSO"
                }
            };

            if (!context.DocumentTypes.Any())
            {
                foreach (var dt in documentTypes)
                {
                    dt.DateCreated = DateTime.Now;
                    context.DocumentTypes.Add(dt);
                }

                await context.SaveChangesAsync();
            }


            var positions = new List <Position>()
            {
                new Position()
                {
                    PositionName = "Captain",
                    PositionCode = "CT"
                },
                new Position()
                {
                    PositionName = "Deck Officer",
                    PositionCode = "DC"
                },
                new Position()
                {
                    PositionName = "Engineering Officer",
                    PositionCode = "EO"
                },
                new Position()
                {
                    PositionName = "Electro-Technical",
                    PositionCode = "ET"
                },
                new Position()
                {
                    PositionName = "Cadet",
                    PositionCode = "CD"
                },
                new Position()
                {
                    PositionName = "Chief Cook",
                    PositionCode = "CC"
                }
            };

            if (!context.Positions.Any())
            {
                foreach (var po in positions)
                {
                    po.DateCreated = DateTime.Now;

                    context.Positions.Add(po);
                }

                await context.SaveChangesAsync();
            }


            var vessels = new List <Vessel>()
            {
                new Vessel()
                {
                    VesselName     = "GRAND URANUS",
                    Principal      = "CIDO SHIPPING (KOREA) CO., LTD",
                    Flag           = "PANAMA",
                    GrossTonnage   = "72654",
                    JSU            = "0",
                    EngineMake     = "HYUNDAI MAN B&W",
                    PortRegistry   = "PANAMA",
                    OfficialNumber = "43497",
                    CBA            = "IBF FKSU",
                    IMONumber      = "9472206",
                    VesselAbr      = "GRUR",
                    HorsePower     = "19040",
                    Classification = "DNV",
                    Type           = "PCC",
                    YearEnrolled   = "2012",
                    YearBuilt      = "2012"
                },
                new Vessel()
                {
                    VesselName     = "DREAM ANGEL",
                    Principal      = "CIDO SHIPPING (KOREA) CO., LTD",
                    Flag           = "PANAMA",
                    GrossTonnage   = "41678",
                    JSU            = "40",
                    EngineMake     = "MITSUI MAN B&W",
                    PortRegistry   = "PANAMA",
                    OfficialNumber = "31564",
                    CBA            = "IBF FKSU",
                    IMONumber      = "41678",
                    VesselAbr      = "GRUR",
                    HorsePower     = "19040",
                    Classification = "DNV",
                    Type           = "PCC",
                    YearEnrolled   = "2012",
                    YearBuilt      = "2012"
                }
            };

            if (!context.Vessels.Any())
            {
                foreach (var vessel in vessels)
                {
                    vessel.DateAdded = DateTime.Now;
                    vessel.Owner     = "Owner";
                    context.Vessels.Add(vessel);
                }

                await context.SaveChangesAsync();
            }

            Applicant applicant   = new Applicant();
            Applicant applicant2  = new Applicant();
            Applicant applicant3  = new Applicant();
            Applicant applicant4  = new Applicant();
            Applicant applicant5  = new Applicant();
            Applicant applicant6  = new Applicant();
            Applicant applicant7  = new Applicant();
            Applicant applicant8  = new Applicant();
            Applicant applicant9  = new Applicant();
            Applicant applicant10 = new Applicant();


            if (!context.Applicants.Any())
            {
                var family = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family2 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family3 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family4 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family5 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family6 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };


                var family7 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };

                var family8 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };


                var family9 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };


                var family10 = new Family()
                {
                    FathersFirstName  = "Fathers",
                    FathersMiddleName = "Middle",
                    FathersLastName   = "Last",
                    MothersFirstName  = "Mothers",
                    MothersMiddleName = "Middle",
                    MothersLastName   = "Last",
                    SpouseFirstName   = "Spouse",
                    SpouseMiddleName  = "Middle",
                    SpouseLastName    = "Last",
                    NumberOfChildren  = "12"
                };


                var dependents = new List <Dependent>()
                {
                    new Dependent()
                    {
                        Age          = 19,
                        Name         = "Maria Luna",
                        Relationship = "Wife"
                    },
                    new Dependent()
                    {
                        Age          = 5,
                        Name         = "Johnny Name",
                        Relationship = "Son"
                    }
                };

                var dependents2 = new List <Dependent>()
                {
                    new Dependent()
                    {
                        Age          = 19,
                        Name         = "Maria Luna",
                        Relationship = "Wife"
                    },
                    new Dependent()
                    {
                        Age          = 5,
                        Name         = "Johnny Name",
                        Relationship = "Son"
                    }
                };


                var documents = new List <Document>()
                {
                    new Document()
                    {
                        DocumentType  = documentTypes[0],
                        DateExpiry    = new DateTime(2017, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[1],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[2],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[3],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[4],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[5],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[6],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    }
                };


                var documents2 = new List <Document>()
                {
                    new Document()
                    {
                        DocumentType  = documentTypes[0],
                        DateExpiry    = new DateTime(2017, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[1],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    },
                    new Document()
                    {
                        DocumentType  = documentTypes[2],
                        DateExpiry    = new DateTime(2018, 2, 2),
                        DateSubmitted = new DateTime(2016, 6, 2)
                    }
                };


                applicant = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents2),
                    Dependents = new List <Dependent>(dependents2),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family,
                    Gender             = "Male",
                    Position           = positions[0],
                    Height             = 23,
                    Weight             = 42,
                    Religion           = "Christian",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "Jr",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2010",
                    LastName           = "Test",
                    FirstName          = "Juan",
                    MiddleName         = "Test",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Quezon City",
                    CivilStatus        = "Married",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                applicant2 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family2,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };



                applicant3 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family3,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };


                applicant4 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family4,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };


                applicant5 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family5,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                applicant6 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family6,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                applicant7 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family7,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                applicant8 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family8,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                applicant9 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family9,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };


                applicant10 = new Applicant()
                {
                    Address    = "123 Address St., Manila, NCR 1016",
                    Age        = 32,
                    Documents  = new List <Document>(documents),
                    Dependents = new List <Dependent>(dependents),
                    Skills     = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    },
                    Cellphone          = "09123456789",
                    Citizenship        = "Filipino",
                    Family             = family10,
                    Gender             = "Male",
                    Position           = positions[2],
                    Height             = 32,
                    Weight             = 50,
                    Religion           = "Roman Catholic",
                    Telephone          = "1231231",
                    Status             = Status.Active,
                    Suffix             = "",
                    SchoolFrom         = "2005",
                    SchoolTo           = "2012",
                    LastName           = "Cruiser",
                    FirstName          = "Peter",
                    MiddleName         = "David",
                    DateOfBirth        = new DateTime(2001, 2, 1),
                    PlaceOfBirth       = "Manila City",
                    CivilStatus        = "Single",
                    DateCreated        = DateTime.Now,
                    LastSchoolAttended = "School",
                    PositionId         = 1,
                    Photo = defaultAvatar
                };

                context.Applicants.Add(applicant);
                context.Applicants.Add(applicant2);
                context.Applicants.Add(applicant3);
                context.Applicants.Add(applicant4);
                context.Applicants.Add(applicant5);
                context.Applicants.Add(applicant6);
                context.Applicants.Add(applicant7);
                context.Applicants.Add(applicant8);
                context.Applicants.Add(applicant9);
                context.Applicants.Add(applicant10);

                await context.SaveChangesAsync();
            }

            var requirements = new List <Requirement>()
            {
                new Requirement()
                {
                    Position = positions[0],
                    Quantity = 2,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    }
                },
                new Requirement()
                {
                    Position = positions[1],
                    Quantity = 10,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    }
                },
                new Requirement()
                {
                    Position = positions[2],
                    Quantity = 5,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        }
                    }
                },
                new Requirement()
                {
                    Position = positions[3],
                    Quantity = 4,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        }
                    }
                },
                new Requirement()
                {
                    Position = positions[4],
                    Quantity = 6,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[1]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[2]
                        },
                        new Skill()
                        {
                            SkillType = skillTypes[3]
                        }
                    }
                },
                new Requirement()
                {
                    Position = positions[5],
                    Quantity = 2,
                    Skills   = new List <Skill>()
                    {
                        new Skill()
                        {
                            SkillType = skillTypes[0]
                        }
                    }
                }
            };

            var request = new Request()
            {
                Vessel          = vessels[0],
                Destination     = "South Korea",
                Remarks         = "Remarks",
                Requirements    = new List <Requirement>(requirements),
                StartDate       = new DateTime(2014, 2, 5),
                EndDate         = new DateTime(2014, 5, 5),
                DateCreated     = DateTime.Now,
                ApplicationUser = principal
            };


            if (!context.Requests.Any())
            {
                context.Requests.Add(request);
                await context.SaveChangesAsync();
            }


            var embarkation = new Embarkation()
            {
                Request           = request,
                EmbarkationStatus = EmbarkationStatus.Embarked,
                Applicants        = new List <ApplicantEmbarkation>()
                {
                    new ApplicantEmbarkation()
                    {
                        Applicant = applicant
                    }
                }
            };

            if (!context.Embarkations.Any())
            {
                context.Embarkations.Add(embarkation);
                await context.SaveChangesAsync();
            }
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new Applicant { UserName = model.Email, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return RedirectToAction("Index", "Home");
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
 public bool IsEligible(Applicant applicant)
 {
     return(applicant.AnnualIncome > threshold);
 }
        public ActionResult ApplicationConfirmation(int id)
        {
            var app = db.PendingApplications.Find(id);
            var applicant = new Applicant()
            {
                Name = app.FirstName + app.LastName,
                DateRegistered = DateTime.Now,
                Campaigns = new List<Campaign>(),
                Contributions = new List<Contribution>(),
                Links = new List<UserLink>(),
                Email = app.Email,
                UserName = "******",
                AvatarImagePath = "http://www.designmissionseries.com/dmseries/india/wp-content/uploads/2015/09/user.png"
            };

            var password = "******";
            UserManager.Create(applicant, password);
            db.Users.Add(applicant);

            try
            {
                db.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                        .SelectMany(x => x.ValidationErrors)
                        .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Combine the original exception message with the new one.
                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
            }

            return RedirectToAction("ProfileView", "Profile");
            //EmailMessage emailMessage = new EmailMessage();

            //System.IO.StreamReader file = new System.IO.StreamReader("C:\\Users\\Asus\\Desktop\\LegalAccessInnovationFund\\secretfile.txt");

            //var secret = file.ReadToEnd();

            ////Send Email To Student
            //using (MailMessage mail = new MailMessage())
            //{
            //    mail.From = new MailAddress("*****@*****.**");
            //    mail.To.Add(app.Email);
            //    mail.Subject = $"Thank You! Your Application Is Pending { app.FirstName }";
            //    mail.Body = emailMessage.Message;
            //    mail.IsBodyHtml = true;
            //    // Can set to false, if you are sending pure text.

            //    using (SmtpClient smtp = new SmtpClient("smtp.live.com", 587))
            //    {
            //        smtp.Credentials = new NetworkCredential("*****@*****.**", secret);
            //        smtp.EnableSsl = true;
            //        smtp.Send(mail);
            //    }
            //}

            //EmailMessage adminEmail = new EmailMessage();

            ////Send Email To Administrator
            //using (MailMessage adminMail = new MailMessage())
            //{
            //    adminMail.From = new MailAddress("*****@*****.**");
            //    adminMail.To.Add(app.Email);
            //    adminMail.Subject = $"Thank You! Your Application Is Pending { app.FirstName }";
            //    adminMail.Body = adminEmail.MessageToAdministratorOnApproveApplication;
            //    adminMail.IsBodyHtml = true;
            //    // Can set to false, if you are sending pure text.

            //    using (SmtpClient smtp = new SmtpClient("smtp.live.com", 587))
            //    {
            //        smtp.Credentials = new NetworkCredential("*****@*****.**", emailPassword);
            //        smtp.EnableSsl = true;
            //        smtp.Send(adminMail);
            //    }
            //}

        }
Exemple #38
0
 /**
  * <summary>
  * Prepares the view for editing an applicant by populating variables
  * in the ViewBag.
  * </summary>
  *
  * <param name="applicant">The applicant who's data should be populated into the view</param>
  **/
 private void PrepareEditApplicantView(Applicant applicant)
 {
     viewHelper.PrepareStudentInformationView(ViewBag, false);
     viewHelper.PrepareGuardianInformationView(ViewBag);
     viewHelper.PrepareSchoolSelectionView(ViewBag, applicant);
 }
Exemple #39
0
 partial void OnBeforePut(Applicant applicant);
Exemple #40
0
        public ActionResult EditApplicant(Applicant applicant, FormCollection formCollection)
        {
            // Verify that the applicant exists
            var queriedApplicant = db.Applicants.Find(applicant.ID);

            if (queriedApplicant == null)
            {
                return(HttpNotFound());
            }

            // Empty check student and guardian information
            viewHelper.EmptyCheckStudentInformation(ModelState, applicant);
            viewHelper.EmptyCheckGuardianInformation(ModelState, applicant);

            // School selection check //TODO Make this code shareable with the parent side
            var schoolIds = new List <int>();

            if (formCollection["programs"] == null || !formCollection["programs"].Any())
            {
                ModelState.AddModelError("programs", GoldenTicketText.NoSchoolSelected);
                PrepareEditApplicantView(applicant);
                return(View(applicant));
            }
            else
            {
                var programIdStrs = formCollection["programs"].Split(',').ToList();
                programIdStrs.ForEach(idStr => schoolIds.Add(int.Parse(idStr)));
            }

            if (!ModelState.IsValid)
            {
                PrepareEditApplicantView(applicant);
                return(View(applicant));
            }

            // Remove existing applications for this user
            var applieds = db.Applieds.Where(applied => applied.ApplicantID == applicant.ID).ToList();

            applieds.ForEach(a => db.Applieds.Remove(a));

            // Add new Applied associations (between program and program)
            var populatedApplicant = db.Applicants.Find(applicant.ID);

            foreach (var programId in schoolIds)
            {
                var applied = new Applied();
                applied.ApplicantID = applicant.ID;
                applied.SchoolID    = programId;

                // Confirm that the program ID is within the city lived in (no sneakers into other districts)
                var program = db.Schools.Find(programId);
                if (program != null && program.City.Equals(populatedApplicant.StudentCity, StringComparison.CurrentCultureIgnoreCase))
                {
                    db.Applieds.Add(applied);
                }
            }

            // Save changes to the database
            db.Applicants.AddOrUpdate(applicant);
            db.SaveChanges();

            return(RedirectToAction("ViewApplicant", new{ id = applicant.ID }));
        }
Exemple #41
0
 partial void OnBeforeDelete(Applicant applicant);
Exemple #42
0
 public ActionResult Delete(Applicant applicant)
 {
     service.DeleteApplicant(applicant.Id);
     return(RedirectToAction(nameof(GetAllProfiles)));
 }
        public ActionResult SaveApp(int flowTypeId, CreateFlowCaseInfo caseInfo, string[] nextApprover)
        {
            if (caseInfo.Deadline.HasValue && caseInfo.Deadline <= DateTime.Now)
            {
                ViewBag.DisplayButtons = false;
                return(View("_PartialError", "~/Views/Shared/_ModalLayout.cshtml", StringResource.INVALID_DEADLINE));
            }

            Applicant manager = new Applicant(WFEntities, this.Username);

            //if (!manager.CheckCancelLeaveBalance(caseInfo.Properties, flowTypeId))
            //{
            //    ViewBag.DisplayButtons = false;
            //    return View("_PartialError", "~/Views/Shared/_ModalLayout.cshtml", StringResource.ALREADY_CANCELED);
            //}

            if (nextApprover != null && nextApprover.Length > 0)
            {
                caseInfo.Approver = nextApprover;
                if (nextApprover.GroupBy(p => p).Any(p => p.Count() > 1))
                {
                    ViewBag.DisplayButtons = false;
                    return(View("_PartialError", "~/Views/Shared/_ModalLayout.cshtml", StringResource.DUPLICATE_APPROVERS));
                }
            }

            int selectedFlowId = manager.SelectFlow(flowTypeId, caseInfo);

            if (selectedFlowId > 0)
            {
                caseInfo.FlowId = selectedFlowId;
                bool HasStep = manager.HasSteps(selectedFlowId);
                if ((nextApprover == null || nextApprover.Length == 0) && HasStep)
                {
                    NextStepData nsd = manager.GetNextStepApprovers(selectedFlowId, caseInfo.Properties, this.Username);
                    if (nsd == null || nsd.EmployeeList == null || nsd.EmployeeList.Count == 0 || nsd.EmployeeList.Any(p => p == null || p.Length == 0))
                    {
                        ViewBag.DisplayButtons = false;
                        return(View("_PartialError", "_ModalLayout", StringResource.NO_NEXT_APPROVER_FOUND));
                    }
                    return(View("SelectNextApprover", "_ModalLayout", nsd.EmployeeList));
                }
                (CreateFlowResult result, int flowCaseId)res = manager.CreateFlowCase(caseInfo);
                ViewBag.FlowCaseId    = res.flowCaseId;
                ViewBag.NextApprovers = caseInfo.Approver;
                if (res.result == CreateFlowResult.Success)
                {
                    EmailService.SendWorkFlowEmail(
                        WFEntities.GlobalUserView.FirstOrDefault(p => p.EmployeeID == User.Identity.Name)?.EmployeeName,
                        caseInfo.Approver, caseInfo.Subject, null);
                    manager.NotificationSender.PushInboxMessages(caseInfo.Approver, res.flowCaseId);
                    manager.NotificationSender.Send();
                    ViewBag.PendingCount = manager.CountPending();
                    return(PartialView("_CreateResult", manager.GetFlowAndCase(res.flowCaseId)));
                }
            }
            else
            {
                ViewBag.DisplayButtons = false;
                return(View("_PartialError", "_ModalLayout", StringResource.NO_ELIGIBLE_WORKFLOW_FOUND));
            }
            ViewBag.DisplayButtons = false;
            return(View("_PartialError", "~/Views/Shared/_ModalLayout.cshtml", StringResource.UNABLE_TO_CREATE_YOUR_APPLICATION));
        }
Exemple #44
0
        public ActionResult Edit(int id)
        {
            Applicant applicant = service.GetApplicant(id);

            return(View(applicant));
        }
    private void Fill_GridRegisteredRequests_RegisteredRequests(CurrentUserState CUS, string LoadState, int year, int month, string filterString, int pageSize, int pageIndex)
    {
        string[]             retMessage             = new string[4];
        IList <KartablProxy> RegisteredRequestsList = null;

        try
        {
            Applicant           applicant   = Applicant.None;
            KartablSummaryItems itemSummary = KartablSummaryItems.UnKnown;
            if (HttpContext.Current.Request.QueryString.AllKeys.Contains("Applicant") && this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["Applicant"]) != "")
            {
                applicant = (Applicant)Enum.Parse(typeof(Applicant), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["Applicant"]));
                if (applicant == Applicant.PrivateNews)
                {
                    itemSummary = (KartablSummaryItems)Enum.Parse(typeof(KartablSummaryItems), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["KeyApplicant"]));
                    switch (itemSummary)
                    {
                    case KartablSummaryItems.ConfirmedRequestCount:
                        LoadState = RequestState.Confirmed.ToString();
                        break;

                    case KartablSummaryItems.NotConfirmedRequestCount:
                        LoadState = RequestState.Unconfirmed.ToString();
                        break;

                    case KartablSummaryItems.InFlowRequestCount:
                        LoadState = RequestState.UnderReview.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }
            switch (LoadState)
            {
            case "CustomFilter":
                UserRequestFilterProxy CustomFilterProxy = this.GetRegisteredRequestsCustomFilterProxy_RegisteredRequests(filterString);
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetFilterUserRequests(CustomFilterProxy, pageIndex, pageSize);
                break;

            default:
                RegisteredRequestsList = this.RegisteredRequestsBusiness.GetAllUserRequests((RequestState)Enum.Parse(typeof(RequestState), LoadState), year, month, pageIndex, pageSize, itemSummary);
                break;
            }

            this.operationYearMonthProvider.SetOperationYearMonth(year, month);
            this.GridRegisteredRequests_RegisteredRequests.DataSource = RegisteredRequestsList;
            this.GridRegisteredRequests_RegisteredRequests.DataBind();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (OutOfExpectedRangeException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_RegisteredRequests.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
        private async Task ForwardToDialog(IDialogContext context, LuisResult result, Applicant a)
        {
            var factory = new LuisDialogFactory();
            var dialog  = await factory.Create(result?.Query, a);

            if (dialog != null)
            {
                var message = context.MakeMessage();
                message.Text = _userToBot;

                await context.Forward(dialog, ResumeAfterForward, message, CancellationToken.None);
            }
            else
            {
                await context.PostAsync(Resources.msgIDidntCatchThat);

                context.Wait(MessageReceived);
            }
        }
 public void Save(Applicant applicant)
 {
     applicants[applicants.FindIndex(a => a.Id == applicant.Id)] = applicant;
 }
Exemple #48
0
        public void MakeMenu(DirectoryInfo GameToContinue)
        {
            var frame = CreateMenu(Library.GetString("main-menu-title"));

            if (GameToContinue != null && NewOverworldFile.CheckCompatibility(GameToContinue.FullName))
            {
                CreateMenuItem(frame,
                               "Continue",
                               NewOverworldFile.GetOverworldName(GameToContinue.FullName),
                               (sender, args) => {
                    var file = NewOverworldFile.Load(GameToContinue.FullName);
                    GameStateManager.PopState();
                    var overworldSettings = file.CreateSettings();
                    overworldSettings.InstanceSettings.LoadType = LoadType.LoadFromFile;
                    GameStateManager.PushState(new LoadState(Game, overworldSettings, LoadTypes.UseExistingOverworld));
                });
            }

            CreateMenuItem(frame,
                           Library.GetString("new-game"),
                           Library.GetString("new-game-tooltip"),
                           (sender, args) => GameStateManager.PushState(new WorldGeneratorState(Game, Overworld.Create(), WorldGeneratorState.PanelStates.Generate)));

            CreateMenuItem(frame,
                           Library.GetString("load-game"),
                           Library.GetString("load-game-tooltip"),
                           (sender, args) => GameStateManager.PushState(new WorldLoaderState(Game)));

            CreateMenuItem(frame,
                           Library.GetString("options"),
                           Library.GetString("options-tooltip"),
                           (sender, args) => GameStateManager.PushState(new OptionsState(Game)));

            CreateMenuItem(frame,
                           Library.GetString("manage-mods"),
                           Library.GetString("manage-mods-tooltip"),
                           (sender, args) => GameStateManager.PushState(new ModManagement.ManageModsState(Game)));

            CreateMenuItem(frame,
                           Library.GetString("credits"),
                           Library.GetString("credits-tooltip"),
                           (sender, args) => GameStateManager.PushState(new CreditsState(GameState.Game)));

            CreateMenuItem(frame, "QUICKPLAY", "",
                           (sender, args) =>
            {
                DwarfGame.LogSentryBreadcrumb("Menu", "User generating a random world.");

                var overworldSettings = Overworld.Create();
                overworldSettings.InstanceSettings.InitalEmbarkment       = new Embarkment(overworldSettings);
                overworldSettings.InstanceSettings.InitalEmbarkment.Funds = 1000u;
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Crafter", overworldSettings.Company));
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Manager", overworldSettings.Company));
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Miner", overworldSettings.Company));
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Wizard", overworldSettings.Company));
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Soldier", overworldSettings.Company));
                overworldSettings.InstanceSettings.InitalEmbarkment.Employees.Add(Applicant.Random("Musketeer", overworldSettings.Company));

                GameStateManager.PushState(new LoadState(Game, overworldSettings, LoadTypes.GenerateOverworld));
            });

            CreateMenuItem(frame, "GIANT QUICKPLAY", "",
                           (sender, args) =>
            {
                GameStateManager.PushState(new CheckMegaWorldState(Game));
            });

            CreateMenuItem(frame, "Dwarf Designer", "Open the dwarf designer.",
                           (sender, args) =>
            {
                GameStateManager.PushState(new Debug.DwarfDesignerState(GameState.Game));
            });

#if DEBUG
            CreateMenuItem(frame, "Yarn test", "", (sender, args) =>
            {
                GameStateManager.PushState(new YarnState(null, "test.conv", "Start", new Yarn.MemoryVariableStore()));
            });

            CreateMenuItem(frame, "Debug GUI", "", (sender, args) =>
            {
                GameStateManager.PushState(new Debug.GuiDebugState(GameState.Game));
            });
#endif

            CreateMenuItem(frame,
                           Library.GetString("quit"),
                           Library.GetString("quit-tooltip"),
                           (sender, args) => Game.Exit());

            FinishMenu();
        }
Exemple #49
0
 public override void SetApplicant(Applicant applicant)
 {
     this.Applicant = applicant;
 }
        public void ProcesScannedImages()
        {
            /*
             *this method suports miltiple surveys at once image charge
             */
            #region Read all at once

            txtResult.Clear();
            applicants.Clear();

            for (int k = 0; k < TOTAL_APPLICANTS; k++)
            {
                int oneSurveyPages = TOTAL_SCANNED_PAPERS / TOTAL_APPLICANTS;

                // Survey for one person
                for (int i = k * oneSurveyPages; i < (k + 1) * oneSurveyPages; i++)
                {
                    ProcesseFramesToFindSquares(images[i]);

                    ProcesseFrameToFindCircles(images[i], 0);
                }

                // Add the applicant to the list of applicants
                Applicant applicant = new Applicant();
                applicant.fillApplicant(k + 1, "NOMBRE " + (k + 1).ToString(), questions);
                applicants.Add(applicant);

                // print applicant resutls
                //txtResult.AppendText(Environment.NewLine);
                //txtResult.AppendText("=============  APPLICANT N°  : " + (k + 1).ToString() + "  ==============");

                //each applicants result
                string[] row = new string[176 + 7];
                row[0] = txtCode.Text;
                if (opcion_01 == -1) row[1] = empty; else row[1] = (opcion_01 + 1).ToString();
                if (opcion_02 == -1) row[2] = empty; else row[2] = (opcion_02 + 1).ToString();
                if (codigo_sede == -1) row[3] = empty; else row[3] = (codigo_sede + 1).ToString();
                if (num_01 == -1) row[4] = empty; else row[4] = num_01.ToString();
                if (num_02 == -1) row[5] = empty; else row[5] = num_02.ToString();
                if (codigo_turno == -1) row[6] = empty; else row[6] = (codigo_semestre + 1).ToString();
                if (codigo_turno == -1) row[7] = empty; else row[7] = (codigo_turno + 1).ToString();

                for (int j = 0; j < applicants[0].getExam().Count(); j++)
                {
                    //txtResult.AppendText(Environment.NewLine);
                    //txtResult.AppendText("Pregunta ID: " + (1 + j).ToString() + " - Answer :  " + applicants[0].getExam()[j].getAnswer());

                    //To gridView
                    row[j + 8] = applicants[0].getExam()[j].getAnswer();
                }
                addColumToGridView(row);

                if (k == TOTAL_APPLICANTS - 1)
                //if (k == TOTAL_APPLICANTS )
                {
                    //TODO : Comment to calibrate
                    //BeginProcess = false;
                }

                //clear resources used for each applicant
                questions.Clear();
                ID_SEQUENCE = 0;

                CleanAllList();

            }

            #endregion
        }
Exemple #51
0
 public void DeleteApplicant(Applicant applicant)
 {
     _context.Applicant.Remove(applicant);
     _context.SaveChanges();
 }
 public void UpdateApplicant(Applicant applicant)
 {
     using (var connection = new SqlConnection(_connectionString))
     {
         connection.Open();
         connection.Update(ApplicantTableName,
                           new KeyValuePair<string, object>("证件号", applicant.证件号),
                           ToKeyValuePairs(applicant));
     }
 }
Exemple #53
0
        public IActionResult Apply([FromHeader(Name = "apply-token")] string applyTokenValue, [FromForm] ApplyInput input)
        {
            if (string.IsNullOrWhiteSpace(applyTokenValue))
            {
                ModelState.AddModelError("apply-token", "apply-token header is missing. You can get an apply token from http://laninayazilim.com/getApplyToken.html");
            }
            else
            {
                var applyToken = _applicantDbContext.ApplyTokens.FirstOrDefault(at => at.Value == applyTokenValue);
                if (applyToken == null)
                {
                    ModelState.AddModelError("apply-token", "apply-token header is invalid. You can get an apply token from http://laninayazilim.com/getApplyToken.html");
                }
                else
                {
                    _applicantDbContext.Remove(applyToken);
                    _applicantDbContext.SaveChanges();
                }
            }

            if (input.Resume.Length <= 0 || !string.Equals(input.Resume.ContentType, "application/pdf"))
            {
                ModelState.AddModelError("Resume", "Resume contentType should be application/pdf");
            }

            if (!string.IsNullOrWhiteSpace(input.Flag))
            {
                var flagExists = _flagDbContext.Flags.Any(f => f.Value == input.Flag.Trim());

                if (!flagExists)
                {
                    ModelState.AddModelError("Flag", "Invalid flag value");
                }
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var emailOrMobilePhoneExists = _applicantDbContext.Applicants.Any(a =>
                                                                              a.MobilePhone == input.MobilePhone ||
                                                                              a.Email == input.Email);

            if (emailOrMobilePhoneExists)
            {
                ModelState.AddModelError("Email || MobilePhone", "An application with the same email or mobilePhone already exists");

                return(Conflict(ModelState));
            }

            var newApplicant = new Applicant
            {
                Key     = Guid.NewGuid().ToString(),
                Name    = input.Name.Trim(),
                Surname = input.Surname.Trim(),
                Email   = input.Email.Trim().ToLower(),
                EmailConfirmationKey       = Guid.NewGuid().ToString(),
                MobilePhone                = input.MobilePhone,
                MobilePhoneConfirmationKey = Guid.NewGuid().ToString(),
                Github      = input.Github,
                Linkedin    = input.Linkedin,
                CoverLetter = input.CoverLetter,
                Status      = ApplicantStatus.New,
                Flag        = input.Flag
            };

            _applicantDbContext.Applicants.Add(newApplicant);
            _applicantDbContext.SaveChanges();

            string filePath = null;

            if (input.Resume.Length > 0)
            {
                var ext      = Path.GetExtension(input.Resume.FileName);
                var fileName = newApplicant.Id.ToString() + ext;
                filePath = Path.Combine(_env.ContentRootPath, "Resumes", fileName);
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    input.Resume.CopyTo(fileStream);
                }
            }

            _laninaInterviewManager.SendApplicationReceivedMail(
                newApplicant.Email,
                newApplicant.Name,
                newApplicant.EmailConfirmationKey,
                _adminSettings.Value.AdminEmail,
                filePath);

            return(Ok());
        }
Exemple #54
0
        /// <summary>
        /// Builds the conversation form.
        /// </summary>
        /// <returns>IForm instance.</returns>
        public static IForm <W4Info> BuildForm()
        {
            OnCompletionAsyncDelegate <W4Info> processW4 = async(context, state) =>
            {
                Applicant a = null;
                context.UserData.TryGetValue <Applicant>("applicant", out a);
                if (a == null)
                {
                    throw new ArgumentNullException("applicant");
                }
                a.W4Info = state;
                a.Applications.First().Value.State = Common.ConversationType.None;
                context.UserData.SetValue <Applicant>("applicant", a);
                await ApplicantFactory.PersistApplicant(a);

                await context.PostAsync("Please hold a moment while I create your form...");

                string W4Uri = FillW4Dialog.FillForm(a);
                //IMessageActivity m = context.MakeMessage();
                //m.Attachments.Add(new Attachment()
                //{
                //    ContentUrl = W4Uri,
                //    ContentType = "application/pdf",
                //    Name = "w4.pdf"
                //});
                //m.Text = "Please save this form for future reference!Thanks and I hope we'll talk again soon.";
                //try
                //{
                //    await context.PostAsync(m);
                //}
                //catch (Exception ex) {
                //    Exception e = ex;
                //    throw;
                //}
                await context.PostAsync($"You can find your W4 at {W4Uri}. Please save this form for future reference!Thanks and I hope we'll talk again soon.");

                context.Done <Applicant>(a);
            };

            IForm <W4Info> b = new FormBuilder <W4Info>()
                               .Message($"Ok, let's fill out the W4 form. I'll ask you some question, simply type the answers and I'll assemble the form.")
                               .Message("We'll start by confirming some basic information about you.")
                               .Field(nameof(W4Info.FirstName))
                               .Field(nameof(W4Info.LastName))
                               .Field(nameof(W4Info.FirstNameDiffers),
                                      validate: async(state, value) =>
            {
                Task <ValidateResult> task = Task.Factory.StartNew(() =>
                {
                    if (value == null)
                    {
                        value = false;
                    }
                    var r = new ValidateResult {
                        IsValid = true, Value = value
                    };
                    if ((bool)value == true)
                    {
                        r.Feedback = "Ok, we can proceed, but you must call 1-800-772-1213 to obtain a replacement social security card with your correct legal name.";
                    }
                    return(r);
                });
                var result = await task;
                return(result);
            })
                               .Field(nameof(W4Info.Street))
                               .Field(nameof(W4Info.City))
                               .Field(nameof(W4Info.SSN),
                                      validate: async(state, value) =>
            {
                Task <ValidateResult> task = Task.Factory.StartNew(() =>
                {
                    var r = new ValidateResult {
                        IsValid = false, Value = value
                    };
                    Regex regex = new Regex(@"^(?!219-09-9999|078-05-1120)(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$", RegexOptions.IgnoreCase);
                    if (regex.IsMatch((string)value))
                    {
                        r.IsValid  = true;
                        r.Feedback = "Your social security number has been validated with DHS e-Verify.";
                    }
                    else
                    {
                        r.Feedback = "Your social security number has an invalid format. Please correct and try again.";
                    }
                    // make call to DHS employee validation endpoint
                    // this is just fake.
                    // add some delay to simulate elapsed time
                    Task.Delay(1500);
                    return(r);
                });
                var result = await task;
                return(result);
            })
                               .Field(nameof(W4Info.Exempt))
                               .Field(new FieldReflector <W4Info>(nameof(W4Info.MariageStatus))
                                      .SetActive((s) => !s.Exempt)
                                      )
                               .Field(new FieldReflector <W4Info>(nameof(W4Info.Allowances))
                                      .SetActive((s) => !s.Exempt)
                                      )
                               .Field(new FieldReflector <W4Info>(nameof(W4Info.AdditionalAmountToWithold))
                                      .SetActive((s) => !s.Exempt)
                                      .SetValidate(async(state, value) =>
            {
                Task <ValidateResult> task = Task.Factory.StartNew(() =>
                {
                    if (value == null)
                    {
                        value = 0;
                    }
                    var r = new ValidateResult {
                        IsValid = true, Value = value
                    };
                    if ((Int64)value > 0)
                    {
                        r.Feedback = $"Ok, we'll withhold an additional ${value} from each paycheck.";
                    }
                    return(r);
                });
                var result = await task;
                return(result);
            })
                                      )
                               .Confirm("Please review the data before I proceed. I have captured: {*} \r\n Is this correct?")
                               .Message("Thanks for helping me to get this information captured!")
                               .OnCompletion(processW4)
                               .Build();

            return(b);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Numer of applicants</param>
        /// <param name="m">Number of posts</param>
        /// <param name="c">Capacity of the posts</param>
        /// <param name="prios"></param>
        public Instance(int n, int m, int c, List<Tuple<int, int>>[] prios)
        {
            Applicants = new Applicant[n];
            Posts = new Post[m + n];
            this.n = n;
            this.m = m;

            for (int i = 0; i < n; i++)
            {
                Applicants[i] = new Applicant(i);
                Applicants[i].Priorities = new List<Instance.Priority>();
                for (int j = 0; j < prios[i].Count; j++)
                {
                    Applicants[i].Priorities.Add(new Instance.Priority(prios[i].ElementAt(j).Item1, prios[i].ElementAt(j).Item2));
                }
                Applicants[i].Priorities.Add(new Instance.Priority(m + i, prios[i].Count));
            }

            for (int i = 0; i < m; i++)
            {
                Posts[i] = new Post(i, c);
            }
            for (int i = m; i < m + n; i++)
            {
                Posts[i] = new Post(i, 1);
            }

        }
Exemple #56
0
 public static void AddApplicant(Applicant applicant)
 {
     Context.Applicants.Add(applicant);
     Context.SaveChanges();
 }
Exemple #57
0
        public void ConstructorTest()
        {
            Applicant target = new Applicant();

            Assert.IsNotNull(target);
        }
Exemple #58
0
 public List<Applicant> getApplicantByRefID(string ID)
 {
     List<Applicant> list = new List<Applicant>();
     new Applicant();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("select * from applicant where log_staff IN (select ID from pwallet where validationID='" + ID + "'') ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         Applicant item = new Applicant {
             ID = reader["ID"].ToString(),
             xtype = reader["xtype"].ToString(),
             xname = reader["xname"].ToString(),
             tax_id_type = reader["tax_id_type"].ToString(),
             tax_id_number = reader["tax_id_number"].ToString(),
             individual_id_number = reader["individual_id_number"].ToString(),
             nationality = reader["nationality"].ToString(),
             addressID = reader["addressID"].ToString(),
             log_staff = reader["log_staff"].ToString(),
             reg_date = reader["reg_date"].ToString(),
             visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }
        public void ProcesScannedImagesOneByOne(int pPage)
        {
            /*
             *this method one surveys
             */
            #region Read one

            txtResult.Clear();
            applicants.Clear();

            //kevinRemote
            label4.Text = "Test Numero : " + (pPage + 1).ToString();
            ProcesseFramesToFindSquares(images[pPage]);
            pictureBox1.Image = new System.Drawing.Bitmap(imagesNames[pPage]);
            label3.Text = imagesNames[pPage];
            ProcesseFrameToFindCircles(images[pPage], 0);

            // Add the applicant to the list of applicants
            Applicant applicant = new Applicant();
            applicant.fillApplicant(codeNumber, "  -  NOMBRE  TEST de prueba", questions);
            applicants.Add(applicant);

            // print applicant resutls
            //txtResult.AppendText(Environment.NewLine);
            //txtResult.AppendText("=============  APPLICANT N°  : " + codeNumber.ToString() + "  ==============");

            //each applicants result
            string[] row = new string[176 + 7];

            row[0] = txtCode.Text;
            if (opcion_01 == -1) row[1] = empty; else row[1] = (opcion_01 + 1).ToString();
            if (opcion_02 == -1) row[2] = empty; else row[2] = (opcion_02 + 1).ToString();
            if (codigo_sede == -1) row[3] = empty; else row[3] = (codigo_sede + 1).ToString();
            if (num_01 == -1) row[4] = empty; else row[4] = num_01.ToString();
            if (num_02 == -1) row[5] = empty; else row[5] = num_02.ToString();
            if (codigo_turno == -1) row[6] = empty; else row[6] = (codigo_semestre + 1).ToString();
            if (codigo_turno == -1) row[7] = empty; else row[7] = (codigo_turno + 1).ToString();
            for (int j = 0; j < applicants[0].getExam().Count(); j++)
            {
                //txtResult.AppendText(Environment.NewLine);
                //txtResult.AppendText("Pregunta ID: " + applicants[0].getExam()[j].getIdQuestion().ToString() + " - Answer :  " + applicants[0].getExam()[j].getAnswer());

                //To gridView

                row[j + 8] = applicants[0].getExam()[j].getAnswer();

            }
            addColumToGridView(row);

            //TODO : Comment to calibrate
            //BeginProcess = false;

            //clear resources used for each applicant
            questions.Clear();
            CleanAllList();
            #endregion
        }
Exemple #60
0
        public ActionResult EditPost(int?id, Byte[] rowVersion)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Applicant applicantToUpdate = db.Applicants.Find(id);

            if (TryUpdateModel(applicantToUpdate, "",
                               new string[] { "apFirstName", "apMiddleName", "apLastName", "apPhone", "apSubscripted", "apEMail", "apAddress", "apCity", "apPostalCode" }))
            {
                try
                {
                    db.Entry(applicantToUpdate).OriginalValues["RowVersion"] = rowVersion;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    var entry         = ex.Entries.Single();
                    var clientValues  = (Applicant)entry.Entity;
                    var databaseEntry = entry.GetDatabaseValues();
                    if (databaseEntry == null)
                    {
                        ModelState.AddModelError("", "Unable to save changes. The Applicant was deleted.");
                    }
                    else
                    {
                        var databaseValues = (Applicant)databaseEntry.ToObject();
                        if (databaseValues.apFirstName != clientValues.apFirstName)
                        {
                            ModelState.AddModelError("apFirstName", "Current Value: " + databaseValues.apFirstName);
                        }
                        if (databaseValues.apMiddleName != clientValues.apMiddleName)
                        {
                            ModelState.AddModelError("apMiddleName", "Current Value: " + databaseValues.apMiddleName);
                        }
                        if (databaseValues.apLastName != clientValues.apLastName)
                        {
                            ModelState.AddModelError("apLastName", "Current Value: " + databaseValues.apLastName);
                        }
                        if (databaseValues.apPhone != clientValues.apPhone)
                        {
                            ModelState.AddModelError("apPhone", "Current Value: " + String.Format("{0:(###)-###-####}", databaseValues.apPhone));
                        }
                        if (databaseValues.apSubscripted != clientValues.apSubscripted)
                        {
                            ModelState.AddModelError("apSubscripted", "Current Value: " + databaseValues.apSubscripted);
                        }
                        if (databaseValues.apEMail != clientValues.apEMail)
                        {
                            ModelState.AddModelError("apEmail", "Current Value: " + databaseValues.apEMail);
                        }
                        if (databaseValues.apAddress != clientValues.apAddress)
                        {
                            ModelState.AddModelError("apAddress", "Current Value: " + databaseValues.apAddress);
                        }
                        if (databaseValues.apPostalCode != clientValues.apPostalCode)
                        {
                            ModelState.AddModelError("apPostalCode", "Current Value: " + databaseValues.apPostalCode);
                        }
                        if (databaseValues.UserRoleID != clientValues.UserRoleID)
                        {
                            ModelState.AddModelError("UserRoleID", "Current Value: " + db.UserRoles.Find(databaseValues.UserRoleID).RoleTitle);
                        }
                        ModelState.AddModelError(string.Empty, "The record you attempted to edit was modified by another User. Your changes were not saved.");
                        applicantToUpdate.RowVersion = databaseValues.RowVersion;
                    }
                }
                catch (DataException dex)
                {
                    if (dex.InnerException.InnerException.Message.Contains("IX_Unique"))
                    {
                        ModelState.AddModelError("apEmail", "Email is already existed.");
                    }
                    else
                    {
                        ModelState.AddModelError("", "Unables to save changes. Try Again!");
                    }
                }
            }

            return(View(applicantToUpdate));
        }