Пример #1
0
        public List <InvigilationDuty> searchInvigilationDuty2(int staffID)
        {
            List <InvigilationDuty> invDutyList = new List <InvigilationDuty>();

            try
            {
                /*Step 2: Create Sql Search statement and Sql Search Object*/
                strSearch = "Select TimeslotID, VenueID, Location, CatOfInvi, Duration from dbo.InvigilationDuty where StaffID = @StaffID";
                cmdSearch = new SqlCommand(strSearch, conn);

                cmdSearch.Parameters.AddWithValue("@StaffID", staffID.ToString());

                /*Step 3: Execute command to retrieve data*/
                SqlDataReader dtr = cmdSearch.ExecuteReader();

                /*Step 4: Get result set from the query*/
                if (dtr.HasRows)
                {
                    while (dtr.Read())
                    {
                        InvigilationDuty invDuty = new InvigilationDuty(dtr["TimeslotID"].ToString(), dtr["VenueID"].ToString(), dtr["Location"].ToString(), staffID.ToString(), dtr["CatOfInvi"].ToString(), Int32.Parse(dtr["Duration"].ToString()));
                        invDutyList.Add(invDuty);
                    }
                    dtr.Close();
                }
            }
            catch (SqlException)
            {
                throw;
            }

            return(invDutyList);
        }
Пример #2
0
 public Constraint3(InvigilationDuty invigilationDuty, Staff invigilator, Examination examination, bool?isHardConstraint, bool?isCnblPaper, bool?isDoubleSeating)
 {
     this.invigilationDuty = invigilationDuty;
     this.invigilator      = invigilator;
     this.examination      = examination;
     this.isHardConstraint = isHardConstraint;
     this.isCnblPaper      = isCnblPaper;
     this.isDoubleSeating  = isDoubleSeating;
 }
Пример #3
0
        public int addInvigilationDuty(Staff staff, InvigilationDuty invigilationDuty)
        {
            int n = 0;

            try
            {
                /*Step 2: Create Sql Insert statement and Sql Insert Object*/
                strInsert = "Insert Into InvigilationDuty  (TimeslotID, VenueID, Location, StaffID, CatOfInvi, Duration) Values (@TimeslotID, @VenueID, @Location, @StaffID, @CategoryOfInvigilator, @Duration)";
                cmdInsert = new SqlCommand(strInsert, conn);

                cmdInsert.Parameters.AddWithValue("@TimeslotID", invigilationDuty.Session + invigilationDuty.Date.Date.ToString("ddMMyy"));
                if (invigilationDuty.VenueID.Equals(""))
                {
                    cmdInsert.Parameters.AddWithValue("@VenueID", DBNull.Value);
                }
                else
                {
                    cmdInsert.Parameters.AddWithValue("@VenueID", invigilationDuty.VenueID);
                }
                if (invigilationDuty.Location.Equals("") && invigilationDuty.CategoryOfInvigilator.Equals("Relief"))
                {
                    cmdInsert.Parameters.AddWithValue("@Location", "West Campus");
                }
                else
                {
                    cmdInsert.Parameters.AddWithValue("@Location", invigilationDuty.Location);
                }
                cmdInsert.Parameters.AddWithValue("@StaffID", staff.StaffID);
                cmdInsert.Parameters.AddWithValue("@CategoryOfInvigilator", invigilationDuty.CategoryOfInvigilator);
                cmdInsert.Parameters.AddWithValue("@Duration", invigilationDuty.Duration);

                /*Step 3: Execute command to insert*/
                n = cmdInsert.ExecuteNonQuery();
                if (invigilationDuty.Date.DayOfWeek == DayOfWeek.Saturday)
                {
                    updateNoOfSatSession(staff.StaffID);
                }
            }
            catch (SqlException)
            {
                throw;
            }
            return(n);
        }
Пример #4
0
        public List <InvigilationDuty> searchInvigilationDuty(string staffID)
        {
            List <InvigilationDuty> invigilationDutiesList = new List <InvigilationDuty>();

            try
            {
                /*Step 2: Create Sql Search statement and Sql Search Object*/
                strSearch = "Select T.Date, T.Session, I.VenueID, I.Location, I.Duration, I.CatOfInvi From dbo.Timeslot T, dbo.InvigilationDuty I Where I.StaffID = @StaffID And I.TimeSlotID = T.TimeSlotID";
                cmdSearch = new SqlCommand(strSearch, conn);

                cmdSearch.Parameters.AddWithValue("@StaffID", staffID);

                /*Step 3: Execute command to retrieve data*/
                SqlDataReader dtr = cmdSearch.ExecuteReader();

                /*Step 4: Get result set from the query*/
                if (dtr.HasRows)
                {
                    while (dtr.Read())
                    {
                        string categoryOfInvigilator = dtr["CatOfInvi"].ToString();
                        string venueID = "";
                        if (categoryOfInvigilator.Equals("Chief"))
                        {
                            venueID = "";
                        }
                        else
                        {
                            venueID = dtr["VenueID"].ToString();
                        }

                        InvigilationDuty invigilationDuty = new InvigilationDuty(DateTime.Parse(dtr["Date"].ToString()), dtr["Session"].ToString(), venueID, dtr["Location"].ToString(), dtr["CatOfInvi"].ToString(), int.Parse(dtr["Duration"].ToString()));
                        invigilationDutiesList.Add(invigilationDuty);
                    }
                }
                dtr.Close();
            }
            catch (SqlException)
            {
                throw;
            }
            return(invigilationDutiesList);
        }
Пример #5
0
 public Constraint3()
 {
     this.invigilationDuty                      = new InvigilationDuty();
     this.invigilator                           = new Staff();
     this.examination                           = new Examination();
     this.isHardConstraint                      = false;
     this.isCnblPaper                           = null;
     this.IsDoubleSeating                       = null;
     this.hasOtherDutyOnSameDay                 = null;
     this.hasSpecificDurationDutyOnSameDay      = null;
     this.hasSpecificDurationDutyOnSameDayInt   = 0;
     this.hasSpecificSessionDutyOnSameDay       = null;
     this.hasSpecificSessionDutyOnSameDayString = "";
     this.dayOfWeek = "";
     this.constraintImportanceValue = 1;
     this.assignExaminerToPaper     = null;
     this.minExperiencedInvigilator = 0;
     this.hasSpecificSessionAndDurationDutyOnSameDay           = null;
     this.percentageOfInvigilatorAssignedToTheirOwnFacultyDuty = 0;
     this.remark = "";
 }
 public int addInvigilationDuty(Staff staff, InvigilationDuty invigilationDuty)
 {
     return(invigilationDutyDA.addInvigilationDuty(staff, invigilationDuty));
 }