public bool _insert(string DeviceId, string time, string cont, string type) { AlarmClocks al = new AlarmClocks(); al.ClockTime = time; al.DeviceId = DeviceId; al.Content = cont; al.Repeat = "0"; al.RepeatDate = "1,1,1,1,1,0,0"; al.AlarmType = type; al.State = 0; al.Frequency = 1; al.Interval = 3; return(insertAlarm(al)); }
public static string insert_id(AlarmClocks ID) { string sql = string.Format("insert into AlarmClock values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}') SELECT @@IDENTITY", ID.ClockTime, ID.DeviceId, ID.Content, ID.Repeat, ID.RepeatDate, ID.Frequency, ID.Interval, ID.AlarmType, ID.State); return(SqlHelper.ExecuteScalar(sql) + ""); }
public static bool insertAlarm(AlarmClocks ID) { string sql = string.Format("insert into AlarmClock values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", ID.ClockTime, ID.DeviceId, ID.Content, ID.Repeat, ID.RepeatDate, ID.Frequency, ID.Interval, ID.AlarmType, ID.State); return(SqlHelper.ExecuteNonQuery(sql) > 0); }
public static bool UpdateByIDDeviceid(AlarmClocks a) { string sql = string.Format("update [AlarmClock] set ClockTime='{0}',content='{1}',[Repeat]='{2}',RepeatDate='{3}',Frequency='{4}',Interval='{5}',alarmtype='{6}',[State]='{7}' where id='{8}' and Deviceid = '{9}'", a.ClockTime, a.Content, a.Repeat, a.RepeatDate, a.Frequency, a.Interval, a.AlarmType, a.State, a.Id, a.DeviceId); return(SqlHelper.ExecuteNonQuery(sql) > 0); }
/// <summary> /// 修改内容 /// </summary> /// <param name="ID"></param> /// <returns></returns> public static bool updateAlarm(AlarmClocks ID) { string sql = string.Format("update AlarmClock set ClockTime='{0}',[Content]='{1}',[Repeat]='{2}',RepeatDate='{3}',Frequency='{4}',Interval='{5}',alarmtype='{6}',state='{7}' where [id]='{8}'", ID.ClockTime, ID.Content, ID.Repeat, ID.RepeatDate, ID.Frequency, ID.Interval, ID.AlarmType, ID.State, ID.Id); return(SqlHelper.ExecuteNonQuery(sql) > 0); }