Example #1
0
        //绑定搜索到的教师数据
        protected void DataListBind()
        {
            DalOperationUsers dos = new DalOperationUsers();
            DataView dv = dos.SearchTeacher(txtKeyword.Text.Trim(), ddltTeacherType.SelectedValue).Tables[0].DefaultView;
            this.AspNetPager2.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="termTag"></param>
        /// <param name="searchKey"></param>
        /// <param name="teacherType"></param>
        /// <returns></returns>
        public DataSet getTeacherLoad(string termTag,string searchKey,string teacherType)
        {
            DataSet ds = new DataSet();
            DataTable datatable = new DataTable();
            DataSet normDs = GetFirstNorms(termTag);
            DataTable dt = normDs.Tables[0];
            int[] ids = new int[dt.Rows.Count];
            datatable.Columns.Add("教师");
            datatable.Columns.Add("硕士教学");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                datatable.Columns.Add(dt.Rows[i]["name"].ToString());
                ids[i] =  Convert.ToInt32( dt.Rows[i]["normId"]);
            }
            datatable.Columns.Add("合计");
            ds.Tables.Add(datatable);
            datatable.TableName = "工作汇总";
            DalOperationUsers daluser = new DalOperationUsers();

            DataTable teachers = daluser.SearchTeacher(searchKey, teacherType).Tables[0];
            DataTable normValues = GetNormValuesByTerm(termTag).Tables[0];
            for (int i = 0; i < teachers.Rows.Count; i++)
            {
                DataRow dr = datatable.NewRow();
                dr.SetField(datatable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
               DataRow[] shuoshirows =  normValues.Select("normId=-1 and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
               if (shuoshirows.Length == 0)
               {
                   dr.SetField(datatable.Columns[1], 0);
               }
               else
               {
                   dr.SetField(datatable.Columns[1], shuoshirows[0]["value"]);
               }
                for (int j = 2; j < datatable.Columns.Count - 1; j++)
                {
                    Object value = null;
                    DataRow[] rows = normValues.Select("normId=" + ids[j - 2] + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
                    if (GetNormType(ids[j - 2]) == 0)
                    {
                        if (rows.Length > 0)
                            value = rows[0]["value"];
                        float factValue = 0;
                        if (value != null)
                        {
                            factValue = float.Parse(value.ToString());
                        }
                        dr.SetField(datatable.Columns[j], factValue);
                    }
                    else
                    {
                        if (rows.Length > 0)
                        dr.SetField(datatable.Columns[j], rows[0]["textValue"]);
                    }

                }
                DataRow[] rootrow = normValues.Select("normId=" + 0 + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");

                object roots = null;
                if (rootrow.Length > 0)
                    roots = rootrow[0]["value"];
                float rootValue = 0;
                if (roots != null)
                {
                    rootValue = float.Parse(roots.ToString());
                }
                dr.SetField("合计", rootValue);
                datatable.Rows.Add(dr);
            }
            DataTable shuoshitable = new DataTable();
            shuoshitable.TableName = "硕士教学";
            shuoshitable.Columns.Add("教师");
            shuoshitable.Columns.Add("课程名称");
            shuoshitable.Columns.Add("学期");
            shuoshitable.Columns.Add("类型");
            shuoshitable.Columns.Add("理论课时");
            shuoshitable.Columns.Add("实验课时");
            DataTable shuoshinormChildValues = this.GetChildNorms(-1,termTag).Tables[0];

            for (int i = 0; i < shuoshinormChildValues.Rows.Count; i++)
            {
                shuoshitable.Columns.Add(shuoshinormChildValues.Rows[i]["name"].ToString());

            }
            for (int i = 0; i < teachers.Rows.Count; i++)
            {

                DataTable shuoshit = this.GetCourseStatistic(teachers.Rows[i]["teacherNo"].ToString().Trim(), termTag);
                for (int rownum = 0; rownum < shuoshit.Rows.Count; rownum++)
                {
                    DataRow dr = shuoshitable.NewRow();
                    dr.SetField(shuoshitable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
                    for (int col = 3; col < shuoshit.Columns.Count; col++)
                    {
                        dr.SetField(shuoshit.Columns[col].ColumnName, shuoshit.Rows[rownum][shuoshit.Columns[col]].ToString().Trim());
                    }
                    shuoshitable.Rows.Add(dr);

                }

            }
            ds.Tables.Add(shuoshitable);

            for (int ci = 0; ci < dt.Rows.Count; ci++)
            {
                DataTable childTable = new DataTable();
                childTable.TableName = dt.Rows[ci]["name"].ToString();
                DataTable normChildValues = this.GetChildNorms(int.Parse(dt.Rows[ci]["normId"].ToString()),termTag).Tables[0];
                int[] dids = new int[normChildValues.Rows.Count];
                childTable.Columns.Add("教师");
                for (int i = 0; i < normChildValues.Rows.Count; i++)
                {
                    childTable.Columns.Add(normChildValues.Rows[i]["name"].ToString());
                    dids[i] = Convert.ToInt32(normChildValues.Rows[i]["normId"]);
                }
                for (int i = 0; i < teachers.Rows.Count; i++)
                {
                    DataRow dr = childTable.NewRow();
                    dr.SetField(childTable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
                    for (int j = 1; j < childTable.Columns.Count; j++)
                    {
                        Object value = null;
                        DataRow[] rows = normValues.Select("normId=" + dids[j - 1] + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
                        if (GetNormType(dids[j - 1]) == 0)
                        {
                            if (rows.Length > 0)
                                value = rows[0]["value"];
                            float factValue = 0;
                            if (value != null)
                            {
                                factValue = float.Parse(value.ToString());
                            }
                            dr.SetField(childTable.Columns[j], factValue);
                        }
                        else
                        {
                            if (rows.Length > 0)
                                dr.SetField(childTable.Columns[j], rows[0]["textValue"]);
                        }
                    }
                    childTable.Rows.Add(dr);
                }

                ds.Tables.Add(childTable);
            }
            conn.Close();
            return ds;
        }
Example #3
0
        //绑定搜索到的教师数据
        protected void DataListBind()
        {
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }

            DalOperationUsers dos = new DalOperationUsers();
            DataView dv = dos.SearchTeacher(txtKeyword.Text.Trim(), ddltTeacherType.SelectedValue).Tables[0].DefaultView;

            this.AspNetPager2.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }