Example #1
0
        /// <summary>
        /// 获取报警信息列表
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetList(AlarmListReq req)
        {
            var user = JsonConvert.DeserializeObject <AllInOne_UserInfo>(Session["user"].ToString());
            var r    = AllFunc.Instance.GetAlarmList(req, user);

            return(JsonConvert.SerializeObject(r));
        }
Example #2
0
        /// <summary>
        /// 获取区域列表总数
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public int GetCount(AlarmListReq req, string lastCId)
        {
            var search = req.search ?? "";
            var dict   = new Dictionary <string, string>
            {
                { "@search", $"%{search}%" },
                { "@lastcid", lastCId },
            };

            var condition = $" 1=1 and (cid1=@lastcid or cid2=@lastcid or cid3=@lastcid or cid4=@lastcid) ";

            var name = req.lastName;

            if (name != null)
            {
                var cid = AllInOne_UserInfoOper.Instance.GetLastCIdByName(name);

                if (cid != null)
                {
                    dict.Add("cid", cid);
                    condition += $" and  (cid1=@cid or cid2=@cid or cid3=@cid or cid4=@cid) ";
                }
                else
                {
                    return(0);
                }
            }

            //if (req.meterNo != null && req.meterNo != "0")
            //    condition += $" and devid = {req.meterNo} ";

            if (req.customerNo != null && req.customerNo != "0")
            {
                dict.Add("@customerNo", req.customerNo);
                condition += $" and customerNo =@customerNo ";
            }

            if (!search.IsNullOrEmpty())
            {
                condition += " and (communicateNo like @search or alarmContent like @search or DealOperator like @search or LinkMan like @search) ";
            }
            var list = SqlHelper.Instance.GetDistinctCount <DeviceAlarmView>("DeviceAlarmView", condition, dict);

            return(list.Count);
        }
Example #3
0
        /// <summary>
        /// 获取区域列表
        /// </summary>
        /// <param name="req"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public List <DeviceAlarmView> GetList(AlarmListReq req, int size, string lastCId)
        {
            var search = req.search ?? "";
            var order  = req.orderField;
            var desc   = Convert.ToBoolean(req.isDesc);
            var index  = Convert.ToInt32(req.pageIndex);
            //var size = 5;
            var orderStr = $"order by {order} ";

            if (desc)
            {
                orderStr += " desc ";
            }
            else
            {
                orderStr += " asc ";
            }
            var dict = new Dictionary <string, string>
            {
                { "@search", $"%{search}%" },
                { "@lastcid", lastCId },
            };


            var condition = $" 1=1 and (cid1=@lastcid or cid2=@lastcid or cid3=@lastcid or cid4=@lastcid) ";

            var name = req.lastName;

            if (name != null)
            {
                var cid = AllInOne_UserInfoOper.Instance.GetLastCIdByName(name);

                if (cid != null)
                {
                    dict.Add("cid", cid);
                    condition += $" and  (cid1=@cid or cid2=@cid or cid3=@cid or cid4=@cid) ";
                }
                else
                {
                    return(new List <DeviceAlarmView>());
                }
            }


            //if (req.meterNo != null && req.meterNo != "0")
            //    condition += $" and devid = {req.meterNo} ";
            if (req.customerNo != null && req.customerNo != "0")
            {
                dict.Add("@customerNo", req.customerNo);
                condition += $" and customerNo =@customerNo ";
            }

            if (!search.IsNullOrEmpty())
            {
                condition += " and (communicateNo like @search or alarmContent like @search or DealOperator like @search or LinkMan like @search) ";
            }
            return(SqlHelper.Instance.GetViewForAlarmPaging <DeviceAlarmView>("DeviceAlarmView", @"select Id,
siteNo,
communicateNo,
Devid,
DevType,
DevTypeName,
AlarmContent,
AlarmTime,
DealFlag,
DealTime,
DealOperator,
SmsTimes,
SmsSendTimes,
SmsInvTime,
Linkman,
MobileNo,
meterNo,
barCode,
customerNo,
deviceNo,
meterTypeNo,
factoryNo,
openState,
caliber,
baseVolume,
fluidNo,
lat,
lng,
remark,
defineNo1,
defineNo2,
defineNo3,
buildTime,
editTime,
Operator,
collectorNo,
MeterType,
isConcentrate,
factoryName,
meterTypeName,
openStateName,
fluidName,
customerName,
address from DeviceAlarmView ", condition, index, size, orderStr, dict));
        }