/// <summary> /// 添加报警信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool Add(INFO_ALARMINFO info) { bool isSuccess = true; StringBuilder pInsertText = new StringBuilder(); pInsertText.Append("INSERT INTO INFO_ALARMINFO(ALARMINFO,ALARMTIME,ALARMADDRESS,ALARMTYPE,ALARMOBJECTNAME) VALUES('"); pInsertText.Append(info.ALARMINFO + "',TO_DATE('" + info.ALARMTIME.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-mm-dd hh24:mi:ss'),'" + info.ALARMADDRESS + "','" + info.ALARMTYPE + "','" + info.ALARMOBJECTNAME + "')"); try { OracleOperateBLL.ExecuteSql(pInsertText.ToString()); } catch { isSuccess = false; } return(isSuccess); //DbBase<INFO_ALARMINFO> db = new DbBase<INFO_ALARMINFO>(); //db.Insert(info); //if (db.SaveChanges() >= 0) //{ // return true; //} //else //{ // return false; //} }
/// <summary> /// 新增报警信息 /// </summary> /// <returns></returns> public ActionResult AddAlarmInfo(string info, string alarmAddress, string alarmObjectName, string alarmType, string alarmTime, string objectName) { INFO_ALARMINFO alarmInfo = new INFO_ALARMINFO(); alarmInfo.ALARMINFO = info; alarmInfo.ALARMADDRESS = alarmAddress; alarmInfo.ALARMOBJECTNAME = alarmObjectName; alarmInfo.ALARMTYPE = Convert.ToInt32(alarmType); alarmInfo.ALARMTIME = DateTime.Parse(alarmTime); var isSuccess = AlarmBLL.Add(alarmInfo); MapBLL.UpdateGpsInfo(objectName); return(new JsonResult { Data = isSuccess }); }