private void bindBooking() { ApplicationUser user = new UserService().getCurrentUser(this.Context); if (user.FamilyMemberID.HasValue) { BurialPlace burialPlace = new BurialPlaceService().getByFamilyMemberID(user.FamilyMemberID.Value); // already has booking if (burialPlace != null) { divBurialPlace.Visible = true; divBurialPlaceList.Visible = false; txtBurialPlaceFieldNumber.Text = burialPlace.FieldNumber; txtBurialPlaceGraveNumber.Text = burialPlace.GraveNumber; } // new booking else { divBurialPlace.Visible = false; divBurialPlaceList.Visible = true; List <BurialPlace> listBurialPlace = new BurialPlaceService().getForBooking(); repBurialPlace.DataSource = listBurialPlace; repBurialPlace.DataBind(); } } else { Response.Redirect("/Pages/DashboardFamilyMember"); } }
private void bindBurialPlaceDropdownList() { try { List <BurialPlace> listBurialPlace = new BurialPlaceService().getAll(); ddlGraveNumber.Items.AddRange(listBurialPlace.OrderBy(x => x.FieldFormatted).Select(x => new ListItem(x.FieldFormatted, x.BurialPlaceID.ToString())).ToArray()); } catch (Exception ex) { } }
protected void btnDelete_ServerClick(object sender, EventArgs e) { BurialPlace burialPlace = new BurialPlaceService().getByID(BurialPlaceID.ToString()); if (burialPlace != null) { new BurialPlaceService().delete(burialPlace); } Response.Redirect("/Pages/BurialPlacesList.aspx"); }
private void loadBurialPlace() { BurialPlace burialPlace = new BurialPlaceService().getByID(BurialPlaceID.ToString()); if (burialPlace != null) { txtFieldNumber.Text = burialPlace.FieldNumber; txtGraveNumber.Text = burialPlace.GraveNumber; ddlType.SelectedValue = ((int)burialPlace.Type).ToString(); ddlStatus.SelectedValue = ((int)burialPlace.Status).ToString(); ddlPaymentClass.SelectedValue = burialPlace.PaymentClassID.ToString(); txtPaymentDate.Text = burialPlace.PaymentDateFormatted; txtDescription.Text = burialPlace.Description; } else { Response.Redirect("/Pages/BurialPlacesList.aspx"); } }
private void bindBurialPlaceList() { try { List <BurialPlace> listBurialPlace = new BurialPlaceService().getAll(); List <Guid> listBurialPlaceID = listBurialPlace .Select(x => x.BurialPlaceID) .ToList(); List <DeadPerson> listDeadPerson = new DeadPersonService().getBy(x => x.BurialPlaceID != null && listBurialPlaceID.Contains(x.BurialPlaceID)); List <BurialPlaceViewModel> listBurialPlaceViewModel = listBurialPlace .Select(x => new BurialPlaceViewModel( x, listDeadPerson.Find(y => y.BurialPlaceID.Equals(x.BurialPlaceID)))) .ToList(); repBurialPlace.DataSource = listBurialPlaceViewModel; repBurialPlace.DataBind(); } catch (Exception ex) { } }
private void Tick(object sender, ElapsedEventArgs a) { DateTime dateNow = DateTime.Today; // where the payment period is less than 30 days DateTime compareDate = dateNow.AddDays(30); List <BurialPlace> listPlaces = new BurialPlaceService().getBy(x => x.PaymentDate <= compareDate); List <Guid> listPlacesId = listPlaces.Select(x => x.BurialPlaceID).ToList(); List <DeadPerson> listDeadPerson = new DeadPersonService().getBy(x => listPlacesId.Contains(x.BurialPlaceID)); List <Guid?> listFamilyId = listDeadPerson.Select(x => x.FamilyMemberID).ToList(); List <ApplicationUser> listUser = new UserService().getBy(x => listFamilyId.Contains(x.FamilyMemberID)); List <String> emails = listUser.Select(x => x.Email).ToList(); EmailService service = new EmailService(); service.sendMail(emails); }
private void saveBurialPlace() { BurialPlace burialPlace = null; if (IsCreateMode) { burialPlace = new BurialPlace() { BurialPlaceID = Guid.NewGuid() }; } else { burialPlace = new BurialPlaceService().getByID(this.BurialPlaceID.ToString()); } var burialPlaceExisting = new BurialPlaceService().getBy(x => (!x.BurialPlaceID.Equals(burialPlace.BurialPlaceID)) && ("" + x.GraveNumber).Trim().ToLower().Equals(txtGraveNumber.Text.Trim().ToLower()) && ("" + x.FieldNumber).Trim().ToLower().Equals(txtFieldNumber.Text.Trim().ToLower())); if (burialPlaceExisting.Count > 0) { ViewState["Existing"] = "True"; return; } burialPlace.FieldNumber = txtFieldNumber.Text; burialPlace.GraveNumber = txtGraveNumber.Text; burialPlace.Type = (EnumBurialPlaceType)Convert.ToInt32(ddlType.SelectedValue); burialPlace.Status = (EnumBurialPlaceStatus)Convert.ToInt32(ddlStatus.SelectedValue); PaymentClass paymentClass = new PaymentClassService().getByID(ddlPaymentClass.SelectedValue); if (paymentClass != null) { burialPlace.PaymentClassID = paymentClass.PaymentClassID; burialPlace.PaymentClass = null; } if (string.IsNullOrEmpty(("" + txtPaymentDate.Text).Trim())) { burialPlace.PaymentDate = null; } else { try { burialPlace.PaymentDate = DateTime.ParseExact(txtPaymentDate.Text.Trim(), "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture); } catch (Exception ex) { burialPlace.PaymentDate = null; } } burialPlace.Description = txtDescription.Text; if (IsCreateMode) { new BurialPlaceService().create(burialPlace); Response.Redirect(string.Format("/Pages/BurialPlacesDetails?BurialPlaceID={0}", burialPlace.BurialPlaceID.ToString())); } else { new BurialPlaceService().update(burialPlace); } }
private void saveDeadPerson() { Funeral funeral = null; DeadPerson deadPerson = null; if (IsCreateMode) { funeral = new Funeral() { FuneralID = Guid.NewGuid() }; deadPerson = new DeadPerson() { DeadPersonID = Guid.NewGuid() }; } else { deadPerson = new DeadPersonService().getByID(this.DeadPersonID.ToString()); funeral = new FuneralService().getByID(deadPerson.FuneralID.ToString()); } FuneralCompany funeralCompany = new FuneralCompanyService().getByID(ddlFuneralCompany.SelectedValue); CemeteryStaffPerson cemeteryStaff = new CemeteryStaffPersonService().getByID(ddlStaffPerson.SelectedValue); funeral.FuneralDate = DateTime.ParseExact(txtFuneralDate.Text.Trim(), "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture); funeral.FuneralCompanyID = funeralCompany.FuneralCompanyID; funeral.CemeteryStaffPersonID = cemeteryStaff.CemeteryStaffPersonID; BurialPlace burialPlace = new BurialPlaceService().getByID(ddlGraveNumber.SelectedValue); deadPerson.FirstName = txtFirstName.Text; deadPerson.LastName = txtLastName.Text; deadPerson.PESEL = txtPesel.Text; deadPerson.Gender = (EnumGender)int.Parse(ddlGender.SelectedValue); deadPerson.BurialPlaceID = burialPlace.BurialPlaceID; deadPerson.FuneralID = funeral.FuneralID; try { Guid familyMemberID = Guid.Parse(ddlFamilyMember.SelectedValue); if (familyMemberID == Guid.Empty) { deadPerson.FamilyMemberID = null; deadPerson.FamilyMember = null; } else { if (!IsCreateMode) { deadPerson.FamilyMember = new FamilyMemberService().getBy(x => x.FamilyMemberID.Equals(familyMemberID))[0]; } deadPerson.FamilyMemberID = familyMemberID; } } catch (Exception ex) { } if (IsCreateMode) { new FuneralService().create(funeral); new DeadPersonService().create(deadPerson); Response.Redirect(string.Format("/Pages/DeadPersonsDetails?DeadPersonID={0}", deadPerson.DeadPersonID.ToString())); } else { new DeadPersonService().update(deadPerson); } }