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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
using System.Text;
using CY.BLL.OA;
using CY.BLL.EC;
using System.Collections;
using System.Globalization;
using System.IO;
using CY.Infrastructure.Configuration;
 
namespace CY.WebForm.Pages.business
{
    public partial class OrderKehuqianshou : BasePage
    {
        private EC_OrderBLL _eC_OrderBLL = null;
 
        private OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
        private EC_OrderBasicBLL _eC_OrderBasicBLL = null;
 
 
        private OA_StaffBLL _StaffBLL = null;
        OA_KaipiaoshenqingBLL oA_KaipiaoshenqingBLL = null;
        public OrderKehuqianshou()
        {
 
            bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
            _StaffBLL = new OA_StaffBLL();
            _eC_OrderBasicBLL = new EC_OrderBasicBLL();
            oA_KaipiaoshenqingBLL = new OA_KaipiaoshenqingBLL();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    try
                    {
                        string orderIds = Request["id"];
                        if (string.IsNullOrEmpty(orderIds))
                        {
                            JavaScript.MessageBox("订单不存在!", this);
                            return;
                        }
 
                        this.ids.Value = orderIds;
                        OA_Kaipiaoshenqing oA_Kaipiaoshenqing = oA_KaipiaoshenqingBLL.GetModelByKeyid(orderIds.ToGuid2());
                        OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.SelectModelByFirmIdandMemberId(CurrentUser.MemberId, oA_Kaipiaoshenqing.BuyerId);
 
                        this.txtBuyerName.InnerText = m_OA_CorporateClients.CompanyName;
                        OA_Staff oA_Staff = _StaffBLL.GetModelByKeyid(oA_Kaipiaoshenqing.BusinessManagerId);
                        if (oA_Staff != null)
                        {
                            this.txtBusinessManager.InnerText = oA_Staff.Name;
                        }
                        this.txtkaipiaoshijian.InnerText = oA_Kaipiaoshenqing.KaipiaoquerenTime.HasValue? oA_Kaipiaoshenqing.KaipiaoquerenTime.Value.ToString("yyyy-MM-dd"):"";
                        //this.txtSellerOrderId.InnerText = oA_Kaipiaoshenqing.SellerOrderId;
                        this.txtshuliang.InnerText = oA_Kaipiaoshenqing.Dingdanshu.ToString();
 
                        this.txtFapiaohao.InnerText = oA_Kaipiaoshenqing.Fapiaohao.ToString();
 
 
                        this.txtjine.InnerText = String.Format("{0:F}", oA_Kaipiaoshenqing.kpmoney + oA_Kaipiaoshenqing.Zengjianmoney);
 
 
                    }
                    catch (Exception ex)
                    {
                        PAGEHandleException(ex);
                        JavaScript.MessageBox("订单不存在!", this);
                    }
                }
 
 
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                Response.Clear();
                Response.Write("-1");
            }
            //Response.End();
        }
 
 
        //提交事件
        protected void btn_Submit_Config(object sender, EventArgs e)
        {
 
 
            try
            {
                var files = Request.Files;
                if (files.Count <= 0)
                {
                    JavaScript.MessageBox("请选择文件!", this);
                    return;
                }
 
 
                HttpPostedFile file = null;
 
 
 
                for (int i = 0; i < files.Count; i++)
                {
 
                    if (files.Keys[i] == "filesel")
                    {
                        file = files[i];
                        if (file.ContentLength == 0)
                        {
                            JavaScript.MessageBox("请选择文件!", this);
                            return;
                        }
 
                        break;
                    }
 
                }
 
 
                string WebDomain = ConfigurationSetting.TuPianLuJing;
                //根目录路径,相对路径
                String savePath = "/images/WorkBook/" + DateTime.Now.ToString("yyyyMMdd") + "/";
                //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
                String saveUrl = ConfigurationSetting.TuPianLuJing.TrimEnd('/') + "/images/WorkBook/" + DateTime.Now.ToString("yyyyMMdd") + "/";
 
                string fileTypes = "gif,jpg,jpeg,png,bmp";
                double maxSize = 2 * 1024 * 1024;
 
 
                string dirPath = Server.MapPath("~" + savePath);
                if (!Directory.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath);
                }
 
                string fileName = file.FileName;
                string fileExt = Path.GetExtension(fileName).ToLower();
 
                ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(','));
 
 
                if (file.InputStream == null || file.InputStream.Length > maxSize)
                {
                    JavaScript.MessageBox("上传文件大小超过限制", this);
 
                }
 
                if (string.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1)
                {
                    JavaScript.MessageBox("上传文件扩展名是不允许的扩展名", this);
 
                }
 
                string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
                string filePath = dirPath + newFileName;
                file.SaveAs(filePath);
                string fileUrl = savePath + newFileName;
 
 
                Guid Keyid = Request["ids"].ToGuid2();
 
 
                DateTime Kehuqianshou = DateTime.Now;
 
                OA_Kaipiaoshenqing oA_Kaipiaoshenqing = oA_KaipiaoshenqingBLL.GetModelByKeyid(Keyid);
 
 
                oA_Kaipiaoshenqing.KehuqianshouCreater = CurrentUser.TrueMemberId;
                oA_Kaipiaoshenqing.KehuqianshouTime = Kehuqianshou;
                oA_Kaipiaoshenqing.Kehuqianshou = 2;
                oA_Kaipiaoshenqing.Kehuqianshoutupian = fileUrl;
 
 
 
                bool result = oA_KaipiaoshenqingBLL.UpdateModel(oA_Kaipiaoshenqing);
 
                if (result)
                    JavaScript.MessageBox("更新成功", this, true, true);
                else
                    JavaScript.MessageBox("更新失败", this);
 
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}