Esempio n. 1
0
        private void DataListBindSalaryItem()
        {
            DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
            List<SalaryItem> items = dal.GetAllSalaryItem();

            if (items != null)
            {
                this.SalaryItemPager.RecordCount = items.Count;
                SalaryItemPager.PageSize = CommonUtility.pageSize;

                PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
                pds.DataSource = items;
                pds.AllowPaging = true;

                pds.CurrentPageIndex = pageIndex - 1;
                pds.PageSize = SalaryItemPager.PageSize;

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

            }
            else
            {
                this.SalaryItemPager.RecordCount = 0;
            }

            if (SalaryItemPager.RecordCount > 0)
            {
                this.SalaryItemList.ShowFooter = false;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                string tid = Request["teacherNO"];
                string courseNo = Request["courseNo"];
                if (tid == null || tid.Trim().Length == 0)
                {

                    Javascript.Alert("请先选择教师后再进行此项操作", Page);
                    Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=1", Page);
                }
                else
                {
                    DalOperationAboutTeacher teacherDal = new DalOperationAboutTeacher();
                    TeachersList teacher = teacherDal.GetTeacherById(tid);
                    if (teacher == null)
                    {
                        Javascript.AlertAndRedirect("请先确定教师后再进行此项操作", "/Administrator.aspx?fragment=1", Page);
                    }
                    else {
                        this.teacherName.Text = teacher.teacherName;
                        this.teacherNo.Value = teacher.teacherNo;
                    }

                    int teacherType = 1;

                    if ("本院" == teacher.teacherType)
                    {
                        teacherType = 1;
                    }
                    else {
                        this.SelectCourse_Literal.Visible = true;
                        this.SelectCourse.Visible = true;
                        DalOperationAboutTeacher dalt = new DalOperationAboutTeacher();
                        DataTable dsTeacher = dalt.GetCoursesByTeacherAssistant(tid).Tables[0];
                        if (dsTeacher.Rows.Count == 0)
                        {
                            Javascript.Alert("该教师非院内教师并且本学期未待任何课程!", Page);
                            Javascript.RefreshParentWindowReload(Page);
                        }
                        else
                        {
                            DataBindTeacherSalaryCourse(dsTeacher, courseNo);

                            if (string.IsNullOrWhiteSpace(courseNo)) {
                                courseNo = this.SelectCourse.SelectedValue;
                            }

                            string[] courseInfo = courseNo.Split('-');
                            int atCourseType = 1;
                            if (courseInfo.Length > 1)
                            {
                                atCourseType = int.Parse(courseInfo[1].Trim());
                            }
                            teacherType = CommonUtility.CheckTeacherType(teacher.teacherType, atCourseType);
                        }
                    }

                    this.TeacherType_Literal.Text = CommonUtility.ConvertTeacherType2String(teacherType);

                    this.teacherType.Value = teacherType.ToString();

                    DalOperationAboutSalaryItem dalsi = new DalOperationAboutSalaryItem();
                    List<SalaryItem> salaryItems = dalsi.GetAllSalaryItem(teacherType, 1);

                    this.TeacherInSalaryItemList.DataSource = salaryItems;
                    this.TeacherInSalaryItemList.DataBind();

                    this.TeacherOutSalaryItemList.DataSource = salaryItems;
                    this.TeacherOutSalaryItemList.DataBind();
                }
            }
        }
        private List<SalaryItem> GetSalaryItem(int useFor)
        {
            DalOperationAboutSalaryItem dalsi = new DalOperationAboutSalaryItem();
            List<SalaryItem> salaryItems = dalsi.GetAllSalaryItem(useFor, 0);

            return salaryItems;
        }