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);
            }
        }
        private void AddSalaryEntryDefault(TeacherSalary teacherSalary)
        {
            List<SalaryItemElement> teacherSalaryElements = teacherSalary.GetSalaryInItemElements();
            int maxMonth = 1;
            foreach(SalaryItemElement teacherSalaryElement in teacherSalaryElements){
                if (teacherSalaryElement.MonthNum > maxMonth) {
                    maxMonth = teacherSalaryElement.MonthNum;
                }
            }
            List<string> salaryInValueListForMonth = new List<string>();
            List<float> salaryWithTax = new List<float>();
            List<float> salaryWithoutTax = new List<float>();

            string salaryInValueStringForMonth;
            string singleSalaryItemValue;
            float salaryWithTaxForMonth;
            float salaryWithoutTaxForMonth;
            for (int i = 1; i <= maxMonth; i++) {
                salaryInValueStringForMonth = "";
                salaryWithTaxForMonth = 0f;
                salaryWithoutTaxForMonth = 0f;
                foreach (SalaryItemElement teacherSalaryElement in teacherSalaryElements) {
                    singleSalaryItemValue = "";

                    if (i <= teacherSalaryElement.MonthNum)
                    {
                        if (teacherSalaryElement.salaryStandard != 0)
                        {
                            singleSalaryItemValue = (teacherSalaryElement.salaryItemId + ":" + teacherSalaryElement.salaryStandard + "," + CommonUtility.ConvertFormatedFloat("{0:F2}", (teacherSalaryElement.times / teacherSalaryElement.MonthNum).ToString()) + ",1;");
                        }
                        else {
                            singleSalaryItemValue = (teacherSalaryElement.salaryItemId + ":" +
                                CommonUtility.ConvertFormatedFloat("{0:F2}", (teacherSalaryElement.itemCost / teacherSalaryElement.MonthNum).ToString()) + ",1,1;");
                            if (teacherSalaryElement.hasTax)
                            {
                                salaryWithTaxForMonth += CommonUtility.ConvertFormatedFloat("{0:F2}", (teacherSalaryElement.itemCost / teacherSalaryElement.MonthNum).ToString());
                            }
                            else {
                                salaryWithoutTaxForMonth += CommonUtility.ConvertFormatedFloat("{0:F2}", (teacherSalaryElement.itemCost / teacherSalaryElement.MonthNum).ToString());
                            }
                        }

                        salaryInValueStringForMonth += singleSalaryItemValue;
                        if (teacherSalaryElement.hasTax) {
                            salaryWithTaxForMonth += (teacherSalaryElement.salaryStandard * teacherSalaryElement.times / teacherSalaryElement.MonthNum);
                            }else{
                            salaryWithoutTaxForMonth += (teacherSalaryElement.salaryStandard * teacherSalaryElement.times / teacherSalaryElement.MonthNum);
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(salaryInValueStringForMonth)) {
                    salaryInValueStringForMonth = salaryInValueStringForMonth.Substring(0, salaryInValueStringForMonth.Length - 1);
                    salaryInValueListForMonth.Add(salaryInValueStringForMonth);
                    salaryWithTax.Add(salaryWithTaxForMonth);
                    salaryWithoutTax.Add(salaryWithoutTaxForMonth);
                }
            }

            DalOperationAboutSalaryEntry dalse = new DalOperationAboutSalaryEntry();
            SalaryEntry salaryEntry = new SalaryEntry();
            salaryEntry.teacher = teacherSalary.teacher;
            salaryEntry.teacherType = teacherSalary.teacherType;
            salaryEntry.course = teacherSalary.course;
            salaryEntry.atCourseType = "" + teacherSalary.atCourseType;
            salaryEntry.termTag = teacherSalary.termTag;
            salaryEntry.salaryEntryStatus = 1;
            salaryEntry.memo = "本列表中的税后所得仅为假定你在苏州研究院的所有收入只有此项而计算(因为是兼职,财务默认您的基础收入已经为3500元),仅供参考!实际税后金额,以财务发放为准,有问题可以及时联系教学管理部(0512-68839206)或者财务(0512-87161163)";

            DateTime monthDateTime = DateTime.Now;

            for (int i = 0; i < salaryInValueListForMonth.Count; i++) {
                salaryEntry.SetSalaryInItemValueList(salaryInValueListForMonth[i], false);

                salaryEntry.teacherCostWithTax = CommonUtility.ConvertFormatedFloat("{0:F2}", salaryWithTax[i].ToString());
                salaryEntry.teacherCostWithoutTax = CommonUtility.ConvertFormatedFloat("{0:F2}", salaryWithoutTax[i].ToString());
                salaryEntry.teacherTotalCost = CommonUtility.ConvertFormatedFloat("{0:F2}", ((salaryEntry.teacherCostWithTax - float.Parse(CommonUtility.CalculateTax(decimal.Parse(salaryEntry.teacherCostWithTax.ToString())).ToString())) + salaryEntry.teacherCostWithoutTax).ToString());

                int monthValue = monthDateTime.Month;

                salaryEntry.salaryMonth = (monthDateTime.Year + "-" + (monthValue < 10 ? "0" + monthValue.ToString() : monthValue.ToString()));

                dalse.AddSalaryEntry(salaryEntry);
                monthDateTime = monthDateTime.AddMonths(1);
            }
        }