예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtCount.Text = "0";
                JiaJiao.BLL.Teacher t = new BLL.Teacher();
                var ds = t.GetAllList();
                this.ddlTeacher.DataSource = ds.Tables[0];
                this.ddlTeacher.DataBind();

                JiaJiao.BLL.Class c = new BLL.Class();
                clist= c.GetModelList("");
               this.ddlDay.DataSource = clist.GroupBy(d => d.Day).Select(g => g.Key) ;
               this.ddlDay.DataBind();
               this.ddlTime.DataSource = clist.Where(d => d.Day == "周一");
               this.ddlTime.DataBind();
            }
        }
예제 #2
0
        private void GetDataForCombobox(HttpContext context)
        {
            var ds = new DataSet();
            var teaBll = new BLL.Teacher();
            ds = teaBll.GetAllList();

              //  [{"SUBITEM_VALUE":"1","SUBITEM_NAME":"男"},{"SUBITEM_VALUE":"2","SUBITEM_NAME":"女"}]

            if (ds != null && ds.Tables.Count > 0)
            {
                var str = new StringBuilder("[");
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    str.Append("{\"TeacherId\": \"" + row["TeacherId"] + "\",");
                    str.Append("\"TeacherName\": \"" + row["TeacherName"] + "\"},");
                }
                str.Remove(str.Length - 1, 1);
                str.Append("]");

                context.Response.Write(str.ToString());
            }

               // var str = JsonConvert.SerializeObject(new { total = ds.Tables[0].Rows.Count, rows = ds.Tables[0] });
        }
예제 #3
0
        private void ShowInfo(int ID)
        {
            JiaJiao.BLL.ClassSetting bll = new JiaJiao.BLL.ClassSetting();
            JiaJiao.Model.ClassSetting model = bll.GetModel(ID);
            this.lblID.Text = model.ID.ToString();

            this.txtTotal.Text = model.Total.ToString();
            this.txtCount.Text = model.Count.ToString();

            JiaJiao.BLL.Class bll1 = new BLL.Class();
            var classModel1 = bll1.GetModel(model.DayId.Value);
            JiaJiao.BLL.Teacher bll2 = new BLL.Teacher();
            var teacherModel2 = bll2.GetModel(model.TeacherId);

            JiaJiao.BLL.Teacher t = new BLL.Teacher();
            var ds = t.GetAllList();
            this.ddlTeacher.DataSource = ds.Tables[0];
            this.ddlTeacher.DataBind();
            ddlTeacher.SelectedValue = model.TeacherId.ToString();

            JiaJiao.BLL.Class c = new BLL.Class();
            var clist = c.GetModelList("");
            this.ddlDay.DataSource = clist.GroupBy(d => d.Day).Select(g => g.Key);
            this.ddlDay.DataBind();
            ddlDay.SelectedValue = classModel1.Day;

            this.ddlTime.DataSource = clist.Where(d => d.Day == classModel1.Day);
            this.ddlTime.DataBind();
        }