protected void btnSumitCourseInfo_Click(object sender, EventArgs e) { int hours = int.Parse(txtCourseWklyHours.Text); Course course = new Course(txtCourseNumber.Text, txtCourseName.Text, hours); CourseDataAccess.AddNewCourse(course); }
public CourseListPresenter(ICourseList view, CourseDataAccess model) { this.view = view; this.model = model; this.view.searchHandler += Search; LoadAllCourses(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && Request.QueryString["CourseID"] != null) { long lngCourseID; if (long.TryParse(Request.QueryString["CourseID"], out lngCourseID)) { if (Request.QueryString["fname"] != null) { string strDeletedFirstName = Request.QueryString["fname"]; string strDeletedLastName = Request.QueryString["lname"]; uiLblDeletedAlert.Text = strDeletedFirstName + " " + strDeletedLastName + " has been deleted <br /><br />"; uiLblDeletedAlert.Visible = true; } PopulateAttendeeList(lngCourseID); CourseDataAccess objCourseDAL = new CourseDataAccess(); Course selectedCourse = objCourseDAL.GetCoursesDetailsByID(lngCourseID); if (selectedCourse != null) { uiLblCourseName.Text = selectedCourse.Title; } } } }
/// <summary> /// Used to populate course information into UI. It get a course id from query string /// which detail information needed. Return none. /// </summary> private void populateCourseInfo() { long courseID = 0; if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null) { try { //get the course id from query string courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]); //get course detail by courseid and providerid CourseDataAccess courseDAL = new CourseDataAccess(); Course course = courseDAL.GetCoursesDetailsByID(courseID); // Get Courses Details from Course ID and Provider ID if (course == null || course.ID < 1) { lblMsg.Text = LACESConstant.Messages.COURSE_NOT_FOUND_IN_ADMIN; return; } Label lblMasterCourseName = (Label)Master.FindControl("lblCourseName"); lblMasterCourseName.Text = "Selected Course: <a href='CourseDetails.aspx?" + LACESConstant.QueryString.COURSE_ID + "=" + Server.HtmlEncode(course.ID.ToString()) + "'>" + Server.HtmlEncode(course.Title) + "</a>"; lblMasterCourseName.Attributes.Add("onclick", "javascript:return CheckChange(2,-1)"); } catch (Exception ex) { } } }
/// <summary> /// Page Load Event Handler, call every time when the page is loaded. /// </summary> /// <param name="sender">sender object</param> /// <param name="e">EventArgs</param> protected void Page_Load(object sender, EventArgs e) { //set focus the default text box txtLastName.Focus(); //get the master page form tag and set default button HtmlForm masterHtmlForm = (HtmlForm)Master.FindControl("form1"); masterHtmlForm.DefaultButton = btnSaveFinish.UniqueID; if (!IsPostBack) { try { //check the parent url if (Request.UrlReferrer != null) { //save the parent url so we can redirect when operation in current page successfull referalURL = Request.UrlReferrer.AbsoluteUri; } long courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]); CourseDataAccess oCourseDataAccess = new CourseDataAccess(); title.InnerHtml = "Edit Attendee for: " + Server.HtmlEncode(oCourseDataAccess.GetCoursesDetailsByID(courseID).Title); //load Attendees information into the UI controls LoadParticipant(); } catch (Exception ex) { throw ex; } } }
/// <summary> /// Populate course details in the UI. Get course id from query string. /// </summary> /// <returns>True if any course not found provider, otherwise false</returns> private bool populateCourseInfo() { long courseID = 0; if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null) { try { //get the course id from query string courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]); //get course detail by courseid and providerid CourseDataAccess courseDAL = new CourseDataAccess(); Course course = courseDAL.GetCoursesDetailsByID(courseID); // Get Courses Details from Course ID and Provider ID if (course == null || course.ID < 1) { lblMsg.Text = LACESConstant.Messages.COURSE_NOT_FOUND_IN_ADMIN; lblMsg.ForeColor = System.Drawing.Color.Red; txtLastName.Text = ""; txtFirstName.Text = ""; txtASLA.Text = ""; txtCLARB.Text = ""; txtFL.Text = ""; return(false); } divRightMessage.InnerHtml = "Use this page to edit an attendees who attended the " + Server.HtmlEncode(course.Title) + " course. Removing an attendees from the course is a permanent action, and can not be undone."; } catch (Exception ex) { } } return(true); }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!IsPostBack) { List <Course> courses = CourseDataAccess.RetrieveAllCourses(); List <CourseOffering> coursesOffering = CourseOfferingDataAccess.RetrieveAllCoursesOffering(); if (courses.Count == 0) { Response.Redirect("AddCourse.aspx"); } else { courses.Sort((c1, c2) => c1.CourseName.CompareTo(c2.CourseName)); foreach (Course course in courses) { drpCourseOfferingList.Items.Add(new ListItem(course.ToString(), course.courseNumber)); } drpOfferInYr.Items.Add(new ListItem("2016")); drpOfferInYr.Items.Add(new ListItem("2017")); drpOfferInYr.Items.Add(new ListItem("2018")); drpOfferInYr.Items.Add(new ListItem("2019")); drpOfferInYr.Items.Add(new ListItem("2020")); drpSemester.Items.Add(new ListItem(Semester.Fall)); drpSemester.Items.Add(new ListItem(Semester.Winter)); drpSemester.Items.Add(new ListItem(Semester.Spring_Summer)); } //drpSemester.Items.Add(lblSemest.Fall); //drpSemester.Items.Add(lblSemest.Winter); //drpSemester.Items.Add(lblSemest.SpringSummer); } }
protected void Page_Load(object sender, EventArgs e) { ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; if (provider != null) { string stritemsperpage = Request.QueryString["itemsperpage"] != null ? Request.QueryString["itemsperpage"] : "99999"; int itemsPerPage = 99999; if (int.TryParse(stritemsperpage, out itemsPerPage)) { } string strpage = Request.QueryString["page"] != null ? Request.QueryString["page"] : "1"; int page = 1; if (int.TryParse(strpage, out page)) { } string strKeyword = Request.QueryString["keyword"] != null ? Request.QueryString["keyword"] : ""; string strEndDate = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : ""; string strStartDate = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : ""; string strState = Request.QueryString["state"] != null ? Request.QueryString["state"] : ""; string strStatus = Request.QueryString["status"] != null ? Request.QueryString["status"] : ""; string strSubject = Request.QueryString["subject"] != null ? Request.QueryString["subject"] : ""; int totalCount = 0; CourseDataAccess objCourseDAL = new CourseDataAccess(); IList <Course> courseResult = new List <Course>(); courseResult = objCourseDAL.GetPagedCourseBySearchByProvider(strStartDate, strEndDate, strKeyword, 1, 99999, strStatus, provider.ID, strSubject, strState, ref totalCount); Response.Write(courseResult.Count.ToString()); } }
/// <summary> /// Call every time when click on the open close link button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnActive_OnClick(object sender, EventArgs e) { LinkButton openCloseButton = sender as LinkButton; try { long courseID = Convert.ToInt32(openCloseButton.CommandArgument); string status = openCloseButton.CommandName; CourseDataAccess oCourseDataAccess = new CourseDataAccess(); if (status == "T") { oCourseDataAccess.ChangeCourseActive(courseID, "F"); } else if (status == "F") { oCourseDataAccess.ChangeCourseActive(courseID, "T"); } } catch { } Response.Redirect(Request.Url.AbsoluteUri); }
protected void FilterCoursesBind(string strStartDate, string strEndDate, string strKeyword, string strState, string strSubject, string strStatus, string strProviderList, string courseType) { try { int totalCount = 0; ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; CourseDataAccess objCourseDAL = new CourseDataAccess(); IList <Course> courseResult = new List <Course>(); courseResult = objCourseDAL.GetPagedCourseBySearchAdmin(strStartDate, strEndDate, strKeyword, 0, 10000, strStatus, strProviderList, strSubject, strState, courseType, ref totalCount); if (courseResult.Count < 1) { dlCourseList.Visible = false; NoResult.Visible = true; } else { dlCourseList.DataSource = courseResult; dlCourseList.DataBind(); dlCourseList.Visible = true; NoResult.Visible = false; } } catch (Exception ex) { } }
/// <summary> /// Used to populate course information into UI. It get a course id from query string /// which detail information needed. Return none. /// </summary> private void populateCourseInfo() { long courseID = 0; if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null) { try { //get the course id from query string courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]); //get course detail by courseid and providerid ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session CourseDataAccess courseDAL = new CourseDataAccess(); Course course = courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID); // Get Courses Details from Course ID and Provider ID if (course == null || course.ID < 1) { //btnSaveAddMore.Enabled = false; //btnSaveFinish.Enabled = false; lblMsg.Text = LACESConstant.Messages.COURSE_NOT_FOUND_IN_PROVIDER; // dvParticipantList.Visible = false; return; } Label lblMasterCourseName = (Label)Master.FindControl("lblCourseName"); lblMasterCourseName.Text = "Selected Course: <a href='CourseDetails.aspx?" + LACESConstant.QueryString.COURSE_ID + "=" + Server.HtmlEncode(course.ID.ToString()) + "'>" + Server.HtmlEncode(course.Title) + "</a>"; lblMasterCourseName.Attributes.Add("onclick", "javascript:return CheckChange(2,-1)"); } catch (Exception ex) { } } }
/// <summary> /// Load all cources in the UI /// </summary> private void LoadAllCourses() { //create the coures data access CourseDataAccess objCourseDAL = new CourseDataAccess(); //get the current provider Provider1 provider = (Provider1)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; existingCourcesDiv.InnerHtml = "<div class='dvHeader2'>Existing Cources</div>"; existingCourcesDiv.InnerHtml += "<div class='existingCources'>"; IList <Course> cources = objCourseDAL.GetCoursesByProviderId(provider.ID, "T"); foreach (Course c in cources) { existingCourcesDiv.InnerHtml += "<a href=UploadParticipants.aspx?courseid=" + c.ID + ">" + c.Title + "</a><br/>"; } existingCourcesDiv.InnerHtml += "</div>"; if (cources.Count <= 0) { existingCourcesDiv.Visible = false; } else { existingCourcesDiv.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; if (provider != null) { string courseTitle = Request.QueryString["title"] != null ? Request.QueryString["title"] : ""; string StartDate = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : ""; string EndDate = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : ""; string Location = Request.QueryString["location"] != null ? Request.QueryString["location"] : ""; string FirstName = Request.QueryString["first"] != null ? Request.QueryString["first"] : ""; string LastName = Request.QueryString["last"] != null ? Request.QueryString["last"] : ""; string Email = Request.QueryString["email"] != null ? Request.QueryString["email"] : ""; string strOrderBy; if (Request.QueryString["Sort"] != null && Request.QueryString["Sort"].Length > 0) { strOrderBy = Request.QueryString["Sort"].ToString(); } else { strOrderBy = "S"; } //create the coures data access CourseDataAccess objCourseDAL = new CourseDataAccess(); //get the current provider IList <Course> courses; if (FirstName.Length == 0 && LastName.Length == 0 && Email.Length == 0) { courses = objCourseDAL.GetCoursesByProviderId(provider.ID, strOrderBy); } else { courses = objCourseDAL.GetCoursesByProviderIdAndAttendee(provider.ID, strOrderBy, FirstName, LastName, Email); } if (courseTitle.Length > 0) { courses = courses.Where(x => x.Title.ToLower().Contains(courseTitle.ToLower())).ToList(); } if (StartDate.Length > 0) { DateTime dtStartDate = new DateTime(); if (DateTime.TryParse(StartDate, out dtStartDate)) { courses = courses.Where(x => x.StartDate >= dtStartDate && x.EndDate >= dtStartDate).ToList(); } } if (EndDate.Length > 0) { DateTime dtEndDate = new DateTime(); if (DateTime.TryParse(EndDate, out dtEndDate)) { courses = courses.Where(x => x.EndDate < dtEndDate).ToList(); } } Response.Write(courses.Count.ToString()); } }
/// <summary> /// Page load event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { CourseDataAccess objCourseDAL = new CourseDataAccess(); string sSortColumn = string.Empty; string sSortOrder = string.Empty; //If found PARTICIPANT ID as query sting then display the participant info if (Request.QueryString[LACESConstant.QueryString.PARTICIPANT_ID] != null) { ///Check Sort Column Query String if (Request.QueryString[LACESConstant.QueryString.SORT_COLUMN] != null) { sSortColumn = Request.QueryString[LACESConstant.QueryString.SORT_COLUMN].ToString(); } else { sSortColumn = "DateEntered"; // by default sort by DateEntered column } ///Check Sort Order Query String if (Request.QueryString[LACESConstant.QueryString.SORT_ORDER] != null) { sSortOrder = Request.QueryString[LACESConstant.QueryString.SORT_ORDER].ToString(); } else { sSortOrder = "asc"; // by default sort in ascending order } //Create Header row //createHeaderRow(sSortColumn, sSortOrder); //Adjust left/right content place holder width IncreaseLeftContentWidth(); //System.Diagnostics.Debugger.Break(); ///Get Search result courseResult = objCourseDAL.GetParticipantCourses(Convert.ToInt32(Request.QueryString[LACESConstant.QueryString.PARTICIPANT_ID].ToString()), sSortColumn, sSortOrder); //Display participant information ParticipantDataAccess partDAC = new ParticipantDataAccess(); Participant objPart = partDAC.GetParticipantByID(Convert.ToInt32(Request.QueryString[LACESConstant.QueryString.PARTICIPANT_ID].ToString())); if (objPart != null) { lblPartLastName.Text = Server.HtmlEncode(objPart.LastName); lblPartFirstName.Text = Server.HtmlEncode(objPart.FirstName); lblPartASLA.Text = Server.HtmlEncode(objPart.ASLANumber); lblPartCLARB.Text = Server.HtmlEncode(objPart.CLARBNumber); lblPartFL.Text = Server.HtmlEncode(objPart.FloridaStateNumber); lblMiddleName.Text = Server.HtmlEncode(objPart.MiddleInitial); lblCSLA.Text = Server.HtmlEncode(objPart.CSLANumber); //if no course found then display 0 as number of courses lblPartCourses.Text = courseResult != null && courseResult.Count > 0 ? courseResult.Count.ToString() : "0"; } } }
/// <summary> /// Returns a list of Submission assignments /// </summary> /// <param name="id">Course ID for the class</param> /// <param name="a">Authentication Key for the Course to access the assignment</param> /// <returns></returns> public List <SubmisionAssignment> GetAssignmentsForCourse(int id, string a) { if ((new Authentication()).IsValidKey(a)) { return(CourseDataAccess.GetAssignmentsForCourse(id, DateTime.UtcNow)); } return(null); }
protected void Page_PreRender(object sender, EventArgs ev) { txtCourseName.Text = ""; txtCourseNumber.Text = ""; txtCourseWklyHours.Text = ""; List <Course> courses = CourseDataAccess.RetrieveAllCourses(); ShowCourseInfo(courses); }
static void Main(string[] args) { try { CourseDataAccess rep = new CourseDataAccess(); Course c = new Course(); c.NumberOfLessons = 1; c.Language = LanguageTypes.French; c.Level = LevelTypes.A1Beginer; c.StatusActive = false; c.Category = CategoryTypes.Adults; c.Description = "Curs franceza"; Console.WriteLine("Add: " + rep.Add(c)); Console.WriteLine("Save-add: " + rep.Save(c)); Course c1 = new Course(); c1.Id = 3; c1.NumberOfLessons = 1; c1.Language = LanguageTypes.French; c1.Level = LevelTypes.A1Beginer; c1.StatusActive = false; c1.Category = CategoryTypes.Children; c1.Description = "Curs Franceza"; Console.WriteLine("Update: " + rep.Update(c1.Id, c1)); // rep.Delete(c); var rez = rep.GetAll(); foreach (var item in rez) { Console.WriteLine(rep.GetString(item)); } //Console.WriteLine(rep.ToString(rez)); var rez2 = rep.GetById(2); Console.WriteLine($"Get by Id 2 {rep.GetString(rez2)}"); Console.ReadLine(); } catch (SqlException e) { Console.WriteLine(e.StackTrace); } //catch(System.InvalidCastException e) //{ // Console.WriteLine(e.StackTrace); //} catch (ArgumentException e) { Console.WriteLine(e.StackTrace); } finally { Console.ReadLine(); } Console.WriteLine("abc"); }
protected void Page_Load(object sender, EventArgs e) { ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; if (provider != null) { string stritemsperpage = Request.QueryString["itemsperpage"] != null ? Request.QueryString["itemsperpage"] : "99999"; int itemsPerPage = 99999; if (int.TryParse(stritemsperpage, out itemsPerPage)) { } string strpage = Request.QueryString["page"] != null ? Request.QueryString["page"] : "1"; int page = 1; if (int.TryParse(strpage, out page)) { } string strKeyword = Request.QueryString["keyword"] != null ? Request.QueryString["keyword"] : ""; string strEndDate = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : ""; string strStartDate = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : ""; string strState = Request.QueryString["state"] != null ? Request.QueryString["state"] : ""; string strStatus = Request.QueryString["status"] != null ? Request.QueryString["status"] : ""; string strSubject = Request.QueryString["subject"] != null ? Request.QueryString["subject"] : ""; int totalCount = 0; CourseDataAccess objCourseDAL = new CourseDataAccess(); IList <Course> courseResult = new List <Course>(); courseResult = objCourseDAL.GetPagedCourseBySearchByProvider(strStartDate, strEndDate, strKeyword, 1, 99999, strStatus, provider.ID, strSubject, strState, ref totalCount); uiHdnResultCount.Value = courseResult.Count.ToString(); if (courseResult.Count < 1) { dlCourseList.Visible = false; NoResult.Visible = true; } else { int pageBegin = 0; if (page > 1) { pageBegin = (itemsPerPage * page) - itemsPerPage; } dlCourseList.Visible = true; NoResult.Visible = false; if (itemsPerPage < 999) { dlCourseList.DataSource = courseResult.Skip(pageBegin).Take(itemsPerPage); } else { dlCourseList.DataSource = courseResult; } dlCourseList.DataBind(); } } }
protected void btnAddCourseOffering_Click(object sender, EventArgs e) { string courseId = drpCourseOfferingList.SelectedValue; int year = int.Parse(drpOfferInYr.SelectedValue); string semester = drpSemester.SelectedValue; Course course = CourseDataAccess.RetrieveCourseByCourseId(courseId); CourseOffering courseOffering = new CourseOffering(course, year, semester); CourseOfferingDataAccess.AddNewCourseOffering(courseOffering); }
/// <summary> /// Get's the last submit date for an assignment /// </summary> /// <param name="id">Course ID for the class</param> /// <param name="a">Authentication Key for the Course to access the assignment</param> /// <returns></returns> public DateTime?GetLastSubmitDateForAssignment(int id, string a) { var auth = new Authentication(); if (auth.IsValidKey(a)) { return(CourseDataAccess.GetLastSubmitDateForAssignment(id, (auth.GetActiveUserId(a)))); } return(null); }
public CourseEntity CourseEntityConversion() { ICourseDataAccess courseDataAccess = new CourseDataAccess(); return(new CourseEntity { Id = this.Id, Name = this.Name, UserId = this.UserId }); }
protected void Page_Load(object sender, EventArgs e) { CourseDataAccess oCourseDataAccess = new CourseDataAccess(); if (Request.QueryString["id"] != null) { long courseID = long.Parse(Request.QueryString["id"].ToString()); oCourseDataAccess.ChangeCourseActive(courseID, "F"); } Response.Redirect("CourseResult.aspx"); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ICourseDataAccess courseDataAccess = new CourseDataAccess(); ICourseBusiness courseBusiness = new CourseBusiness(courseDataAccess); IDepartmentDataAccess departmentDataAccess = new DepartmentDataAccess(); IDepartmentBusiness departmentBusiness = new DepartmentBusiness(departmentDataAccess); ICourseViewModel courseViewModel = new CourseViewModel(courseBusiness, departmentBusiness); Application.Run(new CourseRead(courseViewModel)); }
protected void drpCourseOfferingList_SelectedIndexChanged(object sender, EventArgs e) { if (drpCourseOfferingList.SelectedIndex != 0) { string courseId = drpCourseOfferingList.SelectedItem.Value; Course course = CourseDataAccess.RetrieveCourseByCourseId(courseId); lblCourseOfferingDisplay.Text = courseId; } else { lblCourseOfferingDisplay.Text = string.Empty; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string courseNumber = txtCourseNumber.Text; string courseName = txtCourseName.Text; string stringCourseHours = txtCourseHours.Text; int courseHours = Int32.Parse(stringCourseHours); userCourse = new Course(courseNumber, courseName, courseHours); CourseDataAccess.addNewCourse(userCourse); txtCourseNumber.Text = ""; txtCourseName.Text = ""; txtCourseHours.Text = ""; }
protected void btnSubmit_Click(object sender, EventArgs e) { List <Course> userCourse = CourseDataAccess.retreiveAllCourses(); userCourse.Sort(sortBy); string offeredSemester = ddlSemester.SelectedValue; int offeredYear = Int32.Parse(ddlOfferYear.SelectedValue); int courseIndex = ddlCourses.SelectedIndex - 1; CourseOffering coursesOffered = new CourseOffering(userCourse[courseIndex], offeredYear, offeredSemester); CourseOfferingsDataAccess.addNewCourseOffering(coursesOffered); }
/// <summary> /// Get course details information if any course found otherwise null /// </summary> /// <returns>course object</returns> private Course getCourseInfo() { try { //get course detail by courseid and providerid //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; // Get provider information from Session ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session CourseDataAccess courseDAL = new CourseDataAccess(); return(courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID)); // Get Courses Details from Course ID and Provider ID } catch (Exception ex) { throw ex; } }
protected void Search(object sender, EventArgs e) { IList <Course> courseResult = new List <Course>(); SearchCourse objSearchCourse = buildSearchCriteria(); int itemIndex = 0; int totalCount = 0; string strStartDate = txtStartDate.Text; string strEndDate = txtEndDate.Text; string strSearchTerm = txtKeyword.Text; CourseDataAccess objCourseDAL = new CourseDataAccess(); try { courseResult = objCourseDAL.GetPagedCourseBySearch(strStartDate, strEndDate, strSearchTerm, 1, 250, "", ref totalCount); string resultsNumber = courseResult.Count.ToString(); existingCourcesDiv.InnerHtml = "<div class='title'>Upload or Edit Attendees</div>"; existingCourcesDiv.InnerHtml += "<div class='existingCources'>"; existingCourcesDiv.InnerHtml += "<table cellpadding='0' width='100%'><tr><td class='TableHeader' width='37%'>Course Title</td><td class='TableHeader' width='11%'>Start Date</td><td class='TableHeader' width='10%'>End Date</td><td class='TableHeader' width='27%'>Upload Attendees in Excel</td><td class='TableHeader' width='15%'>Edit Attendees</td></tr>"; existingCourcesDiv.InnerHtml += "<tbody id='course_list'>"; foreach (Course c in courseResult) { existingCourcesDiv.InnerHtml += "<tr><td class='grayText'><a href=CourseDetails.aspx?courseid=" + c.ID + ">" + Server.HtmlEncode(c.Title) + "</a></td>"; existingCourcesDiv.InnerHtml += "<td class='grayText'>" + c.StartDate.ToShortDateString() + "</td>"; existingCourcesDiv.InnerHtml += "<td class='grayText'>" + c.EndDate.ToShortDateString() + "</td>"; existingCourcesDiv.InnerHtml += "<td align='center'><a href=UploadAttendees.aspx?courseid=" + c.ID + ">Upload</a></td>"; existingCourcesDiv.InnerHtml += "<td align='center'><a href=EditAllCourseAttendees.aspx?CourseID=" + c.ID + ">Edit</a></td></tr>"; } existingCourcesDiv.InnerHtml += "</tbody>"; existingCourcesDiv.InnerHtml += "</table>"; existingCourcesDiv.InnerHtml += "<div class='page_navigation'></div>"; existingCourcesDiv.InnerHtml += "</div>"; if (courseResult.Count <= 0) { existingCourcesDiv.Visible = false; } else { existingCourcesDiv.Visible = true; } // uiLitResultsMessage.Text = "Search Results: " + resultsNumber + " out of " + totalCount.ToString() + " results"; } catch (Exception ex) { } }
/// <summary> /// Page load event handler /// Loads the course name based on course id /// Generates the redirect URL /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { long courseID = 0; string courseName = ""; //If CourseId is defined in URL if (Request.QueryString["CourseID"] != null) { try { courseID = Convert.ToInt64(Request.QueryString["CourseID"]); } catch (Exception ex) { throw ex; } //Get course information by courseId //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; // Get provider information from Session ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session CourseDataAccess courseDAL = new CourseDataAccess(); Course course = courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID); // Get Courses Details from Course ID and Provider ID //Generate linked course name to display courseName = "<a href=\"CourseDetails.aspx?CourseID=" + courseID + "\">" + Server.HtmlEncode(course.Title) + "</a>"; } else//If courseId is not defined in URL, display None { courseName = "<i>None</i>"; } //System.Diagnostics.Debugger.Break(); //Set value for the lblCourseName control of master page Label lblCourseName = (Label)Master.FindControl("lblCourseName"); if (lblCourseName != null) { lblCourseName.Text = "Selected Course: " + courseName; } } lblMessage.Text = ""; lblMessage.Visible = false; message = ""; txtCodeType.Focus(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string courseNumber = txtCourseNumber.Text; string courseName = txtCourseName.Text; string stringCourseHours = txtCourseHours.Text; int offeredYear = Int32.Parse(ddlYear.SelectedValue); string offeredSemester = ddlSemester.SelectedValue; int courseHours = Int32.Parse(stringCourseHours); userCourse = new Course(courseNumber, courseName, courseHours); CourseDataAccess.addNewCourse(userCourse); coursesOffered = new CourseOffering(userCourse, offeredYear, offeredSemester); CourseOfferingsDataAccess.addNewCourseOffering(coursesOffered); Response.Redirect(Request.RawUrl); }