示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //checkIniFile
            if (!File.Exists(IniPath))
            {
                Error2Close = true;
                MessageBox.Show("Error: Please check your configuration file.\nPath:" + IniPath, "Configuration File not Found (.ini)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            inif = new IniFile(IniPath);
            if (CheckLists())
            {
                Error2Close = true;
                Application.Exit();
            }
            Initialization();
            isStandAlone = cf.isBoolean(inif.Read("Stand-Alone", "System"));
            CheckCompanyInfo();
            //Check Sychronization for data handling
            if (!isStandAlone)
            {
                CheckSync();
            }
            else
            {
                if (isOnline)
                {
                    MessageBox.Show("Warning: Your settings was set to \"ONLINE\".\nIt is recommended to Set your Stand-Alone to true.", "Warning: ONLINE Transaction was set", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            Login login = new Login();

            login.SQLClient  = SQLCLient;
            login.SQLServer  = SQLServer;
            login.BranchCode = inif.Read("BranchCode", "CompanyDetails");
            login.ShowDialog();
            if (string.IsNullOrEmpty(login.ActiveUser))
            {
                return;
            }
            ActiveUser         = login.ActiveUser;
            tssActiveUser.Text = string.IsNullOrEmpty(ActiveUser) ? "N/A" : ActiveUser;
            tssLogin.Visible   = string.IsNullOrEmpty(ActiveUser) ? true : false;
            tssLogout.Visible  = !tssLogin.Visible;
            if (ActiveRole == "staff")
            {
                POS PS = new POS();
                PS.inif      = inif;
                PS.MdiParent = this;
                PS.ShowDialog();
            }
            UserValidator(login.ActiveRole);
        }