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
        private void BuildOutSalaryItemValueList(SalaryEntry salaryEntry)
        {
            DataListItemCollection itemCollection = this.OutSalaryItemList.Items;
            string salaryItemValueList = "";
            float totalSalaryValue = 0;
            foreach (DataListItem item in itemCollection)
            {
                string itemId = ((HiddenField)item.FindControl("out" + "SalaryItemId")).Value;

                string salaryStandard = ((TextBox)item.FindControl("out" + "SalaryStandard")).Text;

                string salaryUnit = ((TextBox)item.FindControl("out" + "SalaryUnit")).Text;

                string salaryAdjust = ((TextBox)item.FindControl("out" + "salaryAdjust")).Text;

                float salaryValue = float.Parse(salaryStandard) * float.Parse(salaryUnit) * float.Parse(salaryAdjust);

                salaryItemValueList += (itemId + ":" + salaryStandard + "," + salaryUnit + "," + salaryAdjust + ";");
                totalSalaryValue += salaryValue;
            }

            if (salaryItemValueList.Length > 0)
            {
                salaryItemValueList = salaryItemValueList.Substring(0, salaryItemValueList.Length - 1);
            }
            salaryEntry.SetSalaryOutItemValueList(salaryItemValueList, false);
            salaryEntry.teacherTotalCost -= totalSalaryValue;

            salaryEntry.teacherTotalCost = CommonUtility.ConvertFormatedFloat("{0:F2}", salaryEntry.teacherTotalCost.ToString());
        }
        /// <summary>
        /// 从DataReader中转化并构造SalaryEntry记录集
        /// </summary>
        /// <param name="dataReader"></param>
        /// <returns></returns>
        private void BuildSalaryEntry(IDataReader dataReader, List<SalaryEntry> salaryEntries)
        {
            DalOperationAboutTeacher dalt = new DalOperationAboutTeacher();
            DalOperationAboutCourses dalc = new DalOperationAboutCourses();
            if (dataReader != null)
            {
                while (dataReader.Read())
                {
                    SalaryEntry salaryEntry = new SalaryEntry();
                    salaryEntry.salaryEntryId = int.Parse(dataReader["salaryEntryId"].ToString().Trim());
                    TeachersList teacher = dalt.GetTeacherById(dataReader["teacherNo"].ToString().Trim());
                    salaryEntry.teacher = teacher;
                    salaryEntry.teacherType = int.Parse(dataReader["teacherType"].ToString().Trim());
                    salaryEntry.termTag = dataReader["termTag"].ToString().Trim();
                    Courses course = dalc.GetCoursesByNo(dataReader["courseNo"].ToString().Trim(), salaryEntry.termTag);
                    salaryEntry.course = course;
                    salaryEntry.atCourseType = dataReader["atCourseType"].ToString().Trim();

                    salaryEntry.SetSalaryInItemValueList(dataReader["salaryInItemValueList"].ToString().Trim(), true);
                    salaryEntry.SetSalaryOutItemValueList(dataReader["salaryOutItemValueList"].ToString().Trim(), true);
                    if (dataReader["salaryInAdjustFactor"] != null)
                    {
                        salaryEntry.salaryInAdjustFactor = float.Parse(dataReader["salaryInAdjustFactor"].ToString().Trim());
                    }

                    if (dataReader["salaryOutAdjustFactor"] != null)
                    {
                        salaryEntry.salaryOutAdjustFactor = float.Parse(dataReader["salaryOutAdjustFactor"].ToString().Trim());
                    }

                    if (dataReader["teachPeriod"] != null)
                    {
                        salaryEntry.teachPeriod = int.Parse(dataReader["teachPeriod"].ToString().Trim());
                    }

                    if (dataReader["teachAssiPeriod"] != null)
                    {
                        salaryEntry.teachAssiPeriod = int.Parse(dataReader["teachAssiPeriod"].ToString().Trim());
                    }

                    salaryEntry.teacherCostWithTax = float.Parse(dataReader["teacherCostWithTax"].ToString().Trim());
                    salaryEntry.teacherCostWithoutTax = float.Parse(dataReader["teacherCostWithoutTax"].ToString().Trim());
                    salaryEntry.teacherTotalCost = float.Parse(dataReader["teacherTotalCost"].ToString().Trim());
                    salaryEntry.salaryMonth = dataReader["salaryMonth"].ToString().Trim();
                    salaryEntry.salaryEntryStatus = int.Parse(dataReader["salaryEntryStatus"].ToString());
                    salaryEntry.createdTime = DateTime.Parse(dataReader["createdTime"].ToString().Trim());
                    salaryEntry.memo = dataReader["memo"].ToString().Trim();
                    salaryEntries.Add(salaryEntry);
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                string formatedTeacherSalaryCostWithTax = CommonUtility.ConvertFormatedFloat("{0:F2}", Request["withTax"].Trim()).ToString();

                string formatedTeacherSalaryCostWithoutTax = CommonUtility.ConvertFormatedFloat("{0:F2}", Request["withoutTax"].Trim()).ToString();

                string formatedTeacherTotalCost = CommonUtility.ConvertFormatedFloat("{0:F2}", Request["totalCost"].Trim()).ToString();

                this.TeacherSalaryCostWithTax.Text = formatedTeacherSalaryCostWithTax;
                this.TeacherSalaryCostWithoutTax.Text = formatedTeacherSalaryCostWithoutTax;
                this.TeacherTotalCost.Text = formatedTeacherTotalCost;
                this.InSalaryItemValueList.Value = Request["inValueList"];
                this.OutSalaryItemValueList.Value = Request["outValueList"];

                SalaryEntry salaryEntry = new SalaryEntry();
                salaryEntry.SetSalaryInItemValueList(Request["inValueList"], true);
                salaryEntry.SetSalaryOutItemValueList(Request["outValueList"], true);

                List<SalaryItemElement> inItemElements = salaryEntry.GetSalaryInItemElements();
                List<SalaryItemElement> outItemElements = salaryEntry.GetSalaryOutItemElements();

                FullFillSalaryItemElements(inItemElements);
                FullFillSalaryItemElements(outItemElements);

                this.ShowSalaryInItems.DataSource = inItemElements;
                this.ShowSalaryOutItems.DataSource = outItemElements;

                this.ShowSalaryInItems.DataBind();
                this.ShowSalaryOutItems.DataBind();

                DataBindSearchTermTagList();

                this.TeacherId.Value = Request["tid"];
                DalOperationAboutTeacher teacherDal = new DalOperationAboutTeacher();
                TeachersList teacher = teacherDal.GetTeacherById(Request["tid"].Trim());
                this.TeacherName.Text = teacher.teacherName;

                DateTime lastMonth = DateTime.Now.Date.AddMonths(-1);
                string lastMonthString = lastMonth.Month < 10 ? "0" + lastMonth.Month.ToString() : lastMonth.Month.ToString();
                this.SalaryMonth.Value = lastMonth.Year + "-" + lastMonthString;

                this.CourseId.Value = Request["cid"];
                this.atCourseType.Value = Request["acType"];
                this.teacherType.Value = Request["teacherType"];
            }
        }