Beispiel #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
               string pageIndex = this.hf_page.Value;
            if (this.btnSubmit.Text == "添加")
            {
                SalaryItem salaryItem = new SalaryItem();
                salaryItem.salaryItemName = salaryItemName.Text.Trim();
                salaryItem.salaryItemUnit = salaryItemUnit.Text.Trim();
                salaryItem.salaryItemDesc = salaryItemDesc.Text.Trim();
                if (SalaryItemIsHidden.Checked)
                {
                    salaryItem.salaryItemStatus = 2;        //默认隐藏
                }
                else {
                    salaryItem.salaryItemStatus = 1;        //默认展示
                }

                if (SalaryItemForOutTeacher.Checked)
                {
                    salaryItem.useFor = 2;                  //适用于院外教师
                }
                else if (SalaryItemForOutAssistant.Checked)
                {
                    salaryItem.useFor = 3;                  //适用于院外助教
                }
                else {
                    salaryItem.useFor = 1;                  //适用于院内教师/助教
                }

                salaryItem.hasTax = cb_hasTax.Checked;
                salaryItem.isDefaultChecked = cb_defaultChecked.Checked;

                dal.AddSalaryItem(salaryItem);

                Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=2&page=" + pageIndex,  Page);
            }
            else if (this.btnSubmit.Text == "修改")
            {
                if (Request["salaryItemId"] != null)
                {
                    string salaryItemId = Request["salaryItemId"].ToString().Trim();

                    SalaryItem item = dal.GetSalaryItemById(int.Parse(salaryItemId));
                    item.salaryItemName = salaryItemName.Text;
                    item.salaryItemUnit = salaryItemUnit.Text;
                    item.salaryItemDesc = salaryItemDesc.Text;
                    item.hasTax = cb_hasTax.Checked;
                    item.isDefaultChecked = cb_defaultChecked.Checked;

                    dal.updateSalaryItem(item);

                    Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=2&page=" + pageIndex, Page);
                }

            }
        }
Beispiel #2
0
 /// <summary>
 /// 根据薪酬项id字符串获得相应的薪酬项信息列表 
 /// </summary>
 /// <param name="salaryItemIds"></param>
 /// <returns></returns>
 private List<SalaryItem> GetOutSalaryItemListByIdString(string salaryItemIds)
 {
     string[] salaryItemIdArray = ConvertSalaryItemIdString2Array(salaryItemIds);
     List<SalaryItem> salaryItemList = new List<SalaryItem>();
     if (salaryItemIdArray != null)
     {
         DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
         foreach (string salaryItemId in salaryItemIdArray)
         {
             salaryItemList.Add(dal.GetSalaryItemById(int.Parse(salaryItemId)));
         }
     }
     return salaryItemList;
 }
Beispiel #3
0
 /// <summary>
 /// 根据薪酬项id字符串获得相应的薪酬项信息列表 
 /// </summary>
 /// <param name="salaryItemIds"></param>
 /// <returns></returns>
 private List<SalaryItem> GetInSalaryItemListByIdString(string salaryItemIds, TeacherSalary teacherSalary)
 {
     string[] salaryItemIdArray = ConvertSalaryItemIdString2Array(salaryItemIds);
     List<SalaryItem> salaryItemList = new List<SalaryItem>();
     if (salaryItemIdArray != null)
     {
         DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
         foreach (string salaryItemId in salaryItemIdArray)
         {
             SalaryItem salaryItem = dal.GetSalaryItemById(int.Parse(salaryItemId));
             SetSalaryItemElement(salaryItem, teacherSalary);
             salaryItemList.Add(salaryItem);
         }
     }
     return salaryItemList;
 }
 private void FullFillSalaryItemElements(List<SalaryItemElement> itemElements)
 {
     DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
     if (itemElements != null && itemElements.Count > 0)
     {
         foreach (SalaryItemElement itemElement in itemElements)
         {
             SalaryItem item = dal.GetSalaryItemById(int.Parse(itemElement.salaryItemId));
             itemElement.salaryItemName = item.salaryItemName;
             itemElement.itemUnit = item.salaryItemUnit;
             itemElement.hasTax = item.hasTax;
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                string tid = Request["teacherNO"];
                string courseNo = Request["courseNo"];
                if (tid == null || tid.Trim().Length == 0)
                {

                    Javascript.Alert("请先选择教师后再进行此项操作", Page);
                    Javascript.RefreshParentWindow("/Administrator/SalaryManage.aspx?fragment=1", Page);
                }
                else
                {
                    DalOperationAboutTeacher teacherDal = new DalOperationAboutTeacher();
                    TeachersList teacher = teacherDal.GetTeacherById(tid);
                    if (teacher == null)
                    {
                        Javascript.AlertAndRedirect("请先确定教师后再进行此项操作", "/Administrator.aspx?fragment=1", Page);
                    }
                    else {
                        this.teacherName.Text = teacher.teacherName;
                        this.teacherNo.Value = teacher.teacherNo;
                    }

                    int teacherType = 1;

                    if ("本院" == teacher.teacherType)
                    {
                        teacherType = 1;
                    }
                    else {
                        this.SelectCourse_Literal.Visible = true;
                        this.SelectCourse.Visible = true;
                        DalOperationAboutTeacher dalt = new DalOperationAboutTeacher();
                        DataTable dsTeacher = dalt.GetCoursesByTeacherAssistant(tid).Tables[0];
                        if (dsTeacher.Rows.Count == 0)
                        {
                            Javascript.Alert("该教师非院内教师并且本学期未待任何课程!", Page);
                            Javascript.RefreshParentWindowReload(Page);
                        }
                        else
                        {
                            DataBindTeacherSalaryCourse(dsTeacher, courseNo);

                            if (string.IsNullOrWhiteSpace(courseNo)) {
                                courseNo = this.SelectCourse.SelectedValue;
                            }

                            string[] courseInfo = courseNo.Split('-');
                            int atCourseType = 1;
                            if (courseInfo.Length > 1)
                            {
                                atCourseType = int.Parse(courseInfo[1].Trim());
                            }
                            teacherType = CommonUtility.CheckTeacherType(teacher.teacherType, atCourseType);
                        }
                    }

                    this.TeacherType_Literal.Text = CommonUtility.ConvertTeacherType2String(teacherType);

                    this.teacherType.Value = teacherType.ToString();

                    DalOperationAboutSalaryItem dalsi = new DalOperationAboutSalaryItem();
                    List<SalaryItem> salaryItems = dalsi.GetAllSalaryItem(teacherType, 1);

                    this.TeacherInSalaryItemList.DataSource = salaryItems;
                    this.TeacherInSalaryItemList.DataBind();

                    this.TeacherOutSalaryItemList.DataSource = salaryItems;
                    this.TeacherOutSalaryItemList.DataBind();
                }
            }
        }
Beispiel #6
0
        private void DataListBindSalaryItem()
        {
            DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
            List<SalaryItem> items = dal.GetAllSalaryItem();

            if (items != null)
            {
                this.SalaryItemPager.RecordCount = items.Count;
                SalaryItemPager.PageSize = CommonUtility.pageSize;

                PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
                pds.DataSource = items;
                pds.AllowPaging = true;

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

                this.SalaryItemList.DataSource = pds;
                this.SalaryItemList.DataBind();

            }
            else
            {
                this.SalaryItemPager.RecordCount = 0;
            }

            if (SalaryItemPager.RecordCount > 0)
            {
                this.SalaryItemList.ShowFooter = false;
            }
        }
Beispiel #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string pageIndex = Request["page"];

                if (pageIndex == null || pageIndex.Trim().Length == 0)
                {
                    pageIndex = "1";
                }
                else {
                    pageIndex = Request["page"].Trim();
                }

                string operation = Request["op"];
                if ("edit".Equals(operation))
                {
                    string itemID = Request["salaryItemId"];

                    if (itemID == null || itemID.Trim().Length == 0)
                    {
                        Javascript.Alert("请提供正确的薪酬项Id", Page);
                        Javascript.RefreshParentWindowReload(Page);
                    }
                    else
                    {
                        DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();
                        SalaryItem item = dal.GetSalaryItemById(int.Parse(Request["salaryItemId"].ToString().Trim()));
                        salaryItemName.Text = item.salaryItemName;
                        salaryItemUnit.Text = item.salaryItemUnit;
                        salaryItemDesc.Text = item.salaryItemDesc;
                        cb_hasTax.Checked = item.hasTax;
                        cb_defaultChecked.Checked = item.isDefaultChecked;

                        SalaryVisible_TR.Visible = false;
                        UserFor_TR.Visible = false;
                        this.btnSubmit.Text = "修改";
                    }
                }
                else
                {
                    this.btnSubmit.Text = "添加";
                    cb_hasTax.Checked = true;
                    this.UserFor_TR.Visible = true;
                }
                this.hf_page.Value = pageIndex;
            }
        }
        private List<SalaryItem> GetSalaryItem(int useFor)
        {
            DalOperationAboutSalaryItem dalsi = new DalOperationAboutSalaryItem();
            List<SalaryItem> salaryItems = dalsi.GetAllSalaryItem(useFor, 0);

            return salaryItems;
        }
Beispiel #9
0
        protected void SalaryManage_ItemCommand(object source, DataListCommandEventArgs e)
        {
            DalOperationAboutSalaryItem dal = new DalOperationAboutSalaryItem();

            string salaryItemId = SalaryItemList.DataKeys[e.Item.ItemIndex].ToString();
            if (e.CommandName == "showItem") {
                dal.updateSalaryItemStatus(int.Parse(salaryItemId), 1);
            }
            else if (e.CommandName == "hiddenItem") {
                dal.updateSalaryItemStatus(int.Parse(salaryItemId), 2);
            }
            Javascript.AlertAndRedirect("设置成功!", "/Administrator/SalaryManage.aspx?fragment=2&page=" + pageIndex, Page);
        }