username@email.com
2024-12-18 21a248a0cf76b6f05fcaac6f90975ef15ab607a1
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
/**  
* DemandDescribeEdit.aspx.cs
*
* 功 能: 需求信息编辑页
* 类 名: DemandDescribeEdit
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2013-4-12 9:23       吴崎均    初版
* V0.02  2013-4-17            吴崎均    修改Page_load方法为Target=GetDataById参数分配LoadModelById()方法
* V0.03  2013-5-3 10:24       吴崎均    修改关联字典表的字段存储值为MeanValue
*
*
*
*
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.Sys;
using CY.Model;
using CY.BLL.EC;
using CY.Infrastructure.Common;
using CY.WebForm.cs;
using CY.BLL;
 
namespace CY.WebForm.Pages.business
{
 
    /// <summary>
    /// 需求信息编辑
    /// </summary>
    public partial class DemandDescribeEdit : BasePage
    {
        private Sys_DictionaryBLL _sys_DictionaryBLL = null;//字典业务逻辑操作类对象
        private SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = null;//印刷业务类型业务逻辑操作类对象
        private EC_DemandDescribeBLL _eC_DemandDescribeBLL = null;//需求信息业务逻辑操作对象
        /// <summary>
        /// 初始化
        /// </summary>
        public DemandDescribeEdit()
        {
            _sys_DictionaryBLL = new Sys_DictionaryBLL();
            _eC_DemandDescribeBLL = new EC_DemandDescribeBLL();
            _sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                switch (Request["Target"])
                {
                    case "SaveInfo":
                        SaveDemandDescribe();
                        break;
                    case "GetDataById":
                        LoadModelById();
                        break;
 
                    default://一般情况不处理
 
                        InitPageData();
                        LoadModelById();
                        if (IsPostBack || IsCallback) return; else { }
 
                        return;
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                Response.Clear();
                Response.Write("-1");
            }
            Response.End();
        }
        /// <summary>
        /// 根据编号加载数据
        /// </summary>
        /// <returns></returns>
        private bool LoadModelById()
        {
            // DealMvc.Common.Net.DealString.ChangeSQL(Request["ParamName"])
            int? id = MyConvert.ConvertToInt32(Request["id"]);
            if (!id.HasValue) return false;
            EC_DemandDescribe eC_DemandDescribe = _eC_DemandDescribeBLL.SelectModleById(id.Value);
            string jmodel = null == eC_DemandDescribe ? "" : JsonHelper.GetJsonStringByObject(eC_DemandDescribe);
 
            //若是外部获取数据则输出jsonString
            if (!string.IsNullOrEmpty(Request["IsFrontRequest"]) && "frontTrue".Equals(Request["IsFrontRequest"]))
            {
                Response.Write(jmodel);
            }
            else
            {
                if (eC_DemandDescribe.State == 0)
                    selState.DataBind();//重新绑定
                else ;
 
                int? stateId = eC_DemandDescribe.State;
                btnSave.Disabled = stateId.HasValue && stateId.Value == 0;
                selState.Disabled = !stateId.HasValue || btnSave.Disabled;
 
                Request.RequestContext.RouteData.DataTokens.Add("jmodel", jmodel);
            }
            return true;
        }
        /// <summary>
        /// 保存信息
        /// </summary>
        private void SaveDemandDescribe()
        {
 
            if ("0".Equals(Request["State"])) { Response.Write("-2"); return; }//已发布的信息不能被修改
            EC_DemandDescribe demandDescribe = new EC_DemandDescribe();
            demandDescribe.Operator = CurrentUser.ShortName;
            demandDescribe.MemberId = CurrentUser.MemberId;
            bool isWin = WebUtil<EC_DemandDescribe>.SaveData(_eC_DemandDescribeBLL.AddData, _eC_DemandDescribeBLL.UpdateData, demandDescribe);
 
            if (isWin && !demandDescribe.Keyid.HasValue)
            {
                Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
                Sys_DictionaryBLL _sys_DictionaryBLL = new BLL.Sys.Sys_DictionaryBLL();
                isWin = _pay_PaymentAccountBLL.SendPoOrMoToMember(CurrentUser.MemberId,292, null);
            }
        }
        /// <summary>
        /// 初始化页面数据
        /// </summary>
        private void InitPageData()
        {
            selPrintTypes.DataSource = _sysInquiry_PrintingTypeBLL.SelectUsedModles();
            selState.DataSource = _sys_DictionaryBLL.GetDataByType("需求信息状态");
            selCallTypes.DataSource = _sys_DictionaryBLL.GetDataByType("通知类型");
 
            selPrintTypes.DataBind();
            selState.DataBind();
            selCallTypes.DataBind();
 
            selPrintTypes.Items.Add(new ListItem("请选择", ""));
            selPrintTypes.Value = "";
            selCallTypes.Value = "1";//默认为站内信息
            selState.Value = "0";
            selState.Items.Remove(selState.Items[selState.SelectedIndex]);//添加时没有有效这个状态
            selState.Value = "-1";//默认为未发布
 
        }
    }
}