コード例 #1
0
        public bool AddPropertyPL()
        {
            Property newProperty = new Property();
            bool     IsAdd       = false;

            try
            {
                newProperty.PropertyName = txtPropertyName.Text;
                newProperty.PropertyType = CbPropertyType.Text;

                newProperty.Description = txtDescription.Text;
                if (CbState.Text.ToString() == string.Empty)
                {
                    sb.Append("State Required");
                }

                newProperty.Address = CbCity.Text;

                if (txtPriceRange.Text.ToString() != string.Empty)
                {
                    newProperty.PriceRange = Decimal.Parse(txtPriceRange.Text);
                }
                else
                {
                    newProperty.PriceRange = -1;
                }
                if (txtInitialDeposit.Text.ToString() != string.Empty)
                {
                    newProperty.InitialDeposit = long.Parse(txtInitialDeposit.Text);
                }
                else
                {
                    newProperty.InitialDeposit = -1;
                }

                newProperty.Landmark = txtLandmark.Text;
                if (txtSellerId.Text.ToString() != string.Empty)
                {
                    newProperty.SellerId = int.Parse(txtSellerId.Text);
                }
                else
                {
                    newProperty.SellerId = -1;
                }

                IsAdd = propertyBL.AddPropertyBL(newProperty);
            }
            catch (EasyHousingSolutionException ex)
            {
                MessageBox.Show("Error: " + sb.ToString() + ex.Message);
            }
            return(IsAdd);
        }