private void btnDelete_Click(object sender, EventArgs e) { try { DialogResult dlgResult = CustomClientMessageBox.Show("Delete Device '" + pvtDataView[pvtintDataViewReaderIndex]["DEVICE_DESC"].ToString() + "'", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dlgResult == DialogResult.Yes) { object[] objParm = new object[1]; objParm[0] = Convert.ToInt32(pvtDataView[pvtintDataViewReaderIndex]["DEVICE_NO"]); clsISClientUtilities.DynamicFunction("Delete_Record", objParm, true); pvtDataView[pvtintDataViewReaderIndex].Delete(); this.pvtDataSet.AcceptChanges(); this.Load_CurrentForm_Records(); } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
private void btnSave_Click(object sender, EventArgs e) { if (this.cboFingerPrintReader.SelectedIndex == -1) { MessageBox.Show("Select a Fingerprint Reader.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { object[] objParm = new object[1]; objParm[0] = this.txtRemoteBackupSiteName.Text.Trim(); byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Update_Record", objParm, false); if (fiFileInfo.Exists == true) { File.Delete(pvtstrFilePath); } StreamWriter swStreamWriter = fiFileInfo.AppendText(); swStreamWriter.WriteLine(this.cboFingerPrintReader.SelectedItem.ToString()); swStreamWriter.Close(); AppDomain.CurrentDomain.SetData("FingerPrintReader", this.cboFingerPrintReader.SelectedItem.ToString()); btnCancel_Click(sender, e); } }
private void btnOK_Click(object sender, EventArgs e) { try { DialogResult myDialogResult = CustomClientMessageBox.Show("Are you sure you want to Backup the Database?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (myDialogResult == System.Windows.Forms.DialogResult.Yes) { int intReturnCode = (int)clsISClientUtilities.DynamicFunction("Backup_DataBase", null, false); if (intReturnCode == 0) { CustomClientMessageBox.Show("Backup Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { CustomClientMessageBox.Show("Backup Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } 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 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 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 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 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 = 383; this.lblCostCentreDelete.Visible = false; this.dgvCostCentreDeletedDataGridView.Visible = false; this.btnAddDeleted.Visible = false; object[] objParm = new object[2]; objParm[0] = pvtint64CompanyNo; objParm[1] = "B"; pvtbytCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_PayCategory_Records_New", objParm, false); pvtDataSetClient = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); if (pvtDataSetClient == null) { InteractPayroll.CustomMessageBox.Show("Connection to Client 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"] , "COMPANY_NO = " + pvtint64CompanyNo.ToString() , "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); } }
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 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); } }
private void ToolStripMenuItem_Click(object sender, EventArgs e) { string strPath = ""; object lateBoundObj = null; Form myForm; if (pvtDateTimeLast > DateTime.Now.AddSeconds(-1)) { return; } else { pvtDateTimeLast = DateTime.Now; } ToolStripMenuItem tsMenuItem = (ToolStripMenuItem)sender; AppDomain.CurrentDomain.SetData("LinkedMenuItem", tsMenuItem); try { switch (tsMenuItem.Name) { case "convertCostCenterToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "ClientConvertCostCentre.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmClientConvertCostCentre"); break; case "fileDownloadToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "FileDownload.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayroll.frmFileDownload"); break; case "fileUploadToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "FileUpload.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayroll.frmFileUpload"); break; case "databaseBackupToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "BackupRestoreClientDatabase.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmBackupDatabase"); break; case "databaseRestoreToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "BackupRestoreClientDatabase.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmRestoreDatabase"); break; case "fingerPrintReadertoolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "ChooseFingerprintReader.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayroll.frmChooseFingerprintReader"); break; case "clockReaderEmployeesLinkToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "ClockToEmployeeLink.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmClockToEmployeeLink"); break; case "dataDownloadToolStripMenuItem": case "dataUploadTimeSheetsToolStripMenuItem": DateTime dtDownloadMessage = DateTime.Now.AddSeconds(3); frmMessage = new InteractPayrollClient.frmMessage(); frmMessage.Show(); tsMenuItem.Enabled = false; object[] objParm = null; DataSet DataSet = new DataSet(); pvtstrWebServerBeenUsed = "L"; clsISClientUtilities.Set_New_BusinessObjectName("busClientPayrollLogon"); //Check Client Databse ia Available / Check Tables are Correct byte[] pvtbytCompress = (byte[])clsISClientUtilities.DynamicFunction("Logon_Client_DataBase", objParm, false); if (pvtbytCompress == null) { frmMessage.Close(); frmMessage = null; return; } DataSet = clsISUtilities.DeCompress_Array_To_DataSet(pvtbytCompress); object[] obj = new object[1]; obj[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("UserNo")); pvtstrWebServerBeenUsed = "W"; byte[] bytCompress = (byte[])clsISUtilities.DynamicFunction("Get_New_Client_Download_Files", obj, false); if (pvtbytCompress == null) { frmMessage.Close(); frmMessage = null; return; } else { //Wait 3 Seconds while (dtDownloadMessage > DateTime.Now) { } frmMessage.Close(); frmMessage = null; } DataSet pvtDataSet = clsISUtilities.DeCompress_Array_To_DataSet(bytCompress); if (pvtDataSet.Tables["Files"].Rows.Count > 0) { bool blnLogoff = false; int intReturnCode = clsFileDownLoad.DownLoad_Files_From_TimeAttendance(ref pvtDataSet, ref DataSet, ref blnLogoff, "Y"); if (intReturnCode != 0) { if (AppDomain.CurrentDomain.GetData("KillApp").ToString() == "Y") { } else { System.Windows.Forms.MessageBox.Show("Error In Download of File.\nProgram Closing.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } //Force Program To Close AppDomain.CurrentDomain.SetData("UserNo", -1); this.Close(); return; } if (DataSet.Tables["FileToDelete"].Rows.Count > 0) { DataSet myDataSet = new System.Data.DataSet(); DataTable myDataTable = DataSet.Tables["FileToDelete"].Copy(); myDataSet.Tables.Add(myDataTable); byte[] mybytCompress = clsISClientUtilities.Compress_DataSet(DataSet); obj = new object[1]; obj[0] = mybytCompress; clsISClientUtilities.DynamicFunction("Cleanup_Client_DataBase_Files", obj, false); } if (blnLogoff == true) { System.Windows.Forms.MessageBox.Show("Changes Have been Made to the Main Program.\nYou need to Restart the Program.", "Program Changes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); AppDomain.CurrentDomain.SetData("Logoff", true); this.Close(); return; } } //Reset Back To busTimeAttendanceMain - What It was Initially clsISClientUtilities.Set_New_BusinessObjectName("busTimeAttendanceMain"); if (tsMenuItem.Name == "dataDownloadToolStripMenuItem") { strPath = AppDomain.CurrentDomain.BaseDirectory + "TimeAttendanceDataDownload.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmTimeAttendanceDataDownload"); } else { strPath = AppDomain.CurrentDomain.BaseDirectory + "TimeAttendanceDataUpload.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmTimeAttendanceDataUpload"); } break; case "employeeOverrideMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "EmployeeOverride.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmEmployeeOverride"); break; case "usertoolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "UserClient.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmUserClient"); break; case "fingerprintWebServerIPandPort": strPath = AppDomain.CurrentDomain.BaseDirectory + "SetupInternetWebServerIP.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmSetupInternetWebServerIP"); break; case "clockToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "Clock.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmClock"); break; case "clockInBoundarytoolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "ClockInBoundary.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmClockInBoundary"); break; case "employeeToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "EmployeeClient.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmEmployeeClient"); break; case "employeeGroupToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "EmployeeGroup.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmEmployeeGroup"); break; case "employeeLinkToClockReaderToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "EmployeeLinkDevice.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmEmployeeLinkDevice"); break; case "timeSheetsToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "TimeSheetClient.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmTimeSheetClient"); break; case "timesheetBatchToolStripMenuItem": strPath = AppDomain.CurrentDomain.BaseDirectory + "TimeSheetBatchClient.dll"; myAssembly = System.Reflection.Assembly.LoadFile(strPath); lateBoundObj = myAssembly.CreateInstance("InteractPayrollClient.frmTimeSheetBatchClient"); break; default: //Window - Dynamic Add/Delete of Forms foreach (Form form in this.MdiChildren) { if (tsMenuItem.Tag != null) { if (tsMenuItem.Tag == form.Tag) { if (this.ActiveMdiChild == form) { } else { form.Activate(); } break; } } else { if (tsMenuItem.Text.IndexOf(form.Text) > -1) { if (this.ActiveMdiChild == form) { } else { form.Activate(); } break; } } } return; } myForm = (Form)lateBoundObj; myForm.MdiParent = this; myForm.Tag = tsMenuItem.Tag; if (myForm.FormBorderStyle == FormBorderStyle.None) { if (myForm.Name != "frmPasswordChange") { myForm.Height += intHeight; } } else { myForm.Icon = this.Icon; myForm.MaximizeBox = false; myForm.MinimizeBox = false; } foreach (Control myControl in myForm.Controls) { //ELR-2018-08-18 if (myForm.FormBorderStyle == FormBorderStyle.None && myForm.Name != "frmPasswordChange") { myControl.Top += intHeight; } if (myControl is Button) { Button button = (Button)myControl; #if (DEBUG) if (button.FlatStyle != FlatStyle.Flat) { System.Windows.Forms.MessageBox.Show(button.Name + " Not FlatStyle"); } #endif button.FlatStyle = FlatStyle.Flat; if (button.Text.ToUpper().IndexOf("CLOSE") > -1) { button.FlatAppearance.MouseOverBackColor = Color.Red; } //switch (myControl.Text.Replace("&", "")) //{ // case "New": // case "Update": // case "Delete": // case "Save": // case "Cancel": // myControl.EnabledChanged += new System.EventHandler(this.MdiChild_Edit_Button_EnabledChanged); // break; //} } } //ELR-2018-08-18 if (myForm.FormBorderStyle == FormBorderStyle.None && myForm.Name != "frmPasswordChange") { Label lblHeader = new Label(); lblHeader.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; lblHeader.BackColor = System.Drawing.Color.DimGray; lblHeader.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lblHeader.ForeColor = System.Drawing.Color.Black; lblHeader.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; lblHeader.Location = new System.Drawing.Point(1, 1); lblHeader.Name = "lblHeader"; lblHeader.Size = new System.Drawing.Size(myForm.Width - (2 * intHeight), intHeight - 2); lblHeader.Text = tsMenuItem.Text; lblHeader.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblHeader_MouseDown); lblHeader.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lblHeader_MouseMove); lblHeader.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lblHeader_MouseUp); myForm.Text = lblHeader.Text; myForm.Controls.Add(lblHeader); Button btnHeaderClose = new Button(); btnHeaderClose.BackColor = System.Drawing.Color.DimGray; btnHeaderClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Red; btnHeaderClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat; btnHeaderClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); btnHeaderClose.ForeColor = System.Drawing.Color.Black; btnHeaderClose.Location = new System.Drawing.Point(myForm.Width - intHeight, 0); btnHeaderClose.Name = "btnHeaderClose"; btnHeaderClose.Size = new System.Drawing.Size(intHeight, intHeight); btnHeaderClose.TabStop = false; btnHeaderClose.Text = "X"; btnHeaderClose.Click += new System.EventHandler(MdiChild_ButtonClose_Click); myForm.Controls.Add(btnHeaderClose); Button btnHeaderMinimize = new Button(); btnHeaderMinimize.BackColor = System.Drawing.Color.DimGray; btnHeaderMinimize.FlatStyle = System.Windows.Forms.FlatStyle.Flat; btnHeaderMinimize.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); btnHeaderMinimize.ForeColor = System.Drawing.Color.Black; btnHeaderMinimize.Location = new System.Drawing.Point(myForm.Width - (2 * intHeight) + 1, 0); btnHeaderMinimize.Name = "btnHeaderMinimize"; btnHeaderMinimize.Size = new System.Drawing.Size(intHeight, intHeight); btnHeaderMinimize.TabStop = false; btnHeaderMinimize.Text = "_"; btnHeaderMinimize.Click += new System.EventHandler(MdiChild_ButtonMinimize_Click); myForm.Controls.Add(btnHeaderMinimize); } if (myForm.FormBorderStyle == FormBorderStyle.None) { myForm.Paint += new System.Windows.Forms.PaintEventHandler(MdiChild_Paint); } System.Drawing.Rectangle rect = Screen.GetWorkingArea(this); int intX = (rect.Width - myForm.Width) / 2; int intY = (rect.Height - myForm.Height + this.pnlHeader.Height) / 2; if (AppDomain.CurrentDomain.GetData("FormSmallest") != null) { //Errol Use For Screenshots Program intY = this.pnlHeader.Height + 10; } myForm.StartPosition = FormStartPosition.Manual; myForm.Location = new Point(intX, intY); //Hook Up so That Menu Item Can br Enabled On Close myForm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MdiChild_FormClosing); myForm.TextChanged += new System.EventHandler(MdiChild_TextChanged); myForm.Leave += new System.EventHandler(MdiChild_Leave); ToolStripMenuItem newToolStripMenuItem = new ToolStripMenuItem(myForm.Text); if (tsMenuItem.Tag != null) { myForm.Tag = tsMenuItem.Tag; newToolStripMenuItem.Tag = tsMenuItem.Tag; } windowToolStripMenuItem.DropDownItems.Add(newToolStripMenuItem); newToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); myForm.Show(); tsMenuItem.Enabled = false; } catch (Exception ex) { tsMenuItem.Enabled = true; if (pvtstrWebServerBeenUsed == "L") { clsISClientUtilities.ErrorHandler(ex); } else { clsISUtilities.ErrorHandler(ex); } if (frmMessage != null) { frmMessage.Close(); frmMessage = null; } } }
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, EventArgs e) { try { DialogResult myDialogResult = CustomClientMessageBox.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::InteractPayrollClient.Properties.Resources.Question; this.picRestoreDatabase.Image = null; DateTime dtWaitTime = DateTime.Now.AddSeconds(3); this.tmrTimer.Enabled = true; int intReturnCode = 0; intReturnCode = (int)clsISClientUtilities.DynamicFunction("Backup_DataBase_Before_Restore", null, false); this.tmrTimer.Enabled = false; this.picBackupBefore.Visible = true; if (intReturnCode == 0) { while (dtWaitTime > DateTime.Now) { Application.DoEvents(); } dtWaitTime = DateTime.Now.AddSeconds(3); this.picBackupBefore.Image = (Image)global::InteractPayrollClient.Properties.Resources.Ok; pvtintProcess += 1; this.pnlRestoreDatabase.Visible = true; this.picRestoreDatabase.Image = (Image)global::InteractPayrollClient.Properties.Resources.Question; this.tmrTimer.Enabled = true; object[] objParm = new object[1]; objParm[0] = dgvFilesDataGridView[1, dgvFilesDataGridView.SelectedRows[0].Index].Value.ToString(); intReturnCode = (int)clsISClientUtilities.DynamicFunction("Restore_DataBase", objParm, false); this.tmrTimer.Enabled = false; this.picRestoreDatabase.Visible = true; while (dtWaitTime > DateTime.Now) { Application.DoEvents(); } if (intReturnCode == 0) { this.picRestoreDatabase.Image = (Image)global::InteractPayrollClient.Properties.Resources.Ok; this.Refresh(); CustomClientMessageBox.Show("Restore Successful.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.picRestoreDatabase.Image = (Image)global::InteractPayrollClient.Properties.Resources.Error; this.Refresh(); CustomClientMessageBox.Show("Restore Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { this.picBackupBefore.Image = (Image)global::InteractPayrollClient.Properties.Resources.Error; CustomClientMessageBox.Show("Backup of Database Before Restore Failed.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } Load_Restore_Files(); this.grbActivationProcess.Visible = false; } } catch (Exception eException) { clsISClientUtilities.ErrorHandler(eException); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { this.Cursor = Cursors.WaitCursor; //Remove Chosen Records (On Database) DataView EmployeeChosenDataView = new DataView(pvtDataSet.Tables["EmployeeChosen"], "DEVICE_NO = " + this.pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < EmployeeChosenDataView.Count; intRow++) { EmployeeChosenDataView[intRow].Delete(); intRow -= 1; } DataView PayCategoryChosenDataView = new DataView(pvtDataSet.Tables["PayCategoryChosen"], "DEVICE_NO = " + this.pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < PayCategoryChosenDataView.Count; intRow++) { PayCategoryChosenDataView[intRow].Delete(); intRow -= 1; } DataView DepartmentChosenDataView = new DataView(pvtDataSet.Tables["DepartmentChosen"], "DEVICE_NO = " + this.pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < DepartmentChosenDataView.Count; intRow++) { DepartmentChosenDataView[intRow].Delete(); intRow -= 1; } DataView GroupChosenDataView = new DataView(pvtDataSet.Tables["GroupChosen"], "DEVICE_NO = " + this.pvtintDeviceNo + " AND COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < GroupChosenDataView.Count; intRow++) { GroupChosenDataView[intRow].Delete(); intRow -= 1; } pvtDataSet.AcceptChanges(); DataSet TempDataSet = new DataSet(); TempDataSet.Tables.Add(pvtDataSet.Tables["EmployeeChosen"].Clone()); for (int intRowCount = 0; intRowCount < this.dgvEmployeeChosenDataGridView.Rows.Count; intRowCount++) { DataRowView drvDataRowView = EmployeeChosenDataView.AddNew(); drvDataRowView["DEVICE_NO"] = pvtintDeviceNo; drvDataRowView["COMPANY_NO"] = pvtint64CompanyNo; drvDataRowView["EMPLOYEE_NO"] = Convert.ToInt32(this.dgvEmployeeChosenDataGridView[4, intRowCount].Value); drvDataRowView["PAY_CATEGORY_NO"] = Convert.ToInt32(this.dgvEmployeeChosenDataGridView[5, intRowCount].Value); drvDataRowView["PAY_CATEGORY_TYPE"] = this.dgvEmployeeChosenDataGridView[3, intRowCount].Value.ToString(); drvDataRowView.EndEdit(); TempDataSet.Tables["EmployeeChosen"].ImportRow(drvDataRowView.Row); } TempDataSet.Tables.Add(pvtDataSet.Tables["PayCategoryChosen"].Clone()); for (int intRowCount = 0; intRowCount < this.dgvPayCategoryChosenDataGridView.Rows.Count; intRowCount++) { DataRowView drvDataRowView = PayCategoryChosenDataView.AddNew(); drvDataRowView["DEVICE_NO"] = pvtintDeviceNo; drvDataRowView["COMPANY_NO"] = pvtint64CompanyNo; drvDataRowView["PAY_CATEGORY_NO"] = Convert.ToInt32(this.dgvPayCategoryChosenDataGridView[2, intRowCount].Value); drvDataRowView["PAY_CATEGORY_TYPE"] = this.dgvPayCategoryChosenDataGridView[1, intRowCount].Value.ToString(); drvDataRowView.EndEdit(); TempDataSet.Tables["PayCategoryChosen"].ImportRow(drvDataRowView.Row); } TempDataSet.Tables.Add(pvtDataSet.Tables["DepartmentChosen"].Clone()); for (int intRowCount = 0; intRowCount < this.dgvDepartmentChosenDataGridView.Rows.Count; intRowCount++) { DataRowView drvDataRowView = DepartmentChosenDataView.AddNew(); drvDataRowView["DEVICE_NO"] = pvtintDeviceNo; drvDataRowView["COMPANY_NO"] = pvtint64CompanyNo; drvDataRowView["PAY_CATEGORY_NO"] = this.dgvDepartmentChosenDataGridView[3, intRowCount].Value.ToString(); drvDataRowView["PAY_CATEGORY_TYPE"] = this.dgvDepartmentChosenDataGridView[2, intRowCount].Value.ToString(); drvDataRowView["DEPARTMENT_NO"] = Convert.ToInt32(this.dgvDepartmentChosenDataGridView[4, intRowCount].Value); drvDataRowView.EndEdit(); TempDataSet.Tables["DepartmentChosen"].ImportRow(drvDataRowView.Row); } TempDataSet.Tables.Add(pvtDataSet.Tables["GroupChosen"].Clone()); for (int intRowCount = 0; intRowCount < this.dgvGroupChosenDataGridView.Rows.Count; intRowCount++) { DataRowView drvDataRowView = GroupChosenDataView.AddNew(); drvDataRowView["DEVICE_NO"] = pvtintDeviceNo; drvDataRowView["COMPANY_NO"] = pvtint64CompanyNo; drvDataRowView["GROUP_NO"] = Convert.ToInt32(this.dgvGroupChosenDataGridView[1, intRowCount].Value); drvDataRowView.EndEdit(); TempDataSet.Tables["GroupChosen"].ImportRow(drvDataRowView.Row); } //Compress DataSet byte[] pvtbytCompress = clsISClientUtilities.Compress_DataSet(TempDataSet); object[] objParm = new object[3]; objParm[0] = pvtint64CompanyNo; objParm[1] = pvtintDeviceNo; objParm[2] = pvtbytCompress; clsISClientUtilities.DynamicFunction("Update_Records", objParm, true); pvtDataSet.AcceptChanges(); btnCancel_Click(sender, e); this.Cursor = Cursors.Default; } catch (Exception ex) { clsISClientUtilities.ErrorHandler(ex); } }
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 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); } }
public void btnSave_Click(object sender, System.EventArgs e) { try { if (this.txtGroup.Text.Trim() == "") { CustomClientMessageBox.Show("Enter Group Description.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); this.txtGroup.Focus(); return; } if (this.dgvEmployeeLinkedDataGridView.Rows.Count == 0) { CustomClientMessageBox.Show("Select Employees.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); this.btnAdd.Focus(); return; } if (this.Text.IndexOf(" - New") > 0) { pvtintGroupNo = 0; } //NB - New Will Not Remove Any Records DataView EmployeeLinkDataView = new DataView(pvtDataSet.Tables["EmployeeLink"], "GROUP_NO = " + pvtintGroupNo + " AND COMPANY_NO = " + pvtint64CompanyNo, "", DataViewRowState.CurrentRows); for (int intRow = 0; intRow < EmployeeLinkDataView.Count; intRow++) { EmployeeLinkDataView[intRow].Delete(); intRow -= 1; } pvtDataSet.AcceptChanges(); for (int intRowCount = 0; intRowCount < this.dgvEmployeeLinkedDataGridView.Rows.Count; intRowCount++) { DataRowView drvDataRowView = EmployeeLinkDataView.AddNew(); drvDataRowView["GROUP_NO"] = pvtintGroupNo; drvDataRowView["COMPANY_NO"] = pvtint64CompanyNo; drvDataRowView["EMPLOYEE_NO"] = Convert.ToInt32(this.dgvEmployeeLinkedDataGridView[pvtintEmployeeNoCol, intRowCount].Value); drvDataRowView["PAY_CATEGORY_NO"] = Convert.ToInt32(this.dgvEmployeeLinkedDataGridView[pvtintPayCategoryNoCol, intRowCount].Value); drvDataRowView["PAY_CATEGORY_TYPE"] = this.dgvEmployeeLinkedDataGridView[pvtintPayCategoryTypeCol, intRowCount].Value.ToString(); drvDataRowView.EndEdit(); } DataSet TempDataSet = new DataSet(); //Add EmployeePayCategory Table TempDataSet.Tables.Add(pvtDataSet.Tables["EmployeeLink"].Clone()); for (int intRow = 0; intRow < EmployeeLinkDataView.Count; intRow++) { TempDataSet.Tables["EmployeeLink"].ImportRow(EmployeeLinkDataView[intRow].Row); } //Compress DataSet byte[] pvtbytCompress = clsISClientUtilities.Compress_DataSet(TempDataSet); this.Cursor = Cursors.WaitCursor; if (this.Text.IndexOf(" - New") > 0) { object[] objParm = new object[3]; objParm[0] = pvtint64CompanyNo; objParm[1] = this.txtGroup.Text.Trim(); objParm[2] = pvtbytCompress; pvtintGroupNo = (int)clsISClientUtilities.DynamicFunction("Insert_Group", objParm, true); for (int intRowCount = 0; intRowCount < EmployeeLinkDataView.Count; intRowCount++) { EmployeeLinkDataView[intRowCount]["GROUP_NO"] = pvtintGroupNo; intRowCount -= 1; } DataRowView drvDataRowView = this.pvtGroupDataView.AddNew(); //Set Key for Find drvDataRowView["COMPANY_NO"] = pvtDataSet.Tables["Company"].Rows[pvtintCompanyDataTableRow]["COMPANY_NO"].ToString(); drvDataRowView["GROUP_DESC"] = this.txtGroup.Text.Trim(); drvDataRowView["GROUP_NO"] = pvtintGroupNo; drvDataRowView.EndEdit(); } else { object[] objParm = new object[4]; objParm[0] = Convert.ToInt64(pvtDataSet.Tables["Company"].Rows[pvtintCompanyDataTableRow]["COMPANY_NO"]); objParm[1] = pvtintGroupNo; objParm[2] = this.txtGroup.Text.Trim(); objParm[3] = pvtbytCompress; clsISClientUtilities.DynamicFunction("Update_Group", objParm, true); this.dgvGroupDataGridView[0, this.dgvGroupDataGridView.CurrentRow.Index].Value = this.txtGroup.Text.Trim(); pvtGroupDataView[pvtintGroupDataViewRow]["GROUP_DESC"] = this.txtGroup.Text.Trim(); } pvtDataSet.AcceptChanges(); if (this.Text.IndexOf(" - New") > 0) { Load_CurrentForm_Records(); } btnCancel_Click(sender, e); this.Cursor = Cursors.Default; } catch (Exception ex) { clsISClientUtilities.ErrorHandler(ex); } }