username@email.com
2025-05-21 a980cd04341d71216e0f59bd4b7327fe9fc50032
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL.Inquiry;
using CY.Model;
using System.Data.SqlClient;
using System.Data;
 
namespace CY.SQLDAL
{
    public class SysInquiry_SignboardInfoDAL : ISysInquiry_SignboardInfoDAL
    {
        private Database _dataBase = null;
 
        public SysInquiry_SignboardInfoDAL()
        {
            _dataBase = new Database();
        }
 
        public IEnumerable<Model.SysInquiry_SignboardInfo> SelectModelPage(string characterName, string thickness, string status, Infrastructure.Query.Pagination pagination)
        {
            string condition = string.Empty;
            condition = " 1=1 ";
            if (!string.IsNullOrEmpty(characterName))
            {
                condition += " and characterName like '%" + characterName + "%' ";
            }
            if (!string.IsNullOrEmpty(thickness))
            {
                condition += " and thickness like '%" + thickness + "%' ";
            }
            if (!string.IsNullOrEmpty(status))
            {
                condition += " and Status='" + status + "'";
            }
            return _dataBase.SelectModelPage<SysInquiry_SignboardInfo>(pagination, "*", "SysInquiry_SignboardInfo", "OrderNum", "OrderNum", condition);
        }
 
        public Model.SysInquiry_SignboardInfo SelectModelByKey(int keyid)
        {
            string condition = string.Empty;
            condition = " KeyId=" + keyid;
            IList<SysInquiry_SignboardInfo> result = _dataBase.SelectModel<SysInquiry_SignboardInfo>("*", "SysInquiry_SignboardInfo", condition);
            return null == result || result.Count == 0 ? null : result[0];
        }
 
        public int GetOrderNumByMax()
        {
            int orderNum = 1;
            try
            {
                IList<SysInquiry_SignboardInfo> result = _dataBase.SelectModel<SysInquiry_SignboardInfo>(" MAX(OrderNum)+1 AS OrderNum ", "SysInquiry_SignboardInfo", "");
                if (result != null && result.Count > 0)
                {
                    orderNum = result[0].OrderNum;
                }
            }
            catch
            {
                orderNum = 1;
            }
            return orderNum;
        }
 
        public IList<Model.SysInquiry_SignboardInfo> GetModelList()
        {
            string condition = string.Empty;
            condition = " Status='true' order by orderNum ";
            IList<SysInquiry_SignboardInfo> result = _dataBase.SelectModel<SysInquiry_SignboardInfo>("*", "SysInquiry_SignboardInfo", condition);
 
            return result;
        }
 
        public IList<string> GetCharacterNameList()
        {
            IList<string> characterNameList = new List<string>();
            string condition = " Status='true' order by orderNum ";
            IList<SysInquiry_SignboardInfo> result = _dataBase.SelectModel<SysInquiry_SignboardInfo>("CharacterName", "SysInquiry_SignboardInfo", condition);
            if (result != null && result.Count > 0)
            {
                foreach (SysInquiry_SignboardInfo model in result)
                {
                    if (!characterNameList.Contains(model.CharacterName))
                    characterNameList.Add(model.CharacterName);
                }
            }
            return characterNameList;
        }
 
        public bool InserModel(Infrastructure.Domain.IAggregateRoot model)
        {
            Model.SysInquiry_SignboardInfo trueModel = model as Model.SysInquiry_SignboardInfo;
            if (trueModel == null)
            {
                return false;
            }
            IList<SqlParameter> sqlParms = new List<SqlParameter>()
            {
                    new SqlParameter("@CharacterName",trueModel.CharacterName),
                    new SqlParameter("@Thickness",trueModel.Thickness),
                    new SqlParameter("@Status",trueModel.Status),
                    new SqlParameter("@OrderNum",trueModel.OrderNum)
            };
            try
            {
                _dataBase.Query("SysInquiry_SignboardInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray<SqlParameter>());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return true;
        }
 
        public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model)
        {
            Model.SysInquiry_SignboardInfo trueModel = model as Model.SysInquiry_SignboardInfo;
            if (trueModel == null)
            {
                return false;
            }
            IList<SqlParameter> sqlParms = new List<SqlParameter>()
            {
                    new SqlParameter("@KeyId",trueModel.KeyId),
                    new SqlParameter("@CharacterName",trueModel.CharacterName),
                    new SqlParameter("@Thickness",trueModel.Thickness),
                    new SqlParameter("@Status",trueModel.Status),
                    new SqlParameter("@OrderNum",trueModel.OrderNum)
            };
            try
            {
                _dataBase.Query("SysInquiry_SignboardInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray<SqlParameter>());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return true;
        }
 
        public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model)
        {
            throw new NotImplementedException();
        }
 
        /// <summary>
        /// 判断是否有重复的
        /// </summary>
        /// <param name="characterName"></param>
        /// <param name="thickness"></param>
        /// <returns></returns>
        public bool IsExist(string characterName, string thickness)
        {
            bool isExist = false;
            string condition = " characterName='" + characterName + "' and thickness='" + thickness + "' ";
            IList<SysInquiry_SignboardInfo> result = _dataBase.SelectModel<SysInquiry_SignboardInfo>("*", "SysInquiry_SignboardInfo", condition);
            if (result != null && result.Count > 0)
            {
                isExist = true;
            }
            return isExist;
        }
    }
}