private void ExecuteAddOrder() { try { EditEnabled = true; EnabledCC = true; _selectedCommand = CommandType.AddOrder; Detailed = new OrderViewModel(); Detailed.Initialize(_warehouse); Detailed.EnableOrderAdd = true; Detailed.EnableOrderEdit = true; Detailed.EnableSubOrderEdit = true; Detailed.EnableSKUEdit = true; Detailed.ValidationEnabled = true; Detailed.ReferenceOrderID = 0; Detailed.ReferenceSubOrderID = 0; Detailed.ERPID = null; Detailed.ERPIDRef = null; Detailed.OrderID = _dbservicewms.GetLastUsedOrderID() + 1; Detailed.Destination = ""; Detailed.ReleaseTime = SqlDateTime.MaxValue.Value; Detailed.SubOrderID = 0; Detailed.SubOrderERPID = 0; Detailed.SubOrderName = ""; Detailed.SKUID = ""; Detailed.SKUBatch = ""; Detailed.SKUQty = 0; Detailed.Status = 0; Detailed.Initialize(_warehouse); } 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)); } }