protected void AllocateRoomsButton_Click(object sender, EventArgs e) { AllocatedRooms _AllocateRooms = new AllocatedRooms(); _AllocateRooms.DepartmentId = Convert.ToInt32(DepartmentDropDownList.SelectedValue); _AllocateRooms.CourseCode = CoursesDropDownList.SelectedValue; _AllocateRooms.RoomId = Convert.ToInt32(RoomsDropDownList.SelectedValue); _AllocateRooms.DayId = Convert.ToInt32(DayDropDownList.SelectedValue); _AllocateRooms.StartTime = Convert.ToDateTime(txtDateFrom.Text); _AllocateRooms.EndTime = Convert.ToDateTime(txtDateTo.Text); decimal CheckExitCourse = _AllocateRoomManager.AlreadyCourseAllocate(_AllocateRooms); if (CheckExitCourse >= 1) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This Course Already Allocated');", true); } else { decimal CheckExitRoom = _AllocateRoomManager.AlreadyReservedRoom(_AllocateRooms); if (CheckExitRoom >= 1) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This Time Allocated Same Room');", true); } else { int AllocateClass = _AllocateRoomManager.AllocateRooms(_AllocateRooms); if (AllocateClass > 0) { EnrollCourse _EnrollCourse = new EnrollCourse(); _EnrollCourse.DepartmentId = Convert.ToInt32(DepartmentDropDownList.SelectedValue); _EnrollCourse.CourseCode = CoursesDropDownList.SelectedValue; _EnrollCourse.ScheduleInfo = RoomsDropDownList.SelectedItem.ToString() + ", " + DayDropDownList.SelectedItem.ToString() + ", " + Convert.ToDateTime(_AllocateRooms.StartTime).ToString("HH : mm tt") + "-" + Convert.ToDateTime(_AllocateRooms.EndTime).ToString("HH : mm tt"); int UpdateClassSchedule = _AllocateRoomManager.UpdateClassScheduleInfo(_EnrollCourse); if (UpdateClassSchedule > 0) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Succssefully Allocate Class Room');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Room Allocate Update');", true); } } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Room Allocate');", true); } } } }
public List <AllocatedRooms> GetAllDays() { var _AllocateDaystList = new List <AllocatedRooms>(); string query = ("Select *From Days"); var reader = _MainRepository.Reader(query, _MainRepository.ConnectionString()); if (reader.HasRows) { while (reader.Read()) { var _AllocateRooms = new AllocatedRooms(); _AllocateRooms.DayId = Convert.ToInt32(reader["DayId"]); _AllocateRooms.DayName = reader["DayName"].ToString(); _AllocateDaystList.Add(_AllocateRooms); } } reader.Close(); return(_AllocateDaystList); }
public int AllocateRooms(AllocatedRooms _AllocateRooms) { return(_AllocateRoomsRepository.AllocateRooms(_AllocateRooms)); }
public decimal AlreadyReservedRoom(AllocatedRooms _AllocateRooms) { return(_AllocateRoomsRepository.AlreadyReservedRoom(_AllocateRooms)); }
public decimal AlreadyCourseAllocate(AllocatedRooms _AllocateRooms) { return(_AllocateRoomsRepository.AlreadyCourseAllocate(_AllocateRooms)); }
public int AllocateRooms(AllocatedRooms _AllocateRooms) { string query = "Insert Into AllocateClass(DepartmentId,CourseCode,RoomId,DayId,StartTime,EndTime,RoomStatus) Values ('" + _AllocateRooms.DepartmentId + "','" + _AllocateRooms.CourseCode + "','" + _AllocateRooms.RoomId + "','" + _AllocateRooms.DayId + "','" + _AllocateRooms.StartTime + "','" + _AllocateRooms.EndTime + "','Active')"; return(_MainRepository.ExecuteNonQuery(query, _MainRepository.ConnectionString())); }
public decimal AlreadyReservedRoom(AllocatedRooms _AllocateRooms) { string query = "Select Count(*)from AllocateClass where RoomId='" + _AllocateRooms.RoomId + "' And DayId='" + _AllocateRooms.DayId + "' And StartTime='" + _AllocateRooms.StartTime + "' And EndTime='" + _AllocateRooms.EndTime + "'"; return(_MainRepository.ExecuteScalar(query, _MainRepository.ConnectionString())); }
public decimal AlreadyCourseAllocate(AllocatedRooms _AllocateRooms) { string query = "Select Count(*)from AllocateClass where DepartmentId='" + _AllocateRooms.DepartmentId + "' And CourseCode='" + _AllocateRooms.CourseCode + "' And RoomId='" + _AllocateRooms.RoomId + "' And DayId='" + _AllocateRooms.DayId + "'"; return(_MainRepository.ExecuteScalar(query, _MainRepository.ConnectionString())); }