protected void AddSession_Click(object sender, EventArgs e)
        {
            string date      = Year.SelectedValue + "-" + Month.SelectedValue + "-" + Day.SelectedValue;
            string startTime = starthour.SelectedValue + ":" + startmin.SelectedValue;
            string endTime   = endhour.SelectedValue + ":" + endmin.SelectedValue;

            if (Request.QueryString["cId"] != null && Request.QueryString["classId"] == null)
            {
                addSessionsObj.AddClass(Request.QueryString["cId"], date, startTime, endTime);

                Enrollment enrollmentObj = new Enrollment();
                DataTable  students      = new DataTable();
                students = enrollmentObj.SelectStudentsInCourse(Request.QueryString["cId"]);

                Attendance attendanceObj = new Attendance();
                for (int i = 0; i < students.Rows.Count; ++i)
                {
                    attendanceObj.AddAttendance(students.Rows[i][0].ToString());
                }

                Response.Redirect("~/Faculty/Sessions.aspx?cId=" + Request.QueryString["cId"]);
            }
            else
            {
                addSessionsObj.UpdateClass(Request.QueryString["classId"], date, startTime, endTime);
                Response.Redirect("~/Faculty/Sessions.aspx?cId=" + Request.QueryString["cId"]);
            }
        }
예제 #2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         Employee employee = Employee.GetEmployee(int.Parse(textBox1.Text));
         label3.Text = employee.FirstName + " " + employee.MiddleName + " " + employee.LastName;
         Department department = Department.GetDepartment(employee.DepartmentId);
         label4.Text     = department.Name;
         label5.Text     = employee.Status == 1 ? "Time In" : "Time Out";
         employee.Status = employee.Status == 1 ? (ulong)0 : (ulong)1;
         Employee.EditEmployee(employee.Id, employee);
         Attendance.AddAttendance(employee.Id);
         pictureBox1.Image = Properties.Resources.avatar;
     }
     catch (Exception)
     {
         label3.Text = "UNKNOWN";
     }
     finally
     {
         timeBeforeTimeout = 0;
     }
 }