コード例 #1
0
ファイル: Property.ascx.cs プロジェクト: Devang83/csc131
    private void LoadProperty()
    {
        if (Request["PropertyId"] == null)
        {
            Session["PropertyErrorMessage"] = "Please provide a property number";
            return;
        }
        Property property = null;
        try
        {
            property = new Property(long.Parse(Request["PropertyId"]));
        }
        catch (Exception e)
        {
            Session["PropertyErrorMessage"] = "Error finding Property#" + Request["PropertyId"] +
                "<br/>" + "Details:<br/>" + e.Message;
            return;
        }
        TextBoxPropertyId.Text = property.Id.ToString();
        TextBoxPropertyName.Text = property.Name;
        TextBoxLegalName.Text = property.LegalName;
        TextBoxPhysicalAddress.Text = property.Address;
        RadioButtonActive.Checked = property.Active;
        RadioButtonInactive.Checked = !property.Active;
        List<QuickPM.Person> contacts = QuickPM.Person.GetContacts(property);
        foreach (QuickPM.Person contact in contacts)
        {
            if (contact.Name == "" && contact.CellPhone == "" && contact.Email == "" && contact.Fax == "" &&
                contact.HomePhone == "" && contact.OfficePhone == "" && contact.Title == "")
            {
                contact.Delete();
            }

        }
        contacts = QuickPM.Person.GetContacts(property);
        RemitInfo remit = null;
        try
        {
            remit = new RemitInfo((int)property.Id);
        }
        catch (QuickPM.Exceptions.RemitInfoException ex)
        {
            if (ex.ExceptionType == QuickPM.Exceptions.RemitInfoExceptionType.NoData)
            {
                remit = new RemitInfo();
                remit.Id = (int)property.Id;
                remit.AddToDatabase();
            }
        }
        TextBoxRemitAddress.Text = remit.Address;
        TextBoxRemitCity.Text = remit.City;
        TextBoxRemitEmail.Text = remit.Email;
        TextBoxRemitFax.Text = remit.Fax;
        TextBoxRemitName.Text = remit.Name;
        TextBoxRemitState.Text = remit.State;
        TextBoxRemitTelephone.Text = remit.Telephone;
        TextBoxRemitZip.Text = remit.Zip;
    }
コード例 #2
0
ファイル: Property.ascx.cs プロジェクト: Devang83/csc131
 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;
 }
コード例 #3
0
ファイル: Property.ascx.cs プロジェクト: Devang83/csc131
    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;
    }