// shows the form in edit modus // links: // docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77 public void ShowAsEdit(System.Guid defaultUserActivityId, System.Guid defaultUserId) { var service = new CrudeDefaultUserActivityServiceClient(); _isNew = false; try { _contract = service.FetchByDefaultUserActivityId(defaultUserActivityId); defaultUserActivityTypeRefCombo.Text = _contract.DefaultUserActivityTypeRcd != null ? _contract.DefaultUserActivityTypeRcd : String.Empty; textBoxUserActivityNote.Text = _contract.UserActivityNote; textBoxOriginatingAddress.Text = _contract.OriginatingAddress; textBoxReferrer.Text = _contract.Referrer; _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 CrudeDefaultUserActivityServiceClient(); try { _contract.DefaultUserActivityTypeRcd = defaultUserActivityTypeRefCombo.Text; _contract.UserActivityNote = textBoxUserActivityNote.Text; _contract.OriginatingAddress = textBoxOriginatingAddress.Text; _contract.Referrer = textBoxReferrer.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(); }
public static void ActionLog( HttpRequestBase request, string message ) { try { var contract = new CrudeDefaultUserActivityContract(); contract.DefaultUserActivityId = Guid.NewGuid(); contract.DefaultUserActivityTypeRcd = DefaultUserActivityTypeRef.WebPageOpened; contract.UserActivityNote = message; try { contract.OriginatingAddress = request.ServerVariables["REMOTE_ADDR"]; } catch { }; //contract.DefaultUserId = UserId(User.Identity, string.Empty); contract.DefaultUserId = UserId(request.LogonUserIdentity, string.Empty); //contract.DefaultUserId = new Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); contract.DateTime = DateTime.UtcNow; var activity = new CrudeDefaultUserActivityServiceClient(); activity.Insert(contract); activity.Close(); } catch { }; }
// refresh the grid // links: // docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f public void RefreshCrudeDefaultUserActivity() { var defaultUserActivity = new CrudeDefaultUserActivityServiceClient(); try { var bindingSource = new BindingSource(); bindingSource.DataSource = defaultUserActivity.FetchWithFilter( Guid.Empty , defaultUserActivityTypeRefCombo.Text , textBoxUserActivityNote.Text , textBoxOriginatingAddress.Text , textBoxReferrer.Text , Guid.Empty , dateTimePickerDateTime.Checked ? Convert.ToDateTime(dateTimePickerDateTime.Value): DateTime.MinValue ); dataGridViewCrudeDefaultUserActivity.AutoGenerateColumns = false; dataGridViewCrudeDefaultUserActivity.DataSource = bindingSource; dataGridViewCrudeDefaultUserActivity.AutoResizeColumns(); dataGridViewCrudeDefaultUserActivity.Refresh(); } catch (Exception ex) { if (ex == null) { } else { System.Diagnostics.Debugger.Break(); } } finally { defaultUserActivity.Close(); } }
public static void ActionLog( // HttpRequestBase request, string message, dynamic viewBag ) { try { var contract = new CrudeDefaultUserActivityContract(); contract.DefaultUserActivityId = Guid.NewGuid(); contract.DefaultUserActivityTypeRcd = DefaultUserActivityTypeRef.WebPageOpened; contract.UserActivityNote = string.IsNullOrEmpty(message) ? null : message; contract.DefaultUserId = UserId(viewBag); contract.DateTime = DateTime.UtcNow; var activity = new CrudeDefaultUserActivityServiceClient(); activity.Insert(contract); activity.Close(); } catch { }; }
public static void ActionLog( // HttpRequestBase request, string message, dynamic viewBag ) { try { CrudeDefaultUserActivityContract contract = new CrudeDefaultUserActivityContract { DefaultUserActivityId = Guid.NewGuid(), DefaultUserActivityTypeRcd = DefaultUserActivityTypeRef.WebPageOpened, UserActivityNote = string.IsNullOrEmpty(message) ? null : message, DefaultUserId = new Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"), DateTime = DateTime.UtcNow }; CrudeDefaultUserActivityServiceClient activity = new CrudeDefaultUserActivityServiceClient(); activity.Insert(contract); activity.Close(); } catch { }; }
public static void ActionLog( HttpRequestBase request, string message, dynamic viewBag ) { try { var contract = new CrudeDefaultUserActivityContract(); contract.DefaultUserActivityId = Guid.NewGuid(); contract.DefaultUserActivityTypeRcd = DefaultUserActivityTypeRef.WebPageOpened; // get referrer try { contract.Referrer = request.UrlReferrer != null && !string.IsNullOrEmpty(request.UrlReferrer.OriginalString) ? request.UrlReferrer.OriginalString : "no referrer"; } catch { } contract.UserActivityNote = string.IsNullOrEmpty(message) ? null : message; try { contract.OriginatingAddress = request.ServerVariables != null && !string.IsNullOrEmpty(request.ServerVariables["REMOTE_ADDR"]) ? request.ServerVariables["REMOTE_ADDR"] : "no originating address"; } catch { }; //contract.DefaultUserId = UserId(User.Identity, viewBag); contract.DefaultUserId = new Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); contract.DateTime = DateTime.UtcNow; var activity = new CrudeDefaultUserActivityServiceClient(); //activity.Insert(contract); activity.Close(); } catch { }; }
public static void ActionLog( // HttpRequestBase request, string message ) { try { CrudeDefaultUserActivityContract contract = new CrudeDefaultUserActivityContract { DefaultUserActivityId = Guid.NewGuid(), DefaultUserActivityTypeRcd = DefaultUserActivityTypeRef.WebPageOpened, UserActivityNote = message }; try { // contract.OriginatingAddress = request.ServerVariables["REMOTE_ADDR"]; } catch { }; contract.DefaultUserId = new Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}"); contract.DateTime = DateTime.UtcNow; CrudeDefaultUserActivityServiceClient activity = new CrudeDefaultUserActivityServiceClient(); activity.Insert(contract); activity.Close(); } catch { }; }