username@email.com
2024-12-24 a0d38325a97957b37dd755bf732b63f6f7e2a5ff
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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.BLL.Sys;
using CY.BLL.EC;
using CY.Infrastructure.DESEncrypt;
using CY.Infrastructure.Query;
using CY.BLL.OA;
 
namespace CY.WebForm.Pages.work
{
    //吴辉
    //新增请示
    public partial class MyRequestAdd : BasePage
    {
 
        OA_DepartmentBll departmentBll = null;
        OA_StaffBLL oA_StaffBLL = null;
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
        OA_WorkPlanBll oA_WorkReminderBll = null;
        OA_CarDictionaryBLL bll_OA_CarDictionaryBLL = null;
        OA_SuppliersBLL _OA_SuppliersBLL = null;
        public MyRequestAdd()
        {
            departmentBll = new OA_DepartmentBll();
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
            oA_WorkReminderBll = new OA_WorkPlanBll();
            oA_StaffBLL = new OA_StaffBLL();
            bll_OA_CarDictionaryBLL = new OA_CarDictionaryBLL();
            _OA_SuppliersBLL = new OA_SuppliersBLL(); 
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.selPlanTitle.DataSource = bll_OA_CarDictionaryBLL.SelectListByMemberIdAndParType(CurrentUser.MemberId, "出车事由");//出车事由
                this.selPlanTitle.DataValueField = "ParName";
                this.selPlanTitle.DataTextField = "ParName";
                this.selPlanTitle.DataBind();
                this.selPlanTitle.Items.Insert(0, new ListItem("全部", ""));
 
                //供应商
                this.selSuppliers.DataSource = _OA_SuppliersBLL.getSupplierTable(CurrentUser.MemberId);
                this.selSuppliers.DataBind();
                this.selSuppliers.Items.Insert(0, new ListItem("全部", ""));
 
                InitData();
            }
        }
 
        //数据加载
        public void InitData()
        {
            Pagination pa = new Pagination();
            pa.PageSize = 500;
            pa.PageIndex = 1;
 
 
            OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
            if (m_OA_WorkPlan != null)
            {
                this.selPlanDataType.Value = m_OA_WorkPlan.PlanDataType.ToString();
                this.txtPlanMoney.Value = m_OA_WorkPlan.PlanMoney.Value.ToString("0.00");
                this.txtPlanRemark.Value = m_OA_WorkPlan.PlanRemark.ToString();
                if (m_OA_WorkPlan.PlanDataType == 7)
                {
                    this.selPlanTitle.Value = m_OA_WorkPlan.PlanTitle.ToString();
                }
                else
                {
                    this.txtPlanTitle.Value = m_OA_WorkPlan.PlanTitle.ToString();
                }
                if (m_OA_WorkPlan.PlanDataType == 15)
                {
                    this.txtShoukuandanwei.Value = m_OA_WorkPlan.PlanComplany;
                }
                else
                {
                    this.txtShoukuandanwei.Value = "";
                }
                this.txtPlanContent.Value = m_OA_WorkPlan.PlanContent.ToString();
            }
        }
 
        //表单提交
        protected void btn_submit_form(object sender, EventArgs e)
        {
            try
            {
                DateTime nowTime = DateTime.Now;
                OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                if (m_OA_WorkPlan == null)
                {
                    m_OA_WorkPlan = new OA_WorkPlan();
                    m_OA_WorkPlan.ApprovalContent = "";
                    m_OA_WorkPlan.ApprovalStaffId = Guid.Empty;
                    m_OA_WorkPlan.ApprovalStaffName = "";
                    m_OA_WorkPlan.ApprovalStatus = 0;
                    m_OA_WorkPlan.ApprovalTime = nowTime;
                    m_OA_WorkPlan.EvaluationContent = "";
                    m_OA_WorkPlan.EvaluationStaff = "";
                    m_OA_WorkPlan.EvaluationStaffId = Guid.Empty;
                    m_OA_WorkPlan.EvaluationStatus = 0;
                    m_OA_WorkPlan.EvaluationTime = nowTime;
                    m_OA_WorkPlan.RewardContent = "";
                    m_OA_WorkPlan.RewardMoney = 0;
                    m_OA_WorkPlan.RewardResult = "";
                    m_OA_WorkPlan.RewardType = 0;
 
                    m_OA_WorkPlan.PlanStartTime = nowTime;
                    m_OA_WorkPlan.PlanStatus = 1;
                    m_OA_WorkPlan.SentStaffId = CurrentUser.TrueMemberId;
                    m_OA_WorkPlan.MemberId = CurrentUser.MemberId;
 
                    OA_Staff m_OA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId);
                    if (m_OA_Staff != null)
                        m_OA_WorkPlan.DepartId = m_OA_Staff.DepartmentId;
                    else
                        m_OA_WorkPlan.DepartId = 0;
 
                    m_OA_WorkPlan.PlanPeople = CurrentUser.TrueName;
                    m_OA_WorkPlan.ReciveStaffId = CurrentUser.TrueMemberId;
                }
                else
                {
 
                }
 
                m_OA_WorkPlan.Operator = CurrentUser.ShortName;
                if (this.selPlanDataType.Value == "15")
                {
                    if (!this.txtPlanMoney.Value.Trim().ToDecimal2().HasValue || this.txtPlanMoney.Value.Trim().ToDecimal2().Value <= 0)
                    {
                        JavaScript.MessageBox("付款申请请填写申请费用!", this);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(this.txtShoukuandanwei.Value))
                    {
                        JavaScript.MessageBox("付款申请请填写收款单位!", this);
                        return;
                    }
                    m_OA_WorkPlan.PlanComplany = this.txtShoukuandanwei.Value; 
                }
                else
                {
                    m_OA_WorkPlan.PlanComplany = "";
                }
                
                m_OA_WorkPlan.PlanContent = this.txtPlanContent.Value.Trim();
                m_OA_WorkPlan.PlanDataType = this.selPlanDataType.Value.ToInt32();
                m_OA_WorkPlan.PlanMoney = this.txtPlanMoney.Value.Trim().ToDecimal2()??0;
                m_OA_WorkPlan.PlanRemark = this.txtPlanRemark.Value.Trim();
                m_OA_WorkPlan.PlanRunTime = DateTime.Now;
 
                if (m_OA_WorkPlan.PlanDataType == 7)
                {
                    m_OA_WorkPlan.PlanTitle = this.selPlanTitle.Value.Trim();
                }
                else
                {
                    m_OA_WorkPlan.PlanTitle = this.txtPlanTitle.Value.Trim();
                }
                m_OA_WorkPlan.PlanType = 3;
                m_OA_WorkPlan.LastUpdateTime = nowTime;
 
                if (Request["keyid"].ToInt32() > 0)
                {
                    if (oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan))
                        JavaScript.MessageBox("更新成功", this, true, true);
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
                else
                {
                    if (oA_WorkReminderBll.InsertModel(m_OA_WorkPlan))
                        JavaScript.MessageBox("新增成功", this, true, true);
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}