示例#1
0
        private void frmDataUpload_Load(object sender, System.EventArgs e)
        {
            try
            {
                //Move Group Boxes Over each Other
                this.grbNoDateOpen.Top = this.grbRunTimeAttendance.Top;

                clsISUtilities = new clsISUtilities(this, "busDataUpload");
                //Local
                clsISClientUtilities = new clsISClientUtilities(this, "busClientDataUpload");

                if (AppDomain.CurrentDomain.GetData("AccessInd").ToString() == "U")
                {
                    this.lblResetTimeAttendanceMenu.Visible = false;
                    this.lblOpenPayrollMenu.Visible         = false;
                }

                //Get Pay Categories on Local Mahine
                pvtDataSetClient = new DataSet();

                object[] objParm = new object[1];
                objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));

                blnclsISClientUtilities = true;
                pvtbytCompress          = (byte[])this.clsISClientUtilities.DynamicFunction("Get_New_Company_Records", objParm, false);

                pvtDataSetClient = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress);

                this.lblCostCentreSpreadsheetHeader.Paint  += new System.Windows.Forms.PaintEventHandler(clsISUtilities.Label_Paint);
                this.lblPayrollTypeSpreadsheetHeader.Paint += new System.Windows.Forms.PaintEventHandler(clsISUtilities.Label_Paint);

                NoPayrollDateOpenDataGridViewCellStyle                    = new DataGridViewCellStyle();
                NoPayrollDateOpenDataGridViewCellStyle.BackColor          = Color.Red;
                NoPayrollDateOpenDataGridViewCellStyle.SelectionBackColor = Color.Red;

                RunTimeAttendancePendingDataGridViewCellStyle                    = new DataGridViewCellStyle();
                RunTimeAttendancePendingDataGridViewCellStyle.BackColor          = Color.Lime;
                RunTimeAttendancePendingDataGridViewCellStyle.SelectionBackColor = Color.Lime;

                RunTimeAttendanceAlreadyRunDataGridViewCellStyle                    = new DataGridViewCellStyle();
                RunTimeAttendanceAlreadyRunDataGridViewCellStyle.BackColor          = Color.Orange;
                RunTimeAttendanceAlreadyRunDataGridViewCellStyle.SelectionBackColor = Color.Orange;

                objParm    = new object[2];
                objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                objParm[1] = AppDomain.CurrentDomain.GetData("FromProgramInd").ToString();

                blnclsISClientUtilities = false;
                pvtbytCompress          = (byte[])clsISUtilities.DynamicFunction("Get_Form_Records_New", objParm);

                pvtDataSet = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress);

                string strPayrollType = "";

                if (this.pvtDataSet.Tables["PayrollType"].Rows.Count > 0)
                {
                    for (int intRow = 0; intRow < this.pvtDataSet.Tables["PayrollType"].Rows.Count; intRow++)
                    {
                        this.dgvPayrollTypeDataGridView.Rows.Add("",
                                                                 this.pvtDataSet.Tables["PayrollType"].Rows[intRow]["PAYROLL_TYPE"].ToString());

                        strPayrollType = this.pvtDataSet.Tables["PayrollType"].Rows[intRow]["PAYROLL_TYPE"].ToString().Substring(0, 1);

                        pvtPayCategoryDataView = null;
                        pvtPayCategoryDataView = new DataView(pvtDataSet.Tables["PayCategory"],
                                                              "COMPANY_NO = " + AppDomain.CurrentDomain.GetData("CompanyNo").ToString() + "AND PAY_CATEGORY_TYPE = '" + strPayrollType + "'",
                                                              "",
                                                              DataViewRowState.CurrentRows);

                        if (pvtPayCategoryDataView.Count == 0)
                        {
                            this.dgvPayrollTypeDataGridView[0, intRow].Style = this.NoPayrollDateOpenDataGridViewCellStyle;
                        }
                        else
                        {
                            switch (strPayrollType)
                            {
                            case "W":

                                if (this.pvtDataSet.Tables["Company"].Rows[0]["WAGE_RUN_IND"].ToString() == "N")
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendancePendingDataGridViewCellStyle;
                                }
                                else
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendanceAlreadyRunDataGridViewCellStyle;
                                }

                                break;

                            case "S":

                                if (this.pvtDataSet.Tables["Company"].Rows[0]["SALARY_RUN_IND"].ToString() == "Y")
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendancePendingDataGridViewCellStyle;
                                }
                                else
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendanceAlreadyRunDataGridViewCellStyle;
                                }

                                break;

                            case "T":

                                if (this.pvtDataSet.Tables["Company"].Rows[0]["TIME_ATTENDANCE_RUN_IND"].ToString() == "N")
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendancePendingDataGridViewCellStyle;
                                }
                                else
                                {
                                    this.dgvPayrollTypeDataGridView[0, intRow].Style = this.RunTimeAttendanceAlreadyRunDataGridViewCellStyle;
                                }

                                break;
                            }
                        }
                    }

                    pvtblnPayrollTypeDataGridViewLoaded = true;

                    this.Set_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView, 0);
                }
            }
            catch (Exception eException)
            {
                if (blnclsISClientUtilities == true)
                {
                    clsISClientUtilities.ErrorHandler(eException);
                }
                else
                {
                    clsISUtilities.ErrorHandler(eException);
                }
            }
        }
示例#2
0
        private void Load_CurrentForm_Records()
        {
            try
            {
                this.btnOK.Enabled = false;

                this.Clear_DataGridView(this.dgvCostCentreDataGridView);
                this.Clear_DataGridView(this.dgvCostCentreChosenDataGridView);
                this.Clear_DataGridView(this.dgvCostCentreDeletedDataGridView);

                this.dgvCostCentreDataGridView.Height = 516;

                this.lblCostCentreDelete.Visible = false;
                this.dgvCostCentreDeletedDataGridView.Visible = false;
                this.btnAddDeleted.Visible = false;

                object[] objParm = new object[2];
                objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                objParm[1] = AppDomain.CurrentDomain.GetData("FromProgramInd").ToString();

                pvtbytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_PayCategory_Records_New", objParm, false);

                pvtDataSetClient = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress);

                if (pvtDataSetClient == null)
                {
                    CustomMessageBox.Show("Connection to Local Database Could not be Established.",
                                          this.Text,
                                          MessageBoxButtons.OK,
                                          MessageBoxIcon.Error);

                    this.Close();
                }

                string strPayCategoryTypeDesc              = "";
                string strLastDownloadDateTime             = "";
                string strLastDownloadDateTimeYYMMDDHHMMSS = "";

                pvtPayCategoryDataView = new DataView(this.pvtDataSet.Tables["PayCategory"]
                                                      , ""
                                                      , "PAY_CATEGORY_DESC,PAY_CATEGORY_TYPE DESC"
                                                      , DataViewRowState.CurrentRows);

                for (int intIndex = 0; intIndex < pvtPayCategoryDataView.Count; intIndex++)
                {
                    if (pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_TYPE"].ToString() == "W")
                    {
                        strPayCategoryTypeDesc = "Wages";
                    }
                    else
                    {
                        if (pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_TYPE"].ToString() == "S")
                        {
                            strPayCategoryTypeDesc = "Salaries";
                        }
                        else
                        {
                            strPayCategoryTypeDesc = "Time Attendance";
                        }
                    }

                    DataView PayCategoryClientDataView = new DataView(pvtDataSetClient.Tables["PayCategoryClient"]
                                                                      , "PAY_CATEGORY_NO = " + pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_NO"].ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_TYPE"].ToString() + "'"
                                                                      , ""
                                                                      , DataViewRowState.CurrentRows);

                    if (PayCategoryClientDataView.Count == 0)
                    {
                        this.dgvCostCentreDataGridView.Rows.Add(pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_DESC"].ToString(),
                                                                "",
                                                                strPayCategoryTypeDesc,
                                                                pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_NO"].ToString(),
                                                                "");
                    }
                    else
                    {
                        this.btnOK.Enabled = true;

                        if (PayCategoryClientDataView[0]["LAST_DOWNLOAD_DATETIME"] != System.DBNull.Value)
                        {
                            strLastDownloadDateTime             = Convert.ToDateTime(PayCategoryClientDataView[0]["LAST_DOWNLOAD_DATETIME"]).ToString("dd MMM yyyy - HH:mm:ss");
                            strLastDownloadDateTimeYYMMDDHHMMSS = Convert.ToDateTime(PayCategoryClientDataView[0]["LAST_DOWNLOAD_DATETIME"]).ToString("yyyyMMddHHmmss");
                        }
                        else
                        {
                            strLastDownloadDateTime             = "";
                            strLastDownloadDateTimeYYMMDDHHMMSS = "";
                        }

                        this.dgvCostCentreChosenDataGridView.Rows.Add(pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_DESC"].ToString(),
                                                                      strLastDownloadDateTime,
                                                                      strPayCategoryTypeDesc,
                                                                      pvtPayCategoryDataView[intIndex]["PAY_CATEGORY_NO"].ToString(),
                                                                      strLastDownloadDateTimeYYMMDDHHMMSS);
                    }
                }
            }
            catch (Exception eException)
            {
                clsISClientUtilities.ErrorHandler(eException);
            }
        }
示例#3
0
        private void Load_CurrentForm_Records()
        {
            try
            {
                int intFindRow = -1;

                this.Clear_DataGridView(this.dgvPayCategoryDataGridView);

                DataView LocalPayCategoryDataView = new DataView(pvtDataSetClient.Tables["PayCategory"],
                                                                 "PAY_CATEGORY_TYPE = '" + this.pvtstrPayrollType + "'",
                                                                 "PAY_CATEGORY_NO",
                                                                 DataViewRowState.CurrentRows);

                bool blnUploadOK = true;

                pvtblnPayCategoryDataGridViewLoaded = false;

                this.btnOK.Enabled                = false;
                this.grbNoDateOpen.Visible        = false;
                this.grbRunTimeAttendance.Visible = false;

                this.btnOpenPayrollRun.Enabled      = true;
                this.lblNoOpenPayCategory.ForeColor = System.Drawing.Color.Black;

                if (AppDomain.CurrentDomain.GetData("FromProgramInd").ToString() == "X")
                {
                    this.lblNoOpenPayCategory.Text = "There is currently No Date Open for the " + this.dgvPayrollTypeDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView)].Value.ToString() + " Type.";
                }
                else
                {
                    this.lblNoOpenPayCategory.Text = "There is currently No Payroll Date Open for the " + this.dgvPayrollTypeDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView)].Value.ToString() + " Type.";
                }

                pvtPayCategoryDataView = null;
                pvtPayCategoryDataView = new DataView(pvtDataSet.Tables["PayCategory"],
                                                      "COMPANY_NO = " + this.pvtDataSet.Tables["Company"].Rows[0]["COMPANY_NO"].ToString() + "AND PAY_CATEGORY_TYPE = '" + pvtstrPayrollType + "'",
                                                      "",
                                                      DataViewRowState.CurrentRows);

                string strLastUploadDateTime           = "";
                string strLastUploadDateTimeYYMMDDHHMM = "";

                if (pvtPayCategoryDataView.Count > 0)
                {
                    pvtstrPayCategoriesSelected = "(";

                    for (int intRow = 0; intRow < this.pvtPayCategoryDataView.Count; intRow++)
                    {
                        intFindRow = LocalPayCategoryDataView.Find(this.pvtPayCategoryDataView[intRow]["PAY_CATEGORY_NO"].ToString());

                        if (intFindRow == -1)
                        {
                            continue;
                        }

                        if (this.pvtPayCategoryDataView[intRow]["LAST_UPLOAD_DATETIME"] == System.DBNull.Value)
                        {
                            strLastUploadDateTime           = "";
                            strLastUploadDateTimeYYMMDDHHMM = "";
                        }
                        else
                        {
                            strLastUploadDateTime           = Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["LAST_UPLOAD_DATETIME"]).ToString("dd MMMM yyyy - HH:mm");
                            strLastUploadDateTimeYYMMDDHHMM = Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["LAST_UPLOAD_DATETIME"]).ToString("yyyyMMddHHmm");
                        }

                        this.dgvPayCategoryDataGridView.Rows.Add("",
                                                                 this.pvtPayCategoryDataView[intRow]["PAY_CATEGORY_DESC"].ToString(),
                                                                 Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["PAY_PERIOD_DATE"]).ToString("d MMMM yyyy"),
                                                                 Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["TIMESHEET_UPLOAD_DATETIME"]).ToString("d MMMM yyyy") + " - 23:59:59",
                                                                 strLastUploadDateTime,
                                                                 this.pvtPayCategoryDataView[intRow]["PAY_CATEGORY_NO"].ToString(),

                                                                 Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["PAY_PERIOD_DATE"]).ToString("yyyyMMdd"),
                                                                 Convert.ToDateTime(this.pvtPayCategoryDataView[intRow]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyyMMdd") + "235959",
                                                                 strLastUploadDateTimeYYMMDDHHMM);

                        if (pvtstrPayCategoriesSelected == "(")
                        {
                            pvtstrPayCategoriesSelected += this.pvtPayCategoryDataView[intRow]["PAY_CATEGORY_NO"].ToString();
                        }
                        else
                        {
                            pvtstrPayCategoriesSelected += "," + this.pvtPayCategoryDataView[intRow]["PAY_CATEGORY_NO"].ToString();
                        }

                        if ((pvtDataSet.Tables["Company"].Rows[0]["WAGE_RUN_IND"].ToString() == "N"
                             & pvtstrPayrollType == "W")
                            | (pvtDataSet.Tables["Company"].Rows[0]["SALARY_RUN_IND"].ToString() == "Y"
                               & pvtstrPayrollType == "S")
                            | (pvtDataSet.Tables["Company"].Rows[0]["TIME_ATTENDANCE_RUN_IND"].ToString() == "N"
                               & pvtstrPayrollType == "T"))
                        {
                            this.dgvPayCategoryDataGridView[0, this.dgvPayCategoryDataGridView.Rows.Count - 1].Style = this.RunTimeAttendancePendingDataGridViewCellStyle;
                        }
                        else
                        {
                            this.dgvPayCategoryDataGridView[0, this.dgvPayCategoryDataGridView.Rows.Count - 1].Style = this.RunTimeAttendanceAlreadyRunDataGridViewCellStyle;

                            blnUploadOK = false;
                        }
                    }

                    pvtstrPayCategoriesSelected += ")";

                    pvtblnPayCategoryDataGridViewLoaded = true;

                    if (dgvPayCategoryDataGridView.Rows.Count > 0)
                    {
                        this.Set_DataGridView_SelectedRowIndex(dgvPayCategoryDataGridView, 0);
                    }

                    if (LocalPayCategoryDataView.Count == 0)
                    {
                        this.lblNoOpenPayCategory.Text      = "There are No Employees on the Local Machine for the " + this.dgvPayrollTypeDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView)].Value.ToString() + " Type.";
                        this.lblNoOpenPayCategory.ForeColor = System.Drawing.Color.Red;

                        //No Use OPen Payroll Date
                        this.btnOpenPayrollRun.Enabled = false;

                        this.grbNoDateOpen.Visible = true;
                    }
                    else
                    {
                        if (blnUploadOK == true)
                        {
                            this.btnOK.Enabled = true;
                        }
                        this.pgbProgressBar.Value = 0;
                    }
                }
                else
                {
                    this.grbNoDateOpen.Visible = true;
                }

                if ((this.pvtDataSet.Tables["Company"].Rows[0]["WAGE_RUN_IND"].ToString() == "Y"
                     & pvtstrPayrollType == "W")
                    | (this.pvtDataSet.Tables["Company"].Rows[0]["TIME_ATTENDANCE_RUN_IND"].ToString() == "Y"
                       & pvtstrPayrollType == "T"))
                {
                    this.grbRunTimeAttendance.Visible = true;
                }
            }
            catch (Exception eException)
            {
                clsISClientUtilities.ErrorHandler(eException);
            }
        }