Exemplo n.º 1
0
        protected void AddSalary_Submit(object sender, EventArgs e)
        {
            DalOperationAboutSalaryEntry dal = new DalOperationAboutSalaryEntry();
            DalOperationAboutTeacher dalt = new DalOperationAboutTeacher();
            DalOperationAboutCourses dalc = new DalOperationAboutCourses();

            string teacherNo = this.TeacherId.Value;
            string termTag = this.SalaryTermTag.SelectedValue;
            string salaryMonth = this.SalaryMonth.Value;
            int teacherType = int.Parse(this.teacherType.Value.Trim());
            int salaryEntryStatus = 0;

            List<SalaryEntry> salaryEntries = dal.GetSalaryEntrys(teacherNo, termTag, salaryMonth, teacherType, salaryEntryStatus);
            if (salaryEntries != null && salaryEntries.Count != 0)
            {
                Javascript.Alert("本月已为该教师添加过薪酬信息,请核对信息后再次录入!", Page);
            }
            else {
                SalaryEntry salaryEntry = new SalaryEntry();

                TeachersList teacher = new TeachersList
                {
                    teacherNo = teacherNo
                };

                Courses course = new Courses
                {
                    courseNo = this.CourseId.Value
                };

                salaryEntry.teacher = teacher;
                salaryEntry.course = course;
                salaryEntry.atCourseType = atCourseType.Value;
                salaryEntry.termTag = termTag;
                salaryEntry.salaryMonth = salaryMonth;
                salaryEntry.teacherCostWithTax = float.Parse(this.TeacherSalaryCostWithTax.Text);
                salaryEntry.teacherCostWithoutTax = float.Parse(this.TeacherSalaryCostWithoutTax.Text);
                salaryEntry.teacherTotalCost = float.Parse(this.TeacherTotalCost.Text);

                salaryEntry.SetSalaryInItemValueList(this.InSalaryItemValueList.Value, false);
                salaryEntry.SetSalaryOutItemValueList(this.OutSalaryItemValueList.Value, false);
                salaryEntry.memo = this.SalaryEntryMemo.Text.Trim();
                salaryEntry.teacherType = teacherType;

                dal.AddSalaryEntry(salaryEntry);
                Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=5", Page);
            }
        }
Exemplo n.º 2
0
        protected void DataListBindSalaryEntry(string teacherNo)
        {
            DalOperationAboutSalaryEntry dal = new DalOperationAboutSalaryEntry();

            string termTag = Request["termTag"];
            DataBindSearchTermTagList(this.SalaryQuery_TermTag.Items, termTag);
            if (termTag == null || termTag.Trim().Length == 0)
            {
                termTag = this.SalaryQuery_TermTag.SelectedValue;
            }
            else if (termTag.Trim() == "all") {
                termTag = null;
            }

            string salaryMonth = Request["salaryMonth"] != null && Request["salaryMonth"].Trim().Length > 0 ? Request["salaryMonth"].Trim() : null;
            this.SalaryQuery_SalaryMonth.Value = salaryMonth;

            List<SalaryEntry> salaryEntries = new List<SalaryEntry>();

            salaryEntries = dal.GetSalaryEntrys(teacherNo, termTag, salaryMonth, 0, 4); //salaryEntryStatus=4:只看到已发放的

            if (salaryEntries != null)
            {
                this.SalaryEntryPager.RecordCount = salaryEntries.Count;
                SalaryEntryPager.PageSize = CommonUtility.pageSize;

                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = salaryEntries;
                pds.AllowPaging = true;

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

                this.SalaryEntryList.DataSource = pds;
                this.SalaryEntryList.DataBind();
            }
            else
            {
                this.SalaryEntryPager.RecordCount = 0;
            }

            if (SalaryEntryPager.RecordCount > 0)
            {
                this.SalaryEntryList.ShowFooter = false;
            }
        }
Exemplo n.º 3
0
        protected void DataListBindSalaryEntry()
        {
            DalOperationAboutSalaryEntry dal = new DalOperationAboutSalaryEntry();
            string teacherNo = null;
            string teacherName = Request["teacherName"];
            this.SalaryQuery_Name.Text = teacherName;
            if (teacherName != null && teacherName.Trim().Length > 0)
            {
                teacherNo = SearchTeacherIds(teacherName.Trim());

            }
            else
            {
                teacherName = null;
            }
            string termTag = Request["termTag"];
            string teacherType = Request["teacherType"];
            string salaryEntryStatus = Request["status"];
            DataBindSearchTermTagList(this.SalaryQuery_TermTag.Items, termTag);
            DataBindTeacherTypeList(this.SalaryQuery_TeacherType.Items, teacherType);
            DataBindSalaryStatus(this.SalaryQuery_SalaryEntryStatus.Items, salaryEntryStatus);

            if (termTag == null || termTag.Trim().Length == 0)
            {
                termTag = this.SalaryQuery_TermTag.SelectedValue;
            }
            else if (termTag.Trim() == "all") {
                termTag = null;
            }

            if (teacherType == null || teacherType.Trim().Length == 0)
            {
                teacherType = "0";
            }
            else {
                teacherType = teacherType.Trim();
            }

            if (string.IsNullOrWhiteSpace(salaryEntryStatus) || "0" == salaryEntryStatus.Trim())
            {
                salaryEntryStatus = "0";
            }
            else
            {
                salaryEntryStatus = salaryEntryStatus.Trim();
            }

            string salaryMonth = Request["salaryMonth"] != null && Request["salaryMonth"].Trim().Length > 0 ? Request["salaryMonth"].Trim() : null;
            this.SalaryQuery_SalaryMonth.Value = salaryMonth;

            List<SalaryEntry> salaryEntries = new List<SalaryEntry>();

            if (!(teacherName != null && (teacherNo == null || teacherNo.Trim().Length == 0)))
            {
                if (teacherNo == null && termTag == null && salaryMonth == null && teacherType == "0" && salaryEntryStatus == "0")
                {
                    salaryEntries = dal.GetAllSalaryEntry();
                }
                else {
                    salaryEntries = dal.GetSalaryEntrys(teacherNo, termTag, salaryMonth, int.Parse(teacherType), int.Parse(salaryEntryStatus));
                }

            }
            TotalSalaryModel selectedTotalSalaryModel = dal.GetTotalSalaryEntryValues(teacherNo, termTag, salaryMonth, int.Parse(teacherType), int.Parse(salaryEntryStatus));
            TotalSalaryModel allTotalSalaryModel = dal.GetTotalSalaryEntryValues(null, null, null, 0, 0);

            this.literal_SelectedSalaryWithTax.Text = selectedTotalSalaryModel.salaryWithTax.ToString();
            this.literal_SelectedSalaryWithoutTax.Text = selectedTotalSalaryModel.salaryWithoutTax.ToString();
            this.literal_SelectedTotalSalary.Text = selectedTotalSalaryModel.salaryTotal.ToString();

            this.literal_AllSalaryWithTax.Text = allTotalSalaryModel.salaryWithTax.ToString();
            this.literal_AllSalaryWithoutTax.Text = allTotalSalaryModel.salaryWithoutTax.ToString();
            this.literal_AllTotalSalary.Text = allTotalSalaryModel.salaryTotal.ToString();
            if (salaryEntries != null)
            {
                this.SalaryEntryPager.RecordCount = salaryEntries.Count;
                SalaryEntryPager.PageSize = CommonUtility.pageSize;

                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = salaryEntries;
                pds.AllowPaging = true;

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

                this.SalaryEntryList.DataSource = pds;
                this.SalaryEntryList.DataBind();
            }
            else
            {
                this.SalaryEntryPager.RecordCount = 0;
            }

            if (SalaryEntryPager.RecordCount > 0)
            {
                this.SalaryEntryList.ShowFooter = false;
            }
        }