private void windowsUIButtonPanel1_ButtonClick(object sender, ButtonEventArgs e) { switch (e.Button.Properties.Tag.ToString()) { case "Add": if (validateProvider.Validate()) { var menuItem = new Logic.Entities.MenuItem(); menuItem.MenuId = Int32.Parse(lookUpmenu.EditValue.ToString()); menuItem.Name = txtName.Text; menuItem.Price = decimal.Parse(txtPrice.Text); menuItem.PreparationTime = Int32.Parse(txtPreparationTime.Text); menuItem.ImageLocation = txtImage.Text; var returnReuslt = _menuServiceClient.AddMenuItem(menuItem); if (returnReuslt != null) { MessageBox.Show("Menu item added sucessfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Reset(); _formRestaurants.BindData(); } } break; case "Cancel": this.Dispose(); break; default: break; } }
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; } }
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; } }