Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            string inSalaryItemIds = Request["inIds"];
                string outSalaryItemIds = Request["outIds"];
                string teacherNo = Request["tid"];
                string cid = Request["cid"];
                string acType = Request["acType"];
                string teacherType = Request["teacherType"];
                DalOperationAboutTeacherSalary dalts = new DalOperationAboutTeacherSalary();
                string[] courseInfo = cid.Split('-');
                cid = courseInfo[0];
                TeacherSalary teacherSalary = dalts.GetTeacherSalaryByTidAndCidAndTermTag(teacherNo, cid, int.Parse(teacherType), null);

                List<SalaryItem> inSalaryItemList = GetInSalaryItemListByIdString(inSalaryItemIds, teacherSalary);
                List<SalaryItem> outSalaryItemList = GetOutSalaryItemListByIdString(outSalaryItemIds);

                if (inSalaryItemList.Count == 0)
                {
                    Javascript.AlertAndRedirect("请至少选择一项待发薪酬项", "/Administrator/SelectSalaryItem.aspx?teacherNO=" + teacherNo, Page);
                }
                else
                {

                    DalOperationAboutTeacher teacherDal = new DalOperationAboutTeacher();
                    TeachersList teacher = teacherDal.GetTeacherById(teacherNo);
                    this.teacherNo.Value = teacher.teacherNo;
                    this.teacherName.Text = teacher.teacherName;
                    this.courseNo.Value = cid;
                    this.atCourseType.Value = acType;
                    this.teacherType.Value = teacherType;

                    this.TeacherType_Literal.Text = CommonUtility.ConvertTeacherType2String(int.Parse(teacherType));
                    this.InSalaryItemList.DataSource = inSalaryItemList;
                    this.InSalaryItemList.DataBind();

                    this.OutSalaryItemList.DataSource = outSalaryItemList;
                    this.OutSalaryItemList.DataBind();
                    if (!string.IsNullOrWhiteSpace(cid)) {
                        DalOperationAboutCourses dalc = new DalOperationAboutCourses();

                        Courses course = dalc.GetCoursesByNo(cid, null);
                        this.Course_TR.Visible = true;
                        this.CourseName_Literal.Text = course.courseName;

                        this.Course_TR.Visible = true;
                        this.CoursePeriod_TR.Visible = true;
                        if (string.IsNullOrWhiteSpace(course.TestHours) || "0" == course.TestHours)
                        {
                            this.CoursePeriod_Literal.Text = course.period;
                        }
                        else {
                            this.CoursePeriod_Literal.Text = course.period + "/" + course.TestHours;
                        }
                    }

                }
            }
        }
        protected void TeacherSalaryConfirm_Click(object sender, EventArgs e)
        {
            DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();
            string teacherSalaryId = this.TeacherSalaryId.Value;
            dal.confirmTeacherSalary(int.Parse(teacherSalaryId));

            Javascript.RefreshParentWindowReload(Page);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string teacherSalaryId = Request["teacherSalaryId"];
                if (teacherSalaryId == null || teacherSalaryId.Trim().Length == 0)
                {
                    Javascript.Alert("请提供准确的薪酬主键", Page);
                }
                else
                {
                    DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();
                    TeacherSalary teacherSalary = dal.GetTeacherSalaryBySalaryId(int.Parse(teacherSalaryId.Trim()));
                    if (teacherSalary == null)
                    {
                        Javascript.Alert("您查看的薪酬记录不存在!", Page);
                        Javascript.RefreshParentWindowReload(Page);

                    }
                    else
                    {

                        List<SalaryItemElement> inSalaryItemElement = teacherSalary.GetSalaryInItemElements();

                        FullFillSalaryItemElements(inSalaryItemElement);

                        this.ShowSalarySummaryItems.DataSource = inSalaryItemElement;
                        this.ShowSalarySummaryItems.DataBind();

                        this.TeacherName.Text = teacherSalary.teacher.teacherName;
                        this.TeacherTotalSummaryCost.Text = teacherSalary.totalTeachCost.ToString();
                        this.TermTag.Text = CommonUtility.ChangeTermToString(teacherSalary.termTag);
                        if (teacherSalary.teacherType != 1)
                        {
                            this.TeacherCourse.Text = teacherSalary.course.courseName;
                            this.TeacherCoursePeriod.Text = teacherSalary.teachPeriod + "/" + teacherSalary.experPeriod;
                            this.TeacherCourse_TR.Visible = true;
                            this.TeacherCoursePeriod_TR.Visible = true;
                        }
                        this.TeacherPosition.Text = CommonUtility.ConvertTeacherType2String(teacherSalary.teacherType);

                        this.TeacherSalaryId.Value = "" + teacherSalary.teacherSalaryId;
                        this.SalaryEntryMemo.Text = teacherSalary.memo;
                        UserCookiesInfo userCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

                        if (!teacherSalary.isConfirm && teacherSalary.teacher.teacherNo == userCookiesInfo.userNo)
                        {
                            this.btn_TeacherSalaryConfirm.Visible = true;
                            this.btn_TeacherSalaryQA.Visible = true;
                            this.hf_salaryId.Value = teacherSalaryId;
                        }
                    }
                }

            }
        }
Esempio n. 4
0
        private void DataListBindTeacherSalary()
        {
            DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();
            string teacherNo = null;
            string teacherName = Request["teacherName"];
            if (teacherName != null && teacherName.Trim().Length > 0)
            {
                teacherName = teacherName.Trim();
                teacherNo = SearchTeacherIds(teacherName);
                this.TeacherSalary_TeacherName.Text = teacherName;
            }
            else
            {
                teacherName = null;
            }
            string termTag = Request["termTag"];
            string teacherType = Request["teacherType"];
            string status = Request["status"];

            DataBindSearchTermTagList(this.TeacherSalary_TermTag.Items, termTag);
            DataBindTeacherTypeList(this.TeacherSalary_TeacherType.Items, teacherType);
            DataBindSalaryStatus(this.TeacherSalary_Status.Items, status);

            if (string.IsNullOrWhiteSpace(termTag))
            {
                termTag = this.TeacherSalary_TermTag.SelectedValue;
            }
            else if (termTag.Trim() == "all")
            {
                termTag = null;
            }

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

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

            List<TeacherSalary> teacherSalaries = new List<TeacherSalary>();

            if (!(teacherName != null && string.IsNullOrWhiteSpace(teacherNo)))
            {
                if (teacherNo == null && teacherType == "0" && termTag == null && status == "0")
                {
                    teacherSalaries = dal.GetAllTeacherSalary();
                }
                else {
                    teacherSalaries = dal.GetTeacherSalarys(teacherNo, int.Parse(teacherType), termTag, int.Parse(status));
                }
            }

            double totalTeacherSummary = dal.GetTeacherSalarysValue(null, 0, null, 0);
            double selectedTeacherSummary = dal.GetTeacherSalarysValue(teacherNo, int.Parse(teacherType), termTag, int.Parse(status));

            this.literal_TotalTeacherSummay.Text = totalTeacherSummary.ToString();
            this.literal_SelectedTeacherSummay.Text = selectedTeacherSummary.ToString();

            if (teacherSalaries != null)
            {
                this.TeacherSalaryPager.RecordCount = teacherSalaries.Count;
                TeacherSalaryPager.PageSize = CommonUtility.pageSize;

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

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

                this.TeacherSalaryList.DataSource = pds;
                this.TeacherSalaryList.DataBind();
            }
            else
            {
                this.TeacherSalaryPager.RecordCount = 0;
            }

            if (TeacherSalaryPager.RecordCount > 0)
            {
                this.TeacherSalaryList.ShowFooter = false;
            }
        }
        private List<TeacherSalary> QueryTeacherSalaries(string teacherName, string termTag, int teacherType, int status)
        {
            string teacherNo = null;
            if (teacherName != null && teacherName.Trim().Length > 0)
            {
                teacherName = teacherName.Trim();
                teacherNo = SearchTeacherIds(teacherName);
                if (teacherNo == null || teacherNo.Trim().Length == 0)
                {
                    teacherNo = null;
                }
            }
            else
            {
                teacherName = null;
            }

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

            DalOperationAboutTeacherSalary dalts = new DalOperationAboutTeacherSalary();

            List<TeacherSalary> teacherSalaries = new List<TeacherSalary>();

            if (!(teacherName != null && (teacherNo == null || teacherNo.Trim().Length == 0)))
            {
                teacherSalaries = dalts.GetTeacherSalarys(teacherNo, teacherType, termTag, status);
            }

            return teacherSalaries;
        }
Esempio n. 6
0
        private void DataListBindTeacherSalary(string teacherNo)
        {
            DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();

            string termTag = Request["termTag"];
            DataBindSearchTermTagList(this.TeacherSalary_TermTag.Items, termTag);

            if (termTag == null || termTag.Trim().Length == 0)
            {
                termTag = this.TeacherSalary_TermTag.SelectedValue;
            }
            else if(termTag.Trim() == "all") {
                termTag = null;
            }
            List<TeacherSalary> teacherSalaries = new List<TeacherSalary>();

            teacherSalaries = dal.GetTeacherSalarys(teacherNo, 0, termTag, 0);

            if (teacherSalaries != null)
            {
                this.TeacherSalaryPager.RecordCount = teacherSalaries.Count;
                TeacherSalaryPager.PageSize = CommonUtility.pageSize;

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

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

                this.TeacherSalaryList.DataSource = pds;
                this.TeacherSalaryList.DataBind();
            }
            else
            {
                this.TeacherSalaryPager.RecordCount = 0;
            }

            if (TeacherSalaryPager.RecordCount > 0)
            {
                this.TeacherSalaryList.ShowFooter = false;
            }
        }
Esempio n. 7
0
 protected void TeacherSalaryManage_ItemCommand(object source, DataListCommandEventArgs e)
 {
     DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();
     if (e.CommandName == "confirm")
     {
         string teacherSalaryId = TeacherSalaryList.DataKeys[e.Item.ItemIndex].ToString();
         dal.confirmTeacherSalary(int.Parse(teacherSalaryId));
         Javascript.AlertAndRedirect("确认成功", "/Teacher/SalaryView.aspx?fragment=1&page=" + pageIndex, Page);
     }
 }
Esempio n. 8
0
        protected void btn_TeacherSalary_Click(object sender, EventArgs e)
        {
            DalOperationAboutTeacherSalary teacherSalaryDal = new DalOperationAboutTeacherSalary();
            if (this.btn_TeacherSalary.Text == "添加")
            {
                string teacherNo = this.teacherNo.Value;
                string termTag = this.TeacherSalary_TermTag.SelectedValue;
                int teacherType = int.Parse(this.teacherType.Value.Trim());

                List<TeacherSalary> teacherSalaries = teacherSalaryDal.GetTeacherSalarys(teacherNo, teacherType, termTag, 0);
                if (teacherSalaries != null && teacherSalaries.Count != 0)
                {
                    Javascript.Alert("本学期已为该教师添加过薪酬预算,请核对信息后再次录入!", Page);
                }
                else {
                    TeachersList teacherList = new TeachersList
                    {
                        teacherNo = this.teacherNo.Value
                    };

                    TeacherSalary salary = new TeacherSalary();
                    salary.teacher = teacherList;
                    if (Course_TR.Visible)
                    {
                        string atCourseType = this.atCourseType.Value;
                        Courses course = new Courses
                        {
                            courseNo = this.CourseId_hf.Value
                        };
                        salary.course = course;
                        salary.atCourseType = int.Parse(atCourseType);
                        salary.teachPeriod = int.Parse(this.teachPeriod.Text.Trim());
                        if (this.experPeriod.Text == null || this.experPeriod.Text.Trim().Length == 0)
                        {
                            salary.experPeriod = 0;
                        }
                        else
                        {
                            salary.experPeriod = int.Parse(this.experPeriod.Text.Trim());
                        }
                    }

                    if (BuildInSalaryItemValueList(salary)) {
                        salary.teacherType = int.Parse(this.teacherType.Value.Trim());
                        salary.termTag = TeacherSalary_TermTag.SelectedValue;
                        salary.memo = teacherSalary_Memo.Text.Trim();
                        using (TransactionScope scope = new TransactionScope())
                        {
                            try
                            {
                                teacherSalaryDal.AddTeacherSalary(salary);
                                AddSalaryEntryDefault(salary);
                                scope.Complete();
                                Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=3", Page);
                            }
                            catch (Exception ex)
                            {
                                MongoDBLog.LogRecord(ex);
                                Javascript.GoHistory(-1, "添加薪酬预算和月发放薪酬记录失败!", Page);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 9
0
        protected void TeacherSalaryManage_ItemCommand(object source, DataListCommandEventArgs e)
        {
            DalOperationAboutTeacherSalary dal = new DalOperationAboutTeacherSalary();
            if (e.CommandName == "delete")
            {
                string teacherSalaryId = TeacherSalaryList.DataKeys[e.Item.ItemIndex].ToString();
                dal.DelTeacherSalary(int.Parse(teacherSalaryId));

                Javascript.AlertAndRedirect("删除成功", "/Administrator/SalaryManage.aspx?fragment=3&page=" + pageIndex + "&termTag=" + this.TeacherSalary_TermTag.SelectedValue.Trim() + "&teacherName=" + this.TeacherSalary_TeacherName.Text.Trim(), Page);
            }
        }