/// <summary> /// 將新物件加入 tblPre_disasterNotified EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet<T> 屬性的 .Add 方法。 /// </summary> public void AddTotblPre_disasterNotified(tblPre_disasterNotified tblPre_disasterNotified) { base.AddObject("tblPre_disasterNotified", tblPre_disasterNotified); }
/// <summary> /// 建立新 tblPre_disasterNotified 物件。 /// </summary> /// <param name="iDENTIFIED_ID">IDENTIFIED_ID 屬性的初始值。</param> /// <param name="iSSEND">ISSEND 屬性的初始值。</param> public static tblPre_disasterNotified CreatetblPre_disasterNotified(global::System.Int32 iDENTIFIED_ID, global::System.Boolean iSSEND) { tblPre_disasterNotified tblPre_disasterNotified = new tblPre_disasterNotified(); tblPre_disasterNotified.IDENTIFIED_ID = iDENTIFIED_ID; tblPre_disasterNotified.ISSEND = iSSEND; return tblPre_disasterNotified; }
static bool LogToDB(Message msg,string bodytext) { string _class; if (bodytext.Length > 1000) bodytext = bodytext.Substring(0, 1000); //msg.Headers.Subject.Contains("大雨") || msg.Headers.Subject.Contains("豪雨") || msg.Headers.Subject.Contains("豪大雨") || msg.Headers.Subject.Contains("強風") || msg.Headers.Subject.Contains("地震") if (msg.Headers.Subject.Contains("大雨")) _class = "大雨"; else if (msg.Headers.Subject.Contains("豪雨")) _class = "豪雨"; else if (msg.Headers.Subject.Contains("豪大雨")) _class = "豪大雨"; else if (msg.Headers.Subject.Contains("強風")) _class = "強風"; else if (msg.Headers.Subject.Contains("地震")) _class = "地震"; else if (msg.Headers.Subject.Contains("颱風")) _class = "颱風"; else return false; WeatherMail.SSHMC01Entities db = new SSHMC01Entities(); tblPre_disasterNotified rec = new tblPre_disasterNotified() { ISSEND = false, TITLE = msg.Headers.Subject, CONTENT = bodytext, PRE_ADMONISH_CLASS = _class, PUBLISH_ORANG = "中央氣象局", TIMESTAMP = DateTime.Now }; db.tblPre_disasterNotified.AddObject(rec); db.SaveChanges(); db.AcceptAllChanges(); return true; }