private void Frm_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) { if (!Flag_Login) { this.Close(); //Cancel exist if (!exist) { Form_Login frm = new Form_Login(); Flag_Login = false; frm.txtUserName.Text = user.Username; frm.txtPassword.Focus(); frm.FormClosed += Frm_FormClosed; LoadControlForPhanQuyen(); frm.ShowDialog(); } else { System.Windows.Forms.Application.Exit(); } } else { this.Show(); } }
/// <summary> /// LOGOFF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DisableAllControl(); this.Hide(); DisposeAllButThis(); Form_Login frm = new Form_Login(); Flag_Login = false; // info = new InfoIPC(); Logoff(); frm.txtUserName.Text = user.Username; frm.txtPassword.Focus(); user = new User(); frm.FormClosed += Frm_FormClosed; frm.ShowDialog(); this.barheader_text.Caption = string.Format("Xin Chào: {0} - chúc bạn một ngày làm việc hiệu quả", user.Name); ribbonControl1.SelectedPage = ribbonPage1; LoadControlForPhanQuyen(); }
private void Form_Main_Load(object sender, EventArgs e) { try { IPAddress = getIP(); /// check version: /// string _version = System.Windows.Forms.Application.ProductVersion; if (_version != GetVersion()) { XtraMessageBox.Show(string.Format("Version Hiện Tại là {0}, Vui lòng cập nhật bản mới nhất!", GetVersion()), "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Stop); Flag_ExitNow = true; Application.Exit(); } } catch (Exception) { IPAddress = ""; } if (!Flag_Login) { this.Hide(); Form_Login frm = new Form_Login(); frm.FormClosed += Frm_FormClosed; frm.ShowDialog(); LoadControlForPhanQuyen(); } else { Get_Push_Notify.Start(); } if (string.IsNullOrEmpty(info.TenCongTy)) { LoadThongTinDefault(); } this.barheader_text.Caption = string.Format("Xin Chào: {0} - chúc bạn một ngày làm việc hiệu quả", user.Name); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; this.Text = string.Format("IPC247 - Version - {0}", version); }
private void Form_Main_Load(object sender, EventArgs e) { try { //string a = @"Data Source=171.244.140.175;Initial Catalog=IPC247Test;Persist Security Info=True;User ID=sa;Password=123456a@"; //a = StringCipher.Encrypt(a,"IPC247@2018"); //a = StringCipher.Decrypt(a, "IPC247@2018"); IPAddress = getIP(); } catch (Exception) { IPAddress = ""; } if (!Flag_Login) { this.Hide(); #region Xử lý update string _version = System.Windows.Forms.Application.ProductVersion; string ver = GetVersion(); if (_version != ver) { Flag_ExitNow = true; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "AutoUpdate.exe")) { try { Process.Start(AppDomain.CurrentDomain.BaseDirectory + "AutoUpdate.exe"); Application.Exit(); } catch (Exception) { Application.Exit(); } } else { XtraMessageBox.Show("Không tìm thấy File AutoUpdate!, liên hệ quản trị để được hỗ trợ", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Stop); Application.Exit(); } } #endregion Form_Login frm = new Form_Login(); frm.FormClosed += Frm_FormClosed; frm.ShowDialog(); LoadControlForPhanQuyen(); } else { Get_Push_Notify.Start(); } if (string.IsNullOrEmpty(info.TenCongTy)) { LoadThongTinDefault(); } this.barheader_text.Caption = string.Format("Xin Chào: {0} - chúc bạn một ngày làm việc hiệu quả", user.Name); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; string versionDB = SQLHelper.str_connect.Contains("Test")?"(TEST)":""; this.Text = string.Format("IPC247 - Version - {0} {1}", version, versionDB); }