public ActionResult Accept(ApplicantVm avm)
        {
            applicant applicant = new applicant()
            {
                id              = avm.id,
                applicantState  = "Applicant_Being_Recruted",
                username        = avm.username,
                role            = avm.role,
                picture         = avm.picture,
                age             = avm.age,
                arrival         = avm.arrival,
                chanceOfSuccess = avm.chanceOfSuccess,
                country         = avm.country.ToString(),
                demand          = avm.demand,
                lastname        = avm.lastname,
                name            = avm.name,
                password        = avm.password
            };
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:18080");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.PutAsJsonAsync <applicant>("/l4c_map-v2-web/rest/applicant/", applicant).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
            return(RedirectToAction("Profile", "Applicant"));
        }
        public void Remove(applicant applicant, string serverPath)
        {
            RemoveAll(applicant.ApplicantID);

            if ((System.IO.File.Exists(serverPath + applicant.Resume)))
            {
                System.IO.File.Delete(serverPath + applicant.Resume);
            }

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();

                RemoveUser(applicant, connection);

                StringBuilder sb = new StringBuilder();
                sb.Append("DELETE FROM [careerfair].[applicant]");
                sb.Append("WHERE [ApplicantID] = " + applicant.ApplicantID);
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    command.CommandType = System.Data.CommandType.Text;
                    command.ExecuteNonQuery();
                }
            }
        }
 public ActionResult Create(ApplicantVm avm, HttpPostedFileBase File)
 {
     if (ModelState.IsValid)
     {
         if (File != null && File.ContentLength != 0)
         {
             applicant applicant = new applicant()
             {
                 lastname = avm.lastname,
                 name     = avm.name,
                 password = avm.password,
                 picture  = File.FileName,
                 username = avm.username,
                 age      = avm.age,
                 country  = avm.country.ToString()
             };
             HttpClient client = new HttpClient();
             client.BaseAddress = new Uri("http://localhost:18080");
             client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
             client.PostAsJsonAsync <applicant>("/l4c_map-v2-web/rest/inscription", applicant).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
             if (File.ContentLength > 0)
             {
                 var path = Path.Combine(Server.MapPath("~/images/"), File.FileName);
                 File.SaveAs(path);
             }
             return(RedirectToAction("Login", "User"));
         }
     }
     return(View(avm));
 }
        public void Insert(applicant applicant)
        {
            int id = applicant.ApplicantID;

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO [careerfair].[applicant]([Email],[FirstName],[LastName],[University],[Alumni],[Profile],[SocialMedia],[Resume],[YearsExperience],[Internship],[Active])");
                string values = "VALUES(@param2, @param3, @param4, @param5, @param6, @param7, @param8, @param9, @param10, @param11, @param12); SELECT @ID = SCOPE_IDENTITY()";
                sb.Append(values);
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    command.Parameters.Add("@param2", SqlDbType.NVarChar, 128).Value          = (object)applicant.Email ?? DBNull.Value;
                    command.Parameters.Add("@param3", SqlDbType.NVarChar, 50).Value           = (object)applicant.FirstName ?? DBNull.Value;
                    command.Parameters.Add("@param4", SqlDbType.NVarChar, 50).Value           = (object)applicant.LastName ?? DBNull.Value;
                    command.Parameters.Add("@param5", SqlDbType.NVarChar, 50).Value           = (object)applicant.University ?? DBNull.Value;
                    command.Parameters.Add("@param6", SqlDbType.Bit).Value                    = (object)applicant.Alumni ?? DBNull.Value;
                    command.Parameters.Add("@param7", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.Profile ?? DBNull.Value;
                    command.Parameters.Add("@param8", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.SocialMedia ?? DBNull.Value;
                    command.Parameters.Add("@param9", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.Resume ?? DBNull.Value;
                    command.Parameters.Add("@param10", SqlDbType.TinyInt).Value               = (object)applicant.YearsExperience ?? DBNull.Value;
                    command.Parameters.Add("@param11", SqlDbType.Bit).Value                   = (object)applicant.Internship ?? DBNull.Value;
                    command.Parameters.Add("@param12", SqlDbType.Bit).Value                   = (object)applicant.Active ?? DBNull.Value;
                    command.Parameters.Add("@ID", SqlDbType.Int, 4).Direction                 = ParameterDirection.Output;
                    command.CommandType = System.Data.CommandType.Text;
                    command.ExecuteNonQuery();

                    id = (int)command.Parameters["@ID"].Value;
                }
            }
            Insert(applicant.Fields, id);
        }
Example #5
0
    protected void subApply(object sender, RepeaterCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "ApplyNow":
                applicantsDataContext objApplicantDC = new applicantsDataContext();
                applicant objNewApplicant = new applicant();
                TextBox txtFname = (TextBox)e.Item.FindControl("txt_fnameApp");
                TextBox txtLname = (TextBox)e.Item.FindControl("txt_lnameApp");
                TextBox txtEmail = (TextBox)e.Item.FindControl("txt_emailApp");
                TextBox txtPhone = (TextBox)e.Item.FindControl("txt_phoneApp");
                TextBox txtMsg = (TextBox)e.Item.FindControl("txt_msgBox");
                Label lblConfirm = (Label)e.Item.FindControl("lbl_confirmApply");
                HiddenField hdfJobID = (HiddenField)e.Item.FindControl("hdf_jobID");
                objNewApplicant.firstname = txtFname.Text;
                objNewApplicant.lastname = txtLname.Text;
                objNewApplicant.email = txtEmail.Text;
                objNewApplicant.job_id = int.Parse(hdfJobID.Value.ToString());

                objApplicantDC.applicants.InsertOnSubmit(objNewApplicant);
                objApplicantDC.SubmitChanges();
                txtFname.Text = "";
                txtLname.Text = "";
                txtEmail.Text = "";
                txtPhone.Text = "";
                txtMsg.Text = "";
                lblConfirm.Text = "Your applicantion was sent successfully!";

                break;
            case "Refresh":
                //_subRefresh();
                //Response.Redirect("Career.aspx?tabIndex=0");
                break;
        }
    }
        public List <applicant> ReadForAdmin()
        {
            List <applicant> applicants = new List <applicant>();

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();

                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT [ApplicantID],[Email],[FirstName],[LastName],[Active]");
                sb.Append("FROM [careerfair].[applicant]");
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            applicant applicant = new applicant();

                            applicant.ApplicantID = DatabaseHelper.CheckNullInt(reader, 0);
                            applicant.Email       = DatabaseHelper.CheckNullString(reader, 1);
                            applicant.FirstName   = DatabaseHelper.CheckNullString(reader, 2);
                            applicant.LastName    = DatabaseHelper.CheckNullString(reader, 3);
                            applicant.Active      = DatabaseHelper.CheckNullBool(reader, 4);

                            applicants.Add(applicant);
                        }
                    }
                }
            }
            return(applicants);
        }
        public List <applicant> ReadAccountInfo()
        {
            List <applicant> applicants = new List <applicant>();

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();

                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT [ApplicantID],[Email]");
                sb.Append("FROM [careerfair].[applicant]");
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            applicant app = new applicant();

                            app.ApplicantID = DatabaseHelper.CheckNullInt(reader, 0);
                            app.Email       = DatabaseHelper.CheckNullString(reader, 1);

                            applicants.Add(app);
                        }
                    }
                }
            }

            return(applicants);
        }
        public void Insert(applicant applicant)
        {
            //applicant.ApplicantID = NextIdValue();
            //_applicants.Add(applicant);

            _ds.Insert(applicant);
        }
        public ApplicantViewModel ToViewModel(applicant a)
        {
            return(new ApplicantViewModel
            {
                ApplicantID = a.ApplicantID,

                Email = a.Email,

                FirstName = a.FirstName,

                LastName = a.LastName,

                University = a.University,

                Alumni = a.Alumni,

                Profile = a.Profile,

                SocialMedia = a.SocialMedia,

                Resume = a.Resume,

                YearsExperience = a.YearsExperience,

                Internship = a.Internship,

                Active = a.Active,

                Fields = a.Fields
            });
        }
Example #10
0
 private void BtnAdd_Click(object sender, RoutedEventArgs e)
 {
     if (TbFamilia.Text == "" || TbName.Text == "" || TbClientMiddlename.Text == "" || TbClientPass.Text == "")
     {
         MessageBox.Show("Заполните все обязательные поля", "Ошибка", MessageBoxButton.OK);
     }
     else
     {
         currentUser = new applicant
         {
             fist_name   = TbFamilia.Text,
             name        = TbName.Text,
             middle_name = TbClientMiddlename.Text,
             date_of_bth = DPDateBirth.SelectedDate.Value,
             gender      = CbGender.SelectedItem.ToString(),
             edication   = TbClientEducation.Text,
             post        = TbClientPost.Text,
             roles       = TbClientRole.Text,
             login       = TbClientLogin.Text,
             password    = TbClientPass.Text
         };
         AppData.Context.applicant.Add(currentUser);
         MessageBox.Show("Пользователь успешно добавлен", "Сообщение", MessageBoxButton.OK);
     }
     AppData.Context.SaveChanges();
     NavigationService.GoBack();
 }
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,City,State,Phone,Email,WebAddress,skillsId,educationID,referenceID")] applicant applicant)
        {
            if (id != applicant.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(applicant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!applicantExists(applicant.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicant));
        }
        public ActionResult GetSearchUserType(int id, bool isApplicant)
        {
            ApplicantRepository ar        = null;
            BusinessRepository  br        = null;
            applicant           applicant = null;
            business            business  = null;

            if (isApplicant)
            {
                ar        = new ApplicantRepository();
                br        = new BusinessRepository();
                applicant = ar.SelectOne(id);
            }
            else
            {
                br       = new BusinessRepository();
                business = br.SelectOne(id);
            }

            if (applicant != null && User.IsInRole("Business") && (br.CheckApproved(User.Identity.GetUserName()) || User.IsInRole("Admin")))
            {
                return(ApplicantViewProfile(ar.ToViewModel(applicant), null));
            }
            else if (business != null && User.IsInRole("Applicant"))
            {
                return(BusinessSearchViewProfile(br.ToViewModel(business)));
            }
            else
            {
                return(View("Error"));
            }
        }
        public IHttpActionResult Post(RegisterViewModel registrationForm)
        {
            if (ModelState.IsValid)
            {
                //Create entry in DB
                applicant applicant = new applicant
                {
                    Name           = registrationForm.Name,
                    LastName       = registrationForm.LastName,
                    Address        = registrationForm.Address,
                    DateOfBirth    = registrationForm.DateOfBirth,
                    DateOfCreation = DateTime.Now
                };

                db.applicant.Add(applicant);
                db.SaveChanges();

                //Set up return model
                ApplicantRegistered registered = new ApplicantRegistered
                {
                    FullName    = registrationForm.Name + " " + registrationForm.LastName,
                    isDOBFriday = ((int)registrationForm.DateOfBirth.DayOfWeek == 5) ? true : false //true if DOB is friday
                };

                //Return status created + response data (Normally also returns the path to created object (CreatedAtRoute).)
                return(Created("", registered));
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
        private string ApplicantToCSV(applicant a)
        {
            string formatted = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}",
                                             a.ApplicantID.ToString(), a.Email.Replace(",", string.Empty), a.FirstName.Replace(",", string.Empty), a.LastName.Replace(",", string.Empty),
                                             a.University.Replace(",", string.Empty), a.Alumni.ToString(), a.Profile.Replace(",", string.Empty),
                                             a.SocialMedia.Replace(",", string.Empty), a.YearsExperience.ToString(), a.Internship.ToString(), a.Active.ToString());

            return(formatted);
        }
        public ApplicantViewModel SelectOneAsViewModel(int id)
        {
            applicant app = _ds.Read(id);

            ApplicantViewModel selectedApplicant = ToViewModel(app);

            GetAccountInfoByUserID(selectedApplicant);

            return(selectedApplicant);
        }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     //if (CurrentUser.type!=0)
     {
         try
         {
             AddNew = new applicant();
             //fill applicant
             AddNew.idapplicant = int.Parse(this.AID.Text);
             if (this.AFIO.Text.Length > 20)
             {
                 AddNew.FIO = this.AFIO.Text.Substring(0, 19);
             }
             else
             {
                 AddNew.FIO = this.AFIO.Text;
             }
             AddNew.position = this.APOSITION.Text;
             AddNew.salary   = int.Parse(this.ASALARY.Text);
             AddNew.hired    = false;
             if (this.AINFO.Text.Length > 100)
             {
                 AddNew.Info = this.AINFO.Text.Substring(0, 99);
             }
             else
             {
                 AddNew.Info = this.AINFO.Text;
             }
             //fill R
             NewR.Idapplicant  = AddNew.idapplicant;
             NewR2.Idapplicant = AddNew.idapplicant;
             rr2.InsertOnSubmit(NewR2);
             rr.InsertOnSubmit(NewR);
             ap.InsertOnSubmit(AddNew);
             try
             {
                 db.SubmitChanges();
                 MessageBox.Show("Резюме успешно добавлено!");
                 this.Close();
             }
             catch (Exception exx)
             {
                 MessageBox.Show(exx.Message);
                 db.SubmitChanges();
                 this.ASALARY.Text = "0";
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     //else MessageBox.Show("Гости не могут добавлять резюме. Пожалуйста, залогиньтесь.");
 }
        public void UpdateApplicantProfile(applicant applicant, string serverPath)
        {
            var oldApplicant = _ds.Read(applicant.ApplicantID);

            if (oldApplicant != null)
            {
                //_applicants.Remove(oldApplicant);
                //_applicants.Add(applicant);
                _ds.UpdateApplicantProfile(applicant, serverPath, oldApplicant.Resume);
            }
        }
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,City,State,Phone,Email,WebAddress,skillsId,educationID,referenceID")] applicant applicant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(applicant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(applicant));
        }
Example #19
0
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         DataClasses1DataContext db = new DataClasses1DataContext();
         if (e.CommandName.Equals("acceptreq") == true)
         {
             int        maxValue;
             int        id = Convert.ToInt32(e.CommandArgument.ToString());
             acceptance n  = new acceptance();
             if (db.acceptances.Count() > 0)
             {
                 maxValue = db.acceptances.Max(x => x.id);
             }
             else
             {
                 maxValue = 0;
             }
             n.user_id   = id;
             n.work_id   = mywork.id;
             n.id        = maxValue + 1;
             n.dead_time = DateTime.Now;
             n.detail    = ":D";
             n.cost      = 100;
             var hj = from i in db.acceptances where i.user_id == n.user_id && i.work_id == n.work_id select i;
             if (hj.Count() > 0)
             {
                 Exception c = new Exception("this user alredy accepted");
                 throw c;
             }
             db.acceptances.InsertOnSubmit(n);
             db.SubmitChanges();
         }
         else if (e.CommandName.Equals("Delete") == true)
         {
             int id            = Convert.ToInt32(e.CommandArgument.ToString());
             var requestdelete = from i in db.applicants
                                 where i.user_id == id
                                 select i;
             applicant ap = requestdelete.First();
             db.applicants.DeleteOnSubmit(ap);
             db.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         HtmlGenericControl er = (HtmlGenericControl)this.Master.FindControl("error");
         HtmlGenericControl al = (HtmlGenericControl)this.Master.FindControl("alert");
         al.Visible   = true;
         er.Visible   = true;
         er.InnerText = ex.Message;
     }
 }
        private void RemoveUser(applicant applicant, SqlConnection connection)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("DELETE FROM [dbo].[AspNetUsers]");
            sb.Append("WHERE [Email] = '" + applicant.Email + "'");
            String sql = sb.ToString();

            using (SqlCommand command = new SqlCommand(sql, connection))
            {
                command.CommandType = System.Data.CommandType.Text;
                command.ExecuteNonQuery();
            }
        }
Example #21
0
    // this defines what will happen when admin chooses to insert a new applicant
    public bool commitInsert(int _jobID, string _fname, string _lname, string _email)
    {
        applicantsDataContext objApplicantDC = new applicantsDataContext();
        using (objApplicantDC)
        {
            applicant objNewApplicant = new applicant();
            objNewApplicant.firstname = _fname;
            objNewApplicant.lastname = _lname;
            objNewApplicant.email = _email;
            objNewApplicant.Id = _jobID;

            objApplicantDC.applicants.InsertOnSubmit(objNewApplicant);
            objApplicantDC.SubmitChanges();
            return true;
        }
    }
Example #22
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            string applicantUserName = User.Identity.GetUserName();
            string businessUserName  = User.Identity.GetUserName();

            ApplicantRepository ar        = new ApplicantRepository();
            applicant           applicant = ar.SelectAll().Where(a => a.Email == applicantUserName).FirstOrDefault();

            if (applicant != null)
            {
                ViewBag.ApplicantId = applicant.ApplicantID;
            }


            BusinessRepository br       = new BusinessRepository();
            business           business = br.SelectAll().Where(a => a.Email == applicantUserName).FirstOrDefault();

            if (business != null)
            {
                ViewBag.BusinessId = business.BusinessID;
            }


            ViewBag.StatusMessage =
                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
                : message == ManageMessageId.Error ? "An error has occurred."
                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
                : "";

            var userId = User.Identity.GetUserId();
            var model  = new IndexViewModel
            {
                HasPassword       = HasPassword(),
                PhoneNumber       = await UserManager.GetPhoneNumberAsync(userId),
                TwoFactor         = await UserManager.GetTwoFactorEnabledAsync(userId),
                Logins            = await UserManager.GetLoginsAsync(userId),
                BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            };

            return(View(model));
        }
        private void InitApplicant(List <applicant> applicants, SqlConnection connection, int startRow, int numberOfRows)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT [ApplicantID],[Email],[FirstName],[LastName],[University],[Alumni],[Profile],[SocialMedia],[Resume],[YearsExperience],[Internship],[Active]");
            sb.Append("FROM [careerfair].[applicant]");
            if (startRow >= 0)
            {
                sb.Append("ORDER BY [ApplicantID] ASC OFFSET " + startRow + " ROWS FETCH NEXT " + numberOfRows + " ROWS ONLY;");
            }
            String sql = sb.ToString();

            using (SqlCommand command = new SqlCommand(sql, connection))
            {
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        applicant app = new applicant();

                        app.ApplicantID     = DatabaseHelper.CheckNullInt(reader, 0);
                        app.Email           = DatabaseHelper.CheckNullString(reader, 1);
                        app.FirstName       = DatabaseHelper.CheckNullString(reader, 2);
                        app.LastName        = DatabaseHelper.CheckNullString(reader, 3);
                        app.University      = DatabaseHelper.CheckNullString(reader, 4);
                        app.Alumni          = DatabaseHelper.CheckNullBool(reader, 5);
                        app.Profile         = DatabaseHelper.CheckNullString(reader, 6);
                        app.SocialMedia     = DatabaseHelper.CheckNullString(reader, 7);
                        app.Resume          = DatabaseHelper.CheckNullString(reader, 8);
                        app.YearsExperience = DatabaseHelper.CheckNullByte(reader, 9);
                        app.Internship      = DatabaseHelper.CheckNullBool(reader, 10);
                        app.Active          = DatabaseHelper.CheckNullBool(reader, 11);

                        applicants.Add(app);
                    }
                }
            }

            foreach (applicant a in applicants)
            {
                AddFields(a, connection);
            }
        }
        public applicant Read(string email)
        {
            applicant applicant = null;

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();

                StringBuilder sb = new StringBuilder();
                sb.Append("SELECT [ApplicantID],[Email],[FirstName],[LastName],[University],[Alumni],[Profile],[SocialMedia],[Resume],[YearsExperience],[Internship],[Active]");
                sb.Append("FROM [careerfair].[applicant]");
                sb.Append("WHERE [Email] = '" + email + "'");
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            applicant = new applicant();

                            applicant.ApplicantID     = DatabaseHelper.CheckNullInt(reader, 0);
                            applicant.Email           = DatabaseHelper.CheckNullString(reader, 1);
                            applicant.FirstName       = DatabaseHelper.CheckNullString(reader, 2);
                            applicant.LastName        = DatabaseHelper.CheckNullString(reader, 3);
                            applicant.University      = DatabaseHelper.CheckNullString(reader, 4);
                            applicant.Alumni          = DatabaseHelper.CheckNullBool(reader, 5);
                            applicant.Profile         = DatabaseHelper.CheckNullString(reader, 6);
                            applicant.SocialMedia     = DatabaseHelper.CheckNullString(reader, 7);
                            applicant.Resume          = DatabaseHelper.CheckNullString(reader, 8);
                            applicant.YearsExperience = DatabaseHelper.CheckNullByte(reader, 9);
                            applicant.Internship      = DatabaseHelper.CheckNullBool(reader, 10);
                            applicant.Active          = DatabaseHelper.CheckNullBool(reader, 11);
                        }
                    }
                }
                AddFields(applicant, connection);
            }
            return(applicant);
        }
        public void Update(applicant applicant, string serverPath, string oldResume)
        {
            RemoveAll(applicant.ApplicantID);
            Insert(applicant.Fields, applicant.ApplicantID);

            if (oldResume != applicant.Resume)
            {
                if ((System.IO.File.Exists(serverPath + oldResume)))
                {
                    System.IO.File.Delete(serverPath + oldResume);
                }
            }

            using (SqlConnection connection = new SqlConnection(DataSettings.CONNECTION_STRING))
            {
                connection.Open();
                StringBuilder sb = new StringBuilder();
                sb.Append("UPDATE [careerfair].[applicant]");
                sb.Append("SET [Email] = @param2,[FirstName] = @param3,[LastName] = @param4,[University] = @param5,[Alumni] = @param6,[Profile] = @param7,[SocialMedia] = @param8,[Resume] = @param9,[YearsExperience] = @param10,[Internship] = @param11,[Active] = @param12");
                sb.Append(" WHERE [ApplicantID] = " + applicant.ApplicantID);
                String sql = sb.ToString();

                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    command.Parameters.Add("@param2", SqlDbType.NVarChar, 128).Value          = (object)applicant.Email ?? DBNull.Value;
                    command.Parameters.Add("@param3", SqlDbType.NVarChar, 50).Value           = (object)applicant.FirstName ?? DBNull.Value;
                    command.Parameters.Add("@param4", SqlDbType.NVarChar, 50).Value           = (object)applicant.LastName ?? DBNull.Value;
                    command.Parameters.Add("@param5", SqlDbType.NVarChar, 50).Value           = (object)applicant.University ?? DBNull.Value;
                    command.Parameters.Add("@param6", SqlDbType.Bit).Value                    = (object)applicant.Alumni ?? DBNull.Value;
                    command.Parameters.Add("@param7", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.Profile ?? DBNull.Value;
                    command.Parameters.Add("@param8", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.SocialMedia ?? DBNull.Value;
                    command.Parameters.Add("@param9", SqlDbType.NVarChar, int.MaxValue).Value = (object)applicant.Resume ?? DBNull.Value;
                    command.Parameters.Add("@param10", SqlDbType.TinyInt).Value               = (object)applicant.YearsExperience ?? DBNull.Value;
                    command.Parameters.Add("@param11", SqlDbType.Bit).Value                   = (object)applicant.Internship ?? DBNull.Value;
                    command.Parameters.Add("@param12", SqlDbType.Bit).Value                   = (object)applicant.Active ?? DBNull.Value;
                    command.CommandType = System.Data.CommandType.Text;
                    command.ExecuteNonQuery();
                }
            }
        }
        private void AddFields(applicant app, SqlConnection connection)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT [Name]");
            sb.Append("FROM [careerfair].[field]");
            sb.Append("JOIN [careerfair].[applicant2field] ON [applicant2field].[Field] = [field].[FieldID]");
            sb.Append("JOIN [careerfair].[applicant] ON [applicant].[ApplicantID] = [applicant2field].[Applicant]");
            sb.Append("WHERE [careerfair].[applicant2field].[Applicant] = " + app.ApplicantID);
            String sql = sb.ToString();

            using (SqlCommand command = new SqlCommand(sql, connection))
            {
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        app.Fields.Add(DatabaseHelper.CheckNullString(reader, 0));
                    }
                }
            }
        }
        public ActionResult GetUserType(ManageMessageId?message)
        {
            string userName = User.Identity.GetUserName();

            if (User.IsInRole("Applicant"))
            {
                ApplicantRepository ar        = new ApplicantRepository();
                applicant           applicant = ar.SelectOne(userName);

                if (applicant != null)
                {
                    return(ApplicantViewProfile(ar.ToViewModel(applicant), message));
                }
                else
                {
                    return(View("Error"));
                }
            }
            else if (User.IsInRole("Business"))
            {
                BusinessRepository br       = new BusinessRepository();
                business           business = br.SelectOne(userName);

                if (business != null)
                {
                    return(BusinessViewProfile(br.ToViewModel(business), message));
                }
                else
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(View("Error"));
            }
        }
 partial void Deleteapplicant(applicant instance);
        public new ActionResult Profile(ApplicantVm applicantvm)
        {
            var user = (user)Session["user"];

            if (user != null && user.role.Equals("Responsable"))
            {
                user.id = applicantvm.id;
            }
            if (user != null)
            {
                HttpClient Client = new HttpClient();
                Client.BaseAddress = new Uri("http://localhost:18080");
                Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = Client.GetAsync("/l4c_map-v2-web/rest/applicant/" + user.id).Result;
                if (response.IsSuccessStatusCode)
                {
                    applicant   applicant = response.Content.ReadAsAsync <applicant>().Result;
                    ApplicantVm avm       = new ApplicantVm()
                    {
                        id              = applicant.id,
                        age             = applicant.age,
                        applicantState  = applicant.applicantState,
                        chanceOfSuccess = applicant.chanceOfSuccess,
                        country         = (PaysVm)Enum.Parse(typeof(PaysVm), applicant.country),
                        lastname        = applicant.lastname,
                        name            = applicant.name,
                        role            = applicant.role,
                        username        = applicant.username,
                        picture         = applicant.picture,
                        demand          = applicant.demand,
                        arrival         = applicant.arrival
                    };
                    ArrivalVm arrivalvm = new ArrivalVm()
                    {
                        arrivalDate  = avm.arrival.arrivalDate,
                        idArrival    = avm.arrival.idArrival,
                        flightNumber = avm.arrival.flightNumber
                    };
                    avm.arrivalvm = arrivalvm;
                    Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    HttpResponseMessage response_test = Client.GetAsync("/l4c_map-v2-web/rest/test/").Result;
                    if (response_test.IsSuccessStatusCode)
                    {
                        ICollection <test> alltest = (ICollection <test>)response_test.Content.ReadAsAsync <IEnumerable <test> >().Result;

                        foreach (test test in alltest)
                        {
                            TestVm tvm = new TestVm()
                            {
                                dateOfPassing = test.dateOfPassing,
                                difficulty    = test.difficulty,
                                //files = test.files,
                                //idResponsable = test.idResponsable,
                                idTest    = test.idTest,
                                mark      = test.mark,
                                name      = test.name,
                                specialty = test.specialty,
                            };
                            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                            HttpResponseMessage      response_question = Client.GetAsync("/l4c_map-v2-web/rest/question/" + test.idTest).Result;
                            ICollection <QuestionVm> allquestion       = (ICollection <QuestionVm>)response_question.Content.ReadAsAsync <IEnumerable <QuestionVm> >().Result;
                            foreach (QuestionVm question in allquestion)
                            {
                                tvm.questions.Add(new QuestionVm()
                                {
                                    correct    = question.correct,
                                    idQuestion = question.idQuestion,
                                    syn1       = question.syn1,
                                    syn2       = question.syn2,
                                    syn3       = question.syn3,
                                    task       = question.task,
                                    test       = question.test
                                });
                            }
                            avm.tests.Add(tvm);
                        }
                        Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage response_testpassed = Client.GetAsync("/l4c_map-v2-web/rest/test/" + user.id).Result;
                        if (response_testpassed.IsSuccessStatusCode)
                        {
                            ICollection <test> testpassed = (ICollection <test>)response_testpassed.Content.ReadAsAsync <IEnumerable <test> >().Result;
                            foreach (test test in testpassed)
                            {
                                avm.testpassed.Add(new TestVm()
                                {
                                    dateOfPassing = test.dateOfPassing,
                                    difficulty    = test.difficulty,
                                    idTest        = test.idTest,
                                    mark          = test.mark,
                                    name          = test.name,
                                    specialty     = test.specialty
                                });
                            }
                        }
                    }
                    foreach (var passed in avm.testpassed)
                    {
                        avm.tests.Remove(passed);
                    }
                    return(View(avm));
                }
            }
            return(RedirectToAction("Error", "Shared"));
        }
        public static void Initialize(ResumeContext context)
        {
            context.Database.EnsureCreated();
            // Look for any applicants
            if (!context.applicant.Any())
            {
                var applicants = new applicant[]
                {
                    new applicant {
                        FirstName = "Carson", LastName = "Alexander", City = "ABQ", State = "NM", Phone = "505-933-9799", Email = "*****@*****.**", WebAddress = "kellycockrell.net"
                    }
                    //            new applicant {FirstName="Johnson",LastName="Joan",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"},
                    //            new applicant {FirstName="Raphael",LastName="Lobato",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"},
                    //            new applicant {FirstName="Elsa",LastName="Castillo",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"},
                    //            new applicant {FirstName="Cassiano",LastName="de Oliveira",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"},
                    //            new applicant {FirstName="Brendaleigh",LastName="Lobato",City="ABQ", State="NM", Phone="505-933-9799", Email="*****@*****.**", WebAddress="kellycockrell.net"},
                };
                foreach (applicant a in applicants)
                {
                    context.applicant.Add(a);
                }
                context.SaveChanges();
            }



            if (!context.education.Any())
            {
                var education = new education[]
                {
                    new education {
                        degreeType = "Bachelors", subject = "Fine Arts", institution = "University of New Mexico", city = "Albuquerque", state = "NM", gradDate = "May 1994", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new education {
                        degreeType = "Bachelors", subject = "Electrical Engineering", institution = "University of Texas", city = "Austin", state = "NM", gradDate = "May 1994", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new education {
                        degreeType = "Masters", subject = "Physics", institution = "Boston College", city = "Boston", state = "MA", gradDate = "May 2016", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    //new education {degreeType = "PhD", subject = "Sociology", institution = "Harvard University", city = "Cambridge", state = "MA", gradDate = "December 2010",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID },
                    //new education {degreeType = "PhD", subject = "Nuclear Engineering", institution = "Imperial College", city = "London", state = "UK", gradDate = "May 1989",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID },
                    //new education {degreeType = "Associates", subject = "Business Administration", institution = "Santa Fe Community College", city = "Santa Fe", state = "NM", gradDate = "May 2018",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID },
                    //new education {degreeType = "Bachelors", subject = "Biology", institution = "University of Colorado", city = "Boulder", state = "CO", gradDate = "December 1994",applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID }
                };
                foreach (education e in education)
                {
                    context.education.Add(e);
                }
                context.SaveChanges();
            }

            if (!context.references.Any())
            {
                var references = new references[]
                {
                    new references {
                        firstName = "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city = "Washington DC", state = "", emailAddress = "*****@*****.**", phone = "212-444-5555", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new references {
                        firstName = "Vladimir", lastName = "Putin", companyName = "President and DIctator of Russia", mailingAddress = "P.O. Box 666661", city = "Moscow", state = "Russia", emailAddress = "*****@*****.**", phone = "33-433-4424-09090", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new references {
                        firstName = "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city = "Washington DC", state = "", emailAddress = "*****@*****.**", phone = "212-444-5555", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="",  emailAddress= "*****@*****.**", phone = "212-444-5555" },
                    //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="",  emailAddress= "*****@*****.**", phone = "212-444-5555" },
                    //new references {firstName= "Barack", lastName = "Obama", companyName = "Former President of the United States", mailingAddress = "P.O. Box 91000", city="Washington DC", state="",  emailAddress= "*****@*****.**", phone = "212-444-5555" }
                };

                foreach (references r in references)
                {
                    context.references.Add(r);
                }
                context.SaveChanges();
            }
            if (!context.skills.Any())
            {
                var skills = new skills[]
                {
                    new skills {
                        skillName = "Javascript", experienceLevel = "Advanced", yearsUsed = "3", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new skills {
                        skillName = "Adobe Photoshop", experienceLevel = "Expert", yearsUsed = "10", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new skills {
                        skillName = "Adobe Illustrator", experienceLevel = "Advanced", yearsUsed = "8", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new skills {
                        skillName = "C#", experienceLevel = "Novice", yearsUsed = "1", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new skills {
                        skillName = "HTML/CSS", experienceLevel = "Expert", yearsUsed = "10", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new skills {
                        skillName = "Microsoft Office", experienceLevel = "Advanced", yearsUsed = "20", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    }
                };
                foreach (skills s in skills)
                {
                    context.skills.Add(s);
                }
                context.SaveChanges();
            }



            if (!context.experience.Any())
            {
                var experience = new Experience[]
                {
                    new Experience {
                        jobName = "Internship Coordinator and Graphic Designer", placeWorked = "University of New Mexico", city = "Albuquerque", state = "NM", startDate = "June 2015", endDate = "present", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new Experience {
                        jobName = "Teacher of Computer Science and Technology", placeWorked = "The Meadows School", city = "Las Vegas", state = "NV", startDate = "August 2013", endDate = "June 2015", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new Experience {
                        jobName = "Director of Technology", placeWorked = "Steamboat Mountain School", city = "Steamboat Springs", state = "CO", startDate = "June 2012", endDate = "July 2013", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new Experience {
                        jobName = "Technology Lab Coordinator", placeWorked = "Rowland Hall-St. Mark's School", city = "Salt Lake City", state = "UT", startDate = "August 2007", endDate = "June 2012", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new Experience {
                        jobName = "Web and UX Designer", placeWorked = "University of Arkansas", city = "Fayetteville", state = "AR", startDate = "November 2006", endDate = "August 2007", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    },
                    new Experience {
                        jobName = "Marketing Advertising Executive", placeWorked = "Lovely County Citizen", city = "Eureka Springs", state = "AR", startDate = "Jan 2005", endDate = "October 2006", applicantID = context.applicant.FirstOrDefault(y => y.FirstName == "Carson").ID
                    }
                };
                foreach (Experience e in experience)
                {
                    context.experience.Add(e);
                }
                context.SaveChanges();
            }
            if (!context.duties.Any())
            {
                var duty = new duties[]
                {
                    new duties {
                        summary = "• Coordinates mentoring and internship program under a grant from the National Science Foundation.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID
                    },
                    new duties {
                        summary = "• Organizes and expedites mentoring events and meetings with faculty and students.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID
                    },
                    new duties {
                        summary = "• Advises and mentors students in meaningful development of careers. ", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "University of New Mexico").ID
                    },
                    new duties {
                        summary = "• Conceptualizes and designs advertising campaigns for School of Engineering.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID
                    },
                    new duties {
                        summary = "• Photographs students, faculty, and departmental events, to be used for publication", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID
                    },
                    new duties {
                        summary = "• Conceptualized, designed, and taught computer science and technology curriculum to students in a project-based environment at rigorous private middle school.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "The Meadows School").ID
                    },
                    new duties {
                        summary = "• Oversaw entire technology department for an independent boarding school,grades 9-12.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID
                    },
                    new duties {
                        summary = "• Configured and administered firewall, wireless network, and Active Directory Server.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID
                    },
                    new duties {
                        summary = "• Oversaw budget, recommended to and consulted with Head of School or purchases.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Steamboat Mountain School").ID
                    },
                    new duties {
                        summary = "• Taught graphic design; advised and supervised students in the creation of theschool yearbook.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID
                    },
                    new duties {
                        summary = "• Managed the scheduling, maintenance, and security of computer labs.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID
                    },
                    new duties  {
                        summary = "• Recommended hardware, software and learning resources to teachers.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID
                    },
                    new duties {
                        summary = "• First responder for end - user and technical support to faculty and students.", experienceID = context.experience.FirstOrDefault(y => y.placeWorked == "Rowland Hall-St. Mark's School").ID
                    }
                };
                foreach (duties d in duty)
                {
                    context.duties.Add(d);
                }
                context.SaveChanges();
            }
        }
        public applicant SelectOne(int id)
        {
            applicant selectedApplicant = _ds.Read(id);

            return(selectedApplicant);
        }
        public applicant SelectOne(string email)
        {
            applicant selectedApplicant = _ds.Read(email);

            return(selectedApplicant);
        }
 partial void Updateapplicant(applicant instance);
Example #34
0
        static void Main(string[] args)
        {
            applicant applicant1 = new applicant()
            {
                name = "amr rizk", Email = "*****@*****.**", Phonenumber = "00201114566722"
            };


            List <skill> myskills = new List <skill> {
                new skill()
                {
                    SkillName = "ASP.NET", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "ASP.NET MVC", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "C #", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "Minimum 3 years experience", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Talking and writing Danish", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Relevant Education from KU, ITU or similar", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Takes Responsibility for Own Projects from Ide to Implementation", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Entity Framework", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "SQL", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "HTML / CSS", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "jQuery", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "Backend", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "Frontend", SkillLevel = SkillLevel.Pro, SkillCategory = skillcategory.Programming
                },

                new skill()
                {
                    SkillName = "Trives in a young and dynamic environment", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Curious and Learning", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Enjoy working closely with other developers and claimants", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Want to work in a small .NET team with senior and junior developers", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Has humor and lots of good mood", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Preferring delicious food from a canteen to boring food packages", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                },

                new skill()
                {
                    SkillName = "Looking forward to nice social events with colleagues", SkillLevel = SkillLevel.Average, SkillCategory = skillcategory.meta
                }
            };


            string addmotivation = "freelancer web developer with experience, project samples on github:github.com/amrahmedrizk";


            JobApplication jobapp = new JobApplication(applicant1, addmotivation, myskills);

            Console.WriteLine(jobapp.ApplicationAnalysis());
        }
 partial void Insertapplicant(applicant instance);