username@email.com
2025-05-15 6fe02a16e55f17e45a3997171e1b2284d45af25b
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Model;
using CY.Infrastructure.Common;
using CY.Infrastructure.Query;
using CY.BLL.OA;
using CY.BLL.Sys;
 
namespace CY.WebForm.Pages.procurement
{
    public partial class CargoSpaceEdit : BasePage
    {
 
        OA_CargoSpace CargoSpace = null;
        OA_CargoSpaceBLL _OA_CargoSpaceBLL = null;
        Sys_DictionaryBLL _Sys_DictionaryBLL = null;
        OA_WarehouseInfoBLL _OA_WarehouseInfoBLL = null;
        OA_BrandBLL _OA_BrandBLL = null;
        public CargoSpaceEdit()
        {
            _Sys_DictionaryBLL = new Sys_DictionaryBLL();
            _OA_WarehouseInfoBLL = new OA_WarehouseInfoBLL();
            CargoSpace = new OA_CargoSpace();
            _OA_CargoSpaceBLL = new OA_CargoSpaceBLL();
            _OA_BrandBLL = new OA_BrandBLL();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.txtOrderNum.Value = _OA_BrandBLL.GetMaxOrderNumMemberId(CurrentUser.MemberId, " OA_CargoSpace");
                InitialSelData();
                if (Request["Keyid"].ToInt32() > 0)
                {
                    InitialModifyData();
                }
 
            }
        }
        /// <summary>
        /// 绑定下拉列表数据
        /// </summary>
        public void InitialSelData()
        {
            selWarehouseId.DataSource = _OA_WarehouseInfoBLL.getAllWarehouseInfo(CurrentUser.MemberId);
            selWarehouseId.DataTextField = "WarehouseName";
            selWarehouseId.DataValueField = "Keyid";
            selWarehouseId.DataBind();
 
            selStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("货位状态");
            selStatus.DataValueField = "Keyid";
            selStatus.DataTextField = "Name";
            selStatus.DataBind();
        }
        /// <summary>
        /// 绑定要修改的数据
        /// </summary>
        protected void InitialModifyData()
        {
            CargoSpace = _OA_CargoSpaceBLL.getSingleModel(Request["Keyid"].ToString2());
            this.txtWidth.Value = CargoSpace.Width.ToString2();
            this.txtHeight.Value = CargoSpace.Height.ToString2();
            this.txtLength.Value = CargoSpace.Length.ToString2();
            this.txtName.Value = CargoSpace.Name;
            this.selStatus.Value = CargoSpace.StatusId.ToString2();
            this.selWarehouseId.Value = CargoSpace.WarehouseId.ToString2();
            this.txtOrderNum.Value = CargoSpace.OrderNum.ToString2();
        }
 
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            if (Request["Keyid"].ToInt32() > 0)
            {
                CargoSpace = _OA_CargoSpaceBLL.getSingleModel(Request["Keyid"].ToString2());
            }
            CargoSpace.LastUpdateTime = DateTime.Now;
            CargoSpace.Remark = "";
            CargoSpace.StatusId = this.selStatus.Value.ToInt32();
            CargoSpace.Length = this.txtLength.Value.ToInt32();
            CargoSpace.Height = this.txtHeight.Value.ToInt32();
            CargoSpace.Width = this.txtWidth.Value.ToInt32();
            CargoSpace.Operator = this.CurrentUser.ShortName;
            CargoSpace.Name = this.txtName.Value;
            CargoSpace.WarehouseId = this.selWarehouseId.Value.ToInt32();
            CargoSpace.MemberId = this.CurrentUser.MemberId;
            CargoSpace.OrderNum = this.txtOrderNum.Value.ToInt32();
            if (Request["Keyid"].ToInt32() > 0)
            {
                if (_OA_CargoSpaceBLL.UpdateModel(CargoSpace))
                    JavaScript.RefreshDIVOpener(this);
                else
                    JavaScript.MessageBox("修改失败", this);
 
            }
            else
            {
                if (_OA_CargoSpaceBLL.InsertModel(CargoSpace))
                    JavaScript.RefreshDIVOpener(this);
                else
                    JavaScript.MessageBox("添加失败", this);
            }
        }
    }
}