Ejemplo n.º 1
0
        private void tbaMain_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
        {
            switch (Convert.ToString(e.Button.Tag))
            {
                case "DangNhap":
                    settingsModule= new  ModuleSettings();
                    settingsModule = ModuleConfig.GetSettings();

                    if (WorkingContext.CheckConnection(settingsModule.Server, settingsModule.Database, settingsModule.UserName, settingsModule.Password))
                    {
                        AdminDO adminDO = new AdminDO();
                        EmployeeDO employeeDO = new EmployeeDO();
                        dsUser = adminDO.GetAllUsers();
                        dsEmployee = employeeDO.GetAllEmployees(1);
                        if (dsUser.Tables[0].Rows.Count == 0 || dsEmployee.Tables[0].Rows.Count == 0)
                        {
                            NotLogin(true);
                        }
                        else
                            login.ShowDialog(this);
                    }
                    else
                    {
                        string str4 = WorkingContext.LangManager.GetString("frmSetting_Error1_Title");
                        string str5 = WorkingContext.LangManager.GetString("frmSetting_Error2");
                        //MessageBox.Show("Không thể kết nối được cơ sở dữ liệu. Hãy nhập lại thông số cấu hình hệ thống", "Lỗi", MessageBoxButtons.OK,  MessageBoxIcon.Error);
                        MessageBox.Show(str5, str4, MessageBoxButtons.OK, MessageBoxIcon.Error);

                        frmSettings settings = new frmSettings();
                        settings.ShowDialog(this);
                        this.Refresh();
                    }
                    break;
                case "Search":
                    if (CheckMdiClientDuplicates("frmSearch"))
                    {
                        frmSearch search = new frmSearch();
                        search.Show();
                        search.MdiParent = this;
                    }
                    break;
                case "Report":
                    if (CheckMdiClientDuplicates("frmListReport"))
                    {
                        frmListReport report = new frmListReport();
                        report.Show();
                        report.MdiParent = this;
                    }

                    break;
                case "Status":
                    if (CheckMdiClientDuplicates("frmEmployeeStatus"))
                    {
                        frmEmployeeStatus status = new frmEmployeeStatus();
                        status.Show();
                        status.MdiParent = this;
                    }
                    break;
                case "Schedule":
                    if (CheckMdiClientDuplicates("frmRegWorkingTime"))
                    {
                        frmRegWorkingTime workingTime1 = new frmRegWorkingTime();
                        workingTime1.Show();
                        workingTime1.MdiParent = this;
                    }
                    break;
                case "Manage":
                    if (CheckMdiClientDuplicates("frmListEmployees"))
                    {
                        frmListEmployees listEmployees = new frmListEmployees();
                        listEmployees.Show();
                        listEmployees.MdiParent = this;
                    }
                    break;
                case "Salary":
                    if (CheckMdiClientDuplicates("frmListSalary"))
                    {
                        frmListSalary salary = new frmListSalary();
                        salary.Show();
                        salary.MdiParent = this;
                    }
                    break;
                case "TimeSheet":
                    if (CheckMdiClientDuplicates("frmTimeSheet"))
                    {
                        frmTimeSheet timesheet = new frmTimeSheet();
                        timesheet.Show();
                        timesheet.MdiParent = this;
                    }
                    break;
                case "Settings":
                    frmSettings frmsettings = new frmSettings();
                    frmsettings.ShowDialog(this);
                    this.Refresh();
                    break;
                case "Help":
                    MessageBox.Show("Chức năng này đang được xây dựng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                case "Antrua":
                    if (CheckMdiClientDuplicates("frmLunch"))
                    {
                        frmLunch frm = new frmLunch();
                        frm.Show();
                        frm.MdiParent = this;
                    }
                    break;
                case "Exit":
                    string str = WorkingContext.LangManager.GetString("frmMain_MessaThem");
                    string str1 = WorkingContext.LangManager.GetString("frmMain_MessaThem1");
                    if (MessageBox.Show(str, str1, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Application.Exit();
                    }
                    break;
            }
        }
Ejemplo n.º 2
0
 private void mnuSalary_Click(object sender, EventArgs e)
 {
     if (CheckMdiClientDuplicates("frmListSalary"))
     {
         frmListSalary salary = new frmListSalary();
         salary.Show();
         salary.MdiParent = this;
     }
 }