Beispiel #1
0
        public static void InitializeUser(string username, HttpContext context)
        {
            /*after login ( either through the login control or through the code behind ) ,
             * We need the following line of code otherwise Membership.getUser() returns null
             */

            context.Session["EmployerID"] = null;
            context.Session["EmployeeID"] = null;
            FormsAuthentication.SetAuthCookie(username, false /* createPersistentCookie */);

            using (EmployerProfileObject employerprofile = new EmployerProfileObject())
            {
                IEnumerable <Employer> emps = employerprofile.GetProfile(Membership.GetUser(username).ProviderUserKey.ToString());
                Employer employer           = emps.FirstOrDefault();
                if (employer != null)
                {
                    context.Session["EmployerID"] = employer.EmployerID;
                }
            }

            using (EmployeeProfileObject Employeeprofile = new EmployeeProfileObject())
            {
                IEnumerable <Employee> empees = Employeeprofile.GetProfile(Membership.GetUser(username).ProviderUserKey.ToString());
                Employee Employee             = empees.FirstOrDefault();
                if (Employee != null)
                {
                    context.Session["EmployeeID"] = Employee.EmployeeID;
                }
            }
        }
        // GET: /Employer/
        public ActionResult SeekEmployee(string keyword)
        {
            List <Employee> empees = null;

            ViewData["Message"] = "";

            if (keyword != null)
            {
                string[] filters = keyword.Split(';');

                foreach (string filter in filters)
                {
                    _KeywordsPopularity.SetAsPopular(filter);
                }

                using (EmployeeProfileObject Employeeprofile = new EmployeeProfileObject())
                {
                    var temp = Employeeprofile.FilterProfiler(keyword);
                    empees = temp.ToList();
                }

                if (empees == null || empees.Count() == 0)
                {
                    ViewData["Message"] = "No matched record found";
                }
            }


            return(View(empees));
        }
Beispiel #3
0
        public ActionResult ShowEmployeeDetails(int id)
        {
            Employee emp = null;

            using (EmployeeProfileObject Employeeprofile = new EmployeeProfileObject())
            {
                emp = Employeeprofile.GetProfilebyID(id).FirstOrDefault();
            }


            return(View(emp));
        }
Beispiel #4
0
        public ActionResult UpdateProfile()
        {
            Employee emp = null;

            using (EmployeeProfileObject Employeeprofile = new EmployeeProfileObject())
            {
                int EmployeeID = Session["EmployeeID"] == null ? 0 : Convert.ToInt32(Session["EmployeeID"]);
                if (EmployeeID == 0)
                {
                    return(RedirectToAction("CreateProfile"));
                }

                IEnumerable <Employee> empees = Employeeprofile.GetProfilebyID(EmployeeID);
                emp = empees.FirstOrDefault();
            }
            ViewData.Model = emp;
            return(View());
        }