Пример #1
0
        /// <summary>
        /// 页面点击下一步时候触发动作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddSalaryValue_Forward(object sender, EventArgs e)
        {
            SalaryEntry salaryEntry = new SalaryEntry();
            BuildInSalaryItemValueList(salaryEntry);
            BuildOutSalaryItemValueList(salaryEntry);
            string tid = this.teacherNo.Value;
            string cid = this.courseNo.Value;
            string acType = this.atCourseType.Value;
            string teacherType = this.teacherType.Value;

            if (salaryEntry.teacherTotalCost <= 0)
            {
                Javascript.Alert("该老师本月发放薪酬应该为大于0的数值,请核对后再次录入", Page);
            }
            else {
                Javascript.JavaScriptLocationHref("/Administrator/AddSalaryEntryConfirm.aspx?tid=" + tid + "&inValueList=" + salaryEntry.GetSalaryInItemValueList() + "&outValueList=" + salaryEntry.GetSalaryOutItemValueList() + "&totalCost=" + salaryEntry.teacherTotalCost + "&withTax=" + salaryEntry.teacherCostWithTax + "&withoutTax=" + salaryEntry.teacherCostWithoutTax + "&cid=" + cid + "&acType=" + acType + "&teacherType=" + teacherType, Page);
            }
        }
        /// <summary>
        /// 添加一条SalaryEntry记录
        /// </summary>
        /// <param name="salaryEntry"></param>
        public void AddSalaryEntry(SalaryEntry salaryEntry)
        {
            try
            {
                string commandString = "INSERT INTO [USTA].[dbo].[usta_salaryEntry]([teacherNo],[teacherType],[courseNo],[atCourseType], [salaryInItemValueList],[salaryOutItemValueList],[salaryInAdjustFactor],[salaryOutAdjustFactor],[teachPeriod],[teachAssiPeriod],[termTag],[teacherCostWithTax],[teacherCostWithoutTax], [teacherTotalCost],[salaryMonth],[salaryEntryStatus],[memo] , [createdTime]) VALUES (@teacherNo, @teacherType,@courseNo, @atCourseType, @salaryInItemValueList, @salaryOutItemValueList, @salaryInAdjustFactor, @salaryOutAdjustFactor, @teachPeriod, @teachAssiPeriod, @termTag, @teacherCostWithTax, @teacherCostWithoutTax, @teacherTotalCost, @salaryMonth,@salaryEntryStatus,@memo, @createdTime)";
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@teacherNo", salaryEntry.teacher.teacherNo),
                    new SqlParameter("@teacherType", salaryEntry.teacherType),
                    new SqlParameter("@courseNo",   salaryEntry.course == null ? null :  salaryEntry.course.courseNo),
                    new SqlParameter("@atCourseType", salaryEntry.atCourseType),
                    new SqlParameter("@salaryInItemValueList", salaryEntry.GetSalaryInItemValueList()),
                    new SqlParameter("@salaryOutItemValueList", salaryEntry.GetSalaryOutItemValueList()),
                    new SqlParameter("@salaryInAdjustFactor", salaryEntry.salaryInAdjustFactor),
                    new SqlParameter("@salaryOutAdjustFactor", salaryEntry.salaryOutAdjustFactor),
                    new SqlParameter("@teachPeriod", salaryEntry.teachPeriod),
                    new SqlParameter("@teachAssiPeriod", salaryEntry.teachAssiPeriod),
                    new SqlParameter("@termTag", salaryEntry.termTag),
                    new SqlParameter("@teacherCostWithTax", salaryEntry.teacherCostWithTax),
                    new SqlParameter("@teacherCostWithoutTax", salaryEntry.teacherCostWithoutTax),
                    new SqlParameter("@teacherTotalCost", salaryEntry.teacherTotalCost),
                    new SqlParameter("@salaryMonth", salaryEntry.salaryMonth),
                    new SqlParameter("@salaryEntryStatus", "1"),
                    new SqlParameter("@memo", salaryEntry.memo),
                    new SqlParameter("@createdTime", DateTime.Now.ToString())
                };

                SqlHelper.ExecuteNonQuery(conn, CommandType.Text, commandString, parameters);

            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                CommonUtility.RedirectUrl();
            }
            finally
            {
                conn.Close();
            }
        }