예제 #1
0
        public void GetOfferedCourses()
        {
            CourseManagementService cms    = new CourseManagementService();
            Result <List <Course> > result = cms.GetOfferedCourses();

            Console.WriteLine(result.message);
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsLoggedIn)
            {
                if (!IsPostBack)
                {
                    dpcSessionsCalendar.StartDate = DateTime.Today;
                    dpcSessionsCalendar.Days      = 7;


                    ICourseManagementService crsems        = new CourseManagementService();
                    Result <List <Course> >  serviceResult = null;
                    serviceResult = crsems.GetOfferedCourses();
                    /*To display list of courses in dropdown menu*/
                    if (serviceResult.isSuccess)
                    {
                        /*Data Source: Collection list*/
                        ddlCourses.DataSource     = serviceResult.resultObject;
                        ddlCourses.DataValueField = "ID";
                        ddlCourses.DataTextField  = "CourseName";
                        ddlCourses.DataBind();
                        ddlCourses.SelectedIndex = -1;
                    }


                    if (Request.Params.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(Request.Params["sid"]))
                        {
                            LoadSession(int.Parse(Request.Params["sid"]));
                        }
                        else if (!string.IsNullOrEmpty(Request.Params["c"]))
                        {
                            if (!string.IsNullOrEmpty(Request.Params["mxs"]))
                            {
                                if (!string.IsNullOrEmpty(Request.Params["d"]))
                                {
                                    ddlCourses.SelectedValue = Request.Params["c"];
                                    ddlCourses.Enabled       = false;
                                    txtDate.Text             = Request.Params["d"];
                                    txtDate.Enabled          = false;
                                    txtMaxNumber.Text        = Request.Params["mxs"];

                                    if (DateTime.Parse(txtDate.Text).CompareTo(DateTime.Now) < 0)
                                    {
                                        UrlUtility.Redirect(WebsitePages.Tutor.SESSION_MANAGEMENT);
                                    }
                                }
                            }
                        }
                    }
                    LoadSessions();
                }
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsLoggedIn)
            {
                if (!IsPostBack)
                {
                    /*Take data from result object (BL)*/
                    gvSearchResults.DataSource = null;
                    /* Combine the data I give you with the screen in its correct place */
                    gvSearchResults.DataBind();

                    anpTopPaging.AlwaysShow  = anpBottomPaging.AlwaysShow = true;
                    gvSearchResults.PageSize = anpTopPaging.PageSize = anpBottomPaging.PageSize = BL.Common.Models.Constants.DEFAULT_RESULTS_PAGE_SIZE;

                    ceRequestedSessionDate.StartDate = DateTime.Today.AddDays(BL.Common.Models.Constants.MIN_NUM_DAYS_REQUEST_SESSION);

                    //Get parameters from URL named 'q'
                    string query;
                    query = Request.QueryString.Get("q");
                    if (!string.IsNullOrEmpty(query))
                    {
                        txtSearchQuery.Text = query;

                        //Apply the logic of search
                        Search(query);
                    }

                    //Load all request statuses from backend
                    Result <List <string> > result = sms.GetAllPossibleStatuses();
                    if (result.isSuccess)
                    {
                        ddlStatus.DataSource = result.resultObject;
                        ddlStatus.DataBind();
                    }
                }

                ICourseManagementService crsems        = new CourseManagementService();
                Result <List <Course> >  serviceResult = null;
                serviceResult = crsems.GetOfferedCourses();
                /*To display list of courses in dropdown menu*/
                if (serviceResult.isSuccess)
                {
                    /*Data Source: Collection list*/
                    ddlCourses.DataSource     = serviceResult.resultObject;
                    ddlCourses.DataValueField = "ID";
                    ddlCourses.DataTextField  = "CourseName";
                    ddlCourses.DataBind();
                    ddlCourses.SelectedIndex = -1;
                }
            }
        }