Beispiel #1
0
        private void saveFuneral()
        {
            Funeral funeral = null;

            if (IsCreateMode)
            {
                funeral = new Funeral()
                {
                    FuneralID = Guid.NewGuid()
                };
            }
            else
            {
                funeral = new FuneralService().getByID(this.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;
            // FuneralCompany company = new FuneralCompanyService().getByID(ddlFuneralCompany.SelectedValue);


            if (IsCreateMode)
            {
                new FuneralService().create(funeral);
                Response.Redirect(string.Format("/Pages/FuneralsDetails?FuneralID={0}", funeral.FuneralID.ToString()));
            }
            else
            {
                new FuneralService().update(funeral);
            }
        }
Beispiel #2
0
 private void bindFuneralCompanyDropdownList()
 {
     try
     {
         List <FuneralCompany> listCompany = new FuneralCompanyService().getAll();
         ddlFuneralCompany.Items.AddRange(listCompany.Select(x => new ListItem(x.Name, x.FuneralCompanyID.ToString())).ToArray());
     }
     catch (Exception ex) { }
 }
 private void bindFuneralCompanyList()
 {
     try
     {
         List <FuneralCompany> listFuneralCompany = new FuneralCompanyService().getAll();
         repFuneralCompany.DataSource = listFuneralCompany;
         repFuneralCompany.DataBind();
     }
     catch (Exception ex) { }
 }
Beispiel #4
0
        protected void btnDelete_ServerClick(object sender, EventArgs e)
        {
            FuneralCompany funeralCompany = new FuneralCompanyService().getByID(FuneralCompanyID);

            if (funeralCompany != null)
            {
                new FuneralCompanyService().delete(funeralCompany);
            }
            Response.Redirect("/Pages/FuneralCompanyList.aspx");
        }
Beispiel #5
0
        private void loadFuneralCompanyInfo()
        {
            FuneralCompany funeralCompany = new FuneralCompanyService().getByID(FuneralCompanyID);

            if (funeralCompany != null)
            {
                txtName.Text          = funeralCompany.Name;
                txtLicenseNumber.Text = funeralCompany.LicenseNumber;

                if (funeralCompany.Address != null)
                {
                    txtStreet.Text      = funeralCompany.Address.Street;
                    txtHouseNumber.Text = funeralCompany.Address.HouseNumber;
                    txtFlatNumber.Text  = funeralCompany.Address.FlatNumber;
                    txtTown.Text        = funeralCompany.Address.Town;
                    txtPostCode.Text    = funeralCompany.Address.PostCode;
                    txtPhoneNumber.Text = funeralCompany.Address.PhoneNumber;
                }
            }
        }
Beispiel #6
0
        private void saveFuneralCompanyInfo()
        {
            FuneralCompany funeralCompany = null;

            if (IsCreateMode)
            {
                funeralCompany = new FuneralCompany();
                funeralCompany.FuneralCompanyID        = Guid.NewGuid();
                funeralCompany.Address                 = new Address();
                funeralCompany.Address.CustomAddressID = Guid.NewGuid();
                funeralCompany.AddressID               = funeralCompany.Address.CustomAddressID;
            }
            else
            {
                funeralCompany = new FuneralCompanyService().getByID(FuneralCompanyID);
            }

            funeralCompany.Name                = txtName.Text;
            funeralCompany.LicenseNumber       = txtLicenseNumber.Text;
            funeralCompany.Address.Street      = txtStreet.Text;
            funeralCompany.Address.HouseNumber = txtHouseNumber.Text;
            funeralCompany.Address.FlatNumber  = txtFlatNumber.Text;
            funeralCompany.Address.Town        = txtTown.Text;
            funeralCompany.Address.PostCode    = txtPostCode.Text;
            funeralCompany.Address.PhoneNumber = txtPhoneNumber.Text;

            if (IsCreateMode)
            {
                new FuneralCompanyService().create(funeralCompany);
                Response.Redirect(string.Format("/Pages/FuneralCompanyDetails?FuneralCompanyID={0}", funeralCompany.FuneralCompanyID.ToString()));
            }
            else
            {
                new FuneralCompanyService().update(funeralCompany);
            }
        }
        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);
            }
        }