public static Guid ErrorLog( string controller, string action, string message, string stackTrace ) { var contract = new CrudeDefaultErrorContract(); try { contract.DefaultErrorId = Guid.NewGuid(); contract.DefaultErrorTypeRcd = DefaultErrorTypeRef.UserInitiated; contract.DefaultErrorLayerRcd = DefaultErrorLayerRef.ASPModelViewController; contract.DomainName = "General"; contract.ClassName = controller; contract.MethodName = action; contract.StackTrace = stackTrace; contract.ErrorMessage = message; contract.DefaultUserId = new Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); contract.DateTime = DateTime.UtcNow; var activity = new CrudeDefaultErrorServiceClient(); activity.Insert(contract); activity.Close(); } catch { }; return(contract.DefaultErrorId); }
// refresh the grid // links: // docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f public void RefreshCrudeDefaultError() { var defaultError = new CrudeDefaultErrorServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = defaultError.FetchWithFilter( Guid.Empty , defaultErrorLayerRefCombo.Text , defaultErrorTypeRefCombo.Text , textBoxLayerAddress.Text , textBoxErrorMessage.Text , textBoxStackTrace.Text , textBoxMethodName.Text , textBoxDomainName.Text , textBoxClassName.Text , Guid.Empty , dateTimePickerDateTime.Checked ? Convert.ToDateTime(dateTimePickerDateTime.Value): DateTime.MinValue ); dataGridViewCrudeDefaultError.AutoGenerateColumns = false; dataGridViewCrudeDefaultError.DataSource = bindingSource; dataGridViewCrudeDefaultError.AutoResizeColumns(); dataGridViewCrudeDefaultError.Refresh(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { defaultError.Close(); } }
// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(System.Guid defaultErrorId, System.Guid defaultUserId) { var service = new CrudeDefaultErrorServiceClient(); _isNew = false; try { _contract = service.FetchByDefaultErrorId(defaultErrorId); defaultErrorLayerRefCombo.Text = _contract.DefaultErrorLayerRcd != null ? _contract.DefaultErrorLayerRcd : String.Empty; defaultErrorTypeRefCombo.Text = _contract.DefaultErrorTypeRcd != null ? _contract.DefaultErrorTypeRcd : String.Empty; textBoxLayerAddress.Text = _contract.LayerAddress; textBoxErrorMessage.Text = _contract.ErrorMessage; textBoxStackTrace.Text = _contract.StackTrace; textBoxMethodName.Text = _contract.MethodName; textBoxDomainName.Text = _contract.DomainName; textBoxClassName.Text = _contract.ClassName; _contract.DefaultUserId = defaultUserId; dateTimePickerDateTime.Value = _contract.DateTime != DateTime.MinValue ? _contract.DateTime : dateTimePickerDateTime.MinDate; dateTimePickerDateTime.Checked = _contract.DateTime != DateTime.MinValue; Show(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } }
// saves the form // links: // docLink: http://sql2x.org/documentationLink/c9522930-91f8-4468-a936-8030bb2a6482 private void buttonSave_Click(object sender, EventArgs e) { var service = new CrudeDefaultErrorServiceClient(); try { _contract.DefaultErrorLayerRcd = defaultErrorLayerRefCombo.Text; _contract.DefaultErrorTypeRcd = defaultErrorTypeRefCombo.Text; _contract.LayerAddress = textBoxLayerAddress.Text; _contract.ErrorMessage = textBoxErrorMessage.Text; _contract.StackTrace = textBoxStackTrace.Text; _contract.MethodName = textBoxMethodName.Text; _contract.DomainName = textBoxDomainName.Text; _contract.ClassName = textBoxClassName.Text; _contract.DateTime = dateTimePickerDateTime.Checked ? Convert.ToDateTime(dateTimePickerDateTime.Value): DateTime.MinValue; if (_isNew) { service.Insert(_contract); } else { service.Update(_contract); } } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { service.Close(); } Close(); }