public virtual bool IsOf(string userName) { bool _isCreatedBy = CreatedBy.ToLower() == userName.ToLower(); bool _isUpdatedBy = (!LastUpdatedBy.IsNullOrEmptyOrWhiteSpace()) && (LastUpdatedBy.ToLower() == userName.ToLower()); if (_isCreatedBy || _isUpdatedBy) { return(true); } return(false); }
private void InitSystemTray() { var assembly = Assembly.GetExecutingAssembly(); using (Stream stream = assembly.GetManifestResourceStream("Forex.Assets.logo.ico")) { _notifier = new WinForms.NotifyIcon { Visible = true, Icon = new System.Drawing.Icon(stream) }; } Closing += (sender, e) => { Hide(); e.Cancel = true; }; var menu = new WinForms.ContextMenuStrip(); menu.Items.Add("Open", null, (sender, args) => Show()); menu.Items.Add("Quit", null, (sender, args) => Application.Current.Shutdown()); _notifier.ContextMenuStrip = menu; _notifier.MouseMove += (sender, e) => { _notifier.Text = $"USD/CNY Rate: {LatestRate}\r\nUpdated By: {LastUpdatedBy?.ToString("yyyy-MM-dd HH:mm:ss")}"; }; _notifier.MouseDown += (sender, e) => { if (e.Button == WinForms.MouseButtons.Left) { if (IsVisible) { Activate(); } else { Show(); } } }; _notifier.BalloonTipClicked += (sender, e) => Show(); }
public StateSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null) { var stateSet = new StateSet() { CreatedBy = CreatedBy.Clone(), LastUpdatedBy = LastUpdatedBy.Clone(), OwnerOrganization = OwnerOrganization.Clone(), CreationDate = CreationDate, DatabaseName = DatabaseName, Description = Description, EntityType = EntityType, Id = newId ? Guid.NewGuid().ToId() : Id, IsLocked = IsLocked, IsPublic = IsPublic, IsValid = IsValid, Key = Key, LastUpdatedDate = LastUpdatedDate, LockedBy = LockedBy.Clone(), LockedDateStamp = LockedDateStamp, Name = Name, OwnerUser = OwnerUser.Clone(), RequireEnum = RequireEnum, }; if (OwnerUser != null) { stateSet.OwnerUser = user == null?OwnerUser.Clone() : user; } if (IsLocked) { stateSet.LockedBy = user == null?LockedBy.Clone() : user; } foreach (var state in States) { stateSet.States.Add(state.Clone()); } return(stateSet); }
public UnitSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null) { var unitSet = new UnitSet() { CreatedBy = user ?? CreatedBy.Clone(), OwnerOrganization = org ?? OwnerOrganization.Clone(), LastUpdatedBy = user ?? LastUpdatedBy.Clone(), CreationDate = CreationDate, DatabaseName = DatabaseName, Description = Description, EntityType = EntityType, Id = newId ? Guid.NewGuid().ToId() : Id, IsLocked = IsLocked, IsPublic = IsPublic, IsValid = IsValid, Key = Key, LastUpdatedDate = LastUpdatedDate, LockedDateStamp = LockedDateStamp, Name = Name, Notes = CloneNotes(), }; if (OwnerUser != null) { unitSet.OwnerUser = user ?? OwnerUser.Clone(); } if (IsLocked) { unitSet.LockedBy = user ?? LockedBy.Clone(); } foreach (var unit in Units) { unitSet.Units.Add(unit.Clone()); } return(unitSet); }