private void btnOK_Click(object sender, EventArgs e) { try { DialogResult myDialogResult = CustomMessageBox.Show("Are you sure you want to Backup the Company '" + AppDomain.CurrentDomain.GetData("CompanyDesc").ToString() + "' Database?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (myDialogResult == System.Windows.Forms.DialogResult.Yes) { object[] objParm = new object[1]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); int intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase", objParm); if (intReturnCode == 0) { CustomMessageBox.Show("Backup Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { CustomMessageBox.Show("Backup Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
private void btnSave_Click(object sender, EventArgs e) { try { DataSet tempDataSet = new DataSet(); int intLeaveShiftNo = -1; //Employee Earnings //Employee Earnings tempDataSet.Tables.Add(pvtDataSet.Tables["PayCategory"].Clone()); if (this.dgvChosenPayCategoryDataGridView.Rows.Count == 0) { CustomMessageBox.Show("Select at least 1 Cost Centre", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { bool blnDefault = false; for (int intRow = 0; intRow < dgvChosenPayCategoryDataGridView.Rows.Count; intRow++) { DataRow MyDataRow = tempDataSet.Tables["PayCategory"].NewRow(); MyDataRow["PAY_CATEGORY_NO"] = this.dgvChosenPayCategoryDataGridView[3, intRow].Value.ToString(); if (Convert.ToBoolean(this.dgvChosenPayCategoryDataGridView[2, intRow].Value) == true) { MyDataRow["DEFAULT_IND"] = "Y"; if (blnDefault == false) { blnDefault = true; } else { CustomMessageBox.Show("Only 1 Cost Centre can be set to Default", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MyDataRow["DEFAULT_IND"] = "N"; } MyDataRow["REC_RATE"] = this.dgvChosenPayCategoryDataGridView[1, intRow].Value.ToString(); tempDataSet.Tables["PayCategory"].Rows.Add(MyDataRow); } if (blnDefault == false) { CustomMessageBox.Show("1 Cost Centre must be set to Default", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (this.dgvLeaveShiftSelectedDataGridView.Rows.Count == 0) { CustomMessageBox.Show("Select at least 1 Normal Leave / Sick Leave Category", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (this.dgvLeaveShiftSelectedDataGridView.Rows.Count == 1) { intLeaveShiftNo = Convert.ToInt32(this.dgvLeaveShiftSelectedDataGridView[1, 0].Value); } else { CustomMessageBox.Show("Only 1 Normal Leave / Sick Leave Category Record Allowed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DataView CurrentPayCategoryDataView = new DataView(pvtDataSet.Tables["CurrentPayCategory"], "EMPLOYEE_NO = " + pvtintEmployeeNo + " AND PAY_CATEGORY_TYPE = '" + pvtstrCurrentPayrollType + "'", "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < CurrentPayCategoryDataView.Count; intRow++) { CurrentPayCategoryDataView[intRow].Delete(); intRow -= 1; } DataView EmployeeDataView = new DataView(pvtDataSet.Tables["Employee"], "EMPLOYEE_NO = " + pvtintEmployeeNo + " AND PAY_CATEGORY_TYPE = '" + pvtstrCurrentPayrollType + "'", "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < EmployeeDataView.Count; intRow++) { EmployeeDataView[intRow].Delete(); intRow -= 1; } byte[] bytCompress = clsISUtilities.Compress_DataSet(tempDataSet); object[] objParm = new object[6]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = pvtstrCurrentPayrollType; objParm[3] = pvtintEmployeeNo; objParm[4] = intLeaveShiftNo; objParm[5] = bytCompress; bytCompress = (byte[])clsISUtilities.DynamicFunction("Update_Employee", objParm); tempDataSet = clsISUtilities.DeCompress_Array_To_DataSet(bytCompress); pvtDataSet.Merge(tempDataSet); pvtDataSet.AcceptChanges(); Load_CurrentForm_Records(); btnCancel_Click(sender, e); } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { int intReturnCode = clsISUtilities.DataBind_Save_Check(); if (intReturnCode != 0) { return; } pvtTempDataSet = null; pvtTempDataSet = new DataSet(); pvtTempDataSet.Tables.Add(this.pvtDataSet.Tables["Leave"].Clone()); pvtTempDataSet.Tables[0].ImportRow(pvtLeaveDataView[clsISUtilities.DataViewIndex].Row); //Compress DataSet pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet); if (this.Text.IndexOf(" - New", 0) > 0) { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtbytCompress; pvtintLeaveNo = (int)clsISUtilities.DynamicFunction("Insert_New_Record", objParm, true); pvtLeaveDataView[clsISUtilities.DataViewIndex]["LEAVE_SHIFT_NO"] = pvtintLeaveNo; //Reset From 0 To Null pvtLeaveDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = System.DBNull.Value; } else { object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[2] = pvtbytCompress; pvtintReturnCode = (int)clsISUtilities.DynamicFunction("Update_Record", objParm, true); if (pvtintReturnCode == 9999) { this.pvtDataSet.RejectChanges(); this.dgvNormalSickLeaveCategoryDataGridView[0, this.Get_DataGridView_SelectedRowIndex(dgvNormalSickLeaveCategoryDataGridView)].Style = this.PayrollLinkDataGridViewCellStyle; pvtLeaveDataView[clsISUtilities.DataViewIndex]["PAYROLL_LINK"] = 0; DialogResult dlgResult = CustomMessageBox.Show("This Normal Leave and Sick Leave Category is currently being used in a Payroll Run.\r\n\r\nUpdate Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.dgvNormalSickLeaveCategoryDataGridView[1, this.Get_DataGridView_SelectedRowIndex(dgvNormalSickLeaveCategoryDataGridView)].Value = this.txtLeave.Text.Trim(); } } this.pvtDataSet.Tables["Leave"].AcceptChanges(); if (this.clsISUtilities.pubintReloadSpreadsheet == true) { Load_CurrentForm_Records(); } else { btnCancel_Click(sender, e); } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { string strArrayEmployeeNumbers = ""; DateTime dCurrentPayCategoryDateTime; int intReturnCode = Save_Check(); if (intReturnCode != 0) { return; } if (pvtstrPayrollType != "S") { dCurrentPayCategoryDateTime = DateTime.ParseExact(this.txtDate.Text, AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null); } else { dCurrentPayCategoryDateTime = DateTime.ParseExact(this.cboRunDate.SelectedItem.ToString(), AppDomain.CurrentDomain.GetData("DateFormat").ToString(), null); } //Added To End Of SQL Statement if (this.dgvChosenEmployeeDataGridView.Rows.Count > 0) { for (int intIndex = 0; intIndex < this.dgvChosenEmployeeDataGridView.Rows.Count; intIndex++) { if (intIndex == 0) { strArrayEmployeeNumbers = this.dgvChosenEmployeeDataGridView[3, intIndex].Value.ToString(); } else { strArrayEmployeeNumbers += "," + this.dgvChosenEmployeeDataGridView[3, intIndex].Value.ToString(); } } } this.picBackupBefore.Image = EmployeeActivateSelection.Properties.Resources.Question; this.picEmployeeActivation.Image = null; this.picBackupAfter.Image = null; this.pnlEmployeeActivation.Visible = false; this.pnlDatabaseBackupAfter.Visible = false; this.grbActivationProcess.Visible = true; pvtintProcess = 0; this.tmrTimer.Enabled = true; object[] objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = "B"; #if (DEBUG) #else intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase", objParm); #endif if (intReturnCode == 0) { this.picBackupBefore.Image = (Image)global::EmployeeActivateSelection.Properties.Resources.Ok; this.picEmployeeActivation.Image = EmployeeActivateSelection.Properties.Resources.Question; this.pnlEmployeeActivation.Visible = true; pvtintProcess += 1; this.picBackupBefore.Visible = true; //Insert Pay Category Record objParm = new object[6]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = AppDomain.CurrentDomain.GetData("FromProgramInd").ToString(); objParm[3] = dCurrentPayCategoryDateTime; objParm[4] = strArrayEmployeeNumbers; objParm[5] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); pvtbytCompress = (byte[])clsISUtilities.DynamicFunction("Insert_TakeOn_Records", objParm); pvtDataSet = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); this.picEmployeeActivation.Image = (Image)global::EmployeeActivateSelection.Properties.Resources.Ok; this.picBackupAfter.Image = EmployeeActivateSelection.Properties.Resources.Question; this.pnlDatabaseBackupAfter.Visible = true; pvtintProcess += 1; this.picEmployeeActivation.Visible = true; objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = "A"; #if (DEBUG) #else intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase", objParm); #endif this.tmrTimer.Enabled = false; if (intReturnCode == 0) { this.picBackupAfter.Image = (Image)global::EmployeeActivateSelection.Properties.Resources.Ok; } else { this.picBackupAfter.Image = (Image)global::EmployeeActivateSelection.Properties.Resources.Error; } this.picBackupAfter.Visible = true; CustomMessageBox.Show("Employee Take-On Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); btnCancel_Click(sender, e); } else { this.tmrTimer.Enabled = false; this.picBackupBefore.Image = (Image)global::EmployeeActivateSelection.Properties.Resources.Error; this.picBackupBefore.Visible = true; CustomMessageBox.Show("Backup of Database Failed.Speak To System Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } Set_Form_For_Read(); this.cboRunDate.Items.Clear(); this.Clear_DataGridView(this.dgvPayrollTypeDataGridView); this.Clear_DataGridView(this.dgvEmployeeDataGridView); this.Clear_DataGridView(this.dgvChosenEmployeeDataGridView); pvtblnPayrollTypeDataGridViewLoaded = false; for (int intRow = 0; intRow < pvtDataSet.Tables["PayrollType"].Rows.Count; intRow++) { this.dgvPayrollTypeDataGridView.Rows.Add(pvtDataSet.Tables["PayrollType"].Rows[intRow]["PAYROLL_TYPE_DESC"].ToString()); } pvtblnPayrollTypeDataGridViewLoaded = true; if (dgvPayrollTypeDataGridView.Rows.Count > 0) { this.Set_DataGridView_SelectedRowIndex(dgvPayrollTypeDataGridView, 0); dgvPayrollTypeDataGridView.Refresh(); } else { this.btnNew.Enabled = false; } } catch (Exception eException) { this.tmrTimer.Enabled = false; this.picEmployeeActivation.Image = EmployeeActivateSelection.Properties.Resources.Error; this.picEmployeeActivation.Visible = true; CustomMessageBox.Show("Unsuccessful", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); clsISUtilities.ErrorHandler(eException); } }
private void btnOK_Click(object sender, EventArgs e) { try { DialogResult myDialogResult = CustomMessageBox.Show("Are you sure you want to Restore this Database?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (myDialogResult == System.Windows.Forms.DialogResult.Yes) { this.btnOK.Enabled = false; pvtintProcess = 0; grbActivationProcess.Visible = true; this.pnlRestoreDatabase.Visible = false; this.picBackupBefore.Image = (Image)global::InteractPayroll.Properties.Resources.Question; this.picRestoreDatabase.Image = null; this.tmrTimer.Enabled = true; int intReturnCode = 0; object[] objParm = new object[1]; #if (DEBUG) #else objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase_Before_Restore", objParm); #endif this.tmrTimer.Enabled = false; this.picBackupBefore.Visible = true; if (intReturnCode == 0) { this.picBackupBefore.Image = (Image)global::InteractPayroll.Properties.Resources.Ok; pvtintProcess += 1; this.pnlRestoreDatabase.Visible = true; this.picRestoreDatabase.Image = (Image)global::InteractPayroll.Properties.Resources.Question; string strCopyTimeSheetsOver = "Y"; if (this.chkCopy.Checked == false) { strCopyTimeSheetsOver = "N"; } this.tmrTimer.Enabled = true; objParm = new object[4]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = this.dgvFilesDataGridView[3, Get_DataGridView_SelectedRowIndex(this.dgvFilesDataGridView)].Value.ToString(); objParm[2] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[3] = strCopyTimeSheetsOver; intReturnCode = (int)clsISUtilities.DynamicFunction("Restore_DataBase", objParm); this.tmrTimer.Enabled = false; this.picRestoreDatabase.Visible = true; if (intReturnCode == 0) { this.picRestoreDatabase.Image = (Image)global::InteractPayroll.Properties.Resources.Ok; this.Refresh(); CustomMessageBox.Show("Restore Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.picRestoreDatabase.Image = (Image)global::InteractPayroll.Properties.Resources.Error; this.Refresh(); CustomMessageBox.Show("Restore Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { this.picBackupBefore.Image = (Image)global::InteractPayroll.Properties.Resources.Error; CustomMessageBox.Show("Backup of Database Before Restore Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.grbActivationProcess.Visible = false; this.btnOK.Enabled = true; } } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }
private void btnOK_Click(object sender, EventArgs e) { try { DateTime dtFromDate = DateTime.Now; DateTime dtToDate = DateTime.Now; string strReportType = ""; string strEmployeeNoIN = ""; string strPayCategoryNoIN = ""; string strOrder = "E"; string strGroupCostCentre = "N"; if (this.rbnEmployeeSelected.Checked == true) { if (this.dgvChosenEmployeeDataGridView.Rows.Count == 0) { this.tabControl.SelectedIndex = 0; CustomMessageBox.Show("Select Employee/s.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.btnEmployeeAdd.Focus(); return; } else { for (int intRow = 0; intRow < this.dgvChosenEmployeeDataGridView.Rows.Count; intRow++) { if (intRow == 0) { strEmployeeNoIN = "(" + this.dgvChosenEmployeeDataGridView[3, intRow].Value.ToString(); } else { strEmployeeNoIN += "," + this.dgvChosenEmployeeDataGridView[3, intRow].Value.ToString(); } } strEmployeeNoIN += ") "; } } if (this.rbnCostCentreSelected.Checked == true) { if (this.dgvChosenCostCentreDataGridView.Rows.Count == 0) { this.tabControl.SelectedIndex = 1; CustomMessageBox.Show("Select Cost Centre/s.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.btnEmployeeAdd.Focus(); return; } else { for (int intRow = 0; intRow < this.dgvChosenCostCentreDataGridView.Rows.Count; intRow++) { if (intRow == 0) { strPayCategoryNoIN = "(" + this.dgvChosenCostCentreDataGridView[1, intRow].Value.ToString(); } else { strPayCategoryNoIN += "," + this.dgvChosenCostCentreDataGridView[1, intRow].Value.ToString(); } } strPayCategoryNoIN += ") "; } } if (this.rbnPrintName.Checked == true) { strOrder = "N"; } else { if (this.rbnPrintSurname.Checked == true) { strOrder = "S"; } } if (this.chkByPayParameter.Checked == true) { strGroupCostCentre = "Y"; } this.reportViewer.Clear(); this.reportViewer.Refresh(); this.tabMainControl.SelectedIndex = 1; object[] objParm = new object[11]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strReportType; objParm[3] = strEmployeeNoIN; objParm[4] = strPayCategoryNoIN; objParm[5] = this.dgvRunDateDataGridView[1, this.Get_DataGridView_SelectedRowIndex(this.dgvRunDateDataGridView)].Value.ToString(); objParm[6] = AppDomain.CurrentDomain.GetData("FromProgramInd").ToString(); objParm[7] = strOrder; objParm[8] = strGroupCostCentre; objParm[9] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); objParm[10] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); pvtbytCompress = (byte[])clsISUtilities.DynamicFunction("Print_Report", objParm); pvtTempDataSet = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); DataView EmployeeDataView = new DataView(this.pvtDataSet.Tables["Employee"], "", "EMPLOYEE_NO", DataViewRowState.CurrentRows); DataView PayCategoryDataView = new DataView(this.pvtDataSet.Tables["PayCategory"], "", "PAY_CATEGORY_NO", DataViewRowState.CurrentRows); if (pvtTempDataSet.Tables["Report"].Rows.Count == 0) { CustomMessageBox.Show("Empty Result Set.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { this.tabPage2.Cursor = Cursors.WaitCursor; pvtTempDataSet.Tables["Report"].Columns.Add("COMPANY_DESC", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("MAIN_REPORT_HEADER_DESC", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("REPORT_HEADER_DESC", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("REPORT_DATETIME", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("PAY_CATEGORY_DESC", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("EMPLOYEE_CODE", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("EMPLOYEE_SURNAME", typeof(String)); pvtTempDataSet.Tables["Report"].Columns.Add("EMPLOYEE_NAME", typeof(String)); int intFindRow = -1; for (int intRow = 0; intRow < this.pvtTempDataSet.Tables["Report"].Rows.Count; intRow++) { intFindRow = EmployeeDataView.Find(pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_NO"].ToString()); pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_CODE"] = EmployeeDataView[intFindRow]["EMPLOYEE_CODE"].ToString(); pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_SURNAME"] = EmployeeDataView[intFindRow]["EMPLOYEE_SURNAME"].ToString(); pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_NAME"] = EmployeeDataView[intFindRow]["EMPLOYEE_NAME"].ToString(); if (Convert.ToInt32(pvtTempDataSet.Tables["Report"].Rows[intRow]["PAY_CATEGORY_NO"]) != 0) { intFindRow = PayCategoryDataView.Find(this.pvtTempDataSet.Tables["Report"].Rows[intRow]["PAY_CATEGORY_NO"].ToString()); pvtTempDataSet.Tables["Report"].Rows[intRow]["PAY_CATEGORY_DESC"] = PayCategoryDataView[intFindRow]["PAY_CATEGORY_DESC"].ToString(); } if (intRow == 0) { pvtTempDataSet.Tables["Report"].Rows[0]["COMPANY_DESC"] = pvtTempDataSet.Tables["ReportHeader"].Rows[0]["COMPANY_DESC"].ToString(); if (AppDomain.CurrentDomain.GetData("FromProgramInd").ToString() == "P") { pvtTempDataSet.Tables["Report"].Rows[0]["MAIN_REPORT_HEADER_DESC"] = "Timesheet Totals"; } else { pvtTempDataSet.Tables["Report"].Rows[0]["MAIN_REPORT_HEADER_DESC"] = "Timesheet Totals"; } pvtTempDataSet.Tables["Report"].Rows[0]["REPORT_HEADER_DESC"] = "Pay Period Date - " + this.dgvRunDateDataGridView[0, this.Get_DataGridView_SelectedRowIndex(this.dgvRunDateDataGridView)].Value.ToString(); pvtTempDataSet.Tables["Report"].Rows[0]["REPORT_DATETIME"] = pvtTempDataSet.Tables["ReportHeader"].Rows[0]["REPORT_DATETIME"].ToString(); //pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_CODE"] = "ZZZZZZZZ"; //pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_SURNAME"] = "ZZZZZZZZZZZZZZZZZZZZ"; //pvtTempDataSet.Tables["Report"].Rows[intRow]["EMPLOYEE_NAME"] = "ZZZZZZZZZZZZZZZZZZZZ"; } } this.tabPage2.Cursor = Cursors.Default; pvtTempDataSet.AcceptChanges(); Microsoft.Reporting.WinForms.ReportDataSource myReportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource("Report", pvtTempDataSet.Tables["Report"]); this.reportViewer.LocalReport.ReportEmbeddedResource = "RptTimeSheetTotals.Report.rdlc"; this.reportViewer.LocalReport.DataSources.Clear(); this.reportViewer.LocalReport.DataSources.Add(myReportDataSource); this.tabMainControl.SelectedIndex = 1; this.reportViewer.RefreshReport(); this.reportViewer.Focus(); } } catch (Exception eException) { this.tabPage2.Cursor = Cursors.Default; clsISUtilities.ErrorHandler(eException); } }
private void btnOK_Click(object sender, System.EventArgs e) { try { DialogResult dlgResult = CustomMessageBox.Show("Are you sure you want to Upload this Data?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dlgResult == DialogResult.Yes) { string strPayCategoryWhere = ""; //DataSetClient = null; //DataSetClient = new DataSet(); for (int intRow = 0; intRow < this.dgvPayCategoryDataGridView.Rows.Count; intRow++) { if (intRow == 0) { strPayCategoryWhere = " AND EPC.PAY_CATEGORY_NO IN (" + this.dgvPayCategoryDataGridView[5, intRow].Value.ToString(); } else { strPayCategoryWhere += "," + this.dgvPayCategoryDataGridView[5, intRow].Value.ToString(); } } strPayCategoryWhere += ")"; pvtTempDataSet = null; pvtTempDataSet = new DataSet(); DataTable myEmployeeDataTable; myEmployeeDataTable = pvtDataSet.Tables["Employee"].Copy(); pvtTempDataSet.Tables.Add(myEmployeeDataTable); DataTable myEmployeePayCategoryDataTable; myEmployeePayCategoryDataTable = pvtDataSet.Tables["EmployeePayCategory"].Copy(); pvtTempDataSet.Tables.Add(myEmployeePayCategoryDataTable); //Compress DataSet pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet); object[] objParm = new object[5]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; objParm[3] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd"); objParm[4] = pvtbytCompress; blnclsISClientUtilities = true; pvtbytCompress = (byte[])this.clsISClientUtilities.DynamicFunction("Get_Upload_Data", objParm, false); DataSet DataSetClient = clsISClientUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); if (DataSetClient.Tables["ErrorCount"].Rows.Count > 0) { if (DataSetClient.Tables["ErrorCount"].Rows[0]["INDICATOR"].ToString() == "X") { CustomMessageBox.Show("There are Time Sheets with Errors on the Client Database.\n\nYou Need to Fix these TimeSheets on (Interact Time & Attendance Program) to Proceed.\n\nProcess Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (DataSetClient.Tables["Dates"].Rows.Count > 0) { this.grbUploadProgress.Visible = true; this.pgbProgressBar.Maximum = DataSetClient.Tables["Dates"].Rows.Count + 1; for (int intRow = 0; intRow < DataSetClient.Tables["Dates"].Rows.Count; intRow++) { //From Clint Database objParm = new object[4]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; objParm[3] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]).ToString("yyyy-MM-dd"); blnclsISClientUtilities = true; pvtbytCompress = (byte[])this.clsISClientUtilities.DynamicFunction("Get_Upload_Data_For_Day", objParm, false); //Internet Database Insert objParm = new object[6]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]); objParm[2] = pvtbytCompress; objParm[3] = pvtstrPayrollType; objParm[4] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["PAY_PERIOD_DATE"]).ToString("yyyy-MM-dd"); objParm[5] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd"); blnclsISClientUtilities = false; string strUploadDateTime = (string)clsISUtilities.DynamicFunction("Insert_TimeSheet_Records", objParm, false); //Update Client PAYCATEGORY Records with Date TimeStamp objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = strUploadDateTime; objParm[2] = pvtbytCompress; blnclsISClientUtilities = true; this.clsISClientUtilities.DynamicFunction("Update_PayCategory_Last_Upload_DateTime", objParm, false); this.pgbProgressBar.Value += 1; } this.Refresh(); objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; blnclsISClientUtilities = true; this.clsISClientUtilities.DynamicFunction("Move_Data_To_History_And_Cleanup", objParm, false); this.pgbProgressBar.Value += 1; this.Refresh(); CustomMessageBox.Show("Upload Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { CustomMessageBox.Show("There is NO Data to Upload", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } this.grbUploadProgress.Visible = false; } } catch (Exception eException) { if (blnclsISClientUtilities == true) { clsISClientUtilities.ErrorHandler(eException); } else { clsISUtilities.ErrorHandler(eException); } } }
private void btnSave_Click(object sender, EventArgs e) { try { string strEmployeeIn = ""; if (this.dgvChosenEmployeeDataGridView.Rows.Count == 0) { CustomMessageBox.Show("Select Employees.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { for (int intRow = 0; intRow < this.dgvChosenEmployeeDataGridView.Rows.Count; intRow++) { if (intRow == 0) { strEmployeeIn = "(" + this.dgvChosenEmployeeDataGridView[3, intRow].Value.ToString(); } else { strEmployeeIn += "," + this.dgvChosenEmployeeDataGridView[3, intRow].Value.ToString(); } } strEmployeeIn += ")"; } object[] objParm = new object[2]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; int intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase", objParm); if (intReturnCode == 0) { objParm = new object[3]; objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo")); objParm[1] = pvtstrPayrollType; objParm[2] = strEmployeeIn; pvtbytCompress = (byte[])clsISUtilities.DynamicFunction("Reset_Employee_TakeOn", objParm, true); pvtDataSet = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); } else { CustomMessageBox.Show("Backup of Database Failed.\n\nAction Cancelled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.btnCancel_Click(sender, e); //this.Set_DataGridView_SelectedRowIndex(this.dgvPayrollTypeDataGridView, this.Get_DataGridView_SelectedRowIndex(this.dgvPayrollTypeDataGridView)); } catch (Exception eException) { clsISUtilities.ErrorHandler(eException); } }