username@email.com
2025-05-15 9be7596c0b251c392ab0788f3d18806502c6ee76
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
using CY.Infrastructure.Common;
using CY.Infrastructure.Logging;
using CY.Model.OA;
using CY.SQLDAL;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static CY.WebForm.MainPage;
 
namespace CY.WebForm.Pages.business
{
    public partial class DeliverPlanFujianShow : System.Web.UI.Page
    {
        /// <summary>
        /// 合同附件集合
        /// </summary>
        List<OA_CorporateClientsContract> fileDataList { set; get; } = new List<OA_CorporateClientsContract>();
        protected void Page_Load(object sender, EventArgs e)
        {
            ReadList();
        }
 
 
        private void ReadList()
        {
 
            Guid Keyid = Request["Keyid"].ToGuid2();
 
            string AttachmentType = Request["AttachmentType"];
 
            if (Keyid == null)
            {
                JavaScript.MessageBox("未找到该客户", this, false, false);
                return;
            }
            Database DC = new Database();
            string sqlStr = string.Format(@"     select * from  [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]={1} order by [CreateTime]   ", Keyid, AttachmentType);
            int count = 0;
            try
            {
                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
                sqlStr = string.Format("select  count(*) from [dbo].[OA_attachment] where [OA_Id]='{0}' and [AttachmentType]=3 ", Keyid);
                myCmd = new SqlCommand(sqlStr, DC.Connection);
                count = (int)myCmd.ExecuteScalar();
 
 
            }
            catch (Exception ee)
            {
                new Log4NetAdapter().Log("查找送货单图片出错:" + ee.Message);
 
            }
            finally
            {
                if (DC.Connection.State != System.Data.ConnectionState.Closed)
                    DC.Connection.Close();
            }
 
 
 
 
            this.RepClientList.DataSource = fileDataList;// fileDataList.AsEnumerable<OA_CorporateClientsContract>();
 
            this.RepClientList.DataBind();
 
           
        }
    }
}