public FrmUpdateDepartmentHistory(int iEmployeeID, string strDepartmentName, DateTime dtModify, string strDecNumber, string strNote, int iSelectedRow)
        {
            InitializeComponent();
            employeeDO = new EmployeeDO();
            dsDepartmentHistory = employeeDO.GetDepartmentHistory(iEmployeeID);
            rowUpdate = dsDepartmentHistory.Tables[0].Rows[iSelectedRow];

            txtBoPhan.Text = strDepartmentName;
            txtDecNumber.Text = strDecNumber;
            dptDate.Value = dtModify;
            txtNote.Text = strNote;
            //Lưu lại các thông tin trước khi update
            DecNumberBeforeUpdate = strDecNumber;
            ModifiedDateBeforeUpdate = dtModify.Date;
            NoteBeforeUpdate = strNote;
        }
예제 #2
0
        public FrmUpdateSalaryHistory(int iEmployeeID, decimal dbSalary, string strDecNumber, DateTime dtModefiedDate, string strNote, int iSelectedRow)
        {
            InitializeComponent();

            employeeDO = new EmployeeDO();
            dsSalaryHistory = employeeDO.GetSalaryHistory(iEmployeeID);
            rowUpdate = dsSalaryHistory.Tables[0].Rows[iSelectedRow];

            txtSalary.Text = dbSalary.ToString();
            txtDecNumber.Text = strDecNumber;
            dtpDate.Value = dtModefiedDate;
            txtNote.Text = strNote;
            //Lưu lại các thông tin trước khi update
            SalaryBeforeUpdate = dbSalary;
            DecNumberBeforeUpdate = strDecNumber;
            ModifiedDateBeforeUpdate = dtModefiedDate.Date;
            NoteBeforeUpdate = strNote;
        }
예제 #3
0
        private void FrmUser_Load(object sender, EventArgs e)
        {
            employeeDO = new EmployeeDO();
            adminDO = new AdminDO();

            PopulateUserAndGroupCombos();

            if (selectedUser >= 0)
            {
                string str = WorkingContext.LangManager.GetString("frmUser_Text1");
                this.Text = str;
                // Hien thi thong tin nguoi dung
                LoadCurrentUser();
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmUser_Text2");
                this.Text = str;
                this.txtUsername.TabIndex = 0;
            }
            Refresh();
        }
예제 #4
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;
            }
        }
예제 #5
0
        public frmMain()
        {
            ShowSplashScreen();
            InitializeComponent();
            this.Refresh();
            //SetMenuStatus(false);
            this.Show();
            this.Activate();
            login = new frmLogin(this);

            AdminDO adminDO = new AdminDO();
            EmployeeDO employeeDO = new EmployeeDO();

            settingsModule = new ModuleSettings();
            settingsModule = ModuleConfig.GetSettings();

            if (!WorkingContext.CheckConnection(settingsModule.Server, settingsModule.Database, settingsModule.UserName, settingsModule.Password))
            {
                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 frm = new frmSettings();
                frm.ShowDialog(this);
            }
            else
            {

                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);
            }
        }
예제 #6
0
        /// <summary>
        /// Tự động sinh bảng thanh toán tiền phép dựa trên dữ liệu sẵn có
        /// </summary>
        private void GenerateRestSheet()
        {
            frmStatusMessage message = new frmStatusMessage();
            message.Show("Đang sinh dữ liệu bảng thanh toán tiền phép, xin chờ trong giây lát...");
            this.Cursor = Cursors.WaitCursor;
            employeeDO = new EmployeeDO();
            DataSet dsEmployee = employeeDO.GetEmployeeByDepartment(DepartmentID);
            int totalEmployees = dsEmployee.Tables[0].Rows.Count;
            float percentToComplete = 0;
            int percentProcessing = 0;

            restsheetDO.DeleteRegRestInYear(CurrentYear);

            if (dsEmployee.Tables[0].Rows.Count > 0)
            {
                int ret = 0;
                foreach (DataRow dr in dsEmployee.Tables[0].Rows)
                {
                    int EmployeeID = int.Parse(dr["EmployeeID"].ToString());
                    percentProcessing = ++percentProcessing;
                    try
                    {
                        ret = restsheetDO.GenerateRestSheet(CurrentYear, EmployeeID);
                        percentToComplete = (percentProcessing * 100) / totalEmployees;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    message.ProgressBar.Value = (int)percentToComplete;
                }
                message.Close();
                this.Cursor = Cursors.Default;
                if (ret > 0)
                {
                    string str = WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Messa");
                    string str1 = WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Title");
                    //MessageBox.Show("Sinh bảng thanh toán tiền phép thành công", "Sinh bảng thanh toán tiền phép", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string str = WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Messa1");
                    string str1 = WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Title");
                    //MessageBox.Show("Sinh bảng thanh toán tiền phép thất bại", "Sinh bảng thanh toán tiền phép", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                message.Close();
                this.Cursor = Cursors.Default;
            }
        }
예제 #7
0
        private void frmLunch_Load(object sender, EventArgs e)
        {
            Refresh();
            departmentDO = new DepartmentDO();
            employeeDO = new EmployeeDO();
            lunchDO = new LunchDO();
            cboLunchMoney.Text = "16000";

            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
        }
예제 #8
0
        private void frmListEmployees_Load(object sender, EventArgs e)
        {
            EVsoft.HRMS.Common.GeneralProcess.StandardFormControl(this);
            departmentDO = new DepartmentDO();
            employeeDO = new EmployeeDO();

            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;

            Refresh();
        }
예제 #9
0
        private void frmPunish_Load(object sender, EventArgs e)
        {
            Refresh();
            departmentDO = new DepartmentDO();
            employeeDO = new EmployeeDO();
            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            departmentTreeView.ExpandNodes(true);
            LoadPunishCardCombo();
            punishD0 = new PunishDO();
            dtPunish = dsPunish.Tables[0];

            if(selectedPunish >= 0)//Sửa thông tin thẻ phạt
            {

                //this.Text = "Sửa thông tin thiết lập thẻ phạt";
                this.Text = WorkingContext.LangManager.GetString("frmPunish_Text1");
                LoadPunishData();
                cboEmployeeName.Enabled = false;
                departmentTreeView.Enabled = false;
            }
            else// thêm mới
            {
                //This.Text = "Thiết lập thẻ phạt";
                this.Text = WorkingContext.LangManager.GetString("frmPunish_Text2");
            }
        }
예제 #10
0
        private void GenerateSalary()
        {
            frmStatusMessage message = new frmStatusMessage();
            string str = WorkingContext.LangManager.GetString("frmListSalary_btnSinh_THongBao3");
            //message.Show("Đang sinh dữ liệu bảng lương...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            employeeDO = new EmployeeDO();
            DataSet dsEmployee = employeeDO.GetEmployeeByDepartment(DepartmentID);
            int totalEmployees = dsEmployee.Tables[0].Rows.Count;
            float percentToComplete = 0;
            int percentProcessing = 0;
            message.ProgressBar.Value = 0;

            DataSet dsGetAutoGenerateLunchSheet = salaryDO.GetAutoGenerateLunchSheet();
            string checkStatus = dsGetAutoGenerateLunchSheet.Tables[0].Rows[0][0].ToString();
            string ProcedureName = null;
            bool bSalaryHP = true;
            if (dsGetAutoGenerateLunchSheet != null)
                if (string.Compare(checkStatus, "true") == 0 || string.Compare(checkStatus, "True") == 0 || string.Compare(checkStatus, "TRUE") == 0)
                {
                    bSalaryHP = false;
                    ProcedureName = "GenerateSalary_New";
                }
                //else ProcedureName = "GenerateSalary_HP_New";

            if (dsEmployee.Tables[0].Rows.Count > 0)
            {
                int ret = 0;
                if (bSalaryHP)
                {
                    //Lấy về số ngày làm việc trong tháng
                    float fWorkingDayInMonth = 0;
                    fWorkingDayInMonth = salaryDO.GetWorkingDayInMonth(CurrentMonth, CurrentYear);
                    if (fWorkingDayInMonth == 0)
                        fWorkingDayInMonth = WORKING_DAY_IN_MONTH;

                    foreach (DataRow dr in dsEmployee.Tables[0].Rows)
                    {
                        int EmployeeID = int.Parse(dr["EmployeeID"].ToString());
                        percentProcessing = ++percentProcessing;
                        try
                        {
                            ret = ret + salaryDO.GenerateSalary_HP(CurrentMonth, CurrentYear, EmployeeID, fWorkingDayInMonth);
                            percentToComplete = ((float)(percentProcessing) / (float)(totalEmployees)) * 100;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        message.ProgressBar.Value = (int)percentToComplete;
                    }
                }
                else
                {
                    foreach (DataRow dr in dsEmployee.Tables[0].Rows)
                    {
                        int EmployeeID = int.Parse(dr["EmployeeID"].ToString());
                        percentProcessing = ++percentProcessing;
                        try
                        {
                            ret = ret + salaryDO.GenerateSalary(CurrentMonth, CurrentYear, EmployeeID, ProcedureName);
                            percentToComplete = ((float)(percentProcessing) / (float)(totalEmployees)) * 100;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        message.ProgressBar.Value = (int)percentToComplete;
                    }
                }

                message.Close();
                this.Cursor = Cursors.Default;
                if (ret > 0)
                {
                    string str1 = WorkingContext.LangManager.GetString("frmListSalary_btnSinh_THongBao4");
                    string str2 = WorkingContext.LangManager.GetString("frmListSalary_btnSinh_THongBao_title");
                    //MessageBox.Show("Sinh bảng lương thành công", "Sinh bảng lương", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string str1 = WorkingContext.LangManager.GetString("frmListSalary_btnSinh_THongBao5");
                    string str2 = WorkingContext.LangManager.GetString("frmListSalary_btnSinh_THongBao_title");
                    //MessageBox.Show("Sinh bảng lương thất bại", "Sinh bảng lương", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                message.Close();
                this.Cursor = Cursors.Default;
            }
        }
예제 #11
0
        private void frmRegWorkingTime_Load(object sender, EventArgs e)
        {
            Refresh();
            workingTimeDO = new RegWorkingTimeDO();
            employeeDO = new EmployeeDO();

            DepartmentDO departmentDO = new DepartmentDO();
            dsDepartment = departmentDO.GetAllDepartments();

            departmentTreeView.DepartmentDataSet = dsDepartment;
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;

            monthCalendar1.SelectDate(DateTime.Today);

            //CurrentYear = DateTime.Today.Year;
            CurrentYear = DateTime.Now.Year;
            monthCalendar1.ActiveMonth.Year = CurrentYear;
            CurrentMonth = DateTime.Today.Month;
            monthCalendar1.ActiveMonth.Month = CurrentMonth;

            monthCalendar1.SelectDate(DateTime.Today);
            SetStatus(false);

            PopulateShiftCombo();
        }
예제 #12
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            int check = CheckData();
            if(check ==0)
            {

                string value = "";
                if (cbValue.Visible)
                    value = cbValue.Text;
                else if (textBox2.Visible)
                    value = textBox2.Text;
                else if (dtpTime.Visible)
                {

                    value = "1900-01-01 " + dtpTime.Value.Hour + ":" + dtpTime.Value.Minute + ":00";

                }

                if (string.Compare(SysVarname, "UpdateBasicSalary") == 0)
                {
                    try
                    {
                        double BasicSalary = Convert.ToDouble(value);
                        EmployeeDO employeeDO = new EmployeeDO();
                        int result = employeeDO.UpdateBasicSalary(BasicSalary);
                        if (result == 1)
                        {
                            AddEmployeeHistory();
                            MessageBox.Show("Cập nhật lương CB thành công !");
                        }
                        else
                            MessageBox.Show("Lỗi hệ thống !");
                        this.Close();
                    }
                    catch
                    {
                        MessageBox.Show("Giá trị kiểu số !");
                    }
                }
                else if (string.Compare(SysVarname, "UpdateLunchCompany") == 0)
                {
                    try
                    {
                        EmployeeDO employeeDO = new EmployeeDO();
                        int result = employeeDO.UpdateLunchCompany(Convert.ToDouble(value));
                        if (result == 1)
                        {

                            DOadmin.UpdateSysVar(SysVarname, textBox1.Text, value, true);
                            frm.GetSysVar();
                            MessageBox.Show("Cập nhật PC ăn trưa thành công !");
                            this.Close();
                        }
                        else
                            MessageBox.Show("Lỗi hệ thống !");
                        this.Close();
                    }
                    catch
                    {
                        MessageBox.Show("Giá trị kiểu số !");
                    }
                }
                else
                {
                    DOadmin.UpdateSysVar(SysVarname, textBox1.Text, value, true);
                    frm.GetSysVar();
                    this.Close();
                }
            }
            else if(check == 1)
            {
                MessageBox.Show("Vui lòng nhập vào mô tả","Thông báo");
                textBox1.Focus();
            }
            else
            {
                MessageBox.Show("Vui lòng nhập vào gía trị","Thông báo");
                textBox2.Focus();
            }
        }
예제 #13
0
        private void AddEmployeeHistory()
        {
            // Thay đổi diễn biến lương
            EmployeeDO employeeDO = new EmployeeDO();
            int ret = 0;
            try
            {
                dsEmployee = employeeDO.GetAllEmployees(1);
                foreach (DataRow row in dsEmployee.Tables[0].Rows)
                {
                    int EmployeeID = Convert.ToInt32(row["EmployeeID"].ToString());
                    dsSalaryHistory = employeeDO.GetSalaryHistory(EmployeeID);
                    DataRow dr = dsSalaryHistory.Tables[0].NewRow();
                    dr.BeginEdit();
                    dr["EmployeeID"] = EmployeeID;
                    dr["BasicSalary"] = Convert.ToDouble(row["BasicSalary"].ToString());
                    dr["DecisionNumber"] = "001";
                    dr["Note"] = "Thay Đổi lương công ty !";
                    dr["ModifiedDate"] = DateTime.Now;
                    dr.EndEdit();
                    dsSalaryHistory.Tables[0].Rows.Add(dr);
                    ret = employeeDO.AddSalaryHistory(dsSalaryHistory);
                }

            }
            catch
            {
            }
            if (ret == 0)
            {
                string str = WorkingContext.LangManager.GetString("frmEmployee_UpdateE_Error_Messa3");
                string str1 = WorkingContext.LangManager.GetString("frmEmployee_UpdateE_Error_Title1");
                //MessageBox.Show("Không thể thêm thay đổi vào diễn biến lương của nhân viên.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsSalaryHistory.RejectChanges();
            }
            else
            {
                dsSalaryHistory.AcceptChanges();
            }
        }
예제 #14
0
        private void frmEmployee_Load(object sender, EventArgs e)
        {
            Refresh();
            check = false;
            employeeDO = new EmployeeDO();

            //Lấy danh sách các phòng ban, chức vụ trong công ty
            PopulateDepartmentAndPositionCombos();
            PopulateContractCombo();
            PopulateHospitalCombos();
            mtgcComboFixSalary.DataSource = null;

            txtBasicSalary.Prefix = "";
            txtBasicSalary.MaxDecimalPlaces = 0;
            txtLunchAllowance.Prefix = "";
            txtLunchAllowance.MaxDecimalPlaces = 0;
            txtPositionAllowance.Prefix = "";
            txtPositionAllowance.MaxDecimalPlaces = 0;
            txtJobAllowance.Prefix = "";
            txtJobAllowance.MaxDecimalPlaces = 0;
            txtIntimateAllowance.Prefix = "";
            txtIntimateAllowance.MaxDecimalPlaces = 0;
            txtTaskAllowance.Prefix = "";
            txtTaskAllowance.MaxDecimalPlaces = 0;
            txtJapaneseAllowance.Prefix = "";
            txtJapaneseAllowance.MaxDecimalPlaces = 0;

            if (selectedEmployee >= 0)
            {
                // Hiển thị thông nhân viên
                LoadCurrentEmployee();
            }
            else
            {
                //this.Text = "Thêm nhân viên mới";
                label10.Visible = false;
                btnFirst.Visible = false;
                btnPrevious.Visible = false;
                btnNext.Visible = false;
                btnLast.Visible = false;
                txtRecordNum.Visible = false;
                cboGender.SelectedIndex = 0;
                cboContract.SelectedIndex = 0;
                dtpStopDate.Visible = false;
                dtpChangePosition.Enabled = false;
                dtpDepartment.Enabled = false;

                lblBarCode.Visible = false;
                txtBarcode.Visible = false;
                cboNationality.SelectedIndex = 0;
                cboReligious.SelectedIndex = 0;
                cboPeople.SelectedIndex = 0;
                dtpDateOfBirth.Value = DateTime.Now.AddYears(-20);
                dtpIssue.Value = DateTime.Now.AddYears(-4);

            }
            this.ActiveControl = txtEmployeeName;
        }
예제 #15
0
        /// <summary>
        /// Tự động sinh bảng ăn trưa dựa trên dữ liệu sẵn có
        /// </summary>
        private void GenerateLunchSheet()
        {
            frmStatusMessage message = new frmStatusMessage();
            string str = WorkingContext.LangManager.GetString("frmListLunch_Sinh_Messa1");
            //message.Show("Đang sinh dữ liệu ăn trưa...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            employeeDO = new EmployeeDO();
            DataSet dsEmployee = employeeDO.GetEmployeeByDepartment(DepartmentID);
            int totalEmployees = dsEmployee.Tables[0].Rows.Count;
            float percentToComplete = 0;
            int percentProcessing = 0;

            if (dsEmployee.Tables[0].Rows.Count > 0)
            {
                int ret = 0;
                foreach (DataRow dr in dsEmployee.Tables[0].Rows)
                {
                    int EmployeeID = int.Parse(dr["EmployeeID"].ToString());
                    percentProcessing= ++percentProcessing;
                    try
                    {
                        ret = lunchDO.GenerateLunchSheet(CurrentMonth, CurrentYear,EmployeeID);
                        percentToComplete = (percentProcessing*100) / totalEmployees;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    message.ProgressBar.Value = (int)percentToComplete;
                }
                message.Close();
                this.Cursor = Cursors.Default;
                if (ret > 0)
                {
                    string str2 = WorkingContext.LangManager.GetString("frmListLunch_Sinh_Messa2");
                    string str3 = WorkingContext.LangManager.GetString("frmListLunch_Sinh_Title");
                    //MessageBox.Show("Sinh bảng ăn trưa thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string str2 = WorkingContext.LangManager.GetString("frmListLunch_Sinh_Messa3");
                    string str3 = WorkingContext.LangManager.GetString("frmListLunch_Sinh_Title");
                    //MessageBox.Show("Sinh bảng ăn trưa thất bại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(str2, str3, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                message.Close();
                this.Cursor = Cursors.Default;
            }
        }
예제 #16
0
 private void frmChangeTimeInOut_Load(object sender, System.EventArgs e)
 {
     Refresh();
     timeInOutDO = new TimeInOutDO();
     employeeDO = new EmployeeDO();
     DepartmentDO departmentDO = new DepartmentDO();
     departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
     departmentTreeView.BuildTree();
     departmentTreeView.SelectedNode = departmentTreeView.TopNode;
 }
예제 #17
0
 private void btnDeletedEmployee_Click(object sender, System.EventArgs e)
 {
     if (delete == 0)
     {
         //			btnAdd.Visible = false;
         //			btnDelete.Visible = false;
         btnRestore.Visible = true;
         checkEmployeeDeleted = true;
         btnPermanentDelete.Visible = false;
         delete = 1;// chon tim kiem theo danh sach nhan vien nghi
         //btnPermanentDelete.Visible = true;
         EmployeeDO employeeDO = new EmployeeDO();
         dsEmployee = employeeDO.GetDeletedEmployeeInsurance((int)departmentTreeView.SelectedNode.Tag);
         PopulateEmployeeListView();
     }
     else if(delete==1)
     {
         checkEmployeeDeleted = false;
         delete = 0;
         departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
         departmentTreeView.BuildTree();
         departmentTreeView.SelectedNode = departmentTreeView.TopNode;
         EmployeeDO employeeDO = new EmployeeDO();
         dsEmployee = employeeDO.GetEmployeeByDepartmentInsurance((int)departmentTreeView.SelectedNode.Tag);
         Refresh();
         btnRestore.Visible = false;
         btnPermanentDelete.Visible = true;
     }
 }
예제 #18
0
        private void frmRegLeaveSchedule_Load(object sender, EventArgs e)
        {
            Refresh();
            employeeDO = new EmployeeDO();

            departnemtDO = new DepartmentDO();
            departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            departmentTreeView.ExpandNodes(true);

            leaveScheduleDO = new LeaveScheduleDO();

            if (selectedLeaveSchedule >= 0)
            {
                // disable các thuộc tính liên quan đến nhân viên
                string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text2");
                this.Text = str;
                //this.Text = "Sửa đăng ký công tác";
                LoadLeaveSchedule();
                cboEmployeeName.Enabled = false;
                departmentTreeView.Enabled = false;
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text");
                this.Text = str;
                dsLeaveSchedule = leaveScheduleDO.getLeaveSchedule();
            }
        }
예제 #19
0
        private void frmListEmployees_Load(object sender, EventArgs e)
        {
            departmentDO = new DepartmentDO();
            employeeDO = new EmployeeDO();

            departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;
            Refresh();
        }
예제 #20
0
        /// <summary>
        /// Sinh dữ liệu thanh toán tiền phép
        /// </summary>
        private void SinhBangThanhToanTienPhep()
        {
            frmStatusMessage frmMessagePri = new frmStatusMessage();
            frmMessagePri.Show("Đang sinh dữ liệu bảng thanh toán tiền phép, xin chờ trong giây lát...");
            this.Cursor = Cursors.WaitCursor;

            employeeDO = new EmployeeDO();
            restsheetDO = new RestSheetDO();

            //Tổng hợp thông tin nghỉ phép của nhân viên
            TongHopThongTinNghiPhep(frmMessagePri);

            if (tblRestSheet.Rows.Count > 0)
            {
                SqlConnection con = WorkingContext.GetConnection();
                SqlTransaction trans = null;

                try
                {
                    con.Open();
                    trans = con.BeginTransaction();

                    LuuThongTinTienPhep(trans);

                    frmMessagePri.Close();
                    this.Cursor = Cursors.Default;

                    trans.Commit();
                    trans.Dispose();

                    MessageBox.Show(this, WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Messa"),
                            WorkingContext.LangManager.GetString("frmRestSheet_Sinh_Title"),
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    trans.Dispose();

                    frmMessagePri.Close();
                    this.Cursor = Cursors.Default;

                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                    con.Dispose();
                }
            }
            else
            {
                frmMessagePri.Close();
                this.Cursor = Cursors.Default;
            }
        }
예제 #21
0
        private void frmRegOverTime_Load(object sender, EventArgs e)
        {
            Refresh();

            cboDinnnerAmount.Enabled = false;
            employeeDO = new EmployeeDO();

            departnemtDO = new DepartmentDO();
            departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.ExpandNodes(true);
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;

            regOverTimeDO = new RegOverTimeDO();
            dtRegOverTime = dsRegOverTime.Tables[0];

            if (selectedRegOverTime >= 0)
            {
                // disable các thuộc tính liên quan đến nhân viên
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text2");
                //this.Text = "Sửa đăng ký làm thêm giờ";
                this.Text = str;
                LoadRegOverTime();
                //				optEmployee.Checked = true;
                departmentTreeView.Enabled = false;
                //				optAll.Enabled = false;
                dtpDayWorking.Enabled = false;
                cboEmployeeName.Enabled = false;
                lvwListEmployee.Enabled = false;
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text1");
                //this.Text = "Thêm đăng ký làm thêm giờ";
                this.Text = str;
                txtEmployeeName.Enabled = false;
                cboEmployeeName.Enabled = false;

            }
        }
예제 #22
0
        private void frmSearch_Load(object sender, EventArgs e)
        {
            Refresh();
            employeeDO = new EmployeeDO();

            PopulateEmployeeListView();
            ShowCurrentTime();
        }
예제 #23
0
        /// <summary>
        /// Tự động sinh bảng chấm công dựa trên dữ liệu sẵn có
        /// </summary>
        private void GenerateTimeSheet()
        {
            frmStatusMessage message = new frmStatusMessage();
            string str = WorkingContext.LangManager.GetString("frmTimeSheet_frmmessa");
            //message.Show("Đang sinh dữ liệu bảng chấm công, xin chờ trong giây lát...");
            message.Show(str);

            this.Cursor = Cursors.WaitCursor;
            employeeDO = new EmployeeDO();
            DataSet dsEmployee = employeeDO.GetEmployeeByDepartment(DepartmentID);
            int totalEmployees = dsEmployee.Tables[0].Rows.Count;
            float percentToComplete = 0;
            int percentProcessing = 0;
            //DateTime firstMonth = new DateTime(CurrentYear,CurrentMonth+1,1);

            message.ProgressBar.Value = 0;
            if (dsEmployee.Tables[0].Rows.Count > 0)
            {
                int ret = 0, ret1 = 1;
                foreach (DataRow dr in dsEmployee.Tables[0].Rows)
                {
                    percentProcessing = ++percentProcessing;
                    int EmployeeID = int.Parse(dr["EmployeeID"].ToString());
                    //chi tinh cong cho nhung nhan vien chua thoi viec
                    // if (!bool.Parse(dr["Deleted"].ToString()) )
                    //{
                    //if (dr["StartTrial"]!=DBNull.Value)
                    // if (DateTime.Parse(dr["StartTrial"].ToString()) < firstMonth)
                    // {
                    try
                    {
                        ret = timesheetDO.GenerateTimeSheet(CurrentMonth, CurrentYear, EmployeeID);
                        percentToComplete = (percentProcessing * 100) / totalEmployees;
                        //ret1: sinh bảng tổng hợp dữ liệu nhân viên trong tháng để hiển thị trên báo cáo tháng, năm của từng nhân viên
                        //						ret1 = timesheetDO.GenerateEmployeeSummaryInMonth(CurrentMonth, CurrentYear, EmployeeID);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                    // }
                    // }
                    message.ProgressBar.Value = (int)percentToComplete;
                    //						(int)(percentToComplete/totalEmployees);
                }
                message.Close();
                this.Cursor = Cursors.Default;
                if (ret >= 0 && ret1 > 0)
                {
                    string str1 = WorkingContext.LangManager.GetString("frmTimeSheet_SinhBang_Messa");
                    string str2 = WorkingContext.LangManager.GetString("frmTimeSheet_SinhBang_Title");
                    //MessageBox.Show("Sinh bảng chấm công thành công", "Sinh bảng chấm công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string str1 = WorkingContext.LangManager.GetString("frmTimeSheet_SinhBang_Messa1");
                    string str2 = WorkingContext.LangManager.GetString("frmTimeSheet_SinhBang_Title");
                    //MessageBox.Show("Sinh bảng chấm công thất bại", "Sinh bảng chấm công", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                message.Close();
                this.Cursor = Cursors.Default;
            }
        }
예제 #24
0
        //menu dang nhap hệ thống
        private void mnuDangNhap_Click(object sender, EventArgs e)
        {
            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 frmsettings = new frmSettings();
                frmsettings.ShowDialog(this);
                this.Refresh();
            }
        }
예제 #25
0
        private void departmentTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            departmentTreeView.ExpandNodes(true);
            cboEmployeeName.Items.Clear();
            EmployeeDO employeeDO = new EmployeeDO();
            dsEmployee = employeeDO.GetEmployeeByDepartment((int)e.Node.Tag);
            cboEmployeeName.SourceDataString = new string[] { "EmployeeID", "CardID", "EmployeeName" };
            cboEmployeeName.SourceDataTable = dsEmployee.Tables[0];

            // kiểm tra nếu phòng có nhân viên thì hiển thị thông tin của nhân viên đầu tiên
            if (dsEmployee.Tables[0].Rows.Count > 0)
            {
                cboEmployeeName.SelectedIndex = 0;
                cboEmployeeName.Text = ((MTGCComboBoxItem)cboEmployeeName.SelectedItem).Col3;
            }
            else
            {
                cboEmployeeName.Items.Clear();
                cboEmployeeName.Text = "";
            }
        }
예제 #26
0
        private void frmRegWorkingTime_Load(object sender, EventArgs e)
        {
            Refresh();

            cboDinnnerAmount.Enabled = false;
            employeeDO = new EmployeeDO();

            DepartmentDO departnemtDO = new DepartmentDO();
            departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments();
            departmentTreeView.BuildTree();
            departmentTreeView.ExpandNodes(true);
            departmentTreeView.SelectedNode = departmentTreeView.TopNode;

            regOverTimeDO = new RegOverTimeDO();
            dtRegOverTime = dsRegOverTime.Tables[0];

            monthCalendar1.SelectDate(DateTime.Today);

            //CurrentYear = DateTime.Today.Year;
            CurrentYear = DateTime.Now.Year;
            monthCalendar1.ActiveMonth.Year = CurrentYear;
            CurrentMonth = DateTime.Today.Month;
            monthCalendar1.ActiveMonth.Month = CurrentMonth;

            monthCalendar1.SelectDate(DateTime.Today);

            if (selectedRegOverTime >= 0)
            {
                // disable các thuộc tính liên quan đến nhân viên
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text2");
                //this.Text = "Sửa đăng ký làm thêm giờ";
                this.Text = str;
                LoadRegOverTime();
                //				optEmployee.Checked = true;
                departmentTreeView.Enabled = false;
                //				optAll.Enabled = false;
                //dtpDayWorking.Enabled = false;
                //cboEmployeeName.Enabled = false;
                lvwListEmployee.Enabled = false;
            }
            else
            {
                string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text1");
                //this.Text = "Thêm đăng ký làm thêm giờ";
                this.Text = str;
                //txtEmployeeName.Enabled = false;
                //cboEmployeeName.Enabled = false;

            }
            PopulateShiftCombo();
        }
예제 #27
0
 /// <summary>
 /// Hiển thị thông tin chi tiết nhân viên trong ảnh
 /// </summary>
 private void ShowEmployeeDetail()
 {
     UI.Employee.frmEmployee frmemployee = new frmEmployee();
     employeeDO = new EmployeeDO();
     dsEmployee = employeeDO.GetEmployeeProfile(EmployeeID);
     frmemployee.EmployeeDataSet= dsEmployee;
     frmemployee.SelectedEmployee = selectedEmployee;
     frmemployee.ShowDialog();
 }