Пример #1
0
        /// <summary>
        /// 根据家id获取撤防状态
        /// </summary>
        /// <param name="homeId"></param>
        /// <returns></returns>
        public static DefenseStatus DefenseStatus_GetByHomeId(string homeId)
        {
            /*
             *
             * create  proc  DefenseStatus_GetByHomeId
             * @homeId varchar(50)
             * as
             * select  * from  DefenseStatus where homeId=@homeId
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@homeId", homeId);
            var method = new CReader <DefenseStatus>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "DefenseStatus_GetByHomeId");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);

            //var method =
            //var data = method.GetOrgRecord(dt, "DefenseStatus_GetByHomeId");
            //if (data.Count > 0)
            //{
            //    return data[0];
            //}
            //return null;
        }
Пример #2
0
        /// <summary>
        /// 根据uuid得到
        /// </summary>
        /// <param name="uuid"></param>
        /// <returns></returns>
        public static YZKUser YZKUser_GetByuuid(string uuid)
        {
            /*
             * create proc YZKUser_GetByuuid
             * @uuid varchar(50)
             * as
             * select * from  YZKUser where uuid=@uuid
             *
             */
            var key = "YZK.user.uid:" + uuid;

            if (RedisHelper <YZKUser> .IsKeyExist(key) == false)
            {
                var dt = new Dictionary <string, string>();
                dt.Add("@uuid", uuid);

                var conName = Connection.YZK;

                var ac   = new CReader <YZKUser>(conName);
                var data = ac.GetOrgRecord(dt, "YZKUser_GetByuuid");
                if (data.Count > 0)
                {
                    RedisHelper <YZKUser> .StoreOneKey(key, data[0], 3000);

                    return(data[0]);
                }
                return(null);
            }
            else
            {
                var signdata = RedisHelper <YZKUser> .GetStoreValue(key);

                return(signdata);
            }
        }
Пример #3
0
        public static YZKPushToken YZKPushToken_GetByUidDeviceTypeMac(string uid, DeviceType devicetype, string mac)
        {
            /*
             * use YZK
             * go
             * create proc  YZKPushToken_GetByuiddevicetypeMac
             * @uid varchar(50),
             * @devicetype int,
             * @device_mac varchar(50)
             * as
             * select * from  YZKPushToken where uid=@uid and devicetype=@devicetype and device_mac=@device_mac
             *
             */
            var type = ((int)devicetype) + "";
            var dt   = new Dictionary <string, string>();

            dt.Add("@uid", uid);
            dt.Add("@devicetype", type);
            dt.Add("@device_mac", mac);

            var method = new CReader <YZKPushToken>(Connection.YZK);

            var data = method.GetOrgRecord(dt, "YZKPushToken_GetByuiddevicetypeMac");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }
        /// <summary>
        /// 根据home_id,device_protocol,device_type
        /// </summary>
        /// <param name="home_id"></param>
        /// <param name="device_protocol"></param>
        /// <param name="device_type"></param>
        /// <returns></returns>
        public static List <YZKDeviceInfo_UserInfo> YZKDeviceInfo_UserInfo_GetXiaoFeiDieByHomeId(string home_id, int device_protocol, string device_type)
        {
            /*
             * use YZK
             * go
             * create proc  YZKDeviceInfo_UserInfoGetXiaoFeiDieByHomeId
             * @device_type varchar(50),
             * @device_protocol int,
             * @home_id varchar(50)
             * as
             * select  *from  YZKDeviceInfo_UserInfo where device_type=@device_type and  device_protocol=@device_protocol and home_id=@home_id
             *
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@device_type", device_type);
            dt.Add("@device_protocol", device_protocol + "");
            dt.Add("@home_id", home_id + "");


            var method = new CReader <YZKDeviceInfo_UserInfo>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "YZKDeviceInfo_UserInfoGetXiaoFeiDieByHomeId");

            return(data);
        }
Пример #5
0
        /// <summary>
        /// 根据uid获取设备token
        /// </summary>
        /// <param name="uid">uid</param>
        /// <returns></returns>
        public static List <YZKPushToken> YZKPushToken_GetByUid(string uid)
        {
            /*
             *
             * use  YZK
             * go
             * create proc YZKPushToken_GetDataByuid
             * @uid varchar(50)
             * as
             * select  * from  YZKPushToken where uid=@uid
             *
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@uid", uid);
            var method = new CReader <YZKPushToken>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "YZKPushToken_GetDataByuid");

            return(data);
        }
Пример #6
0
        /// <summary>
        /// 根据设备的mac和设备的协议类型获取设备的token
        /// </summary>
        /// <param name="device_mac"></param>
        /// <param name="protocol_type"></param>
        /// <returns></returns>
        public static List <YZKPushToken> YZKPushToken_GetByDeviceMacProcoltype(string device_mac, string protocol_type)
        {
            /*
             *
             * create  proc YZKPushToken_GetByDeviceMacProcoltype
             * @device_mac varchar(50),
             * @device_protocol varchar(50)
             * as
             * select  uid,devicetoken,devicetype,device_mac from  YZKPushToken where uid in(select  uid from YZKDeviceInfo_UserInfo where device_mac=@device_mac and  device_protocol=@device_protocol)
             * group by uid,devicetoken,devicetype,device_mac
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@device_mac", device_mac);
            dt.Add("@device_protocol", protocol_type);
            var method = new CReader <YZKPushToken>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "YZKPushToken_GetByDeviceMacProcoltype");

            return(data);
        }
        public static YZKDeviceInfo_UserInfo YZKDeviceInfo_UserInfo_GetDataByRecordid(string recordid)
        {
            /*
             * create proc  YZKDeviceInfo_UserInfo_GetByRecordid
             * @deviceinfo_userinfo_id varchar(50)
             * as
             * select  * from  YZKDeviceInfo_UserInfo where  deviceinfo_userinfo_id=@deviceinfo_userinfo_id
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@deviceinfo_userinfo_id", recordid);
            var method = new CReader <YZKDeviceInfo_UserInfo>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "YZKDeviceInfo_UserInfo_GetByRecordid");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }
Пример #8
0
        /// <summary>
        /// 根据记录id获取空调命令
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public static AirCondtionCmd GetByDeviceId(string deviceId)
        {
            /*
             * create proc  AirCondtionCmdGetByDeviceId
             * @deviceId varchar(50)
             * as
             * select  * from AirCondtionCmd where  deviceId=@deviceId
             *
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@deviceId", deviceId);

            var method = new CReader <AirCondtionCmd>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "AirCondtionCmdGetByDeviceId");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }
Пример #9
0
        /// <summary>
        /// 根据uid 获取账户信息
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        public static YZKUser YZKUser_GetByuid(string uid)
        {
            /*
             * create proc  YZKUser_Getbyuserid
             * @userid varchar(50)
             * as
             * select * from YZKUser where  userid=@userid
             *
             */
            var readmethod = new CReader <YZKUser>(Connection.YZK);
            var dt         = new Dictionary <string, string>();

            dt.Add("@userid", uid);

            var data = readmethod.GetOrgRecord(dt, "YZKUser_Getbyuserid");

            if (data != null && data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }
Пример #10
0
        public static DefenseStatus DefenseStatusGetByDeviceId(int deviceinfo_userinfo_id)
        {
            /*
             * create  proc DefenseStatus_GetStatusByDeviceID
             * @deviceinfo_userinfo_id int
             * as
             * select  * from  DefenseStatus where homeId in(select  homeId from  YZKDeviceInfo_UserInfo
             * where deviceinfo_userinfo_id=@deviceinfo_userinfo_id)
             *
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@deviceinfo_userinfo_id", deviceinfo_userinfo_id + "");

            var method = new CReader <DefenseStatus>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "DefenseStatus_GetStatusByDeviceID");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }
Пример #11
0
        /// <summary>
        /// 根据mac地址获取 macIPInfo
        /// </summary>
        /// <param name="mac"></param>
        /// <returns></returns>
        public static MacIPInfo MacIPInfo_GetInfoByMac(string mac)
        {
            /*
             * use YZK
             * go
             * create  proc MacIPInfo_GetDatabymac
             * @mac varchar(50)
             * as
             * select * from  MacIPInfo where mac=@mac
             *
             */
            var dt = new Dictionary <string, string>();

            dt.Add("@mac", mac);

            var method = new CReader <MacIPInfo>(Connection.YZK);
            var data   = method.GetOrgRecord(dt, "MacIPInfo_GetDatabymac");

            if (data.Count > 0)
            {
                return(data[0]);
            }
            return(null);
        }