Пример #1
0
 private void SubmitChanges()
 {
     Property property = new Property(long.Parse(TextBoxPropertyId.Text));
     property.Name = TextBoxPropertyName.Text;
     property.LegalName = TextBoxLegalName.Text;
     property.Active = RadioButtonActive.Checked;
     try
     {
         //property.Active = true;
         property.Address = TextBoxPhysicalAddress.Text;
         RemitInfo remit = new RemitInfo((int)property.Id);
         remit.Address = TextBoxRemitAddress.Text;
         remit.City = TextBoxRemitCity.Text;
         remit.Email = TextBoxRemitEmail.Text;
         remit.Fax = TextBoxRemitFax.Text;
         remit.Name = TextBoxRemitName.Text;
         remit.State = TextBoxRemitState.Text;
         remit.Telephone = TextBoxRemitTelephone.Text;
         remit.Zip = TextBoxRemitZip.Text;
         remit.Id = (int)property.Id;
         remit.Save();
         property.Save();
     }
     catch (Exception ex)
     {
         Session["PropertyErrorMessage"] = ex.Message;
         return;
     }
     Session["PropertyChangesSubmitted"] = true;
 }
Пример #2
0
    private void AddProperty()
    {
        Property property = new Property();
        property.Name = TextBoxPropertyName.Text;
        property.Active = true;
        property.LegalName = TextBoxLegalName.Text;
        property.Id = Int32.Parse(TextBoxPropertyId.Text);
        List<Property> properties = Property.Util.GetProperties();
        foreach (Property prop in properties)
        {
            if (prop.Id == property.Id)
            {
                Session["PropertyErrorMessage"] = "<h2>Property number " + property.Id + " is already used.</h2>";
                return;
            }
        }
        try
        {
            property.Active = true;
            property.Address = TextBoxPhysicalAddress.Text;

            RemitInfo remit = new RemitInfo();
            remit.Address = TextBoxRemitAddress.Text;
            remit.City = TextBoxRemitCity.Text;
            remit.Email = TextBoxRemitEmail.Text;
            remit.Fax = TextBoxRemitFax.Text;
            remit.Name = TextBoxRemitName.Text;
            remit.State = TextBoxRemitState.Text;
            remit.Telephone = TextBoxRemitTelephone.Text;
            remit.Zip = TextBoxRemitZip.Text;
            remit.Id = (int)property.Id;
            remit.Save();
            property.Save();
        }
        catch (Exception ex)
        {
            Session["PropertyErrorMessage"] = ex.Message;
            return;
        }
        Session["AddPropertyFinished"] = true;
    }