private void Load_Restore_Files() { string strPayrollRunDate = ""; byte[] byteCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Restore_Files", null, false); pvtDataSet = null; pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(byteCompress); this.dgvFilesDataGridView.Rows.Clear(); pvtDataView = null; pvtDataView = new DataView(pvtDataSet.Tables["RestoreFiles"], "", "RESTORE_DATETIME DESC", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < pvtDataView.Count; intRow++) { if (pvtDataView[intRow]["RESTORE_DATETIME"] != System.DBNull.Value) { strPayrollRunDate = Convert.ToDateTime(pvtDataView[intRow]["RESTORE_DATETIME"]).ToString("yyyy-MM-dd HH:mm:ss"); } else { strPayrollRunDate = ""; } this.dgvFilesDataGridView.Rows.Add(strPayrollRunDate, pvtDataView[intRow]["RESTORE_FILE"].ToString()); } if (pvtDataView.Count > 0) { this.btnOK.Enabled = true; this.btnDelete.Visible = true; } }
private void frmClientConvertCostCentre_Load(object sender, EventArgs e) { try { miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); clsISClientUtilities = new clsISClientUtilities(this, "busClientConvertCostCentre"); this.lblCompanySpreadsheetHeader.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblPayrollTypeHeader.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblPayCategoryDesc.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblPayCategorySelectDesc.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.dgvConvertToPayrollTypeDataGridView.Rows.Add("Wages"); this.dgvConvertToPayrollTypeDataGridView.Rows.Add("TimeSheets"); this.dgvConvertToPayrollTypeDataGridView.Rows.Add("Salaries"); pvtblnConvertToPayrollTypeDataGridViewLoaded = true; this.Set_DataGridView_SelectedRowIndex(this.dgvConvertToPayrollTypeDataGridView, 0); try { clsISUtilities = new InteractPayroll.clsISUtilities(this, "busConvertCostCentre"); } catch (Exception ex) { CustomClientMessageBox.Show("Connection to Internet Database Could Not be Established", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } object[] objParm = new object[0]; pvtbytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); for (int intRow = 0; intRow < this.pvtDataSet.Tables["Company"].Rows.Count; intRow++) { this.dgvCompanyDataGridView.Rows.Add(this.pvtDataSet.Tables["Company"].Rows[intRow]["COMPANY_DESC"].ToString(), this.pvtDataSet.Tables["Company"].Rows[intRow]["COMPANY_NO"].ToString()); } pvtblnCompanyDataGridViewLoaded = true; if (this.dgvCompanyDataGridView.Rows.Count > 0) { this.Set_DataGridView_SelectedRowIndex(this.dgvCompanyDataGridView, 0); } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void Load_CostCentres() { try { if (pvtDataSet.Tables["PayCategory"] != null) { pvtDataSet.Tables.Remove("PayCategory"); } object[] objParm = new object[2]; objParm[0] = pvtInt64CompanyNo; objParm[1] = pvtstrToPayCategoryType; pvtbytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Company_CostCentres", objParm, false); DataSet DataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); pvtDataSet.Merge(DataSet); this.Clear_DataGridView(dgvPayCategoryDataGridView); this.Clear_DataGridView(this.dgvChosenPayCategoryDataGridView); pvtblnPayCategoryDataGridViewLoaded = false; pvtblnChosenPayCategoryDataGridViewLoaded = false; for (int intRow = 0; intRow < this.pvtDataSet.Tables["PayCategory"].Rows.Count; intRow++) { this.dgvPayCategoryDataGridView.Rows.Add(this.pvtDataSet.Tables["PayCategory"].Rows[intRow]["PAY_CATEGORY_DESC"].ToString(), this.pvtDataSet.Tables["PayCategory"].Rows[intRow]["PAY_CATEGORY_TYPE"].ToString(), this.pvtDataSet.Tables["PayCategory"].Rows[intRow]["PAY_CATEGORY_NO"].ToString()); } pvtblnPayCategoryDataGridViewLoaded = true; if (this.dgvPayCategoryDataGridView.Rows.Count > 0) { this.Set_DataGridView_SelectedRowIndex(this.dgvPayCategoryDataGridView, 0); } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void frmFingerPrintReader_Load(object sender, EventArgs e) { clsISClientUtilities = new clsISClientUtilities(this, "busRemotBackupSiteName"); miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); object[] objParm = new object[0]; byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); DataSet DataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); if (DataSet.Tables["RemoteBackupSiteName"].Rows.Count > 0) { this.txtRemoteBackupSiteName.Text = DataSet.Tables["RemoteBackupSiteName"].Rows[0]["SITE_NAME"].ToString(); } pvtstrFilePath = AppDomain.CurrentDomain.BaseDirectory + "FingerPrintReaderConfig.txt"; Read_Reader_From_File(); }
private void frmEmployeeLinkDevice_Load(object sender, System.EventArgs e) { try { clsISClientUtilities = new clsISClientUtilities(this, "busEmployeeLinkDevice"); this.lblCompany.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblClockingDevice.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblEmployee.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblLinkedEmployee.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblCostCentre.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblLinkedCostCentre.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblDepartment.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblLinkedDepartment.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblGroup.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblLinkedGroup.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); #if (DEBUG) int intWidth = this.dgvDeviceDataGridView.RowHeadersWidth; if (this.dgvDeviceDataGridView.ScrollBars == ScrollBars.Vertical | this.dgvDeviceDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < this.dgvDeviceDataGridView.ColumnCount; intCol++) { if (this.dgvDeviceDataGridView.Columns[intCol].Visible == true) { intWidth += this.dgvDeviceDataGridView.Columns[intCol].Width; } } if (intWidth != this.dgvDeviceDataGridView.Width) { System.Windows.Forms.MessageBox.Show("Width should be " + intWidth.ToString()); } int intHeight = this.dgvDeviceDataGridView.ColumnHeadersHeight + 2; int intNewHeight = this.dgvDeviceDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += this.dgvDeviceDataGridView.RowTemplate.Height; if (intHeight == this.dgvDeviceDataGridView.Height) { break; } else { if (intHeight > this.dgvDeviceDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > this.dgvDeviceDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } } } } intWidth = this.dgvDepartmentDataGridView.RowHeadersWidth; if (this.dgvDepartmentDataGridView.ScrollBars == ScrollBars.Vertical | this.dgvDepartmentDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < this.dgvDepartmentDataGridView.ColumnCount; intCol++) { if (this.dgvDepartmentDataGridView.Columns[intCol].Visible == true) { intWidth += this.dgvDepartmentDataGridView.Columns[intCol].Width; } } if (intWidth != this.dgvDepartmentDataGridView.Width) { System.Windows.Forms.MessageBox.Show("Employee Width should be " + intWidth.ToString()); } intHeight = this.dgvDepartmentDataGridView.ColumnHeadersHeight + 2; intNewHeight = this.dgvDepartmentDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += this.dgvDepartmentDataGridView.RowTemplate.Height; if (intHeight == this.dgvDepartmentDataGridView.Height) { break; } else { if (intHeight > this.dgvDepartmentDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Employee Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > this.dgvDepartmentDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Employee Height should be " + intHeight.ToString()); break; } } } } #endif object[] objParm = new object[2]; objParm[0] = Convert.ToInt32(AppDomain.CurrentDomain.GetData("UserNo")); objParm[1] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); string strDeviceType = ""; for (int intRowCount = 0; intRowCount < pvtDataSet.Tables["Device"].Rows.Count; intRowCount++) { if (pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_USAGE"].ToString() == "T") { strDeviceType = "Time & Attendance"; } else { if (pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_USAGE"].ToString() == "A") { strDeviceType = "Access"; } else { strDeviceType = "Access / Time & Attendance"; } } this.dgvDeviceDataGridView.Rows.Add(pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_DESC"].ToString(), strDeviceType, pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString(), intRowCount.ToString()); } pvtblnDeviceDataGridViewLoaded = true; if (pvtDataSet.Tables["Device"].Rows.Count > 0) { this.Set_DataGridView_SelectedRowIndex(dgvDeviceDataGridView, this.Get_DataGridView_SelectedRowIndex(dgvDeviceDataGridView)); Load_CurrentForm_Records(); } else { this.btnUpdate.Enabled = false; } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void dgvCompanyDataGridView_RowEnter(object sender, DataGridViewCellEventArgs e) { try { if (pvtblnCompanyDataGridViewLoaded == true) { if (pvtintCompanyDataGridViewRowIndex != e.RowIndex) { pvtintCompanyDataGridViewRowIndex = e.RowIndex; int intCompanyIndex = Convert.ToInt32(dgvCompanyDataGridView[1, e.RowIndex].Value); pvtint64CompanyNo = Convert.ToInt64(pvtDataSet.Tables["Company"].Rows[intCompanyIndex]["COMPANY_NO"]); DataView dtDataView = new DataView(pvtDataSet.Tables["Employee"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); if (dtDataView.Count == 0) { object[] objParm = new object[1]; objParm[0] = pvtint64CompanyNo; byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Company_Records", objParm, false); DataSet TempDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); pvtDataSet.Merge(TempDataSet); } if (dtDataView.Count == 0) { this.btnUpdate.Enabled = false; this.btnDelete.Enabled = false; } else { this.btnUpdate.Enabled = true; this.btnDelete.Enabled = true; } this.Clear_DataGridView(dgvPayCategoryDataGridView); this.Clear_DataGridView(dgvPayCategoryChosenDataGridView); this.Clear_DataGridView(dgvDepartmentDataGridView); this.Clear_DataGridView(dgvDepartmentChosenDataGridView); this.Clear_DataGridView(dgvGroupDataGridView); this.Clear_DataGridView(dgvGroupChosenDataGridView); //Read Only if (this.btnSave.Enabled == false) { Load_Employees(); pvtPayCategoryDataView = null; pvtPayCategoryDataView = new DataView(pvtDataSet.Tables["PayCategory"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRowCount = 0; intRowCount < pvtPayCategoryDataView.Count; intRowCount++) { DataView DataView = new DataView(pvtDataSet.Tables["PayCategoryChosen"], "DEVICE_NO = " + pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND PAY_CATEGORY_NO = " + pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_NO"].ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString() + "'", "", DataViewRowState.CurrentRows); if (DataView.Count == 0) { this.dgvPayCategoryDataGridView.Rows.Add(pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_DESC"].ToString(), pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString(), pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_NO"].ToString()); } else { this.dgvPayCategoryChosenDataGridView.Rows.Add(pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_DESC"].ToString(), pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString(), pvtPayCategoryDataView[intRowCount]["PAY_CATEGORY_NO"].ToString()); } } pvtDepartmentDataView = null; pvtDepartmentDataView = new DataView(pvtDataSet.Tables["Department"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRowCount = 0; intRowCount < pvtDepartmentDataView.Count; intRowCount++) { DataView DataView = new DataView(pvtDataSet.Tables["DepartmentChosen"], "DEVICE_NO = " + pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND PAY_CATEGORY_NO = " + pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_NO"].ToString() + " AND PAY_CATEGORY_TYPE = '" + pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString() + "' AND DEPARTMENT_NO = " + pvtDepartmentDataView[intRowCount]["DEPARTMENT_NO"].ToString(), "", DataViewRowState.CurrentRows); if (DataView.Count == 0) { dgvDepartmentDataGridView.Rows.Add(pvtDepartmentDataView[intRowCount]["DEPARTMENT_DESC"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_DESC"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_NO"].ToString(), pvtDepartmentDataView[intRowCount]["DEPARTMENT_NO"].ToString()); } else { dgvDepartmentChosenDataGridView.Rows.Add(pvtDepartmentDataView[intRowCount]["DEPARTMENT_DESC"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_DESC"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_TYPE"].ToString(), pvtDepartmentDataView[intRowCount]["PAY_CATEGORY_NO"].ToString(), pvtDepartmentDataView[intRowCount]["DEPARTMENT_NO"].ToString()); } } pvtGroupDataView = null; pvtGroupDataView = new DataView(pvtDataSet.Tables["Group"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRowCount = 0; intRowCount < pvtGroupDataView.Count; intRowCount++) { DataView DataView = new DataView(pvtDataSet.Tables["GroupChosen"], "DEVICE_NO = " + pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND GROUP_NO = " + pvtGroupDataView[intRowCount]["GROUP_NO"].ToString(), "", DataViewRowState.CurrentRows); if (DataView.Count == 0) { this.dgvGroupDataGridView.Rows.Add(pvtGroupDataView[intRowCount]["GROUP_DESC"].ToString(), pvtGroupDataView[intRowCount]["GROUP_NO"].ToString()); } else { this.dgvGroupChosenDataGridView.Rows.Add(pvtGroupDataView[intRowCount]["GROUP_DESC"].ToString(), pvtGroupDataView[intRowCount]["GROUP_NO"].ToString()); } } if (this.dgvEmployeeChosenDataGridView.Rows.Count == 0 & this.dgvPayCategoryChosenDataGridView.Rows.Count == 0 & this.dgvDepartmentChosenDataGridView.Rows.Count == 0 & this.dgvGroupChosenDataGridView.Rows.Count == 0) { this.btnDelete.Enabled = false; } else { this.btnDelete.Enabled = true; } } } } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void frmClock_Load(object sender, EventArgs e) { try { miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); cboFAR.Items.Add("1/10000"); cboFAR.Items.Add("1/25000"); cboFAR.Items.Add("1/50000"); cboFAR.Items.Add("1/75000"); cboFAR.Items.Add("1/100000"); intPossibleFARValuesArray = new int[5]; intPossibleFARValuesArray[0] = 214748; intPossibleFARValuesArray[1] = 85899; intPossibleFARValuesArray[2] = 42949; intPossibleFARValuesArray[3] = 28633; intPossibleFARValuesArray[4] = 21475; string strTag = "Start"; clsISClientUtilities = new clsISClientUtilities(this, "busClock"); this.lblClock.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); object[] objParm = new object[2]; objParm[0] = Convert.ToInt32(AppDomain.CurrentDomain.GetData("UserNo")); objParm[1] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); for (int intRowCount = 0; intRowCount < pvtDataSet.Tables["Company"].Rows.Count; intRowCount++) { this.cboCompany.Items.Add(pvtDataSet.Tables["Company"].Rows[intRowCount]["COMPANY_DESC"].ToString()); } strTag = "After DataSet"; #if (DEBUG) int intWidth = this.dgvClockDataGridView.RowHeadersWidth; if (this.dgvClockDataGridView.ScrollBars == ScrollBars.Vertical | this.dgvClockDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < this.dgvClockDataGridView.ColumnCount; intCol++) { if (this.dgvClockDataGridView.Columns[intCol].Visible == true) { intWidth += this.dgvClockDataGridView.Columns[intCol].Width; } } if (intWidth != this.dgvClockDataGridView.Width) { System.Windows.Forms.MessageBox.Show("Width should be " + intWidth.ToString()); } int intHeight = this.dgvClockDataGridView.ColumnHeadersHeight + 2; int intNewHeight = this.dgvClockDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += this.dgvClockDataGridView.RowTemplate.Height; if (intHeight == this.dgvClockDataGridView.Height) { break; } else { if (intHeight > this.dgvClockDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > this.dgvClockDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } } } } #endif Load_CurrentForm_Records(); } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void btnOK_Click(object sender, System.EventArgs e) { try { if (this.txtUserId.Text.Trim() == "") { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Enter User Id.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmMessageBox.ShowDialog(); this.txtUserId.Focus(); } else { if (this.txtPassword.Text.Trim() == "") { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Enter Password.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmMessageBox.ShowDialog(); this.txtPassword.Focus(); } else { this.Cursor = Cursors.AppStarting; this.txtUserId.Enabled = false; this.txtPassword.Enabled = false; this.btnOK.Enabled = false; string strUserInformation = this.txtUserId.Text.Trim().ToUpper() + "|" + this.txtPassword.Text.Trim().ToUpper(); object[] objParm = new object[1]; objParm[0] = strUserInformation; byte[] bytCompress = null; if (this.rbnLocal.Checked == true) { pvtblnLocalWebService = true; bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Logon_User", objParm, false); } else { pvtblnLocalWebService = false; bytCompress = (byte[])clsISUtilities.DynamicFunction("Logon_Client_User", objParm, false); } pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); this.Cursor = Cursors.Default; this.txtUserId.Enabled = true; this.txtPassword.Enabled = true; this.btnOK.Enabled = true; if (this.rbnLocal.Checked == true) { if (pvtDataSet.Tables["ReturnValues"].Rows[0]["DB_CREATE_FOR_ENGINE"].ToString() == "") { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("There is Currently NO Database for SQL Server.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); this.Close(); return; } } //From Local Machine if (pvtDataSet.Tables["ReturnValues"].Rows[0]["NO_USERS_IND"].ToString() == "Y") { //Not Found InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("There are Currently NO Users on Local Machine.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } else { if (pvtDataSet.Tables["ReturnValues"].Rows[0]["DOWNLOAD_IND"].ToString() != "") { //CRC Error if (pvtDataSet.Tables["ReturnValues"].Rows[0]["DOWNLOAD_IND"].ToString() == "C") { //Not Found InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Server CRC File Error\n\nTry Re-Login\n\nIf Problem Persists, Speak to Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } else { //Not Found InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Server Download Error\n\nTry Re-Login\n\nIf Problem Persists, Speak to Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } this.Close(); return; } else { if (pvtDataSet.Tables["ReturnValues"].Rows[0]["USER_NO"].ToString() == "-1") { //Not Found InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("User Id / Password NOT Found.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmMessageBox.ShowDialog(); } else { btnOK_Click_Continue: if (pvtDataSet.Tables["ReturnValues"].Rows[0]["RESET"].ToString() == "Y") { if (this.rbnLocal.Checked == true) { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("User Needs To Login To Internet Site to Change Password.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } else { AppDomain.CurrentDomain.SetData("UserNo", pvtDataSet.Tables["ReturnValues"].Rows[0]["USER_NO"].ToString()); frmPasswordChange = null; frmPasswordChange = new frmPasswordChange(); frmPasswordChange.ShowDialog(); if (AppDomain.CurrentDomain.GetData("PasswordChanged").ToString() != "Y") { //Set so That Lower Down in Program it Closes in exe AppDomain.CurrentDomain.SetData("UserNo", -1); } else { pvtDataSet.Tables["ReturnValues"].Rows[0]["RESET"] = "N"; goto btnOK_Click_Continue; } } } else { pvtint64UserNo = Convert.ToInt64(pvtDataSet.Tables["ReturnValues"].Rows[0]["USER_NO"]); pvtstrAccessInd = pvtDataSet.Tables["ReturnValues"].Rows[0]["ACCESS_IND"].ToString(); if (this.rbnLocal.Checked == true) { string strApplicationPath = AppDomain.CurrentDomain.BaseDirectory; #if (DEBUG) strApplicationPath = AppDomain.CurrentDomain.BaseDirectory + "bin\\"; #endif FileInfo fiFileInfo; BinaryReader brBinaryReader; FileStream fsFileStream; BinaryWriter bwBinaryWriter; long lngFileStartOffset = 0; byte[] bytFileBytes; byte[] bytFileChunkBytes; byte[] bytDecompressedBytes; byte[] bytTempBytes; string strDownLoadFileName = ""; bool blnRestartProgram = false; #if (DEBUG) //pvtDataSet.Tables["Files"].Rows.Clear(); #endif if (pvtDataSet.Tables["Files"].Rows.Count > 0) { for (int intRow = 0; intRow < pvtDataSet.Tables["Files"].Rows.Count; intRow++) { fiFileInfo = new FileInfo(strApplicationPath + pvtDataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString()); if (fiFileInfo.Exists == true) { if (fiFileInfo.LastWriteTime >= Convert.ToDateTime(pvtDataSet.Tables["Files"].Rows[intRow]["FILE_LAST_UPDATED_DATE"]).AddSeconds(-3) & fiFileInfo.LastWriteTime <= Convert.ToDateTime(pvtDataSet.Tables["Files"].Rows[intRow]["FILE_LAST_UPDATED_DATE"]).AddSeconds(3)) { continue; } } if (pvtDataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString() == "TimeAttendanceClient.exe") { //Check If TimeAttendanceClient.exe_ Exists (Can only be Replaced Via Fix or Manual Process) FileInfo fiFileInfoTemp = new FileInfo(strApplicationPath + pvtDataSet.Tables["Files"].Rows[intRow]["FILE_NAME"].ToString() + "_"); if (fiFileInfoTemp.Exists == true) { if (fiFileInfoTemp.LastWriteTime >= Convert.ToDateTime(pvtDataSet.Tables["Files"].Rows[intRow]["FILE_LAST_UPDATED_DATE"]).AddSeconds(-3) & fiFileInfoTemp.LastWriteTime <= Convert.ToDateTime(pvtDataSet.Tables["Files"].Rows[intRow]["FILE_LAST_UPDATED_DATE"]).AddSeconds(3)) { continue; } } } pvtDataSet.Tables["Files"].Rows[intRow]["DOWNLOAD_IND"] = "Y"; } DataView FilesDataView = new DataView(pvtDataSet.Tables["Files"], "DOWNLOAD_IND = 'Y'", "", DataViewRowState.CurrentRows); if (FilesDataView.Count > 0) { int intProgressBarCombinedMaxValue = 0; int intProgressBarMaxValue = 0; for (int intRow = 0; intRow < FilesDataView.Count; intRow++) { //strFileName = parDataTable.Rows[intRow]["FILE_NAME"].ToString(); intProgressBarCombinedMaxValue += Convert.ToInt32(FilesDataView[intRow]["MAX_FILE_CHUNK_NO"]); } frmReadWriteFile = new frmReadWriteFile(); frmReadWriteFile.Show(); frmReadWriteFile.Refresh(); frmReadWriteFile.prbAllFileProgress.Maximum = intProgressBarCombinedMaxValue; frmReadWriteFile.prbAllFileProgress.Value = 0; //This Must Be Fixed for (int intRow = 0; intRow < FilesDataView.Count; intRow++) { DateTime dtMinLoopTime = DateTime.Now.AddSeconds(1); strDownLoadFileName = FilesDataView[intRow]["FILE_NAME"].ToString(); if (strDownLoadFileName == "URLConfig.dll" | strDownLoadFileName == "clsISUtilities.dll" | strDownLoadFileName == "PasswordChange.dll" | strDownLoadFileName == "DownloadFiles.dll" | strDownLoadFileName == "clsISClientUtilities.dll" | strDownLoadFileName == "TimeAttendanceLogon.dll" | strDownLoadFileName == "TimeAttendanceClient.exe" | strDownLoadFileName == "TimeAttendanceClientIS.exe") { if (strDownLoadFileName == "TimeAttendanceClient.exe") { //Fix Will have to Be done Manually or via Fix } else { blnRestartProgram = true; } strDownLoadFileName += "_"; } intProgressBarMaxValue = Convert.ToInt32(FilesDataView[intRow]["MAX_FILE_CHUNK_NO"]); frmReadWriteFile.prbFileProgress.Maximum = intProgressBarMaxValue; frmReadWriteFile.prbFileProgress.Value = 0; frmReadWriteFile.lblFileName.Text = strDownLoadFileName; bytFileBytes = new byte[Convert.ToInt32(FilesDataView[intRow]["FILE_SIZE_COMPRESSED"])]; lngFileStartOffset = 0; for (int intChunkRow = 1; intChunkRow <= Convert.ToInt32(FilesDataView[intRow]["MAX_FILE_CHUNK_NO"]); intChunkRow++) { objParm = new object[2]; objParm[0] = FilesDataView[intRow]["FILE_NAME"].ToString(); objParm[1] = intChunkRow; pvtblnLocalWebService = true; bytTempBytes = (byte[])clsISClientUtilities.DynamicFunction("Get_File_Chunk", objParm, false); this.pvtTempDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytTempBytes); bytFileChunkBytes = (byte[])pvtTempDataSet.Tables["FileChunk"].Rows[0]["FILE_CHUNK"]; Array.Copy(bytFileChunkBytes, 0, bytFileBytes, lngFileStartOffset, bytFileChunkBytes.Length); lngFileStartOffset += bytFileChunkBytes.Length; frmReadWriteFile.prbAllFileProgress.Value += 1; frmReadWriteFile.prbFileProgress.Value += 1; this.Refresh(); Application.DoEvents(); } bytDecompressedBytes = null; bytDecompressedBytes = new byte[Convert.ToInt32(FilesDataView[intRow]["FILE_SIZE"])]; //Open Memory Stream with Compressed Data MemoryStream msMemoryStream = new MemoryStream(bytFileBytes); System.IO.Compression.GZipStream GZipStreamDecompress = new GZipStream(msMemoryStream, CompressionMode.Decompress); //Decompress Bytes brBinaryReader = new BinaryReader(GZipStreamDecompress); bytDecompressedBytes = brBinaryReader.ReadBytes(Convert.ToInt32(FilesDataView[intRow]["FILE_SIZE"])); if (FilesDataView[intRow]["FILE_CRC_VALUE"].ToString() != "") { //CRC32 Value string strCRC32Value = ""; foreach (byte b in clsCrc32.ComputeHash(bytDecompressedBytes)) { strCRC32Value += b.ToString("x2").ToLower(); } if (strCRC32Value != FilesDataView[intRow]["FILE_CRC_VALUE"].ToString()) { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Client CRC File Error\n\nTry Re-Login\n\nIf Problem Persists, Speak to Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); this.Close(); return; } } fsFileStream = null; bwBinaryWriter = null; fsFileStream = new FileStream(strApplicationPath + strDownLoadFileName, FileMode.Create); bwBinaryWriter = new BinaryWriter(fsFileStream); bwBinaryWriter.Write(bytDecompressedBytes); //Write Memory Portion To Disk bwBinaryWriter.Close(); File.SetLastWriteTime(strApplicationPath + strDownLoadFileName, Convert.ToDateTime(FilesDataView[intRow]["FILE_LAST_UPDATED_DATE"])); while (dtMinLoopTime > DateTime.Now) { this.Refresh(); Application.DoEvents(); } this.Refresh(); Application.DoEvents(); } frmReadWriteFile.Close(); frmReadWriteFile.Dispose(); } } pvtDataSet.Tables.Remove(pvtDataSet.Tables["Files"]); if (blnRestartProgram == true | pvtDataSet.Tables["ReturnValues"].Rows[0]["REBOOT_IND"].ToString() == "Y") { bool blnCloseProgram = true; if (pvtDataSet.Tables["ReturnValues"].Rows[0]["REBOOT_IND"].ToString() == "Y") { frmRestartService frmRestartService = new frmRestartService(pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_NAME"].ToString(), pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_IP"].ToString()); frmRestartService.Show(); try { clsRestartFingerPrintClockTimeAttendanceService clsRestartFingerPrintClockTimeAttendanceService; if (AppDomain.CurrentDomain.GetData("URLClientPath").ToString() != "") { //Calls Web Service Internally clsRestartFingerPrintClockTimeAttendanceService = new clsRestartFingerPrintClockTimeAttendanceService(""); InteractPayrollClient.Restart Restart = (InteractPayrollClient.Restart)clsRestartFingerPrintClockTimeAttendanceService.DynamicFunction("RestartFingerPrintClockTimeAttendanceService", null); if (Restart.OK == "Y") { if (blnRestartProgram == false) { blnCloseProgram = false; } } else { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Failed to Restart 'FingerPrintClockTimeAttendanceService' Service.\n\nSpeak to System Administrator.\n\nReboot of Machine '" + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_NAME"].ToString() + "' (IP = " + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_IP"].ToString() + ")\n will Allow you to Continue.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } } else { clsRestartFingerPrintClockTimeAttendanceService = new clsRestartFingerPrintClockTimeAttendanceService("FingerPrintClockServiceStartStop"); object Restart = clsRestartFingerPrintClockTimeAttendanceService.DynamicFunction("RestartFingerPrintClockTimeAttendanceService", null); string strRestart = Restart.ToString(); if (strRestart.IndexOf("FingerPrintClockServer.Restart") > -1) { //Not Really True if (blnRestartProgram == false) { blnCloseProgram = false; } } else { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Failed to Restart 'FingerPrintClockTimeAttendanceService' Service.\n\nSpeak to System Administrator.\n\nReboot of Machine '" + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_NAME"].ToString() + "' (IP = " + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_IP"].ToString() + ")\n will Allow you to Continue.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } } } catch { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Failed to Restart 'FingerPrintClockTimeAttendanceService' Service.\n\nSpeak to System Administrator.\n\nReboot of Machine '" + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_NAME"].ToString() + "' (IP = " + pvtDataSet.Tables["ReturnValues"].Rows[0]["MACHINE_IP"].ToString() + ")\n will Allow you to Continue.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); frmMessageBox.ShowDialog(); } frmRestartService.Close(); } if (blnRestartProgram == true) { InteractPayrollClient.CustomClientMessageBox frmMessageBox = new CustomClientMessageBox("Changes Have been Made to the Main Program.\nYou need to Restart the Program.", "Program Changes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); frmMessageBox.ShowDialog(); } if (blnCloseProgram == true) { this.Close(); return; } } } else { //2013-11-01 objParm = new object[5]; objParm[0] = Convert.ToInt64(pvtDataSet.Tables["ReturnValues"].Rows[0]["USER_NO"]); objParm[1] = this.txtUserId.Text.Trim().ToUpper(); if (AppDomain.CurrentDomain.GetData("NewPassword") != null) { objParm[2] = AppDomain.CurrentDomain.GetData("NewPassword"); } else { objParm[2] = this.txtPassword.Text.Trim().ToUpper(); } //Access Ind objParm[3] = pvtDataSet.Tables["ReturnValues"].Rows[0]["ACCESS_IND"].ToString(); string strCompanies = ""; if (pvtDataSet.Tables["ReturnValues"].Rows[0]["ACCESS_IND"].ToString() != "S") { for (int intRow = 0; intRow < pvtDataSet.Tables["CompanyAccess"].Rows.Count; intRow++) { if (intRow == 0) { strCompanies = pvtDataSet.Tables["CompanyAccess"].Rows[intRow]["COMPANY_NO"].ToString(); } else { strCompanies += "#" + pvtDataSet.Tables["CompanyAccess"].Rows[intRow]["COMPANY_NO"].ToString(); } } } objParm[4] = strCompanies; clsISClientUtilities.DynamicFunction("Update_New_User_Details_From_Internet", objParm, false); } Close_SplasScreen_And_Show_Main(); } } } } } } } catch (Exception eException) { this.Cursor = Cursors.Default; this.txtUserId.Enabled = true; this.txtPassword.Enabled = true; this.btnOK.Enabled = true; if (pvtblnLocalWebService == true) { clsISClientUtilities.ErrorHandler(eException); } else { clsISUtilities.ErrorHandler(eException); } //this.Close(); } }
private void frmTimeAttendanceMain_Load(object sender, EventArgs e) { try { AppDomain.CurrentDomain.SetData("Globe", pnlGlobe); clsISClientUtilities = new clsISClientUtilities(this, "busTimeAttendanceMain"); clsISUtilities = new clsISUtilities(this, "busPayrollLogon"); clsISUtilities.Set_WebService_Timeout_Value(50000); clsFileDownLoad = new clsFileDownLoad(); if (AppDomain.CurrentDomain.GetData("AccessInd").ToString() == "U") { toolStripSeparator1.Visible = false; this.setupToolStripMenuItem.Visible = false; this.viewToolStripMenuItem.Visible = false; this.UserToolStripButton.Visible = false; this.DeviceToolStripButton.Visible = false; this.employeeToolStripButton.Visible = false; this.employeeGroupToolStripButton.Visible = false; this.deviceEmployeeToolStripButton.Visible = false; } pvtstrWebServerBeenUsed = "L"; byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", null, false); DataSet DataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); FileInfo fiFileInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "URLClientConfig.txt"); if (fiFileInfo.Exists == true) { StreamReader srStreamReader = File.OpenText(AppDomain.CurrentDomain.BaseDirectory + "URLClientConfig.txt"); string strURLClientConfig = srStreamReader.ReadLine(); string[] strParameters = strURLClientConfig.Split(':'); if (strParameters.Length != 2) { System.Windows.Forms.MessageBox.Show("Error in 'URLClientConfig.txt'. Contents = " + strURLClientConfig + "\n\nSpeak to System Administrator.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } if (strParameters[0] == "0.0.0.0") { this.Text += " [Local]"; } else { this.Text += " [" + strURLClientConfig + "]"; } } else { this.Text += " [Local]"; } string strSoftwareToUse = ""; if (DataSet.Tables["SoftwareToUse"].Rows.Count == 0) { strSoftwareToUse = "D"; } else { strSoftwareToUse = DataSet.Tables["SoftwareToUse"].Rows[0]["FINGERPRINT_SOFTWARE_IND"].ToString(); } AppDomain.CurrentDomain.SetData("BiometricSoftware", strSoftwareToUse); AppDomain.CurrentDomain.SetData("MdiForm", this); if (strSoftwareToUse == "D") { this.Text += " [Digital Persona]"; } else { this.Text += " [Griaule]"; } AppDomain.CurrentDomain.SetData("InternetGlobe", this.pnlGlobe); } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void frmClockToEmployeeLink_Load(object sender, EventArgs e) { try { clsISClientUtilities = new clsISClientUtilities(this, "busClockToEmployeeLink"); this.lblCompany.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblClockingDevice.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblEmployee.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); NoTemplateDataGridViewCellStyle = new DataGridViewCellStyle(); NoTemplateDataGridViewCellStyle.BackColor = Color.Yellow; NoTemplateDataGridViewCellStyle.SelectionBackColor = Color.Yellow; UseEmployeeNoDataGridViewCellStyle = new DataGridViewCellStyle(); UseEmployeeNoDataGridViewCellStyle.BackColor = Color.Orange; UseEmployeeNoDataGridViewCellStyle.SelectionBackColor = Color.Orange; NormalDataGridViewCellStyle = new DataGridViewCellStyle(); NormalDataGridViewCellStyle.BackColor = SystemColors.Control; NormalDataGridViewCellStyle.SelectionBackColor = SystemColors.Control; LocalTemplateDataGridViewCellStyle = new DataGridViewCellStyle(); LocalTemplateDataGridViewCellStyle.BackColor = Color.SeaGreen; LocalTemplateDataGridViewCellStyle.SelectionBackColor = Color.SeaGreen; ServerTemplateDataGridViewCellStyle = new DataGridViewCellStyle(); ServerTemplateDataGridViewCellStyle.BackColor = Color.Aquamarine; ServerTemplateDataGridViewCellStyle.SelectionBackColor = Color.Aquamarine; object[] objParm = new object[2]; objParm[0] = Convert.ToInt32(AppDomain.CurrentDomain.GetData("UserNo")); objParm[1] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); #if (DEBUG) int intWidth = 0; int intHeight = 0; int intNewHeight = 0; DataGridView myDataGridView; foreach (Control myControl in this.Controls) { if (myControl is DataGridView) { myDataGridView = null; myDataGridView = (DataGridView)myControl; intWidth = myDataGridView.RowHeadersWidth; if (myDataGridView.ScrollBars == ScrollBars.Vertical | myDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < myDataGridView.ColumnCount; intCol++) { if (myDataGridView.Columns[intCol].Visible == true) { intWidth += myDataGridView.Columns[intCol].Width; } } if (intWidth != myDataGridView.Width) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Width should be " + intWidth.ToString()); } intHeight = myDataGridView.ColumnHeadersHeight + 2; intNewHeight = myDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += myDataGridView.RowTemplate.Height; if (intHeight == myDataGridView.Height) { break; } else { if (intHeight > myDataGridView.Height) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > myDataGridView.Height) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Height should be " + intHeight.ToString()); break; } } } } } else { if (myControl is GroupBox) { foreach (Control myControl1 in myControl.Controls) { if (myControl1 is DataGridView) { myDataGridView = null; myDataGridView = (DataGridView)myControl1; intWidth = myDataGridView.RowHeadersWidth; if (myDataGridView.ScrollBars == ScrollBars.Vertical | myDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < myDataGridView.ColumnCount; intCol++) { if (myDataGridView.Columns[intCol].Visible == true) { intWidth += myDataGridView.Columns[intCol].Width; } } if (intWidth != myDataGridView.Width) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Width should be " + intWidth.ToString()); } intHeight = myDataGridView.ColumnHeadersHeight + 2; intNewHeight = myDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += myDataGridView.RowTemplate.Height; if (intHeight == myDataGridView.Height) { break; } else { if (intHeight > myDataGridView.Height) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > myDataGridView.Height) { System.Windows.Forms.MessageBox.Show(myDataGridView.Name + " Height should be " + intHeight.ToString()); break; } } } } } } } } } #endif Load_CurrentForm_Records(); } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void dgvCompanyDataGridView_RowEnter(object sender, DataGridViewCellEventArgs e) { try { if (dgvCompanyDataGridView.Rows.Count > 0 & pvtblnCompanyDataGridViewLoaded == true) { grbFingerPrintsMissing.Visible = false; int intIndex = Convert.ToInt32(dgvCompanyDataGridView[1, e.RowIndex].Value); pvtint64CompanyNo = Convert.ToInt64(pvtDataSet.Tables["Company"].Rows[intIndex]["COMPANY_NO"]); DataView myCompanyDataView = new DataView(pvtDataSet.Tables["Employee"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); if (myCompanyDataView.Count == 0) { object[] objParm = new object[1]; objParm[0] = pvtint64CompanyNo; byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Company_Records", objParm, false); DataSet TempDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); pvtDataSet.Merge(TempDataSet); } Clear_DataGridView(dgvEmployeeDataGridView); Clear_DataGridView(dgvDeviceDataGridView); this.pvtblnDeviceDataGridViewLoaded = false; string strDeviceType = ""; for (int intRowCount = 0; intRowCount < pvtDataSet.Tables["Device"].Rows.Count; intRowCount++) { DataView myNoTemplateDataView = new DataView(pvtDataSet.Tables["Employee"], "DEVICE_NO = " + pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString() + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND HAS_FINGERPRINTS_AT_SERVER_IND = 'N' AND HAS_FINGERPRINTS_AT_LOCAL_IND = 'N'", "", DataViewRowState.CurrentRows); DataView myLocalDataView = new DataView(pvtDataSet.Tables["Employee"], "DEVICE_NO = " + pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString() + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND HAS_FINGERPRINTS_AT_LOCAL_IND = 'Y'", "", DataViewRowState.CurrentRows); DataView myServerDataView = new DataView(pvtDataSet.Tables["Employee"], "DEVICE_NO = " + pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString() + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND HAS_FINGERPRINTS_AT_SERVER_IND = 'Y'", "", DataViewRowState.CurrentRows); DataView myUseEmployeeNoDataView = new DataView(pvtDataSet.Tables["Employee"], "DEVICE_NO = " + pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString() + " AND COMPANY_NO = " + pvtint64CompanyNo + " AND USE_EMPLOYEE_NO_IND = 'Y'", "", DataViewRowState.CurrentRows); if (this.rbnTemplateMissing.Checked == true) { if (myNoTemplateDataView.Count == 0) { continue; } } else { if (this.rbnLocal.Checked == true) { if (myLocalDataView.Count == 0) { continue; } } else { if (this.rbnServer.Checked == true) { if (myServerDataView.Count == 0) { continue; } } else { if (this.rbnKeyEmployeeNo.Checked == true) { if (myUseEmployeeNoDataView.Count == 0) { continue; } } } } } if (pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_USAGE"].ToString() == "T") { strDeviceType = "Time & Attendance"; } else { if (pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_USAGE"].ToString() == "A") { strDeviceType = "Access"; } else { strDeviceType = "Access / Time & Attendance"; } } this.dgvDeviceDataGridView.Rows.Add("", "", "", "", pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_DESC"].ToString(), strDeviceType, pvtDataSet.Tables["Device"].Rows[intRowCount]["DEVICE_NO"].ToString(), intRowCount.ToString()); if (this.rbnAll.Checked == true || this.rbnTemplateMissing.Checked == true) { if (myNoTemplateDataView.Count > 0) { dgvDeviceDataGridView[0, dgvDeviceDataGridView.Rows.Count - 1].Style = NoTemplateDataGridViewCellStyle; } } if (this.rbnAll.Checked == true || this.rbnServer.Checked == true) { if (myServerDataView.Count > 0) { dgvDeviceDataGridView[1, dgvDeviceDataGridView.Rows.Count - 1].Style = ServerTemplateDataGridViewCellStyle; } } if (this.rbnAll.Checked == true || this.rbnLocal.Checked == true) { if (myLocalDataView.Count > 0) { dgvDeviceDataGridView[2, dgvDeviceDataGridView.Rows.Count - 1].Style = LocalTemplateDataGridViewCellStyle; } } if (this.rbnAll.Checked == true || this.rbnKeyEmployeeNo.Checked == true) { if (myUseEmployeeNoDataView.Count > 0) { dgvDeviceDataGridView[3, dgvDeviceDataGridView.Rows.Count - 1].Style = UseEmployeeNoDataGridViewCellStyle; } } } this.pvtblnDeviceDataGridViewLoaded = true; if (dgvDeviceDataGridView.Rows.Count > 0) { this.Set_DataGridView_SelectedRowIndex(dgvDeviceDataGridView, this.Get_DataGridView_SelectedRowIndex(dgvDeviceDataGridView)); } } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void btnOK_Click(object sender, System.EventArgs e) { try { DialogResult dlgResult = InteractPayroll.CustomMessageBox.Show("Are you sure you want to Upload this Data?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlgResult == DialogResult.Yes) { string strPayCategoryWhere = ""; int pvtPayCategoryDataViewIndex = -1; for (int intRow = 0; intRow < this.dgvPayCategoryDataGridView.Rows.Count; intRow++) { if (intRow == 0) { strPayCategoryWhere = " AND EPC.PAY_CATEGORY_NO IN (" + this.dgvPayCategoryDataGridView[4, intRow].Value.ToString(); pvtPayCategoryDataViewIndex = Convert.ToInt32(this.dgvPayCategoryDataGridView[8, intRow].Value); } else { strPayCategoryWhere += "," + this.dgvPayCategoryDataGridView[4, 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] = pvtint64CompanyNo; objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; objParm[3] = Convert.ToDateTime(this.pvtPayCategoryDataView[pvtPayCategoryDataViewIndex]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd"); objParm[4] = pvtbytCompress; pvtblnLocalWebService = 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") { //Test InteractPayroll.CustomMessageBox.Show("There are Time Sheets with Errors on the Client Database.\n\nYou Need to Fix these TimeSheets on (Validite Client 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] = pvtint64CompanyNo; objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; objParm[3] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]).ToString("yyyy-MM-dd"); pvtblnLocalWebService = true; pvtbytCompress = (byte[])this.clsISClientUtilities.DynamicFunction("Get_Upload_Data_For_Day", objParm, false); //Internet Database Insert objParm = new object[6]; objParm[0] = pvtint64CompanyNo; objParm[1] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]); objParm[2] = pvtbytCompress; objParm[3] = pvtstrPayrollType; objParm[4] = Convert.ToDateTime(this.pvtPayCategoryDataView[pvtPayCategoryDataViewIndex]["PAY_PERIOD_DATE"]).ToString("yyyy-MM-dd"); objParm[5] = Convert.ToDateTime(this.pvtPayCategoryDataView[pvtPayCategoryDataViewIndex]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd"); pvtblnLocalWebService = false; string strUploadDateTime = (string)clsISUtilities.DynamicFunction("Insert_TimeSheet_Records", objParm); //Update Client PAYCATEGORY Records with Date TimeStamp objParm = new object[3]; objParm[0] = pvtint64CompanyNo; objParm[1] = strUploadDateTime; objParm[2] = pvtbytCompress; pvtblnLocalWebService = true; this.clsISClientUtilities.DynamicFunction("Update_PayCategory_Last_Upload_DateTime", objParm, false); this.pgbProgressBar.Value += 1; } this.Refresh(); objParm = new object[3]; objParm[0] = pvtint64CompanyNo; objParm[1] = pvtstrPayrollType; objParm[2] = strPayCategoryWhere; this.clsISClientUtilities.DynamicFunction("Move_Data_To_History_And_Cleanup", objParm, false); this.pgbProgressBar.Value += 1; this.Refresh(); InteractPayroll.CustomMessageBox.Show("Upload Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { InteractPayroll.CustomMessageBox.Show("There is NO Data to Upload", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); } } catch (Exception eException) { if (pvtblnLocalWebService == true) { clsISClientUtilities.ErrorHandler(eException); } else { clsISUtilities.ErrorHandler(eException); } } }
private void dgvCompanyDataGridView_RowEnter(object sender, DataGridViewCellEventArgs e) { try { if (pvtblnCompanyDataGridViewLoaded == true) { if (pvtintCompanyDataGridViewRowIndex != e.RowIndex) { pvtintCompanyDataGridViewRowIndex = e.RowIndex; pvtintCompanyDataTableRow = Convert.ToInt32(this.dgvCompanyDataGridView[1, e.RowIndex].Value); pvtint64CompanyNo = Convert.ToInt64(pvtDataSet.Tables["Company"].Rows[pvtintCompanyDataTableRow]["COMPANY_NO"]); DataView DataView = new DataView(pvtDataSet.Tables["Employee"], "COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); if (DataView.Count == 0) { object[] objParm = new object[1]; objParm[0] = pvtint64CompanyNo; byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Company_Records", objParm, false); DataSet TempDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); pvtDataSet.Merge(TempDataSet); } pvtGroupDataView = null; pvtGroupDataView = new DataView(pvtDataSet.Tables["Group"], "COMPANY_NO = " + pvtint64CompanyNo, "GROUP_DESC", DataViewRowState.CurrentRows); this.txtGroup.Text = ""; int intGroupRow = 0; pvtblnGroupDataGridViewLoaded = false; Clear_DataGridView(dgvGroupDataGridView); Clear_DataGridView(dgvEmployeeDataGridView); Clear_DataGridView(dgvEmployeeLinkedDataGridView); for (int intRow = 0; intRow < pvtGroupDataView.Count; intRow++) { this.dgvGroupDataGridView.Rows.Add(pvtGroupDataView[intRow]["GROUP_DESC"].ToString() , intRow.ToString()); if (pvtintGroupNo == Convert.ToInt32(pvtGroupDataView[intRow]["GROUP_NO"])) { intGroupRow = intRow; } } pvtblnGroupDataGridViewLoaded = true; if (dgvGroupDataGridView.Rows.Count > 0) { this.btnDelete.Enabled = true; this.btnUpdate.Enabled = true; this.Set_DataGridView_SelectedRowIndex(dgvGroupDataGridView, intGroupRow); } else { this.btnDelete.Enabled = false; this.btnUpdate.Enabled = false; } } } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void frmEmployeeGroup_Load(object sender, System.EventArgs e) { try { clsISClientUtilities = new clsISClientUtilities(this, "busEmployeeGroup"); this.lblCompany.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblGroup.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblEmployee.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); this.lblSelectedEmployee.Paint += new System.Windows.Forms.PaintEventHandler(clsISClientUtilities.Label_Paint); miLinkedMenuItem = (ToolStripMenuItem)AppDomain.CurrentDomain.GetData("LinkedMenuItem"); #if (DEBUG) int intWidth = this.dgvGroupDataGridView.RowHeadersWidth; if (this.dgvGroupDataGridView.ScrollBars == ScrollBars.Vertical | this.dgvGroupDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < this.dgvGroupDataGridView.ColumnCount; intCol++) { if (this.dgvGroupDataGridView.Columns[intCol].Visible == true) { intWidth += this.dgvGroupDataGridView.Columns[intCol].Width; } } if (intWidth != this.dgvGroupDataGridView.Width) { System.Windows.Forms.MessageBox.Show("Width should be " + intWidth.ToString()); } int intHeight = this.dgvGroupDataGridView.ColumnHeadersHeight + 2; int intNewHeight = this.dgvGroupDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += this.dgvGroupDataGridView.RowTemplate.Height; if (intHeight == this.dgvGroupDataGridView.Height) { break; } else { if (intHeight > this.dgvGroupDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > this.dgvGroupDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Height should be " + intHeight.ToString()); break; } } } } intWidth = this.dgvEmployeeDataGridView.RowHeadersWidth; if (this.dgvEmployeeDataGridView.ScrollBars == ScrollBars.Vertical | this.dgvEmployeeDataGridView.ScrollBars == ScrollBars.Both) { intWidth += 19; } for (int intCol = 0; intCol < this.dgvEmployeeDataGridView.ColumnCount; intCol++) { if (this.dgvEmployeeDataGridView.Columns[intCol].Visible == true) { intWidth += this.dgvEmployeeDataGridView.Columns[intCol].Width; } } if (intWidth != this.dgvEmployeeDataGridView.Width) { System.Windows.Forms.MessageBox.Show("Employee Width should be " + intWidth.ToString()); } intHeight = this.dgvEmployeeDataGridView.ColumnHeadersHeight + 2; intNewHeight = this.dgvEmployeeDataGridView.RowTemplate.Height / 2; for (int intRow = 0; intRow < 200; intRow++) { intHeight += this.dgvEmployeeDataGridView.RowTemplate.Height; if (intHeight == this.dgvEmployeeDataGridView.Height) { break; } else { if (intHeight > this.dgvEmployeeDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Employee Height should be " + intHeight.ToString()); break; } else { if (intHeight + intNewHeight > this.dgvEmployeeDataGridView.Height) { System.Windows.Forms.MessageBox.Show("Employee Height should be " + intHeight.ToString()); break; } } } } #endif object[] objParm = new object[2]; objParm[0] = Convert.ToInt32(AppDomain.CurrentDomain.GetData("UserNo")); objParm[1] = AppDomain.CurrentDomain.GetData("AccessInd").ToString(); byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Form_Records", objParm, false); pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress); Load_CurrentForm_Records(); } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }