public static bool saveToSentItemThenDelete(long id, bool status) { db = new SMSDataClassesDataContext(); SMS_SentItem sentItems = new SMS_SentItem(); var x = (from i in db.SMS_QueuedBoxes.Where(i => i.ID == id) select i).Take(1).FirstOrDefault(); if (x != null) { sentItems.Number = x.Number; sentItems.Message = x.Message; sentItems.DateTime = config.current_DateTime(); sentItems.Status = status; sentItems.MonthOf = DateTime.Now.Month; sentItems.YearOf = DateTime.Now.Year; try { db.SMS_SentItems.InsertOnSubmit(sentItems); db.SMS_QueuedBoxes.DeleteOnSubmit(x); db.SubmitChanges(); return true; } catch (Exception ex) {} } return false; }
partial void UpdateSMS_SentItem(SMS_SentItem instance);
partial void DeleteSMS_SentItem(SMS_SentItem instance);
partial void InsertSMS_SentItem(SMS_SentItem instance);