1
yangpeixing
2026-03-02 4a1765ea61fb8706bddbf90b91b310e2ce0e9f7d
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
using WIDESEA_Core.Helper;
 
namespace WIDESEA_BasicService
{
    public partial class RoadwayInfoService : ServiceBase<Dt_RoadwayInfo, IRoadwayInfoRepository>, IRoadwayInfoService
    {
        public RoadwayInfoService(IRoadwayInfoRepository BaseDal) : base(BaseDal)
        {
        }
 
        public IRoadwayInfoRepository Repository => BaseDal;
 
        public override WebResponseContent AddData(SaveModel saveModel)
        {
            Dt_RoadwayInfo roadwayInfo = saveModel.MainData.DicToModel<Dt_RoadwayInfo>();
            return base.AddData(roadwayInfo);
        }
 
        public override WebResponseContent UpdateData(SaveModel saveModel)
        {
            var id = saveModel.MainData["id"].ObjToInt();
            var areaId = saveModel.MainData["areaId"].ObjToInt();
            var roadwayNo = saveModel.MainData["roadwayNo"].ToString();
            var deviceNo = saveModel.MainData["deviceNo"].ToString();
            var inStationCode = saveModel.MainData["inStationCode"].ToString();
            var inSCStationCode = saveModel.MainData["inSCStationCode"].ToString();
            var outStationCode = saveModel.MainData["outStationCode"].ToString();
            var outSCStationCode = saveModel.MainData["outSCStationCode"].ToString();
            Dt_RoadwayInfo roadwayInfo = BaseDal.QueryFirst(x => x.Id == id);
            roadwayInfo.AreaId = areaId;
            roadwayInfo.RoadwayNo = roadwayNo;
            roadwayInfo.DeviceNo = deviceNo;
            roadwayInfo.InSCStationCode = inSCStationCode;
            roadwayInfo.OutStationCode = outStationCode;
            roadwayInfo.OutSCStationCode = outSCStationCode;
            return base.UpdateData(roadwayInfo);
        }
 
        public override WebResponseContent DeleteData(object[] keys)
        {
            return base.DeleteData(keys);
        }
 
        public WebResponseContent RoadwayEnableStatus(int[] keys)
        {
            List<Dt_RoadwayInfo> roadwayInfos = Repository.QueryData(x => keys.Contains(x.Id));
            roadwayInfos.ForEach(x =>
            {
                x.EnableStatus = EnableEnum.Enable.ObjToInt();
            });
            Repository.UpdateData(roadwayInfos);
 
            return WebResponseContent.Instance.OK();
        }
 
        public WebResponseContent RoadwayDisableStatus(int[] keys)
        {
            List<Dt_RoadwayInfo> roadwayInfos = Repository.QueryData(x => keys.Contains(x.Id));
            roadwayInfos.ForEach(x =>
            {
                x.EnableStatus = EnableEnum.Disable.ObjToInt();
            });
            Repository.UpdateData(roadwayInfos);
 
            return WebResponseContent.Instance.OK();
        }
 
        public WebResponseContent RoadwayEnableStatus(int key)
        {
            return RoadwayEnableStatus(new int[] { key });
        }
 
        public WebResponseContent RoadwayDisableStatus(int key)
        {
            return RoadwayDisableStatus(new int[] { key });
        }
    }
}