예제 #1
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            string str        = WorkingContext.LangManager.GetString("frmChooseInOut_Messa1");
            string str1       = WorkingContext.LangManager.GetString("frmListReport_thongbao_Title");
            string str2       = WorkingContext.LangManager.GetString("frmRestoreInMonth_Messa3");
            string strSuccess = WorkingContext.LangManager.GetString("frmBackupInMonth_Messa1");
            string strErorr   = WorkingContext.LangManager.GetString("frmBackupInMonth_Messa2");

            if (dtpFromDateDefault.Value > dtpToDateDefault.Value)
            {
                //MessageBox.Show("Kho?ng th?i gian ch?n không h?p l?","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string strTb   = WorkingContext.LangManager.GetString("frmBackUpInMonth_xacnhansaoluudulieu");
                string strTBTD = WorkingContext.LangManager.GetString("frmBackUpInMonth_title");
                //Xác nh?n mu?n sao lýu d? li?u theo tháng
                if (MessageBox.Show(strTb, strTBTD, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                frmStatusMessage message = new frmStatusMessage();
                string           strBU   = WorkingContext.LangManager.GetString("frmBackUpInMonth_dangsaoluudulieu");
                //message.Show("Ðang sao lýu d? li?u...");
                message.Show(strBU);
                this.Cursor = Cursors.WaitCursor;
                float f100 = 100;

                float percentToComplete = 0;
                int   percentProcessing = 0;
                message.ProgressBar.Value = 0;
                for (int i = 1; i <= 100; i++)
                {
                    percentProcessing = ++percentProcessing;
                    //percentToComplete = percentProcessing / 100;
                    percentToComplete         = ((float)(percentProcessing) / (float)(f100));
                    message.ProgressBar.Value = (int)percentProcessing;
                }

                AdminDO adminDO = new AdminDO();
                int     result  = adminDO.BackUpDataInMonth(dtpFromDateDefault.Value, dtpToDateDefault.Value);
                message.Close();
                this.Cursor = Cursors.Default;
                if (result != -1)
                {
                    MessageBox.Show(strSuccess + "\n(" + result + " " + str2 + ")", str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strErorr, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
        private void btnExcel_Click(object sender, EventArgs e)
        {
            frmStatusMessage message = new frmStatusMessage();
            string           str     = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa3");

            //message.Show("Đang xuất dữ liệu bảng đăng ký công tác ra file Excel...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            if (!Utils.ExportExcel(lvwLeaveSchedule, this.Text.ToUpper()))
            {
                string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa4");
                string str2 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa4_Title");
                //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            message.Close();
            this.Cursor = Cursors.Default;
        }
예제 #3
0
        private void btnExcel_Click(object sender, EventArgs e)
        {
            frmStatusMessage message = new frmStatusMessage();
            string           str     = WorkingContext.LangManager.GetString("frmListRegRest_Messa2");

            //message.Show("Đang xuất dữ liệu bảng đăng ký nghỉ ra file Excel...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            if (!Utils.ExportExcel(lvwRestEmployee, this.Text.ToUpper()))
            {
                string str1 = WorkingContext.LangManager.GetString("frmRegOverTime_Excell_Messa2");
                string str2 = WorkingContext.LangManager.GetString("frmListRegRest_btnExcel");
                //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            message.Close();
            this.Cursor = Cursors.Default;
        }
예제 #4
0
        /// <summary>
        /// Tổng hợp thông tin nghỉ phép của nhân viên
        /// </summary>
        private void TongHopThongTinNghiPhep(frmStatusMessage frmMessagePara)
        {
            float fPercentToCompletePri = 0;
            int iPercentProcessingPri = 0;
            int iTotalEmployeesPri = 0;

            //Lấy về danh sách nhân viên của phòng ban cần sinh bảng thanh toán phép
            DataSet dtsEmployeePri = employeeDO.GetEmployeeByDepartment(DepartmentID);

            if (dtsEmployeePri != null)
            {
                tblRestSheet = TaoBangLuuThongTinNghiPhep(); //Bảng tạm lưu thông tin nghỉ phép của nhân viên
                iTotalEmployeesPri = dtsEmployeePri.Tables[0].Rows.Count; //Số lượng nhân viên cần tính phép

                foreach (DataRow drEmployee in dtsEmployeePri.Tables[0].Rows)
                {
                    int iEmployeeIDPri = Convert.ToInt32(drEmployee["EmployeeID"]);
                    iPercentProcessingPri = ++iPercentProcessingPri;

                    float fRestAllowPri = 0; // Tổng số phép được hưởng
                    float fTotalRestPri = 0; // Tổng số phép đá nghỉ
                    string[] strRestMonthPri = new string[12]; //Số phép từng tháng trong 1 năm
                    for (int i = 0; i < strRestMonthPri.Length; i++)
                    {
                        strRestMonthPri[i] = "0";
                    }

                    //Lấy thông tin nghỉ phép của nhân viên
                    DataSet dtsRestAllowPri = restsheetDO.GetRestAllowByEmployee(iEmployeeIDPri, CurrentYear, CurrentMonth);
                    if (dtsRestAllowPri != null)
                    {
                        DataRow drRestAllowPri = dtsRestAllowPri.Tables[0].Rows[0];
                        if (drRestAllowPri["StartDate"] != DBNull.Value)
                        {
                            if (drRestAllowPri["TotalRestAllow"] != DBNull.Value)
                            {
                                fRestAllowPri = Convert.ToSingle(drRestAllowPri["TotalRestAllow"]);

                                //Lấy thông tin nghỉ phép của từng tháng trong năm
                                for (int iMonth = 0; iMonth < 12; iMonth++)
                                {
                                    float fRestInMonthPri = restsheetDO.GetRestInMonth(iEmployeeIDPri, CurrentYear, iMonth + 1);
                                    if (fRestInMonthPri > 0)
                                    {
                                        strRestMonthPri[iMonth] = fRestInMonthPri.ToString();

                                        fTotalRestPri += fRestInMonthPri;
                                    }
                                }
                            }
                        }
                    }

                    //Lưu thông tin RestSheet vào bảng tạm để lưu vào database
                    DataRow drRestSheetPri = tblRestSheet.NewRow();

                    drRestSheetPri["EmployeeID"] = iEmployeeIDPri;
                    drRestSheetPri["RestMonth1"] = strRestMonthPri[0];
                    drRestSheetPri["RestMonth2"] = strRestMonthPri[1];
                    drRestSheetPri["RestMonth3"] = strRestMonthPri[2];
                    drRestSheetPri["RestMonth4"] = strRestMonthPri[3];
                    drRestSheetPri["RestMonth5"] = strRestMonthPri[4];
                    drRestSheetPri["RestMonth6"] = strRestMonthPri[5];
                    drRestSheetPri["RestMonth7"] = strRestMonthPri[6];
                    drRestSheetPri["RestMonth8"] = strRestMonthPri[7];
                    drRestSheetPri["RestMonth9"] = strRestMonthPri[8];
                    drRestSheetPri["RestMonth10"] = strRestMonthPri[9];
                    drRestSheetPri["RestMonth11"] = strRestMonthPri[10];
                    drRestSheetPri["RestMonth12"] = strRestMonthPri[11];
                    drRestSheetPri["TotalRestAllow"] = fRestAllowPri;
                    drRestSheetPri["TotalRest"] = fTotalRestPri;

                    tblRestSheet.Rows.Add(drRestSheetPri);

                    fPercentToCompletePri = (iPercentProcessingPri * 100) / iTotalEmployeesPri;
                    frmMessagePara.ProgressBar.Value = (int)fPercentToCompletePri;
                }
            }
        }
예제 #5
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;
            }
        }
예제 #6
0
        /// <summary>
        /// Sinh bảng thanh toán BHXH
        /// </summary>
        private void GenerateSocialSheet()
        {
            frmStatusMessage message = new frmStatusMessage();
            string str = WorkingContext.LangManager.GetString("frmSocialSheet_Sinh_Messa1");
            //message.Show("Đang sinh dữ liệu bảng thanh toán BHXH, xin chờ trong giây lát...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            int ret = 0;
            try
            {
                ret = socialInsuranceD0.GenerateSocialInsurance(dtpFromDate.Value,DtpToDate.Value);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            if (ret > 0)
            {
                message.Close();
                string str1 = WorkingContext.LangManager.GetString("frmSocialSheet_Sinh_Messa2");
                string str2 = WorkingContext.LangManager.GetString("frmSocialSheet_Sinh_Title");
                //MessageBox.Show("Sinh bảng thanh toán BHXH thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                message.Close();
                string str1 = WorkingContext.LangManager.GetString("frmSocialSheet_Sinh_Messa3");
                string str2 = WorkingContext.LangManager.GetString("frmSocialSheet_Sinh_Title");
                //MessageBox.Show("Sinh bảng thanh toán BHXH thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.Cursor = Cursors.Default;
        }
예제 #7
0
 private void btnExportExcel_Click(object sender, EventArgs e)
 {
     frmStatusMessage message = new frmStatusMessage();
     string str = WorkingContext.LangManager.GetString("frmSocialSheet_Excel_Messa");
     //message.Show("Xuất dữ liệu bảng lương ra file excel...");
     message.Show(str);
     //string str1 = WorkingContext.LangManager.GetString("frmSocialSheet_Text");
     this.Cursor = Cursors.WaitCursor;
     string stitle = WorkingContext.LangManager.GetString("Bosung_tool9");
     if (!Utils.ExportExcel(lvwSocialInsuranceSheet,stitle.ToUpper()))
     {
         string str1 = WorkingContext.LangManager.GetString("frmListSalary_btnXuatE_ThongBao1");
         string str2 = WorkingContext.LangManager.GetString("frmListSalary_btnXuatExcel");
         //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
         MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     message.Close();
     this.Cursor = Cursors.Default;
 }
예제 #8
0
 private void btnExcel_Click(object sender, EventArgs e)
 {
     frmStatusMessage message = new frmStatusMessage();
     string str = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa3");
     //message.Show("Đang xuất dữ liệu bảng đăng ký công tác ra file Excel...");
     message.Show(str);
     this.Cursor = Cursors.WaitCursor;
     if (!Utils.ExportExcel(lvwLeaveSchedule,this.Text.ToUpper()))
     {
         string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa4");
         string str2 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Messa4_Title");
         //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
         MessageBox.Show(str1,str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     message.Close();
     this.Cursor = Cursors.Default;
 }
예제 #9
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;
            }
        }
예제 #10
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;
            }
        }
예제 #11
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            string str = WorkingContext.LangManager.GetString("frmChooseInOut_Messa1");
            string str1 = WorkingContext.LangManager.GetString("frmListReport_thongbao_Title");
            string str2= WorkingContext.LangManager.GetString("frmRestoreInMonth_Messa3");
            string strSuccess=WorkingContext.LangManager.GetString("frmRestoreInMonth_Messa1");
            string strErorr=WorkingContext.LangManager.GetString("frmRestoreInMonth_Messa2");
            if(dtpFromDateDefault.Value > dtpToDateDefault.Value)
            {

                //MessageBox.Show("Kho?ng th?i gian ch?n không h?p l?","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Error);
                MessageBox.Show(str,str1,MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            else
            {
                string strTb = WorkingContext.LangManager.GetString("frmRestoreInMonth_xacnhankhoiphucdulieu");
                string strTBTD = WorkingContext.LangManager.GetString("frmRestoreInMonth_title");
                //Xác nh?n mu?n sao lýu d? li?u theo tháng
                if (MessageBox.Show(strTb, strTBTD, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                frmStatusMessage message = new frmStatusMessage();
                string strBU = WorkingContext.LangManager.GetString("frmRestoreInMonth_dangkhoiphucdulieu");
                //message.Show("Ðang sao lýu d? li?u...");
                message.Show(strBU);
                this.Cursor = Cursors.WaitCursor;
                float f100 = 100;

                float percentToComplete = 0;
                int percentProcessing = 0;
                message.ProgressBar.Value = 0;
                for(int i=1;i<=100;i++)
                {
                    percentProcessing= ++percentProcessing;
                    //percentToComplete = percentProcessing / 100;
                    percentToComplete = ((float)(percentProcessing) / (float)(f100));
                    message.ProgressBar.Value = (int)percentProcessing;

                }

                AdminDO adminDO = new AdminDO();
                int result=adminDO.RestoreDataInMonth(dtpFromDateDefault.Value, dtpToDateDefault.Value);
                message.Close();
                this.Cursor = Cursors.Default;
                if(result!=-1)
                    MessageBox.Show(strSuccess+"\n("+result+" "+str2+")",str1,MessageBoxButtons.OK,MessageBoxIcon.Information);
                else
                    MessageBox.Show(strErorr,str1,MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }
예제 #12
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;
            }
        }
예제 #13
0
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            frmStatusMessage message = new frmStatusMessage();
            string str = WorkingContext.LangManager.GetString("frmTimeSheet_XuatExcel_ThongBao");
            //message.Show("Xuất dữ liệu bảng chấm công ra file excel...");
            message.Show(str);
            this.Cursor = Cursors.WaitCursor;
            // Xuất excel
            if (!ExportExcel(lvwTimeSheet, this.Text.ToUpper()))
            {
                string str1 = WorkingContext.LangManager.GetString("frmTimeSheet_XuatExcel_Erroe_Messa");
                string str2 = WorkingContext.LangManager.GetString("frmTimeSheet_XuatExcel_Erroe_Title");
                //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            message.Close();
            this.Cursor = Cursors.Default;
        }
예제 #14
0
 private void ExportExcel_Click(object sender, EventArgs e)
 {
     frmStatusMessage message = new frmStatusMessage();
     string str = WorkingContext.LangManager.GetString("frmRegOverTime_Excell_Messa1");
     //message.Show("Đang xuất dữ liệu bảng đăng ký làm thêm giờ ra file Excel...");
     message.Show(str);
     this.Cursor = Cursors.WaitCursor;
     if (!Utils.ExportExcel(lvwOverTime,this.Text.ToUpper()))
     {
         string str1 = WorkingContext.LangManager.GetString("frmRegOverTime_Excell_Messa2");
         string str2 = WorkingContext.LangManager.GetString("frmRegOverTime_btnExcel");
         //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
         MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     message.Close();
     this.Cursor = Cursors.Default;
 }
예제 #15
0
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            System.Data.DataTable tblExcelPri = KhoiTaoDuLieuBangLuuThongTinXuatExcel();
            if (tblExcelPri != null && tblExcelPri.Rows.Count > 0)
            {
                frmStatusMessage message = new frmStatusMessage();
                string str = WorkingContext.LangManager.GetString("frmRestSheet_Messa3");
                message.Show(str);
                this.Cursor = Cursors.WaitCursor;

                // Xuất excel
                string strSubHeaderPri = "Năm " + cboYear.Text;
                ExportToExcel.XuatDuLieuRaExcel(6, 0, strSubHeaderPri, tblExcelPri, strTempBangThanhToanTienPhep);
                message.Close();
                this.Cursor = Cursors.Default;

                #region Bỏ lại
                //if (!ExportExcel(lvwRestSheet, this.Text.ToUpper()))
                //{
                //    string str1 = WorkingContext.LangManager.GetString("frmRestSheet_Messa4");
                //    string str2 = WorkingContext.LangManager.GetString("frmRestSheet_btnExcel");
                //    //MessageBox.Show("Có lỗi xảy ra khi xuất dữ liệu ra file excel", "Xuất excel", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    MessageBox.Show(str1, str2, MessageBoxButtons.OK, MessageBoxIcon.Error);
                //}
                #endregion
            }
        }
예제 #16
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;
            }
        }
예제 #17
0
        /// <summary>
        /// thiet lap lich lam viec cho nhung nhan vien duoc chon
        /// </summary>
        private void SetWorkingTime()
        {
            int DeparmentID = (int) departmentTreeView.SelectedNode.Tag;
            int employeeID = 0;
            try
            {
                //				dsWorkingTime = workingTimeDO.GetWorkingTimeByMonthNew(1, CurrentMonth, CurrentYear);
                dsEmployee = employeeDO.GetEmployeeByDepartment(DeparmentID);
                WorkingTimeDataRows = dsEmployee.Tables[0].Select(dataFilter, dataSort);
                // hien thi form thong bao trang thai hoan thanh
                frmStatusMessage message = new frmStatusMessage();
                string strStatus = WorkingContext.LangManager.GetString("frmStatus_thongbao");
                //message.Show("Đang sinh dữ liệu bảng chấm công, xin chờ trong giây lát...");
                message.Show("Đang cập nhật lịch làm việc cho nhân viên ...");
                message.ProgressBar.Value = 0;
                //			int totalEmployees = dataRows.Length;
                this.Cursor = Cursors.WaitCursor;
                int percentToComplete = 0;
                int percentProcessing = 0;

                for (int i=0;i<lvwListEmployee.SelectedIndicies.Length;i++)
                {
                    ++percentProcessing;
                    //					AddWorkingTimeByEmployee(dsWorkingTime,1);
                    // chỉ số hàng được chọn
                    int rowIndex = (int)lvwListEmployee.SelectedItems[i].Tag;
                    DataRow dr = dsEmployee.Tables[0].Rows[rowIndex];
                    employeeID = int.Parse(dr["EmployeeID"].ToString());
                    dsWorkingTime = workingTimeDO.GetWorkingTimeByMonth(employeeID, CurrentMonth, CurrentYear);
                    if(dsWorkingTime.Tables[0].Rows.Count > 0)
                    {
                        UpdateWorkingTimeByEmployee(dsWorkingTime,employeeID);
                    }
                    else
                    {
                        AddWorkingTimeByEmployee(dsWorkingTime,employeeID);
                    }
                    percentToComplete = (percentProcessing*100) / lvwListEmployee.SelectedIndicies.Length;
                    message.ProgressBar.Value = percentToComplete;

                }
                message.Close();

                this.Cursor = Cursors.Default;

                string str = WorkingContext.LangManager.GetString("frmRegWork_Up_Messa");
                string str1 = WorkingContext.LangManager.GetString("frmRegWork_Up_Title");
                //MessageBox.Show("Đăng ký thời gian làm việc thành công", "Đăng ký thời gian làm việc", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                string str = WorkingContext.LangManager.GetString("frmLunch_SetLunch_ThongBao");
                string str1 = WorkingContext.LangManager.GetString("frmLunch_SetLunch_Title");
                //MessageBox.Show("Có lỗi xảy ra khi cập nhật dữ liệu ăn trưa", "Thiết lập ăn trưa", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str,str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }