wxw
2025-05-12 c2dc3bd2569f8398e2710aca2685bb3115c77eb0
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 System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;
using Model;
 
namespace BLL.DAL
{
    public class DAL_Alarm
    {
        public IList<WCSAlarmInfo> GetList(AjaxAlarmInfoList Json, ref PageInfo pageInfo)
        {
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("Select * from WCSAlarmInfo where IsDel=0 ");
 
                if (!string.IsNullOrWhiteSpace(Json.AlarmCode))
                {
                    strSql.Append(" and AlarmCode like '%" + Json.AlarmCode + "%'  ");
                }
                if (!string.IsNullOrWhiteSpace(Json.AlarmName))
                {
                    strSql.Append(" and AlarmName like '%" + Json.AlarmName + "%'  ");
                }
                DataTable dt = DataFactory.SqlDataBase().GetPageList(strSql.ToString(), null, "CreateTime", "Desc", ref pageInfo);
                return ModelConvertHelper<WCSAlarmInfo>.DataTableToModel(dt);
            }
            catch
            {
                throw new NotImplementedException();
            }
        }
 
        public bool AlarmDelete(string[] ID)
        {
            bool result = false;
            try
            {
                int dt = DataFactory.SqlDataBase().IsExist("Alarm", "ID", ID);
                if (dt >= ID.Length)
                {
                    int i = 0;
                    while (i < ID.Length)
                    {
                        StringBuilder sql = new StringBuilder();
                        sql.Append("update Alarm set IsDel=1 where Id='" + ID[i] + "'");
                        int _ret = DataFactory.SqlDataBase().ExecuteBySql(sql);
                        if (_ret >= ID.Length) result = true;
                        i++;
                    }
 
                }
                return result;
 
            }
            catch
            {
                return result;
            }
        }
 
        public bool AlarmDispose(string[] ID, string loginUser)
        {
            bool result = false;
            try
            {
                int dt = DataFactory.SqlDataBase().IsExist("Alarm", "ID", ID);
                if (dt >= ID.Length)
                {
                    int i = 0;
                    while (i < ID.Length)
                    {
                        StringBuilder sql = new StringBuilder();
                        sql.Append("update Alarm set State = 1,UpdateUser = '" + loginUser + "',UpdateTime = getdate() where Id='" + ID[i] + "'");
                        int _ret = DataFactory.SqlDataBase().ExecuteBySql(sql);
                        if (_ret >= ID.Length) result = true;
                        i++;
                    }
 
                }
                return result;
 
            }
            catch
            {
                return result;
            }
        }
    }
}