protected override void OnClosing(CancelEventArgs e) { ESecurityRights nUserRights = ESecurityRights.NORIGHT; if (m_nUserRights != null) { nUserRights = (ESecurityRights)Convert.ToUInt64(m_nUserRights); } if (nUserRights == ESecurityRights.NORIGHT || nUserRights == ESecurityRights.VIEW) { // Nothing. } else if (SaveForChange() == ESaveForChangeResult.FAIL) // save fail? { e.Cancel = true; return; } // close normally this.Dispose(true); GC.SuppressFinalize(this); base.OnClosing(e); }
/// <summary> /// Override OnLoad method to: /// 1. initialize components by using base method /// 2. initialize data of all controls placed on this form using virtual method InitializeData() /// Revision: /// 2003-06-04 created by TRAN VIET HA /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { // initialize all components base.OnLoad(e); if (!this.DesignMode) { // initialize data of all controls placed on this form. if (!InitializeData()) { this.Close(); return; } if (UserID == null || (int)UserID != 3) { btnDesignForm.Visible = false; } // Modified by HoangTV 2005/03/29 to support multi-rights: ESecurityRights nUserRights = ESecurityRights.NORIGHT; if (m_nUserRights != null) { nUserRights = (ESecurityRights)Convert.ToUInt64(m_nUserRights); } if (nUserRights == ESecurityRights.NORIGHT || nUserRights == ESecurityRights.VIEW) { foreach (Control ctrInternal in pnlFWCommand.Controls) { ctrInternal.Enabled = false; } //pnlFWCommand.Enabled = false; pnlFWClose.Enabled = true; } // no dirty data DirtyData = false; } }