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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.Config;
using CY.BLL.OA;
using CY.BLL.Sys;
using CY.Model;
using CY.Infrastructure.Common;
 
namespace CY.WebForm.Pages.sysglobal
{
    //吴辉
    //快递单模版
    public partial class ExSingleTemEdit : BasePage
    {
        EC_ExSingleTemBLL bll_EC_ExSingleTemBLL = null;
        Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
 
        //初始化
        public ExSingleTemEdit()
        {
            bll_EC_ExSingleTemBLL = new EC_ExSingleTemBLL();
            bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindType();
            }
        }
 
        //绑定快递单类型
        public void BindType()
        {
            this.selEMSType.DataSource = bll_Sys_DictionaryBLL.GetDataByType("快递单模版");
            this.selEMSType.DataValueField = "Name";
            this.selEMSType.DataTextField = "Name";
            this.selEMSType.DataBind();
            this.selEMSType.Items.Insert(0, new ListItem("请选择", ""));
        }
 
        //数据绑定
        public void BindData()
        {
            EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(this.selEMSType.SelectedValue);
            if (m_EC_ExSingleTem != null)
            {
                this.txtEST_Width.Value = m_EC_ExSingleTem.EST_Width.ToString();
                this.txtEST_Height.Value = m_EC_ExSingleTem.EST_Height.ToString();
                this.hideBackground.Value = m_EC_ExSingleTem.EST_Background.ToString();
                this.hideHtml.Value = m_EC_ExSingleTem.EST_Html;
            }
            else
            {
                this.txtEST_Width.Value = "0";
                this.txtEST_Height.Value = "0";
                this.hideBackground.Value = "";
                this.hideHtml.Value = "";
            }
        }
 
        //类型选择
        protected void ChangeTypeBindData(object sender, EventArgs e)
        {
            BindData();
        }
 
        //提交背景
        protected void btn_SubmitBackground(object sender, EventArgs e)
        {
            //网站图标上传
            CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload("Background", this.hideBackground.Value);
            if (_UpFileResult1.returnerror.Count == 0)
            {
                if (_UpFileResult1.returnfilename.Count > 0)
                {
                    //this.All_Html.InnerHtml = Request["oldHtml"].ToString();
                    this.TopDIV.Style.Add("background-image", "url('" + _UpFileResult1.returnfilename[0].ToString2() + "')");
                    System.Drawing.Image bacImg = System.Drawing.Image.FromFile(Server.MapPath(_UpFileResult1.returnfilename[0].ToString2()));
                    this.TopDIV.Style.Add("width", bacImg.Width.ToString2() + "px");
                    this.TopDIV.Style.Add("height", bacImg.Height.ToString2() + "px");
                    this.txtEST_Width.Value = bacImg.Width.ToString2();
                    this.txtEST_Height.Value = bacImg.Height.ToString2();
                    this.hideBackground.Value = _UpFileResult1.returnfilename[0].ToString2();
                }
            }
        }
 
        //保存快递单
        protected void SaveAsThisSore(object sender, EventArgs e)
        {
            EC_ExSingleTem m_EC_ExSingleTem = bll_EC_ExSingleTemBLL.GetModelByType(this.selEMSType.SelectedValue);
            if (m_EC_ExSingleTem == null)
                m_EC_ExSingleTem = new EC_ExSingleTem();
 
            m_EC_ExSingleTem.EST_Background = this.hideBackground.Value.ToString();
            m_EC_ExSingleTem.EST_Height = this.txtEST_Height.Value.ToInt32();
            m_EC_ExSingleTem.EST_Html = this.hideHtml.Value;
            m_EC_ExSingleTem.EST_IsUse = true;
            m_EC_ExSingleTem.EST_Name = this.selEMSType.SelectedValue;
            m_EC_ExSingleTem.EST_Type = this.selEMSType.SelectedValue;
            m_EC_ExSingleTem.EST_Width = this.txtEST_Width.Value.ToInt32();
            m_EC_ExSingleTem.LastUpdateTime = DateTime.Now;
            m_EC_ExSingleTem.MemberId = CurrentUser.MemberId;
            m_EC_ExSingleTem.Operator = CurrentUser.ShortName;
            m_EC_ExSingleTem.OrderNum = 0;
 
            if (m_EC_ExSingleTem.Keyid > 0)
            {
                if (bll_EC_ExSingleTemBLL.UpdateModel(m_EC_ExSingleTem))
                    JavaScript.MessageBox("保存成功", this);
                else
                    JavaScript.MessageBox("保存失败", this);
            }else
                if (bll_EC_ExSingleTemBLL.InsertModel(m_EC_ExSingleTem))
                    JavaScript.MessageBox("保存成功", this);
                else
                    JavaScript.MessageBox("保存失败", this);
        }
    }
}