Example #1
0
 public Restaurant AddRestaurant(Logic.Entities.Restaurant restaurant)
 {
     try
     {
         return(_restaurantService.AddRestaurant(restaurant));
     }
     catch (EnterpriseException enterpriseException)
     {
         throw new FaultException <EnterpriseException>(enterpriseException, enterpriseException.Message, new FaultCode(enterpriseException.ErrorCode));
     }
     catch (Exception exception)
     {
         throw new FaultException <Exception>(exception, exception.Message);
     }
 }
Example #2
0
        private void windowsUIButtonPanel1_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            switch (e.Button.Properties.Tag.ToString())
            {
            case "Add":
                if (validator.Validate())
                {
                    var restaurant = new Logic.Entities.Restaurant();
                    restaurant.City                 = txtState.Text;
                    restaurant.Name                 = txtName.Text;
                    restaurant.PostalCode           = txtStreetAddress.Text;
                    restaurant.RestaurantCategoryId = Int32.Parse(lookUpCategory.EditValue.ToString());

                    restaurant.LogoImageLocation      = btnLogoImageLocation.EditValue.ToString();
                    restaurant.MainImageLocation      = btnMainImageLocation.EditValue.ToString();
                    restaurant.SmallLogoImageLocation = btnSmallLogoImageLocation.EditValue.ToString();
                    restaurant.BackgroundLocation     = btnBackGroundImageLocation.EditValue.ToString();
                    restaurant.BannerImageLocation    = btnBannerImageLocation.EditValue.ToString();

                    restaurant.State         = txtPosalCode.Text;
                    restaurant.StreetAddress = txtCity.Text;
                    var result = _restaurantServiceClient.AddRestaurant(restaurant);
                    if (result.Id > 0)
                    {
                        MessageBox.Show("Restaurant  was added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                        _formRestaurants.BindData();
                    }
                }
                break;

            case "Cancel":
                this.Dispose();
                break;

            default:
                break;
            }
        }