Exemple #1
0
        private void rbnFileOption_Click(object sender, EventArgs e)
        {
            RadioButton myRadioButton = (RadioButton)sender;

            this.txtFilePath.Text = "";

            if (myRadioButton.Name == "rbnBackupFile")
            {
                dgvUserDataGridView.Height         -= intUserExtraHeight;
                dgvSelectedUserDataGridView.Height -= intSelectedUserExtraHeight;

                this.btnFile.Visible              = false;
                this.lblFilesHeader.Visible       = true;
                this.dgvFilesDataGridView.Visible = true;

                string strPayrollRunDate = "";

                try
                {
                    byte[] byteCompress = (byte[])clsISClientUtilities.DynamicFunction("Get_Restore_Files", null, false);

                    pvtDataSet = null;
                    pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(byteCompress);

                    this.dgvFilesDataGridView.Rows.Clear();

                    pvtblnFilesDataGridViewLoaded = false;

                    pvtDataView = null;
                    pvtDataView = new DataView(pvtDataSet.Tables["RestoreFiles"], "", "RESTORE_DATETIME DESC", DataViewRowState.CurrentRows);

                    for (int intRow = 0; intRow < pvtDataView.Count; intRow++)
                    {
                        if (pvtDataView[intRow]["RESTORE_DATETIME"] != System.DBNull.Value)
                        {
                            strPayrollRunDate = Convert.ToDateTime(pvtDataView[intRow]["RESTORE_DATETIME"]).ToString("yyyy-MM-dd HH:mm:ss");
                        }
                        else
                        {
                            strPayrollRunDate = "";
                        }

                        this.dgvFilesDataGridView.Rows.Add(strPayrollRunDate,
                                                           pvtDataView[intRow]["RESTORE_FILE"].ToString());
                    }

                    pvtblnFilesDataGridViewLoaded = true;

                    if (this.dgvFilesDataGridView.Rows.Count > 0)
                    {
                        Set_DataGridView_SelectedRowIndex(dgvFilesDataGridView, 0);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                //File
                this.btnFile.Visible              = true;
                this.lblFilesHeader.Visible       = false;
                this.dgvFilesDataGridView.Visible = false;

                dgvUserDataGridView.Height         += intUserExtraHeight;
                dgvSelectedUserDataGridView.Height += intSelectedUserExtraHeight;
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    pvtblnFromWindowsService = false;
                }

                if (pvtblnFromWindowsService == false)
                {
                    Console.WriteLine("Entered ValiditeClockingsSyncViaDB");
                }

                Check_Log_For_Archiving();

                string strConfig = AppDomain.CurrentDomain.BaseDirectory + "URLClientConfig.txt";

                FileInfo fiFileInfo = new FileInfo(strConfig);

                if (fiFileInfo.Exists == true)
                {
                    StreamReader srStreamReader = File.OpenText(strConfig);

                    string strURLPath = srStreamReader.ReadLine();

                    srStreamReader.Close();

                    AppDomain.CurrentDomain.SetData("URLClientPath", strURLPath);
                }
                else
                {
                    AppDomain.CurrentDomain.SetData("URLClientPath", "");
                }

                clsISClientUtilities = new clsISClientUtilities(null, "busValiditeClockingsSyncViaDB");

                pvtDataSet = new DataSet();

                object[] objParm = new object[1];
                objParm[0] = "Hullo";
                byte[] bytCompress = (byte[])clsISClientUtilities.DynamicFunction("Insert_Records", objParm, false);

                pvtDataSet = clsISClientUtilities.DeCompress_Array_To_DataSet(bytCompress);

                if (pvtDataSet.Tables["LinksMissing"].Rows.Count > 0)
                {
                    if (pvtblnFromWindowsService == false)
                    {
                        Console.WriteLine("EMPLOYEES NOT LINKED START*********");
                    }

                    WriteLog("EMPLOYEES NOT LINKED START*********");

                    for (int intCount = 0; intCount < pvtDataSet.Tables["LinksMissing"].Rows.Count; intCount++)
                    {
                        if (pvtblnFromWindowsService == false)
                        {
                            Console.WriteLine("Employee " + pvtDataSet.Tables["LinksMissing"].Rows[intCount]["EMPLOYEE_NO"].ToString());
                        }

                        WriteLog("Employee " + pvtDataSet.Tables["LinksMissing"].Rows[intCount]["EMPLOYEE_NO"].ToString());
                    }

                    if (pvtblnFromWindowsService == false)
                    {
                        Console.WriteLine("EMPLOYEES NOT LINKED END*********");
                    }

                    WriteLog("EMPLOYEES NOT LINKED END*********");
                }

                if (pvtblnFromWindowsService == false)
                {
                    Console.WriteLine("Number of Records Inserted = " + pvtDataSet.Tables["Clockings"].Rows.Count);
                }

                WriteLog("Number of Records Inserted = " + pvtDataSet.Tables["Clockings"].Rows.Count);

                if (pvtblnFromWindowsService == false)
                {
                    Console.WriteLine("Exit ValiditeClockingsSyncViaDB");
                }
            }
            catch (Exception ex)
            {
                string strException = ex.Message;

                if (ex.InnerException != null)
                {
                    strException = strException + " " + ex.InnerException.Message;
                }

                if (pvtblnFromWindowsService == false)
                {
                    Console.WriteLine("Exception = " + strException);
                }

                WriteExceptionLog("ClockingsService", ex);
            }
            finally
            {
                if (pvtblnFromWindowsService == false)
                {
                    Console.ReadLine();
                }
            }
        }
Exemple #3
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            try
            {
                DialogResult dlgResult = CustomMessageBox.Show("Are you sure you want to Upload this Data?",
                                                               this.Text,
                                                               MessageBoxButtons.YesNo,
                                                               MessageBoxIcon.Warning);

                if (dlgResult == DialogResult.Yes)
                {
                    string strPayCategoryWhere = "";

                    //DataSetClient = null;
                    //DataSetClient = new DataSet();

                    for (int intRow = 0; intRow < this.dgvPayCategoryDataGridView.Rows.Count; intRow++)
                    {
                        if (intRow == 0)
                        {
                            strPayCategoryWhere = " AND EPC.PAY_CATEGORY_NO IN (" + this.dgvPayCategoryDataGridView[5, intRow].Value.ToString();
                        }
                        else
                        {
                            strPayCategoryWhere += "," + this.dgvPayCategoryDataGridView[5, intRow].Value.ToString();
                        }
                    }

                    strPayCategoryWhere += ")";

                    pvtTempDataSet = null;
                    pvtTempDataSet = new DataSet();

                    DataTable myEmployeeDataTable;
                    myEmployeeDataTable = pvtDataSet.Tables["Employee"].Copy();
                    pvtTempDataSet.Tables.Add(myEmployeeDataTable);

                    DataTable myEmployeePayCategoryDataTable;
                    myEmployeePayCategoryDataTable = pvtDataSet.Tables["EmployeePayCategory"].Copy();
                    pvtTempDataSet.Tables.Add(myEmployeePayCategoryDataTable);

                    //Compress DataSet
                    pvtbytCompress = clsISUtilities.Compress_DataSet(pvtTempDataSet);

                    object[] objParm = new object[5];
                    objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                    objParm[1] = pvtstrPayrollType;
                    objParm[2] = strPayCategoryWhere;
                    objParm[3] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd");
                    objParm[4] = pvtbytCompress;

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

                    DataSet DataSetClient = clsISClientUtilities.DeCompress_Array_To_DataSet(pvtbytCompress);

                    if (DataSetClient.Tables["ErrorCount"].Rows.Count > 0)
                    {
                        if (DataSetClient.Tables["ErrorCount"].Rows[0]["INDICATOR"].ToString() == "X")
                        {
                            CustomMessageBox.Show("There are Time Sheets with Errors on the Client Database.\n\nYou Need to Fix these TimeSheets on (Interact Time & Attendance Program) to Proceed.\n\nProcess Cancelled.",
                                                  this.Text,
                                                  MessageBoxButtons.OK,
                                                  MessageBoxIcon.Error);

                            return;
                        }
                    }

                    if (DataSetClient.Tables["Dates"].Rows.Count > 0)
                    {
                        this.grbUploadProgress.Visible = true;
                        this.pgbProgressBar.Maximum    = DataSetClient.Tables["Dates"].Rows.Count + 1;

                        for (int intRow = 0; intRow < DataSetClient.Tables["Dates"].Rows.Count; intRow++)
                        {
                            //From Clint Database
                            objParm    = new object[4];
                            objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                            objParm[1] = pvtstrPayrollType;
                            objParm[2] = strPayCategoryWhere;
                            objParm[3] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]).ToString("yyyy-MM-dd");

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

                            //Internet Database Insert
                            objParm    = new object[6];
                            objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                            objParm[1] = Convert.ToDateTime(DataSetClient.Tables["Dates"].Rows[intRow]["TIMESHEET_DATE"]);
                            objParm[2] = pvtbytCompress;
                            objParm[3] = pvtstrPayrollType;
                            objParm[4] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["PAY_PERIOD_DATE"]).ToString("yyyy-MM-dd");
                            objParm[5] = Convert.ToDateTime(this.pvtPayCategoryDataView[0]["TIMESHEET_UPLOAD_DATETIME"]).ToString("yyyy-MM-dd");


                            blnclsISClientUtilities = false;
                            string strUploadDateTime = (string)clsISUtilities.DynamicFunction("Insert_TimeSheet_Records", objParm, false);

                            //Update Client PAYCATEGORY Records with Date TimeStamp
                            objParm    = new object[3];
                            objParm[0] = Convert.ToInt64(AppDomain.CurrentDomain.GetData("CompanyNo"));
                            objParm[1] = strUploadDateTime;
                            objParm[2] = pvtbytCompress;

                            blnclsISClientUtilities = true;
                            this.clsISClientUtilities.DynamicFunction("Update_PayCategory_Last_Upload_DateTime", objParm, false);

                            this.pgbProgressBar.Value += 1;
                        }

                        this.Refresh();

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

                        blnclsISClientUtilities = true;
                        this.clsISClientUtilities.DynamicFunction("Move_Data_To_History_And_Cleanup", objParm, false);

                        this.pgbProgressBar.Value += 1;
                        this.Refresh();

                        CustomMessageBox.Show("Upload Successful.",
                                              this.Text,
                                              MessageBoxButtons.OK,
                                              MessageBoxIcon.Information);
                    }
                    else
                    {
                        CustomMessageBox.Show("There is NO Data to Upload",
                                              this.Text,
                                              MessageBoxButtons.OK,
                                              MessageBoxIcon.Information);
                    }

                    this.grbUploadProgress.Visible = false;
                }
            }
            catch (Exception eException)
            {
                if (blnclsISClientUtilities == true)
                {
                    clsISClientUtilities.ErrorHandler(eException);
                }
                else
                {
                    clsISUtilities.ErrorHandler(eException);
                }
            }
        }