Esempio n. 1
0
        private void windowsUIButtonPanel1_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            switch (e.Button.Properties.Tag.ToString())
            {
            case "Add":
                if (validator.Validate())
                {
                    var restaurantId = Int32.Parse(lookUpRestaurant.EditValue.ToString());
                    var menu         = new Logic.Entities.Menu();
                    menu.MenuType     = txtMenu.Text;
                    menu.StartDate    = DateTime.Parse(dateStartDate.EditValue.ToString());
                    menu.EndDate      = DateTime.Parse(dateEndDate.EditValue.ToString());
                    menu.RestaurantId = restaurantId;
                    var addedMenu = _menuServiceClient.AddMenu(menu);
                    if (addedMenu != null)
                    {
                        MessageBox.Show("Menu created sucessfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                        _formRestaurants.BindData();
                    }
                }
                break;

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

            default:
                break;
            }
        }
 public bool UpdateMenu(Logic.Entities.Menu menu)
 {
     try
     {
         return(_menuService.UpdateMenu(menu));
     }
     catch (EnterpriseException enterpriseException)
     {
         throw new FaultException <EnterpriseException>(enterpriseException, enterpriseException.Message, new FaultCode(enterpriseException.ErrorCode));
     }
     catch (Exception exception)
     {
         throw new FaultException <Exception>(exception, exception.Message);
     }
 }