username@email.com
2021-09-02 9da546cd8de37882147f19f6f090544476bfe5ae
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
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.Query;
 
namespace CY.WebForm.Pages.workcar
{
    //吴辉
    //车辆管理
    public partial class CarManageAdd : BasePage
    {
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
        OA_CarManageBll oA_WorkReminderBll = null;
 
        public CarManageAdd()
        {
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
            oA_WorkReminderBll = new OA_CarManageBll();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.selCarCondition.DataSource = bll_Sys_DictionaryBLL.GetDataByType("车辆状态");
                this.selCarCondition.DataTextField = "Name";
                this.selCarCondition.DataValueField = "MeanValue";
                this.selCarCondition.DataBind();
 
                InitData();
            }
        }
 
        //数据加载
        public void InitData()
        {
            OA_CarManage m_OA_CarManage = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
            if (m_OA_CarManage != null)
            {
                this.selCarType.Value = m_OA_CarManage.CarType;
                this.selCarCondition.Value = m_OA_CarManage.CarCondition.ToString2();
                this.txtCarNumber.Value = m_OA_CarManage.CarNumber;
                this.txtNowMileage.Value = m_OA_CarManage.NowMileage.ToString2();
                this.txtNowMileage.Attributes.Add("min", m_OA_CarManage.StartMileage.ToString2());
                this.txtOrderNum.Value = m_OA_CarManage.OrderNum.ToString2();
            }
        }
 
        //表单提交
        protected void btn_submit_form(object sender, EventArgs e)
        {
            try
            {
                DateTime nowTime = DateTime.Now;
                OA_CarManage m_OA_CarManage = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                if (m_OA_CarManage == null)
                {
                    m_OA_CarManage = new OA_CarManage();
                    m_OA_CarManage.MemberID = CurrentUser.MemberId;
                    m_OA_CarManage.StartMileage = this.txtNowMileage.Value.ToInt32();
                }
                m_OA_CarManage.CarCondition = this.selCarCondition.Value.ToInt32();
                m_OA_CarManage.CarNumber = this.txtCarNumber.Value;
                m_OA_CarManage.CarType = this.selCarType.Value;
                m_OA_CarManage.NowMileage = this.txtNowMileage.Value.ToInt32();
                m_OA_CarManage.OrderNum = this.txtOrderNum.Value.ToInt32();
 
                m_OA_CarManage.Operator = CurrentUser.ShortName;
                m_OA_CarManage.LastUpdateTime = nowTime;
 
                if (Request["keyid"].ToInt32() > 0)
                {
                    if (oA_WorkReminderBll.UpdateModel(m_OA_CarManage))
                        JavaScript.MessageBox("更新成功", this, true, true);
                    else
                        JavaScript.MessageBox("更新失败", this);
                }
                else
                {
                    if (oA_WorkReminderBll.InsertModel(m_OA_CarManage))
                        JavaScript.MessageBox("新增成功", this, true, true);
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}