1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using CY.Model;
using CY.BLL;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
 
namespace CY.WebForm.Pages.personnel
{
    //吴辉
    //新增/修改招聘职位    
    public partial class OA_StaffPostAdd : BasePage
    {
        OA_StaffPostBLL bll_OA_StaffPostBLL = null;
        OA_StaffPostCategoryBLL bll_OA_StaffPostCategoryBLL = null;
 
        //初始化
        public OA_StaffPostAdd()
        {
            bll_OA_StaffPostBLL = new OA_StaffPostBLL();
            bll_OA_StaffPostCategoryBLL = new OA_StaffPostCategoryBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }
 
        //数据加载
        public void InitData()
        {
            Pagination pa = new Pagination();
            pa.PageSize = 500;
            pa.PageIndex = 1;
            this.selP_CateId.DataSource = bll_OA_StaffPostCategoryBLL.SelectModelPage(pa, AdminAccount.MemberId, "", null, null, null, "");
            this.selP_CateId.DataTextField = "PC_Name";
            this.selP_CateId.DataValueField = "Keyid";
            this.selP_CateId.DataBind();
            this.selP_CateId.Items.Insert(0,new ListItem("请选择",""));
 
            OA_StaffPost m_OA_StaffPost = bll_OA_StaffPostBLL.GetModelByKeyid(Request["keyid"].ToInt32());
            if (m_OA_StaffPost != null)
            {
                this.txtP_Name.Value = m_OA_StaffPost.P_Name.ToString2();
                this.selP_CateId.Value = m_OA_StaffPost.P_CateId.ToString2();
                this.txtOrderNum.Value = m_OA_StaffPost.OrderNum.ToString2();
            }
        }
 
        //表单提交
        protected void btn_submit_form(object sender, EventArgs e)
        {
            try
            {
                DateTime nowTime = DateTime.Now;
                OA_StaffPost m_OA_StaffPost = bll_OA_StaffPostBLL.GetModelByKeyid(Request["keyid"].ToInt32());
                if (m_OA_StaffPost == null)
                {
                    m_OA_StaffPost = new OA_StaffPost();
                }
 
                m_OA_StaffPost.Memberid = AdminAccount.MemberId;
                m_OA_StaffPost.P_Name = this.txtP_Name.Value.ToString2();
                m_OA_StaffPost.P_DepartmentId = 0;
                m_OA_StaffPost.P_CateId = this.selP_CateId.Value.ToInt32();
                m_OA_StaffPost.OrderNum = this.txtOrderNum.Value.ToInt32();
                m_OA_StaffPost.LastUpdateTime = DateTime.Now;
                m_OA_StaffPost.Operator = CurrentUser.ShortName;
 
                if (Request["keyid"].ToInt32() > 0)
                {
                    if (bll_OA_StaffPostBLL.UpdateModel(m_OA_StaffPost))
                        JavaScript.MessageBoxAndFirstRefresh("更新成功", this, true);
                    else
                        JavaScript.MessageBox("更新失败", this);
                }
                else
                {
                    if (bll_OA_StaffPostBLL.InsertModel(m_OA_StaffPost))
                        JavaScript.MessageBoxAndFirstRefresh("新增成功", this,false);
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}