public static bool IsSubsrciptionPaid(int memberId, out bool? isWaived ) { using (TopCareDataContext db = new TopCareDataContext()) { MemberSubscriptionsPaid MostRecentlyPaidSubscription = db.MemberSubscriptionsPaids.Where(mi => mi.MemberID == memberId).OrderByDescending(m => m.MemberSubscriptionPaidID).FirstOrDefault(); if (MostRecentlyPaidSubscription == null) { isWaived = false; return false; } else { if (MostRecentlyPaidSubscription.ExpiryDate <= DateTime.Today) { isWaived = MostRecentlyPaidSubscription.IsWaived; return false; } else { isWaived = MostRecentlyPaidSubscription.IsWaived; return true; } } } }
public static List<Member> SearchMember(string searchStrin) { using (TopCareDataContext db = new TopCareDataContext()) { List<Member> members = (from m in db.Members where m.FirstName.ToLower().Contains(searchStrin.ToLower()) || m.LastName.ToLower().Contains(searchStrin) || m.EmailAddress.ToLower().Contains(searchStrin) select m).ToList<Member>(); return members; } }
public clsReportAttachementComplexType GetReportAttachement() { try { TopCareDataContext db = new TopCareDataContext(); Attachment a; _tempSchedule = db.Schedules.FirstOrDefault(sch => sch.ScheduleID == ScheduleID); LocalReport lr = new LocalReport(); lr.ReportPath = HttpContext.Current.Server.MapPath(reportPath); TopCareDataSetTableAdapters.ScheduleDetailsTableAdapter ta1 = new TopCareDataSetTableAdapters.ScheduleDetailsTableAdapter(); TopCareDataSetTableAdapters.SchedulesTableAdapter ta2 = new TopCareDataSetTableAdapters.SchedulesTableAdapter(); //int scheduleID = Convert.ToInt32(Request.QueryString["sID"]); ReportDataSource ds1 = new ReportDataSource("DataSet1", (System.Data.DataTable)ta2.GetDataByScheduleID(ScheduleID)); ReportDataSource ds2 = new ReportDataSource("DataSet2", (System.Data.DataTable)ta1.GetDataByScheduleID(ScheduleID)); lr.DataSources.Add(ds1); lr.DataSources.Add(ds2); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = lr.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); MemoryStream s = new MemoryStream(bytes); s.Seek(0, SeekOrigin.Begin); string _attachmentFileName = String.Format("Charisma Programe Outline-{0}.pdf", _tempSchedule.DateOfEvent.Value.ToShortDateString()); //create instance of attachement and initialize it a = new Attachment(s, _attachmentFileName); return new clsReportAttachementComplexType() { AttachedFileContent = a, AttachedFileName = _attachmentFileName }; } catch (Exception) { return null; } }