public static void YZKPushToken_Add(YZKPushToken pushtoken) { /* * * alter proc YZKPushToken_Add * @devicetoken varchar(50), * @devicetype int, * @uid varchar(50) * as * if not exists(select * from YZKPushToken where uid=@uid) * begin * insert into YZKPushToken(uid,devicetoken,devicetype) * values(@uid,@devicetoken,@devicetype) * end * else * begin * update YZKPushToken set devicetype=@devicetype, * devicetoken=@devicetoken * where uid=@uid * end * */ var paras = "device_mac,devicetoken,devicetype,uid".Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var com = new CommonAction <YZKPushToken>("YZKPushToken_Add", Connection.YZK); com.Action(pushtoken, paras); }
public static void MacIPInfo_Add(MacIPInfo macinfo) { /* * use YZK * go * alter proc MacIPInfo_Add_heartbeat * @mac varchar(50), * @IP varchar(50), * @localip varchar(50), * @ssid varchar(50) * as * if not exists(select * from MacIPInfo where mac=@mac) * begin * insert into MacIPInfo(mac,IP) * values(@mac,@IP) * end * else * begin * update MacIPInfo set IP=@IP,record_time=GETDATE() where mac=@mac * end * */ var com = new CommonAction <MacIPInfo>("MacIPInfo_Add_heartbeat", Connection.YZK); var para = "OrgText,mac,IP,localip,ssid".Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); com.Action(macinfo, para); }
/// <summary> /// 某个家下是否存在某个mac的设备 /// </summary> /// <param name="uid">用户id</param> /// <param name="device_mac">设备mac</param> /// <param name="home_id">家id</param> /// <returns></returns> public static bool YZKDeviceInfo_UserInfo_HomeContainMac(string device_mac, string home_id) { /* * alter proc YZKDeviceInfo_UserInfo_HomeContainMac * @home_id varchar(50), * @device_mac varchar(50), * @uid varchar(50) * as * if exists(select * from YZKDeviceInfo_UserInfo where home_id=@home_id and device_mac=@device_mac) * begin * select '1' * end * else * begin * select '0' * end * */ var com = new CommonAction <YZKDeviceInfo_UserInfo>("YZKDeviceInfo_UserInfo_HomeContainMac", Connection.YZK); var data = com.Scalar(new YZKDeviceInfo_UserInfo() { device_mac = device_mac, home_id = home_id }, "home_id", "device_mac"); if (data.Equals("1")) { return(true); } return(false); }
/// <summary> /// 添加异常通知 /// </summary> /// <param name="notify"></param> public static void NotifyExceptionAdd(NotifyException notify) { /* * alter proc NotifyExceptionAdd * @uid varchar(50), * @bxkLabel varchar(50), * @deviceSetName varchar(50), * @deviceId varchar(50) * as * insert into NotifyException(uid,bxkLabel,deviceSetName,deviceId) * values(@uid,@bxkLabel,@deviceSetName,@deviceId) * */ var c = new CommonAction <NotifyException>("NotifyExceptionAdd", Connection.YZK); c.Action(notify, "uid", "bxkLabel", "deviceSetName", "deviceId"); }
public static void NotifyExceptionAddX(NotifyException notify) { /* * ALTER proc [dbo].[NotifyExceptionAdd] * @uid varchar(50), * @bxkLabel varchar(50), * @deviceSetName varchar(50), * @deviceId varchar(50), * @alarm_type int=0 * as * insert into NotifyException(uid,bxkLabel,deviceSetName,deviceId,alarm_type) * values(@uid,@bxkLabel,@deviceSetName,@deviceId,@alarm_type) * */ var paras = "uid,bxkLabel,deviceSetName,deviceId,alarm_type".Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var c = new CommonAction <NotifyException>("NotifyExceptionAdd", Connection.YZK); c.Action(notify, paras); }
/// <summary> /// 添加或更新空调命令 /// 这里存放通过天猫精灵发出的命令 /// </summary> /// <param name="cmd"></param> public static void addOrUpdateCmd(AirCondtionCmd cmd) { /* * create proc AirCondtionCmdAddOrUpdate * @deviceId varchar(50), * @cmd varchar(200) * as * if not exists(select * from AirCondtionCmd with(index=IX_AirCondtionCmd_deviceId) where deviceId=@deviceId) * begin * insert into AirCondtionCmd(deviceId,cmd) * values(@deviceId,@cmd) * end * else * begin * update AirCondtionCmd set cmd=@cmd where deviceId=@deviceId * end * */ var com = new CommonAction <AirCondtionCmd>("AirCondtionCmdAddOrUpdate", Connection.YZK); com.Action(cmd, "deviceId", "cmd"); }
/// <summary> /// 安防状态 /// </summary> /// <param name="dss"></param> public static void DefenseStatus_Add(DefenseStatus dss) { /* * create proc DefenseStatus_Add * @status int, * @homeId varchar(50) * as * if not exists(select * from DefenseStatus where homeId=@homeId) * begin * insert into DefenseStatus([status],homeId) * values(@status,@homeId) * end * else * begin * update DefenseStatus set [status]=@status where homeId=@homeId * end * * */ var com = new CommonAction <DefenseStatus>("DefenseStatus_Add", Connection.YZK); com.Action(dss, "status", "homeId"); }