public static GreenBeansState OnSaveGreenBean(GreenBeansState state, GreenBeansSaveAction action) { return(state with { Submitted = false, Submitting = true, CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", ShowInputDialog = false, GreenBeanEditMode = false }); }
public static GreenBeansState OnCGreenBeanDelete(GreenBeansState state, GreenBeansDeleteAction action) { if (state.CurrentGreenBean.Id == action.GreenBeanInfo.Id) { return(state with { CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create" }); } return(state with { }); }
public static GreenBeansState OnAddGreenBean(GreenBeansState state, GreenBeanAddAction action) { // handle all cases, the last return statement handles the default case if (state.ShowInputDialog && state.GreenBeanEditMode) { // we reset everything return(state with { ShowInputDialog = true, GreenBeanEditMode = false, CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create" }); } if (state.ShowInputDialog && !state.GreenBeanEditMode) { if (!string.IsNullOrEmpty(state.CurrentGreenBean.Name) || !string.IsNullOrEmpty(state.CurrentGreenBean.Note) || !string.IsNullOrEmpty(state.CurrentGreenBean.Url) || !string.IsNullOrEmpty(state.CurrentGreenBean.Country) || !string.IsNullOrEmpty(state.CurrentGreenBean.Farmer) || !string.IsNullOrEmpty(state.CurrentGreenBean.Processing) || !string.IsNullOrEmpty(state.CurrentGreenBean.Region) || !string.IsNullOrEmpty(state.CurrentGreenBean.Variety) || state.CurrentGreenBean.Crop != 0 || state.CurrentGreenBean.OverallCuppingScore != 0 ) { return(state with { CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", }); } else { return(state with { CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", ShowInputDialog = false, }); } } return(state with { ShowInputDialog = true, }); }
public static StocksState OnStockDelete(StocksState state, StockDeleteAction action) { if (state.CurrentStock.Id == action.Stock.Id) { return(state with { SelectedContact = new CoffeeRoastManagement.Shared.Entities.Contact(), SelectedGreenBeanInfo = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), CurrentStock = new CoffeeRoastManagement.Shared.Entities.Stock(), StockButtonText = "Create" }); } return(state with { }); }
public static StocksState OnAddStock(StocksState state, StocksAddAction action) { // handle all cases, the last return statement handles the default case if (state.ShowInputDialog && state.StockEditMode) { // we reset everything return(state with { ShowInputDialog = true, StockEditMode = false, CurrentStock = new CoffeeRoastManagement.Shared.Entities.Stock(), SelectedGreenBeanInfo = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), SelectedContact = null, StockButtonText = "Create" }); } if (state.ShowInputDialog && !state.StockEditMode) { if (!AllFieldsEmpty(state)) // TODO: finish { return(state with { CurrentStock = new CoffeeRoastManagement.Shared.Entities.Stock(), SelectedGreenBeanInfo = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), SelectedContact = null, StockButtonText = "Create", }); } else { return(state with { StockButtonText = "Create", ShowInputDialog = false, }); } } return(state with { ShowInputDialog = true, }); }
public GreenBeanEditAction(CoffeeRoastManagement.Shared.Entities.GreenBeanInfo greenBeanInfo) { GreenBeanInfo = greenBeanInfo; }
public GreenBeanStopEditAction() { GreenBeanInfo = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(); }
public StockSaveAction(CoffeeRoastManagement.Shared.Entities.Contact contact, CoffeeRoastManagement.Shared.Entities.GreenBeanInfo greenBean, CoffeeRoastManagement.Shared.Entities.Stock stock) { Contact = contact; GreenBean = greenBean; Stock = stock; }
public StocksGreenBeanSaveAction(CoffeeRoastManagement.Shared.Entities.GreenBeanInfo greenBean) { GreenBean = greenBean; }
public SelectedGreenBeanChangeAction(CoffeeRoastManagement.Shared.Entities.GreenBeanInfo greenBeanInfo) { GreenBeanInfo = greenBeanInfo; }