public override DataTemplate SelectTemplate(object item, DependencyObject container) { AfterCareDataContext dbContext = new AfterCareDataContext(); var invoiceItem = item as InvoiceItem; if (invoiceItem == null) { return(base.SelectTemplate(item, container)); } return(StudentTemplate); }
public StudentFormPage(AfterCareDataContext db, string UserID) { this.DataContext = this; InitializeComponent(); this.userID = UserID; this.guardianID = -1; this.relationship = null; this.studentFee = 0; this.feeType = null; this.homeroom = null; this.birthday = null; this.db = db; }
public GuardianFormPage(AfterCareDataContext db, string UserID) { this.db = db; this.DataContext = this; InitializeComponent(); userID = UserID; home = null; cell = null; streetNumber = null; streetName = null; city = null; state = null; zip = null; }
public override Style SelectStyle(object item, DependencyObject container) { AfterCareDataContext dbContext = new AfterCareDataContext(); var invoiceItem = item as InvoiceItem; if (invoiceItem == null) { return(base.SelectStyle(item, container)); } if (invoiceItem.Paid == true) { return(PaidStyle); } return(UnpaidStyle); }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { AfterCareDataContext db = new AfterCareDataContext(); var str = (string)value; if (str == null || str.Length < 1) { return(new ValidationResult(false, "*Required field")); } else if (String.IsNullOrWhiteSpace(str)) { return(new ValidationResult(false, "*Field can't be a blank space")); } else if (_propertyName != null && _propertyName.Length > 1) { switch (_propertyName) { case "userId": try { List <User> userList = ( from u in db.Users select u).ToList(); User userExists = ( from u in db.Users where u.userId.Equals(str) select u).Single(); int idx = userList.IndexOf(userExists); if (idx >= 0) { return(new ValidationResult(false, "*UserID Exists")); } } catch (Exception e) {} break; } } return(ValidationResult.ValidResult); }
private void buildListforInvoices(Object sender = null) { CheckBox cBox = (CheckBox)sender; ListCollectionView invoiceView; PropertyGroupDescription invoiceGroup = null; AfterCareDataContext dbContext = new AfterCareDataContext(); List <InvoiceItem> guardian_invoiceList = ( from s in dbContext.Guardian_Invoices from n in dbContext.Guardians from u in dbContext.Users where s.guardianId == n.guardianId where n.userId == u.userId select new InvoiceItem { InvoiceId = s.invoiceId, GuardianId = n.guardianId, FirstName = u.firstName, LastName = u.lastName, StreetNumber = n.streetNumber, StreetName = n.streetName, City = n.city, State = n.state, Zip = n.zip, StartDate = s.startDate.ToString(), EndDate = s.endDate.ToString(), Balance = s.balance, Paid = s.paid, GroupProperty = this.nameString, }).ToList(); List <Student_Guardian> studentList = ( from sg in dbContext.Student_Guardians select new Student_Guardian { guardianId = sg.guardianId, studentId = sg.studentId }).ToList(); List <User> studentUser = new List <User>(); guardian_invoiceList.ForEach(delegate(InvoiceItem guardList) { studentList.ForEach(delegate(Student_Guardian studList) { if (guardList.GuardianId == studList.guardianId) { guardList.addStudId(studList.studentId); int xtemp = studList.studentId; List <User> studentsByID = ( from su in dbContext.Users from s in dbContext.Students where su.userId == s.userId where s.studentId == xtemp select su).ToList(); guardList.StudentID.Add(studentsByID.Single()); } }); }); invoiceView = new ListCollectionView(guardian_invoiceList); if (cBox != null) { switch (cBox.Name) { case "guardianCheck": this.nameString = "For Guardian ID#"; invoiceGroup = new PropertyGroupDescription("GuardianId"); break; case "paidCheck": this.nameString = "With Paid Value of "; invoiceGroup = new PropertyGroupDescription("Paid"); break; } if (invoiceGroup != null) { invoiceView.GroupDescriptions.Clear(); invoiceView.GroupDescriptions.Add(invoiceGroup); guardian_invoiceList.ForEach(delegate(InvoiceItem invoice) { invoice.GroupProperty = this.nameString; }); } } invoiceGrid.ItemsSource = invoiceView; invoiceGrid.UnselectAll(); }