/// <summary>
        /// Handles the Click event of the JobApplicationUpload control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void JobApplicationUpload_Click(object sender, EventArgs e)
        {
            if (this.RadUpload1.InvalidFiles.Count > 0)
            {
                this.Message.ShowNegativeMessage("Allowed filetypes are " + String.Join(", ", this.RadUpload1.AllowedFileExtensions));
                return;
            }

            if (this.RadUpload1.UploadedFiles.Count < 1)
            {
                this.Message.ShowNegativeMessage("Select a file to upload");
                return;
            }

            JobsModule module = new JobsModule();

            try
            {
                module.UploadApplication(this.FirstName, this.LastName, this.Phone, this.HowDidYouHear.SelectedItem.Text, this.RadUpload1.UploadedFiles[0]);
            }
            catch (Exception exc)
            {
                this.Message.ShowNegativeMessage(exc.Message);
                return;
            }

            this.Message.ShowPositiveMessage("Your application was uploaded successfully");

            // clear the input
            foreach (TextBox txt in this.Container.GetControls <TextBox>().Values)
            {
                txt.Text = String.Empty;
            }
        }
 protected void ApplyButton_Click(object sender, EventArgs e)
 {
     JobsModule myJobsModule = new JobsModule();
     myJobsModule.enterApplicantForJobPosition((String)Session["userID"], Request["pId"]);
     myJobsModule.addRemark(Request["pId"], (String)Session["userID"], RemarkTextBox.Text);
     Response.Redirect("~/ApplicantsJobs.aspx");
 }
    protected void setTable()
    {
        DataTable myDataTable = new DataTable();
        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        myDataTable = myJobsModule.getEmployersJobPositions().Copy();

        myDataTable.Columns.Add("Delete", typeof(String)).SetOrdinal(0);
        myDataTable.Columns.Add("List of Applied Applicants", typeof(String)).SetOrdinal(4);

        JobPositionsGridView.DataSource = myDataTable;
        JobPositionsGridView.DataBind();

        foreach (GridViewRow row in JobPositionsGridView.Rows)
        {
            LinkButton lb = new LinkButton();
            lb.Text = "Delete";
            lb.Click += new EventHandler(LinkButtonClicked);
            row.Cells[0].Controls.Add(lb);

            HyperLink hp = new HyperLink();
            hp.Text = row.Cells[2].Text;
            hp.NavigateUrl = "~/ShowJobPositionsManager.aspx?pId=" + row.Cells[1].Text;
            row.Cells[2].Controls.Add(hp);

            HyperLink hp2 = new HyperLink();
            hp2.Text = "Show Applied Applicants";
            hp2.NavigateUrl = "~/ListOfAppliedApplicants.aspx?pId=" + row.Cells[1].Text;
            row.Cells[4].Controls.Add(hp2);
        }
    }
 protected void ApplyButton_Click(object sender, EventArgs e)
 {
     JobsModule myJobsModule = new JobsModule();
     if ((myJobsModule.enterApplicantForJobPosition((String)Session["userID"], PositionId.Text)).Equals("Applicant successfully inserted"))
     {
         showAlert();
     }
 }
    protected void setTable2()
    {
        DataTable myDataTable = new DataTable();
        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        myDataTable = myJobsModule.getAppliedJobPositionsOfApplicant();

        AppliedJobsGridView.DataSource = myDataTable;
        AppliedJobsGridView.DataBind();
    }
    void LinkButtonClicked(object sender, EventArgs e)
    {
        LinkButton src = (LinkButton)sender;

        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        GridViewRow row = (GridViewRow)src.NamingContainer;

        myJobsModule.deleteApplicantsMentionedJob((row.Cells[2].Text).Replace(" ", String.Empty).ToLower());
        Response.Redirect(Request.RawUrl);
    }
    void LinkButtonClicked(object sender, EventArgs e)
    {
        LinkButton src = (LinkButton)sender;

        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        GridViewRow row = (GridViewRow)src.NamingContainer;

        myJobsModule.deleteJobPosition(row.Cells[1].Text);
        Response.Redirect(Request.RawUrl);
    }
 protected void insert()
 {
     if (isTextBoxesFilled())
     {
         JobsModule myJobsModule = new JobsModule();
         myJobsModule.insertJobPosition((String)Session["userId"], JobTypeDropDownList.SelectedValue, EmployerTextBox.Text,
             TitleTextBox.Text, DescriptionTextBox.Text, SalaryTextBox.Text, MinAgeTextBox.Text, MaxAgeTextBox.Text, ExperienceTextBox.Text,
             FirstQualityDropDownList.SelectedValue, FirstQualityTextBox.Text, SecondQualityDropDownList.SelectedValue, SecondQualityTextBox.Text,
             ThirdQualityDropDownList.SelectedValue, ThirdQualityTextBox.Text);
     }
     else
     {
         FeedbackLabel.Text = "Please fill in all required fields";
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginModule myLoginModule = new LoginModule();
        myLoginModule.checkLoginStatus();
        myLoginModule.checkPermission(1);

        JobsModule myJobsModule = new JobsModule();
        if (!myJobsModule.doesJobBelongToUser((String)Session["userID"], Request["pId"]))
        {
            myLoginModule.checkPermission(3);
        }

        WelcomeLabel.Text = myLoginModule.getFirstName((String)Session["userID"]);

        setTable();
    }
    protected void setTable()
    {
        DataTable myDataTable = new DataTable();
        JobsModule myJobsModule = new JobsModule();
        myJobsModule.setUserId((String)Session["userId"]);

        myDataTable = myJobsModule.viewMentionedJobs().Copy();
        myDataTable.Columns.Add("Delete", typeof(String)).SetOrdinal(0);

        JobsGridView.DataSource = myDataTable;
        JobsGridView.DataBind();

        foreach (GridViewRow row in JobsGridView.Rows)
        {
            LinkButton lb = new LinkButton();
            lb.Text = "Delete";
            lb.Click += new EventHandler(LinkButtonClicked);
            //lb.OnClick = myJobsModule.deleteApplicantsMentionedJob((row.Cells[2].Text).Replace(" ", String.Empty).ToLower());
            row.Cells[0].Controls.Add(lb);

        }
    }
    protected void populatePage()
    {
        JobsModule myJobsModule = new JobsModule();

        Dictionary<String, String> fields = new Dictionary<string, string>();
        fields = myJobsModule.getJobPosition(Context.Request.QueryString["pId"]);

        PositionId.Text = fields["positionId"];
        CreatorsId.Text = fields["creatorsId"];
        TitleLabel.Text = fields["title"];
        JobType.Text = fields["jobType"];
        EmployerLabel.Text = fields["employer"];
        FirstQuality.Text = fields["firstQuality"];
        FirstQualityType.Text = fields["firstQualityType"];
        SecondQuality.Text = fields["secondQuality"];
        SecondQualityType.Text = fields["secondQualityType"];
        ThirdQuality.Text = fields["thirdQuality"];
        ThirdQualityType.Text = fields["thirdQualityType"];
        DescriptionLabel.Text = fields["description"];
        Salary.Text = fields["salary"];
        MinAge.Text = fields["minAge"];
        MaxAge.Text = fields["maxAge"];
        Experience.Text = fields["experience"];
    }
        /// <summary>
        /// Handles the Click event of the JobApplicationUpload control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void JobApplicationUpload_Click(object sender, EventArgs e)
        {
            if (this.RadUpload1.InvalidFiles.Count > 0)
            {
                this.Message.ShowNegativeMessage("Allowed filetypes are " + String.Join(", ", this.RadUpload1.AllowedFileExtensions));
                return;
            }

            if (this.RadUpload1.UploadedFiles.Count < 1)
            {
                this.Message.ShowNegativeMessage("Select a file to upload");
                return;
            }

            JobsModule module = new JobsModule();
            try
            {
                module.UploadApplication(this.FirstName, this.LastName, this.Phone, this.HowDidYouHear.SelectedItem.Text, this.RadUpload1.UploadedFiles[0]);
            }
            catch (Exception exc)
            {
                this.Message.ShowNegativeMessage(exc.Message);
                return;
            }

            this.Message.ShowPositiveMessage("Your application was uploaded successfully");

            // clear the input
            foreach (TextBox txt in this.Container.GetControls<TextBox>().Values)
            {
                txt.Text = String.Empty;
            }
        }