Пример #1
0
        private void HomeForm_Load(object sender, EventArgs e)
        {
            this.Text = "Payroll Timeclock - " + Application.ProductVersion;

            string exeToData = "\\Data";

            if (Environment.CommandLine.Contains("/visualstudio"))
            {
                exeToData = "\\..\\..\\Data";
            }
            PayrollStatic.DataFolder = Path.GetDirectoryName(Application.ExecutablePath) + exeToData;
            if (!string.IsNullOrEmpty(Properties.Settings.Default.DataFilePath))
            {
                PayrollStatic.DataFolder = Properties.Settings.Default.DataFilePath;
            }

            PayrollStatic.Settings = new Settings();
            string loadErrorMsg = PayrollStatic.Settings.LoadFromConfigFile();

            if (loadErrorMsg != null)
            {
                MessageBox.Show(loadErrorMsg);
                this.Close();
                return;
            }
            lnkWebSite.Text = PayrollStatic.Settings.WebSiteLabel;

            PayrollStatic.LoadPeople();
            LoadEmployeeList();

            timerBlogRefresh.Interval = 1000 * 60 * 10;     // every 10 minutes
            timerBlogRefresh.Enabled  = true;
            LoadNews();
        }
Пример #2
0
        private void btnAdmin_Click(object sender, EventArgs e)
        {
            PayrollStatic.Settings.ConfigureForDate();
            EnterAdminPwdForm passwordFrm = new EnterAdminPwdForm();

            if (!passwordFrm.PasswordMatches())
            {
                MessageBox.Show("Invalid administrator password.");
                return;
            }
            AdminForm adminFrm = new AdminForm(true);

            adminFrm.ShowDialog();
            PayrollStatic.LoadPeople();
            LoadEmployeeList();
        }