Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // DataSet dataSet = new DataSet();
            //  dataSet.ReadXml(@"C:\Users\conmc_000\Desktop\THIS IS THE WEBSITE\WebAppAssignment\RecruiterWebsite\RecruiterWebsite\XML\Jobs.xml");

            List<Job> ListOfAllJobIndex = new List<Job>();

            BLL.BLLRecruiterWebsiteManager GetListOfAllJobs = new BLL.BLLRecruiterWebsiteManager();

            ListOfAllJobIndex = GetListOfAllJobs.GetListOfAllActiveJobs();

            GridView1.DataSource = from x in ListOfAllJobIndex
                                   select new
                                   {
                                       x.JobID,
                                       x.EmpID,
                                       x.Category,
                                       x.Title,
                                       x.Location,
                                       x.Description,
                                       x.Type,
                                       x.Terms,
                                       x.Salary,
                                       x.DateCreated

                                   };

            GridView1.DataSource = ListOfAllJobIndex;
            GridView1.DataBind();
        }
        protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {

                int rowIndex = Convert.ToInt32(e.CommandArgument);
                string JobID = GridView2.Rows[rowIndex].Cells[0].Text;

                BLL.BLLRecruiterWebsiteManager DeleteJobEmployerProfile = new BLL.BLLRecruiterWebsiteManager();

                DeleteJobEmployerProfile.DeleteJobFormEmployerProfile(JobID);

                Response.Redirect(Request.RawUrl);

            }

         

        }
        protected void Page_Load(object sender, EventArgs e){


            Employer Emp = new Employer();

            string Sesh = string.Empty;

            if (Session["EmployerID"] == null)
            {
                Response.Redirect("~/EmployerLogin.aspx");
            }
            else
            {

            

            Sesh = Session["EmployerID"].ToString();

         

            int SessionEmployerID = int.Parse(Sesh);

            List<JobApplication> Application = new List<JobApplication>();

            BLL.BLLRecruiterWebsiteManager RequestJobApplicant = new BLL.BLLRecruiterWebsiteManager();

            Application = RequestJobApplicant.GetApplicationsFormDatabase(SessionEmployerID);

            GridView1.DataSource = from t in Application
                                   select new
                                   {
                                       // CHANGED
                                       t.JobIdApplied,
                                       t.EmpidApplied,
                                       t.FullName,
                                       t.ContactNumber,
                                       t.Email,
                                       t.CoverLetter,
                                       t.UploadCvPath
                                   };


            GridView1.DataBind();


            List<Job> JobList = new List<Job>();

            BLL.BLLRecruiterWebsiteManager RequestJobList = new BLL.BLLRecruiterWebsiteManager();

            JobList = RequestJobList.ListJobs(SessionEmployerID);

/*
            DataSet ds = new DataSet();

            DataTable dt = new DataTable("myTable");

            dt.Columns.Add("JobID", typeof(int));
            dt.Columns.Add("EmpID", typeof(int));
            dt.Columns.Add("Category",typeof(string));
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("Location",typeof(string));
            dt.Columns.Add("Requirements",typeof(string));
            dt.Columns.Add("Salary",typeof(decimal));


            foreach (var item in JobList)
            {
                DataRow dr = dt.NewRow();

                dr["JobID"] = item.JobID;
                dr["EmpID"] = item.EmpID;
                dr["Category"] = item.Category;
                dr["Title"] = item.Title;
                dr["Location"] = item.Location;
                dr["Requirements"] = item.Requirements;
                dr["Salary"] = item.Salary;

                dt.Rows.Add(dr);
               
            }
            ds.Tables.Add(dt);
 * 
 * */



            GridView2.DataSource = from x in JobList
                                   orderby x.DateCreated ascending
                                   select new
                                    {
                                        x.JobID,
                                        x.EmpID,
                                        x.Category,
                                        x.Title,
                                        x.Company,
                                        x.Location,
                                        x.Description,
                                        x.Type,
                                        x.Terms,
                                        x.Salary,
                                        x.DateCreated
                                    };
            GridView2.DataBind();

            }


        }
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
          //  Response.Write(e.CommandArgument);
           // Response.Write("Well S***e head");

            if (e.CommandName=="Download")
            {
                

                int rowIndex = Convert.ToInt32(e.CommandArgument);
                string test = GridView1.Rows[rowIndex].Cells[6].Text;

                string fullPath = "~/Uploads/" + test;

                Response.ContentType = "doc/docx";
                Response.AddHeader("Content-Disposition", "attachment;filename=\"" + fullPath + "\"");
                Response.TransmitFile(Server.MapPath(fullPath));
                Response.End();

            }
            else if(e.CommandName == "Delete")
            {
                int rowIndex = Convert.ToInt32(e.CommandArgument);
                string DeleteFullName = GridView1.Rows[rowIndex].Cells[2].Text;
                string DeleteJobId = GridView1.Rows[rowIndex].Cells[0].Text;
                string DeleteEmpId = GridView1.Rows[rowIndex].Cells[1].Text;


                BLL.BLLRecruiterWebsiteManager DeleteJobApplicant = new BLL.BLLRecruiterWebsiteManager();

               bool Check = DeleteJobApplicant.DeleteJobApplicant(DeleteFullName, DeleteJobId, DeleteEmpId);


               if (Check==true)
               {
                   Response.Redirect(Request.RawUrl);
               }



            }

        }