Ejemplo n.º 1
0
    private void AddDate(TableRow row, StudentInterview intv, bool editable)
    {
        TableCell date = new TableCell();

        row.Controls.Add(date);

        TextBox dateTextBox = new TextBox();

        dateTextBox.ID       = "dateTextBox_" + intv.interviewId;
        dateTextBox.Text     = intv.date.IsNull ? "Null" : intv.date.Value.ToString("dd/MM/yyyy");
        dateTextBox.ReadOnly = !editable;
        date.Controls.Add(dateTextBox);

        if (editable)
        {
            ImageButton calendarImgBtn = new ImageButton();
            calendarImgBtn.ID       = "calendarImgBtn_" + intv.interviewId;
            calendarImgBtn.ImageUrl = "Resources/Calendar.png";
            calendarImgBtn.Width    = new Unit(30); // ugly as f**k?
            date.Controls.Add(calendarImgBtn);

            CalendarExtender calendarExt = new CalendarExtender();
            calendarExt.PopupButtonID   = calendarImgBtn.ID;
            calendarExt.TargetControlID = dateTextBox.ID;
            calendarExt.Format          = "dd/MM/yyyy";
            date.Controls.Add(calendarExt);
        }
    }
Ejemplo n.º 2
0
    private void Add_TodayInterview(StudentInterview intv)
    {
        today.Add(intv);

        TableRow row = new TableRow();

        Today_InterviewsTable.Controls.Add(row);

        AddBasicInfo(row, intv);
    }
Ejemplo n.º 3
0
    private void Add_FutureInterview(StudentInterview intv)
    {
        future.Add(intv);

        TableRow row = new TableRow();

        Future_InterviewsTable.Controls.Add(row);

        AddBasicInfo(row, intv);
        AddDate(row, intv, true);
    }
Ejemplo n.º 4
0
    private void Add_ToBeScheduledInterview(StudentInterview intv)
    {
        toBeScheduled.Add(intv);

        TableRow row = new TableRow();

        Schedule_InterviewsTable.Controls.Add(row);

        AddBasicInfo(row, intv);
        AddDate(row, intv, true);
    }
Ejemplo n.º 5
0
    private void Add_PastInterview(StudentInterview intv)
    {
        past.Add(intv);

        TableRow row = new TableRow();

        Past_InterviewsTable.Controls.Add(row);

        AddBasicInfo(row, intv);
        AddDate(row, intv, false);
        AddResult(row, intv);
    }
Ejemplo n.º 6
0
    private void AddResult(TableRow row, StudentInterview intv)
    {
        TableCell result = new TableCell();

        row.Controls.Add(result);

        if (!intv.HasResult)
        {
            Button accept = new Button();
            accept.CssClass = "btn btn-outline-success";
            accept.ID       = "accepted_" + intv.interviewId;
            accept.Text     = "Accept";
            accept.Click   += Accept_Click;
            result.Controls.Add(accept);

            Button declined = new Button();
            declined.CssClass = "btn btn-outline-danger";
            declined.ID       = "declined_" + intv.interviewId;
            declined.Text     = "Decline";
            declined.Click   += Declined_Click;
            result.Controls.Add(declined);
        }
        else if (intv.Accepted)
        {
            Button accept = new Button();
            accept.CssClass = "btn btn-success";
            accept.ID       = "accepted_" + intv.interviewId;
            accept.Text     = "Accepted";
            accept.Enabled  = false;

            result.Controls.Add(accept);
        }
        else if (intv.Refused)
        {
            Button declined = new Button();
            declined.CssClass = "btn btn-danger";
            declined.ID       = "declined_" + intv.interviewId;
            declined.Text     = "Declined";
            declined.Enabled  = false;

            result.Controls.Add(declined);
        }
    }
Ejemplo n.º 7
0
    private void AddBasicInfo(TableRow row, StudentInterview intv)
    {
        TableCell interviewer = new TableCell();

        interviewer.Text = intv.interviewerFirstName + " " + intv.interviewerLastName;
        row.Controls.Add(interviewer);

        TableCell name = new TableCell();

        name.Text = intv.firstName + " " + intv.lastName;
        row.Controls.Add(name);

        TableCell email = new TableCell();

        email.Text = intv.email;
        row.Controls.Add(email);

        TableCell position = new TableCell();

        position.Text = intv.positionName;
        row.Controls.Add(position);
    }
Ejemplo n.º 8
0
    private void Accept(string id, bool accepted)
    {
        int    intvId;
        string error;

        if (int.TryParse(id, out intvId))
        {
            StudentInterview interview = intervs.Find(obj => obj.interviewId == intvId);
            if (InterviewsTable.Instance.Update(intvId, accepted, out error) && (!accepted || EmployeesTable.Instance.Insert(interview.email, interview.positionId, out error)))
            {
                (Master as MasterPage).ShowError(true, "Success");
                Response.Redirect(Request.RawUrl);
                return;
            }
        }
        else
        {
            error = "Cannot parse id. " + id;
        }

        (Master as MasterPage).ShowError(false, error);
    }