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 btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strTimeFrom = "";
                string strTimeTo   = "";

                if (this.cboCompany.SelectedIndex == -1)
                {
                    CustomClientMessageBox.Show("Select Company that owns Clock Reader.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.cboCompany.Focus();
                    return;
                }

                if (this.txtReader.Text.Trim() == "")
                {
                    CustomClientMessageBox.Show("Enter Clock Reader Description.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.txtReader.Focus();
                    return;
                }
                else
                {
                    pvtstrDeviceDesc = this.txtReader.Text.Trim();
                }

                pvtstrTimeAttendClockFirstLastInd = "";

                if (this.rbnTimeAttend.Checked == true)
                {
                    pvtstrDeviceUsage = "T";
                }
                else
                {
                    if (this.rbnAccess.Checked == true)
                    {
                        pvtstrDeviceUsage = "A";
                    }
                    else
                    {
                        if (this.rbnBoth.Checked == true)
                        {
                            pvtstrDeviceUsage = "B";

                            if (this.rbnClockNormal.Checked == true)
                            {
                                pvtstrTimeAttendClockFirstLastInd = "N";
                            }
                            else
                            {
                                if (this.rbnClockFirstLast.Checked == true)
                                {
                                    pvtstrTimeAttendClockFirstLastInd = "Y";
                                }
                                else
                                {
                                    CustomClientMessageBox.Show("Choose Access / Time & Attendance Option.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            CustomClientMessageBox.Show("Choose Device Usage.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }

                if (this.rbnInOnly.Checked == true)
                {
                    pvtstrClockInOutParm = "I";
                }
                else
                {
                    if (this.rbnOutOnly.Checked == true)
                    {
                        pvtstrClockInOutParm = "O";
                    }
                    else
                    {
                        if (this.rbnDynamic.Checked == true)
                        {
                            pvtstrClockInOutParm = "D";
                        }
                        else
                        {
                            if (this.rbnClockRange.Checked == true)
                            {
                                if (this.cboFromHour.SelectedIndex == -1)
                                {
                                    this.cboFromHour.Focus();
                                    CustomClientMessageBox.Show("Select From Hour.\n\n(Clock Range - In Range)", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }

                                if (this.cboFromMinute.SelectedIndex == -1)
                                {
                                    this.cboFromMinute.Focus();
                                    CustomClientMessageBox.Show("Select From Minute.\n\n(Clock Range - In Range)", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }

                                if (this.cboToHour.SelectedIndex == -1)
                                {
                                    this.cboToHour.Focus();
                                    CustomClientMessageBox.Show("Select To Hour.\n\n(Clock Range - In Range)", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }

                                if (this.cboToMinute.SelectedIndex == -1)
                                {
                                    this.cboToMinute.Focus();
                                    CustomClientMessageBox.Show("Select To Minute.\n\n(Clock Range - In Range)", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }

                                pvtstrClockInOutParm = "R";

                                strTimeFrom = this.cboFromHour.SelectedItem.ToString() + this.cboFromMinute.SelectedItem.ToString();
                                strTimeTo   = this.cboToHour.SelectedItem.ToString() + this.cboToMinute.SelectedItem.ToString();

                                pvtintClockInRangeFrom = Convert.ToInt32(strTimeFrom);
                                pvtintClockInRangeTo   = Convert.ToInt32(strTimeTo);
                            }
                            else
                            {
                                CustomClientMessageBox.Show("Select a " + this.grbClockOptions.Text + ".", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }
                }

                if (this.cboLockOut.SelectedIndex == -1)
                {
                    CustomClientMessageBox.Show("Select Lock Out Time.\n\n(Access Control - Employee Lock Out)", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.cboLockOut.Focus();
                    return;
                }
                else
                {
                    pvtintLockOutMinutes = Convert.ToInt32(this.cboLockOut.SelectedItem.ToString());
                }

                if (this.cboCompany.Items.Count > 0)
                {
                    if (this.cboCompany.SelectedIndex == -1)
                    {
                        CustomClientMessageBox.Show("Select Company that owns Clock Reader.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.cboCompany.Focus();
                        return;
                    }
                    else
                    {
                        pvtintCompanyNo = Convert.ToInt32(pvtDataSet.Tables["Company"].Rows[this.cboCompany.SelectedIndex]["COMPANY_NO"]);
                    }
                }
                else
                {
                    pvtintCompanyNo = -1;
                }

                if (this.rbnWAN.Checked == true)
                {
                    pvtstrLanWanInd = "W";
                }
                else
                {
                    pvtstrLanWanInd = "L";
                }

                if (this.cboFAR.SelectedIndex == -1)
                {
                    CustomClientMessageBox.Show("Select False Acceptance Read Value.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.cboFAR.Focus();
                    return;
                }
                else
                {
                    pvtintFARRequested = intPossibleFARValuesArray[this.cboFAR.SelectedIndex];
                }


                DataSet TempDataSet = new DataSet();
                TempDataSet.Tables.Add(pvtDataSet.Tables["Clock"].Clone());

                if (this.Text.IndexOf(" - New") > 0)
                {
                    DataRowView drvDataRowView = this.pvtDataView.AddNew();
                    //Set Key for Find
                    drvDataRowView["DEVICE_NO"]    = 0;
                    drvDataRowView["DEVICE_DESC"]  = pvtstrDeviceDesc;
                    drvDataRowView["DEVICE_USAGE"] = pvtstrDeviceUsage;
                    drvDataRowView["TIME_ATTEND_CLOCK_FIRST_LAST_IND"] = pvtstrTimeAttendClockFirstLastInd;
                    drvDataRowView["CLOCK_IN_OUT_PARM"]   = pvtstrClockInOutParm;
                    drvDataRowView["CLOCK_IN_RANGE_FROM"] = pvtintClockInRangeFrom;
                    drvDataRowView["CLOCK_IN_RANGE_TO"]   = pvtintClockInRangeTo;
                    drvDataRowView["LOCK_OUT_MINUTES"]    = pvtintLockOutMinutes;
                    drvDataRowView["COMPANY_NO"]          = pvtintCompanyNo;
                    drvDataRowView["LAN_WAN_IND"]         = pvtstrLanWanInd;
                    drvDataRowView["FAR_REQUESTED"]       = pvtintFARRequested;

                    drvDataRowView.EndEdit();

                    TempDataSet.Tables["Clock"].ImportRow(drvDataRowView.Row);

                    //Compress DataSet
                    byte[] pvtbytCompress = clsISClientUtilities.Compress_DataSet(TempDataSet);

                    object[] objParm = new object[1];
                    objParm[0] = pvtbytCompress;

                    drvDataRowView["DEVICE_NO"] = clsISClientUtilities.DynamicFunction("Insert_Record", objParm, true);

                    this.pvtintDeviceNo = Convert.ToInt32(drvDataRowView["DEVICE_NO"]);
                }
                else
                {
                    pvtDataView[pvtintDataViewReaderIndex]["DEVICE_DESC"]  = pvtstrDeviceDesc;
                    pvtDataView[pvtintDataViewReaderIndex]["DEVICE_USAGE"] = pvtstrDeviceUsage;
                    pvtDataView[pvtintDataViewReaderIndex]["TIME_ATTEND_CLOCK_FIRST_LAST_IND"] = pvtstrTimeAttendClockFirstLastInd;
                    pvtDataView[pvtintDataViewReaderIndex]["CLOCK_IN_OUT_PARM"]   = pvtstrClockInOutParm;
                    pvtDataView[pvtintDataViewReaderIndex]["CLOCK_IN_RANGE_FROM"] = pvtintClockInRangeFrom;
                    pvtDataView[pvtintDataViewReaderIndex]["CLOCK_IN_RANGE_TO"]   = pvtintClockInRangeTo;
                    pvtDataView[pvtintDataViewReaderIndex]["LOCK_OUT_MINUTES"]    = pvtintLockOutMinutes;
                    pvtDataView[pvtintDataViewReaderIndex]["COMPANY_NO"]          = pvtintCompanyNo;
                    pvtDataView[pvtintDataViewReaderIndex]["LAN_WAN_IND"]         = pvtstrLanWanInd;
                    pvtDataView[pvtintDataViewReaderIndex]["FAR_REQUESTED"]       = pvtintFARRequested;

                    TempDataSet.Tables["Clock"].ImportRow(pvtDataView[pvtintDataViewReaderIndex].Row);

                    //Compress DataSet
                    byte[] pvtbytCompress = clsISClientUtilities.Compress_DataSet(TempDataSet);

                    object[] objParm = new object[1];
                    objParm[0] = pvtbytCompress;

                    clsISClientUtilities.DynamicFunction("Update_Record", objParm, true);

                    this.dgvClockDataGridView[pvtintClockDescCol, this.dgvClockDataGridView.CurrentRow.Index].Value = pvtstrDeviceDesc;
                }

                pvtDataSet.AcceptChanges();

                if (this.Text.IndexOf(" - New") > 0)
                {
                    Load_CurrentForm_Records();
                }

                btnCancel_Click(sender, e);
            }
            catch (Exception ex)
            {
                clsISClientUtilities.ErrorHandler(ex);
            }
        }
        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;
                }
            }
        }
示例#4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool blnServerDatabaseConverted = false;

            try
            {
                if (this.dgvChosenPayCategoryDataGridView.Rows.Count == 0)
                {
                    CustomClientMessageBox.Show("There are NO Selected Cost Centres.\nFix to Continue.",
                                                this.Text,
                                                MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                    return;
                }

                DialogResult dlgResult = CustomClientMessageBox.Show("Are you absolutely sure you want to Convert the Selected Cost Centre/s to '" + dgvConvertToPayrollTypeDataGridView[0, pvtintConvertToPayrollTypeDataGridViewRowIndex].Value.ToString() + "'",
                                                                     this.Text,
                                                                     MessageBoxButtons.YesNo,
                                                                     MessageBoxIcon.Warning);

                if (dlgResult == DialogResult.Yes)
                {
                    DataSet DataSet = new DataSet();

                    DataTable myDataTable = this.pvtDataSet.Tables["PayCategory"].Clone();

                    for (int intRow = 0; intRow < this.dgvChosenPayCategoryDataGridView.Rows.Count; intRow++)
                    {
                        DataRow drDataRow = myDataTable.NewRow();

                        drDataRow["COMPANY_NO"]        = pvtInt64CompanyNo;
                        drDataRow["PAY_CATEGORY_NO"]   = Convert.ToInt32(this.dgvChosenPayCategoryDataGridView[2, intRow].Value);
                        drDataRow["PAY_CATEGORY_TYPE"] = this.dgvChosenPayCategoryDataGridView[1, intRow].Value.ToString();

                        myDataTable.Rows.Add(drDataRow);
                    }

                    DataSet.Tables.Add(myDataTable);

                    //Compress DataSet
                    pvtbytCompress = clsISClientUtilities.Compress_DataSet(DataSet);

                    object[] objParm = new object[3];
                    objParm[0] = pvtInt64CompanyNo;
                    objParm[1] = pvtstrToPayCategoryType;
                    objParm[2] = pvtbytCompress;

                    //Backup Internet Database
                    int intReturnCode = (int)clsISUtilities.DynamicFunction("Check_Run", objParm, false);

                    if (intReturnCode == 9)
                    {
                        CustomClientMessageBox.Show("You do NOT have permission to perform this operation.\nSpeak to System Administrator.",
                                                    this.Text,
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);

                        goto btnSave_Click_Continue;
                    }
                    else
                    {
                        if (intReturnCode == 1)
                        {
                            this.tmrProcess.Enabled = false;
                            this.picDatabaseConvertInternet.Image = global::ConvertCostCentre.Properties.Resources.Error;

                            CustomClientMessageBox.Show("There is Currently a Payroll/Time Attendance Run Date Open.\nFix to Continue.",
                                                        this.Text,
                                                        MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);

                            goto btnSave_Click_Continue;
                        }
                    }

                    pvtintProcessNo = 0;
                    pvtblnShowImage = false;

                    this.picDatabaseBackupInternet.Image  = null;
                    this.picDatabaseBackupLocal.Image     = null;
                    this.picDatabaseConvertInternet.Image = null;
                    this.picDatabaseConvertLocal.Image    = null;

                    this.grbConversionProcess.Visible = true;

                    this.Refresh();

                    this.tmrProcess.Enabled = true;
                    DateTime dtDateTimeNext = DateTime.Now.AddSeconds(pvtintTimeDelaySeconds);

                    clsISUtilities.Set_New_BusinessObjectName("busBackupRestoreDatabase");

                    objParm    = new object[2];
                    objParm[0] = pvtInt64CompanyNo;
                    objParm[1] = "_Backup_Before_CostCentre_Conversion";

                    //Backup Internet Database
                    intReturnCode = (int)clsISUtilities.DynamicFunction("Backup_DataBase_New", objParm, false);

                    if (intReturnCode != 0)
                    {
                        this.tmrProcess.Enabled = false;
                        this.picDatabaseBackupInternet.Image = global::ConvertCostCentre.Properties.Resources.Error;

                        CustomClientMessageBox.Show("Error Backing up Internet Database.\nFix to Continue.",
                                                    this.Text,
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);

                        goto btnSave_Click_Continue;
                    }

                    while (DateTime.Now < dtDateTimeNext)
                    {
                        Application.DoEvents();
                    }

                    this.picDatabaseBackupInternet.Image = global::ConvertCostCentre.Properties.Resources.Ok;
                    this.pvtintProcessNo += 1;
                    dtDateTimeNext        = DateTime.Now.AddSeconds(pvtintTimeDelaySeconds);

                    //Reset Class
                    clsISUtilities.Set_New_BusinessObjectName("busConvertCostCentre");

                    this.pnlDatabaseLocalBackup.Visible = true;
                    this.Refresh();

                    clsISClientUtilities.Set_New_BusinessObjectName("busBackupRestoreClientDatabase");

                    objParm    = new object[1];
                    objParm[0] = "_Backup_Before_CostCentre_Conversion";

                    //Backup Client Database
                    intReturnCode = (int)clsISClientUtilities.DynamicFunction("Backup_DataBase_New", objParm, false);

                    if (intReturnCode != 0)
                    {
                        this.tmrProcess.Enabled           = false;
                        this.picDatabaseBackupLocal.Image = global::ConvertCostCentre.Properties.Resources.Error;

                        CustomClientMessageBox.Show("Error Backing up Client Database.\nFix to Continue.",
                                                    this.Text,
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Error);

                        goto btnSave_Click_Continue;
                    }

                    while (DateTime.Now < dtDateTimeNext)
                    {
                        Application.DoEvents();
                    }

                    this.picDatabaseBackupLocal.Image = global::ConvertCostCentre.Properties.Resources.Ok;
                    this.pvtintProcessNo += 1;
                    dtDateTimeNext        = DateTime.Now.AddSeconds(pvtintTimeDelaySeconds);

                    //Reset Class
                    clsISClientUtilities.Set_New_BusinessObjectName("busClientConvertCostCentre");

                    objParm    = new object[3];
                    objParm[0] = pvtInt64CompanyNo;
                    objParm[1] = pvtstrToPayCategoryType;
                    objParm[2] = pvtbytCompress;

                    //Convert Server
                    intReturnCode = (int)clsISUtilities.DynamicFunction("Convert_Records", objParm, false);

                    if (intReturnCode == 0)
                    {
                        blnServerDatabaseConverted = true;

                        while (DateTime.Now < dtDateTimeNext)
                        {
                            Application.DoEvents();
                        }

                        this.picDatabaseConvertInternet.Image = global::ConvertCostCentre.Properties.Resources.Ok;
                        this.pvtintProcessNo += 1;
                        dtDateTimeNext        = DateTime.Now.AddSeconds(pvtintTimeDelaySeconds);

                        //Convert Client Databases
                        clsISClientUtilities.DynamicFunction("Convert_Client_Records", objParm, true);

                        while (DateTime.Now < dtDateTimeNext)
                        {
                            Application.DoEvents();
                        }

                        this.tmrProcess.Enabled            = false;
                        this.picDatabaseConvertLocal.Image = global::ConvertCostCentre.Properties.Resources.Ok;

                        CustomClientMessageBox.Show("Conversion Successful.",
                                                    this.Text,
                                                    MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                    }

btnSave_Click_Continue:

                    btnCancel_Click(sender, e);
                }
            }
            catch (Exception eException)
            {
                this.tmrProcess.Enabled = false;

                if (pvtintProcessNo == 0)
                {
                    this.picDatabaseBackupInternet.Image = global::ConvertCostCentre.Properties.Resources.Error;
                }
                else
                {
                    if (pvtintProcessNo == 1)
                    {
                        this.picDatabaseBackupLocal.Image = global::ConvertCostCentre.Properties.Resources.Error;
                    }
                    else
                    {
                        if (pvtintProcessNo == 2)
                        {
                            this.picDatabaseConvertInternet.Image = global::ConvertCostCentre.Properties.Resources.Error;
                        }
                        else
                        {
                            if (pvtintProcessNo == 3)
                            {
                                this.picDatabaseConvertLocal.Image = global::ConvertCostCentre.Properties.Resources.Error;
                            }
                        }
                    }
                }

                if (blnServerDatabaseConverted == true)
                {
                    CustomClientMessageBox.Show("Server Database Converted. / Local Database CONVERT FAILURE.\nURGENT - Speak to System Administrator.",
                                                this.Text,
                                                MessageBoxButtons.OK,
                                                MessageBoxIcon.Error);
                }

                clsISClientUtilities.ErrorHandler(eException);
            }
        }
示例#5
0
        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);
            }
        }