username@email.com
2025-05-14 99ddfbcecf0fa2881eb3a91028257eef87dab6de
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
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.soft
{
    //吴辉
    //新增/修改软件订单    
    public partial class OrderAdd : BasePage
    {
        Soft_OrderBLL bll_Soft_OrderBLL = null;
 
        //初始化
        public OrderAdd()
        {
            bll_Soft_OrderBLL = new Soft_OrderBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }
 
        //数据加载
        public void InitData()
        {
            Soft_Order m_Soft_Order = bll_Soft_OrderBLL.GetModelByKeyid(Request["keyid"].ToInt32());
            if (m_Soft_Order != null)
            {
                this.txtClientId.Value = m_Soft_Order.ClientId.ToString2();
                   this.txtClientName.Value = m_Soft_Order.ClientName.ToString2();
                   this.txtSoftId.Value = m_Soft_Order.SoftId.ToString2();
                   this.txtSoftName.Value = m_Soft_Order.SoftName.ToString2();
                   this.txtKeyCode.Value = m_Soft_Order.KeyCode.ToString2();
                   this.txtOrderMoney.Value = m_Soft_Order.OrderMoney.ToString2();
                   this.txtOrderReceiveMoney.Value = m_Soft_Order.OrderReceiveMoney.ToString2();
                   this.txtOrderStatus.Value = m_Soft_Order.OrderStatus.ToString2();
                   this.txtOrderNum.Value = m_Soft_Order.OrderNum.ToString2();
                   this.txtCreatTime.Value = m_Soft_Order.CreatTime.ToString2();
                   this.txtLastUpdateTime.Value = m_Soft_Order.LastUpdateTime.ToString2();
                   this.txtOperator.Value = m_Soft_Order.Operator.ToString2();
                   }
               else
               {
                   this.txtClientId.Value = "";
               this.txtClientName.Value = "";
               this.txtSoftId.Value = "";
               this.txtSoftName.Value = "";
               this.txtKeyCode.Value = "";
               this.txtOrderMoney.Value = "";
               this.txtOrderReceiveMoney.Value = "";
               this.txtOrderStatus.Value = "";
               this.txtOrderNum.Value = "";
               this.txtCreatTime.Value = "";
               this.txtLastUpdateTime.Value = "";
               this.txtOperator.Value = "";
                              }
        }
 
        //表单提交
        protected void btn_submit_form(object sender, EventArgs e)
        {
            try
            {
                DateTime nowTime = DateTime.Now;
                Soft_Order m_Soft_Order = bll_Soft_OrderBLL.GetModelByKeyid(Request["keyid"].ToInt32());
                if (m_Soft_Order == null)
                {
                    m_Soft_Order = new Soft_Order();
                }
                
                m_Soft_Order.ClientId = this.txtClientId.Value.ToInt32();
                m_Soft_Order.ClientName = this.txtClientName.Value.ToString2();
                m_Soft_Order.SoftId = this.txtSoftId.Value.ToInt32();
                m_Soft_Order.SoftName = this.txtSoftName.Value.ToString2();
                m_Soft_Order.KeyCode = this.txtKeyCode.Value.ToString2();
                m_Soft_Order.OrderMoney = this.txtOrderMoney.Value.ToInt32();
                m_Soft_Order.OrderReceiveMoney = this.txtOrderReceiveMoney.Value.ToInt32();
                m_Soft_Order.OrderStatus = this.txtOrderStatus.Value.ToInt32();
                m_Soft_Order.OrderNum = this.txtOrderNum.Value.ToString2();
                m_Soft_Order.CreatTime = this.txtCreatTime.Value.ToDateTime2();
                m_Soft_Order.LastUpdateTime = this.txtLastUpdateTime.Value.ToDateTime2();
                m_Soft_Order.Operator = this.txtOperator.Value.ToString2();
                                
                if (Request["keyid"].ToInt32() > 0)
                {
                    if (bll_Soft_OrderBLL.UpdateModel(m_Soft_Order))
                        JavaScript.MessageBox("更新成功", this, true, true);
                    else
                        JavaScript.MessageBox("更新失败", this);
                }
                else
                {
                    if (bll_Soft_OrderBLL.InsertModel(m_Soft_Order))
                    {
                        JavaScript.MessageBox("新增成功", this, false, true);
                        InitData();
                    }
                    else
                        JavaScript.MessageBox("新增失败", this);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}