Ejemplo n.º 1
0
		public TermPage (Term term)
		{
			InitializeComponent ();
            termValue = term;
            ViewModelTermPage viewModel = new ViewModelTermPage(term);
            BindingContext = viewModel;

            CourseListView.IsPullToRefreshEnabled = true;
            CourseListView.SetBinding(ListView.IsRefreshingProperty, nameof(viewModel.IsBusy));
		}
Ejemplo n.º 2
0
    protected void choosecoursesub_Click(object sender, EventArgs e)
    {
        int           kcdh   = Int32.Parse((sender as Button).CommandArgument.ToString());
        string        check  = "select * from tb_study,tb_course where tb_study.xh ='" + Session["student"] + "' and tb_study.kcdh = tb_course.kcdh and tb_study.pass='******'";
        SqlConnection conn   = DBCon.getConnection();
        SqlCommand    com    = new SqlCommand(check, conn);
        SqlDataReader result = null;

        try
        {
            conn.Open();
            result = com.ExecuteReader();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }
        int xfsum = 0;

        while (result.Read())
        {
            if (Convert.ToInt32(result["kcdh"]) == kcdh)
            {
                ScriptManager.RegisterStartupScript(this.choosecourse_panel, this.GetType(), "updateScript", "alert('你已经选修了该课程,不能再选!')", true);
                return;
            }
            xfsum += Convert.ToInt32(result["xf"]);
        }
        DBCon.CloseAll(conn, com);
        if (xfsum > 20)
        {
            Response.Write(xfsum);
            ScriptManager.RegisterStartupScript(this.choosecourse_panel, this.GetType(), "updateScript", "alert('你已经选修够20学分,不能再选课!')", true);
            return;
        }

        string sql = "insert into tb_study (xh,kcdh) values('" + Session["student"] + "','" + kcdh + "')";

        try
        {
            DBControl.update(sql);
            ScriptManager.RegisterStartupScript(this.choosecourse_panel, this.GetType(), "updateScript", "alert('选课成功!')", true);
            CourseListView.DataSource = null;
            CourseListView.DataBind();
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.choosecourse_panel, this.GetType(), "updateScript", "alert('选课失败!')", true);
        }
    }
Ejemplo n.º 3
0
        void SearchCourse(object sender, TextChangedEventArgs e)
        {
            var _context = BindingContext as CourseViewModel;

            CourseListView.BeginRefresh();

            if (string.IsNullOrWhiteSpace(e.NewTextValue))
            {
                CourseListView.ItemsSource = _context.AllCourses;
            }
            else
            {
                CourseListView.ItemsSource = _context.AllCourses.Where(i => i.courseName.Contains(e.NewTextValue));
            }

            CourseListView.EndRefresh();
        }
Ejemplo n.º 4
0
 public void Init(GameObject go)
 {
     panelObejct    = go;
     controlPanel   = go.GetComponent <UIPanel>();
     setPanelObject = panelObejct.transform.Find("settingPanel").gameObject;
     settingPanel   = setPanelObject.AddComponent <SettingPanelView>();
     settingPanel.InitPanel(setPanelObject);
     navBarObject = panelObejct.transform.Find("navBar").gameObject;
     navBar       = navBarObject.AddComponent <NavBarView>();
     navBar.Init(navBarObject);
     if (panelObejct.transform.Find("courseListView"))
     {
         courseObject   = panelObejct.transform.Find("courseListView").gameObject;
         courseListView = courseObject.AddComponent <CourseListView>();
         courseListView.Init(courseObject);
     }
 }