Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)

        {
            string currentPageFileName = new FileInfo(this.Request.Url.AbsolutePath).Name;
            var    PermMgr             = new PermissionManager(Session);

            if (PermMgr.IsAdmin || PermMgr.CanWorkWithCandidates || PermMgr.CanApprove)
            {
                if (!IsPostBack)
                {
                    var quests = _db.Candidates.Select(a => new CandidateGridModel
                    {
                        ID             = a.Id,
                        TenantId       = a.TenantId ?? 0,
                        Username       = a.Username,
                        FirstName      = a.FirstName,
                        LastName       = a.LastName,
                        Sex            = a.Sex,
                        DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                        Status         = a.Status ?? "-",
                        Email          = a.Email,
                        D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                        DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
                    });
                    TotalRecCount.Text       = quests.Count() + " Candidate(s)";
                    CandidateList.DataSource = quests.OrderByDescending(x => x.ID).ToList();
                    CandidateList.DataBind();
                }
            }
            else
            {
                Response.Redirect("NoPermission.aspx", false);
            }
        }
Exemplo n.º 2
0
        protected void lnkeditCS_Click(object sender, EventArgs e)
        {
            LinkButton  lnkedit = ((LinkButton)sender);
            var         p       = lnkedit.Parent;
            HiddenField hdfID   = (HiddenField)p.FindControl("hdfIDCS");
            var         idcr    = long.Parse(hdfID.Value);

            if (!(idcr == null))
            {
                var opt = _db.T_Candidate.Where(s => s.Id == idcr).FirstOrDefault();
                if (opt.ApprovalStatus == ErecruitHelper.ApprovalStatus.APPROVED.ToString())
                {
                    if (opt != null)
                    {
                        if (opt.IsActive.Value)
                        {
                            opt.IsActive = false;
                        }
                        else
                        {
                            opt.IsActive = true;
                        }

                        _db.SaveChanges();

                        var quests = _db.Candidates.Select(a => new CandidateGridModel
                        {
                            ID             = a.Id,
                            TenantId       = a.TenantId ?? 0,
                            Username       = a.Username,
                            FirstName      = a.FirstName,
                            LastName       = a.LastName,
                            Sex            = a.Sex,
                            DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                            Status         = a.Status ?? "-",
                            Email          = a.Email,
                            D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                            DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
                        }).Distinct().ToList();
                        TotalRecCount.Text       = quests.Count() + " Candidate(s)";
                        CandidateList.DataSource = quests.OrderByDescending(x => x.ID).ToList();
                        CandidateList.DataBind();
                    }
                    resultLbl.Text = "";
                }
                else
                {
                    resultLbl.Text = "The candidate has to be approved first";
                }
            }
        }
Exemplo n.º 3
0
        protected void lnkeditApp_Click(object sender, EventArgs e)
        {
            LinkButton  lnkedit = ((LinkButton)sender);
            var         p       = lnkedit.Parent;
            HiddenField hdfID   = (HiddenField)p.FindControl("hdfIDApp");
            var         idcr    = long.Parse(hdfID.Value);

            if (!(idcr == null))
            {
                var opt = _db.Candidates.FirstOrDefault(s => s.Id == idcr);
                if (opt != null)
                {
                    //if (opt.ApprovalStatus == ErecruitHelper.ApprovalStatus.APPROVED.ToString())
                    //{
                    //    opt.ApprovalStatus = ErecruitHelper.ApprovalStatus.NOT_APPROVED.ToString();
                    //    opt.IsActive = false;
                    //    opt.ApprovedBy = SessionHelper.FetchEmail(Session);
                    //}
                    //else
                    //{
                    //    opt.ApprovalStatus = ErecruitHelper.ApprovalStatus.APPROVED.ToString();
                    //    opt.IsActive = true;
                    //    opt.ApprovedBy = SessionHelper.FetchEmail(Session);
                    //}

                    //_db.SaveChanges();
                    var quests = _db.Candidates.Select(a => new CandidateGridModel
                    {
                        ID             = a.Id,
                        TenantId       = a.TenantId ?? 0,
                        Username       = a.Username,
                        FirstName      = a.FirstName,
                        LastName       = a.LastName,
                        Sex            = a.Sex,
                        DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                        Status         = a.Status ?? "-",
                        Email          = a.Email,
                        D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                        DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
                    });
                    CandidateList.DataSource = quests.OrderByDescending(x => x.DateRegistered).ToList();

                    CandidateList.DataBind();
                    resultLbl.Text = "";
                }
            }
        }
Exemplo n.º 4
0
        protected void SearchCandidate_Click(object sender, EventArgs e)
        {
            try{
                var name        = Name.Text;
                var degree      = Degree.Value;
                var c           = cond.Value;
                var course      = Course.Text;
                var DegreeClass = ClassOfDegree.Value;
                var referal     = Referal.Text;
                var age         = Age.Text;

                IQueryable <QuizBook.Candidate> cands;

                if (!string.IsNullOrEmpty(name))
                {
                    cands = _db.Candidates.Where(s => (s.FirstName.Contains(name) || s.LastName.Contains(name)));
                }
                else
                {
                    cands = _db.Candidates.AsQueryable();
                }


                var quests = cands.Select(a => new CandidateGridModel
                {
                    ID             = a.Id,
                    TenantId       = a.TenantId ?? 0,
                    Username       = a.Username,
                    FirstName      = a.FirstName,
                    LastName       = a.LastName,
                    Sex            = a.Sex,
                    DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                    Status         = a.Status ?? "-",
                    Email          = a.Email,
                    D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                    DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
                }).Distinct().ToList();
                TotalRecCount.Text       = quests.Count() + " Candidate(s)";
                CandidateList.DataSource = quests.OrderByDescending(x => x.ID).ToList();
                CandidateList.DataBind();
            }
            catch (Exception ex)
            {
                ErecruitHelper.SetErrorData(ex, Session);
                Response.Redirect("ErrorPage.aspx", false);
            }
        }
Exemplo n.º 5
0
        protected void CandidateList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            var name        = Name.Text;
            var degree      = Degree.Value;
            var c           = cond.Value;
            var course      = Course.Text;
            var DegreeClass = ClassOfDegree.Value;
            var referal     = Referal.Text;
            var age         = Age.Text;

            IQueryable <QuizBook.Candidate> cands;

            if (!string.IsNullOrEmpty(name))
            {
                cands = _db.Candidates.Where(s => (s.FirstName.Contains(name) || s.LastName.Contains(name)));
            }
            else
            {
                cands = _db.Candidates.AsQueryable();
            }


            var quests = cands.Select(a => new CandidateGridModel
            {
                ID             = a.Id,
                TenantId       = a.TenantId ?? 0,
                Username       = a.Username,
                FirstName      = a.FirstName,
                LastName       = a.LastName,
                Sex            = a.Sex,
                DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                Status         = a.Status ?? "-",
                Email          = a.Email,
                D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
            });

            CandidateList.DataSource = quests.OrderByDescending(x => x.ID).ToList();
            CandidateList.PageIndex  = e.NewPageIndex;
            CandidateList.DataBind();
        }
Exemplo n.º 6
0
        protected void CandidateList_Sorting(object sender, GridViewSortEventArgs e)
        {
            var name        = Name.Text;
            var degree      = Degree.Value;
            var c           = cond.Value;
            var course      = Course.Text;
            var DegreeClass = ClassOfDegree.Value;
            var referal     = Referal.Text;
            var age         = Age.Text;
            var cCode       = code.Text;

            IQueryable <QuizBook.Candidate> cands;

            if (!string.IsNullOrEmpty(name))
            {
                cands = _db.Candidates.Where(s => (s.FirstName.Contains(name) || s.LastName.Contains(name)));
            }
            else
            {
                cands = _db.Candidates.AsQueryable();
            }



            var quests = cands.Select(a => new CandidateGridModel
            {
                ID             = a.Id,
                TenantId       = a.TenantId ?? 0,
                Username       = a.Username,
                FirstName      = a.FirstName,
                LastName       = a.LastName,
                Sex            = a.Sex,
                DOB            = a.DOB == null ? "-" : a.DOB.Value.ToString("dd-MM-yyyy"),
                Status         = a.Status ?? "-",
                Email          = a.Email,
                D              = a.Status == ErecruitHelper.CStatus.Active.ToString() ? "Deactivate" : "Activate",
                DateRegistered = a.DateCreated == null ? "-" : a.DateCreated.Value.ToString("dd-MM-yyyy")
            }).Distinct().ToList();

            quests = quests.OrderByDescending(x => x.ID).ToList();

            if ((string)Session["EXP"] == e.SortExpression && (string)Session["DIRECTION"] == SortDirection.Ascending.ToString())
            {
                e.SortDirection = SortDirection.Descending;
            }
            else
            {
                e.SortDirection = SortDirection.Ascending;
            }

            Session["EXP"]       = e.SortExpression;
            Session["DIRECTION"] = e.SortDirection.ToString();
            switch (e.SortExpression)
            {
            case "Code":
                if (e.SortDirection == SortDirection.Ascending)
                {
                    quests = quests.OrderBy(s => s.Username).ToList();

                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }
                else
                {
                    quests = quests.OrderByDescending(s => s.Username).ToList();
                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }

                break;

            case "FirstName":
                if (e.SortDirection == SortDirection.Ascending)
                {
                    quests = quests.OrderBy(s => s.FirstName).ToList();

                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }
                else
                {
                    quests = quests.OrderByDescending(s => s.FirstName).ToList();
                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }

                break;

            case "LastName":
                if (e.SortDirection == SortDirection.Ascending)
                {
                    quests = quests.OrderBy(s => s.LastName).ToList();

                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }
                else
                {
                    quests = quests.OrderByDescending(s => s.LastName).ToList();
                    CandidateList.DataSource = quests;
                    CandidateList.DataBind();
                }

                break;
            }
        }