private void SaveOrderClick(object sender, EventArgs e) { _errorProvider.SetError(orderTitle, string.IsNullOrEmpty(orderTitle.Text) ? "Bitte einen gültigen Wert eingeben" : ""); _errorProvider.SetError(orderTitle, string.IsNullOrEmpty(orderKind.Text) ? "Bitte einen gültigen Wert eingeben" : ""); if(!_errorProvider.HasErrors) { var order = new Order { Identity = OrderId, }; order.LoadSingleObject(); var newId = order.CopyOrder(); order.OrderName = order.OrderName.Replace("[Kopie]", "[Vordefiniert]"); order.IsPredefined = true; order.SaveObject(); new PredefinedOrder { Name = orderTitle.Text, Kind = orderKind.Text, Pages = (int)pages.Value, ColorBack = (int)colorBack.Value, ColorFront = (int)colorFront.Value, FkOrderId = newId, Quantity = (int)quantity.Value, }.SaveObject(); Close(); } }
private void EditPredefinedOrder(object sender, EventArgs e) { if (FocusedRow.Usable()) { var order = new Order { Identity = FocusedRow.FkOrderId, }; order.LoadSingleObject(); new OrderRibbonView(order).Show(); } }
private void OrderSearchLookUpEditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) { var oldOrder = new Order { Identity = (int)e.OldValue }; oldOrder.LoadSingleObject(); oldOrder.DeleteObject(); var newOrder = new Order { Identity = (int)e.NewValue }; newOrder.LoadSingleObject(); newOrder.CopyOrder(); newOrder.IsPredefined = true; newOrder.OrderName = newOrder.OrderName.Replace("[Kopie]", "[Predefined]"); newOrder.SaveObject(); e.NewValue = newOrder.Identity; }