username@email.com
2025-03-13 0fb5eab0d6787922d3e915543e95fe5073d767ff
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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 CY.BLL.OA;
using CY.BLL.EC;
using CY.BLL.Inquiry;
using CY.Model.Inquiry;
using System.Drawing;
using CY.Model.OA;
using CY.SQLDAL;
using System.Data.SqlClient;
using CY.Infrastructure.Logging;
 
namespace CY.WebForm.Pages.business
{
    public partial class DeliverPlanDakaList : BasePage
    {
 
        OA_DriverRecordBLL _oA_DriverRecordBLL = null;
       
        OA_CarManageBll _OA_CarManageBll = null;
        
 
 
        //初始化
        public DeliverPlanDakaList()
        {
 
            _oA_DriverRecordBLL = new OA_DriverRecordBLL();
            
            _OA_CarManageBll = new OA_CarManageBll();
            
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
            if (!IsPostBack)
            {
                
 
            
                switch (Request["Target"])
                {
                    
                    case "AcceptOrderAll":
                       
                        break;
                    case "AcceptOrderAll2":
                       
                        break; 
                    default:
                        InitialSelectData();
                        BindList();
                        return;
                }
                Response.End();
            }
        }
 
 
        //加载查询条件
        protected void InitialSelectData()
        {
            
 
            this.selCarId.DataSource = _OA_CarManageBll.SelectListByFirmId(CurrentUser.MemberId);
            this.selCarId.DataTextField = "CarNumber";
            this.selCarId.DataValueField = "Keyid";
            this.selCarId.DataBind();
            this.selCarId.Items.Insert(0, new ListItem("全部", ""));
 
 
            this.txtCreatTimestart.Value = DateTime.Now.ToString("yyyy-MM-dd");
            this.txtCreatTimeend.Value = DateTime.Now.ToString("yyyy-MM-dd");
 
        }
 
        //分页事件
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
 
        //查询事件
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            BindList();
        }
       
 
        //绑定列表
        private void BindList()
        {
             
 
 
            
 
 
            Pagination pa = new Pagination();
            pa.PageSize = UCPager1.AspNetPager.PageSize;
            pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
 
            IEnumerable<OA_DriverRecord> oA_DriverRecords = _oA_DriverRecordBLL.SelectModelPage(pa,
                this.txtCreatTimestart.Value,
                 this.txtCreatTimeend.Value,
                 this.selCarId.Value,
                this.txtCreater.Value,
                this.selClockType.Value
              );
 
            Database DC = new Database();
 
            try
            {
                List<OA_CorporateClientsContract> fileDataList = null;
                foreach (var oA_DriverRecord in oA_DriverRecords)
                {
                    if (string.IsNullOrEmpty(oA_DriverRecord.MileageImg))
                    {
                        oA_DriverRecord.MileageImgName = "";
                    }
                    else
                    {
                        oA_DriverRecord.MileageImgName = "<img src=\"" + oA_DriverRecord.MileageImg + "\" width=\"20\" height=\"20\" >";
                    }
 
 
 
                   
 
                    string sqlStr = string.Format(@"     select * from  [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]=4 order by [CreateTime]   ", oA_DriverRecord.Id);
 
                    SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
                    //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
                    var a = myCmd.ExecuteReader();
                    //myDa.Dispose();
                    fileDataList = new List<OA_CorporateClientsContract>();
                    OA_CorporateClientsContract Contract;
                    var i = 1;
                    while (a.Read())
                    {   //注意如何将每次读取到的记录添加到listbox1中(因为第一次做时出错了,嘿嘿)
                        Contract = new OA_CorporateClientsContract();
                        // Contract.Keyid = a.GetInt32(0);
                        //Contract.CorporateClientsid = a.GetGuid(1);
                        //Contract.CorporateClientsName = a.GetString(4);
                        Contract.FileName = a[4].ToString();
                        Contract.PageCode = i;
                        Contract.FilePath = a.GetString(2);
                        // Contract.Remark = a.GetString(6);
                        i += 1;
 
                        fileDataList.Add(Contract);
                    }
                    a.Close();     //关闭sqldatareader
 
                    if (fileDataList.Count > 0)
                    {
                        oA_DriverRecord.ZhuangcheImg = "<img src=\"" + fileDataList[0].FilePath + "\" width=\"20\" height=\"20\" >";
                    }
                    else
                    {
                        oA_DriverRecord.ZhuangcheImg = "";
                    }
 
 
 
 
                    sqlStr = string.Format(@"     select * from  [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]=5 order by [CreateTime]   ", oA_DriverRecord.Id);
 
                    myCmd = new SqlCommand(sqlStr, DC.Connection);
                    //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
                    a = myCmd.ExecuteReader();
                    //myDa.Dispose();
                    fileDataList = new List<OA_CorporateClientsContract>();
                    i = 1;
                    while (a.Read())
                    {   //注意如何将每次读取到的记录添加到listbox1中(因为第一次做时出错了,嘿嘿)
                        Contract = new OA_CorporateClientsContract();
                        // Contract.Keyid = a.GetInt32(0);
                        //Contract.CorporateClientsid = a.GetGuid(1);
                        //Contract.CorporateClientsName = a.GetString(4);
                        Contract.FileName = a[4].ToString();
                        Contract.PageCode = i;
                        Contract.FilePath = a.GetString(2);
                        // Contract.Remark = a.GetString(6);
                        i += 1;
 
                        fileDataList.Add(Contract);
                    }
                    a.Close();     //关闭sqldatareader
 
                    if (fileDataList.Count > 0)
                    {
                        oA_DriverRecord.CarConditionImg = "<img src=\"" + fileDataList[0].FilePath + "\" width=\"20\" height=\"20\" >";
                    }
                    else
                    {
                        oA_DriverRecord.CarConditionImg = "";
                    }
 
 
                }
            }
            catch (Exception ee)
            {
                new Log4NetAdapter().Log("查找送货单图片出错:" + ee.Message);
 
            }
            finally
            {
                if (DC.Connection.State != System.Data.ConnectionState.Closed)
                    DC.Connection.Close();
            }
 
 
            this.RepClientList.DataSource = oA_DriverRecords;
            this.RepClientList.DataBind();
            UCPager1.AspNetPager.RecordCount = pa.RecordCount;
        }
 
        
 
 
        
    }
}