private async Task ExecuteConfirm() { try { DetailedBoxID.EditVisible = true; EditEnabled = false; EnabledCC = false; try { switch (_selectedCommand) { case CommandType.Add: if (DetailedBoxID.BoxID.Batch == "") { DetailedBoxID.BoxID.Batch = "-"; } _dbservicewms.AddBoxID(DetailedBoxID.BoxID); _warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Material, String.Format("BoxID added: id: {0}", DetailedBoxID.ID)); SelectedBoxID = DetailedBoxID; await ExecuteRefresh(); _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add BoxID: {DetailedBoxID.BoxID.ToString()}"); break; case CommandType.Edit: if (DetailedBoxID.BoxID.Batch == "") { DetailedBoxID.BoxID.Batch = "-"; } _dbservicewms.UpdateBoxID(DetailedBoxID.BoxID); _warehouse.AddEvent(Event.EnumSeverity.Event, Event.EnumType.Material, String.Format("BoxID changed: id: {0}", DetailedBoxID.ID)); SelectedBoxID.ID = DetailedBoxID.ID; SelectedBoxID.SKUID = DetailedBoxID.SKUID; SelectedBoxID.Batch = DetailedBoxID.Batch; _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit BoxID: {DetailedBoxID.BoxID.ToString()}"); break; } if (DetailedBoxID != null) { DetailedBoxID.ValidationEnabled = false; } } catch (Exception e) { _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, e.Message); } } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); } }