public bool InsertSchedulePromotion(string UpiCode, string Title, string SMSContent,string WebContent, DateTime StartDate, DateTime EndDate, int AdministratorId, bool IsApprove, string PhoneNumbers) { try { SchedulePromotion SP = new SchedulePromotion(); SP.UpiCode = UpiCode; SP.Title = Title; SP.SMSContent = SMSContent; SP.WebContent = WebContent; SP.StartDate = StartDate; SP.EndDate = EndDate; SP.AdministratorId = AdministratorId; SP.IsApprove = IsApprove; SP.PhoneNumbers = PhoneNumbers; db.SchedulePromotions.InsertOnSubmit(SP); db.SubmitChanges(); int schedulePromotionId = SP.Id; var session = HttpContext.Current.Session; var listPromoHis = session[Constant.PromotionHistorySessionName] as List<PromotionHistoryResult>; if (listPromoHis != null) { var list = new List<PromotionSearchHistory>(); foreach (PromotionHistoryResult hisResult in listPromoHis) { list.Add(ConvertFromPromotionHistoryResultToPromotionSearchHistory(hisResult, schedulePromotionId)); } db.PromotionSearchHistories.InsertAllOnSubmit(list); db.SubmitChanges(); } return true; } catch { return false; } }
partial void UpdateSchedulePromotion(SchedulePromotion instance);
partial void DeleteSchedulePromotion(SchedulePromotion instance);
partial void InsertSchedulePromotion(SchedulePromotion instance);