예제 #1
0
파일: Form_Main.cs 프로젝트: dtsonvt/IPC247
        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);
        }
예제 #2
0
파일: Form_Main.cs 프로젝트: dtsonvt/IPC247
 private void Form_Main_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
 {
     PreClosingConfirmation();
     Get_Push_Notify.Stop();
     Application.Exit();
 }
예제 #3
0
        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);
        }