Exemple #1
0
        private void LoadDataList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveDashBoardDataByEmpID(Int32.Parse(Page.User.Identity.Name.ToString()), Int32.Parse(businessUnitDDList.SelectedValue), Int32.Parse(DivisionLocationList.SelectedValue));

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0) // Employee Divisional Chart
                    {
                        DataTable _DataTable = _DataList.Tables[0];
                        Division_EmpListChart(_DataTable);
                    }
                    else
                    {
                        EmpListChart1.Items.Clear();
                    }

                    if (_DataList.Tables[1].Rows.Count > 0) // Employee Location  Chart
                    {
                        DataTable _DataTable = _DataList.Tables[1];
                        Location_EmpListChart(_DataTable);
                    }
                    else
                    {
                        EmpListChart2.Items.Clear();
                    }

                    if (_DataList.Tables[2].Rows.Count > 0) // Employee Age Profile  Chart
                    {
                        DataTable _DataTable = _DataList.Tables[2];
                        AgeProfile_EmpListChart(_DataTable);
                    }
                    else
                    {
                        EmpListChart3.Items.Clear();
                    }

                    if (_DataList.Tables[3].Rows.Count > 0) // Employee Service Profile  Chart
                    {
                        DataTable _DataTable = _DataList.Tables[3];
                        ServiceProfile_EmpListChart(_DataTable);
                    }
                    else
                    {
                        EmpListChart4.Items.Clear();
                    }

                    if (_DataList.Tables[4].Rows.Count > 0) // Expiring Labor Cards in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[4];
                        Grid3.DataSource = _DataTable;
                        Grid3.DataBind();
                    }
                    else
                    {
                        Grid3.DataSource = null;
                        Grid3.DataBind();
                    }

                    if (_DataList.Tables[5].Rows.Count > 0) // Expiring Visa in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[5];
                        Grid4.DataSource = _DataTable;
                        Grid4.DataBind();
                    }
                    else
                    {
                        Grid4.DataSource = null;
                        Grid4.DataBind();
                    }


                    if (_DataList.Tables[6].Rows.Count > 0) // Expiring Passports in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[6];
                        Grid5.DataSource = _DataTable;
                        Grid5.DataBind();
                    }
                    else
                    {
                        Grid5.DataSource = null;
                        Grid5.DataBind();
                    }

                    if (_DataList.Tables[7].Rows.Count > 0) // Pending Leave in the current week.
                    {
                        DataTable _DataTable = _DataList.Tables[7];
                        Grid1.DataSource = _DataTable;
                        Grid1.DataBind();
                    }
                    else
                    {
                        Grid1.DataSource = null;
                        Grid1.DataBind();
                    }


                    if (_DataList.Tables[8].Rows.Count > 0) // Upcoming Holidays
                    {
                        DataTable _DataTable = _DataList.Tables[8];
                        Grid2.DataSource = _DataTable;
                        Grid2.DataBind();
                    }
                    else
                    {
                        Grid2.DataSource = null;
                        Grid2.DataBind();
                    }

                    if (_DataList.Tables[10].Rows.Count > 0) // Upcoming Probation endings
                    {
                        DataTable _DataTable = _DataList.Tables[10];
                        Grid7.DataSource = _DataTable;
                        Grid7.DataBind();
                    }
                    else
                    {
                        Grid7.DataSource = null;
                        Grid7.DataBind();
                    }
                    if (_DataList.Tables[11].Rows.Count > 0) // Business Visa Expiry
                    {
                        DataTable _DataTable = _DataList.Tables[11];
                        Grid10.DataSource = _DataTable;
                        Grid10.DataBind();
                    }
                    else
                    {
                        Grid10.DataSource = null;
                        Grid10.DataBind();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
            }
        }
Exemple #2
0
        protected void Import_Click(object sender, EventArgs e)
        {
            try
            {
                Tab1_Message.CssClass = "errorMessage";
                Tab1_Message.Visible  = true;
                string extension = System.IO.Path.GetExtension(fileuploadExcel.PostedFile.FileName);
                if (fileuploadExcel.FileName != "") //&& extension == ".xls")
                {
                    string        excelConnectionString;
                    SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionInfo"));
                    string        connStr    = System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionInfo");

                    // string path = fileuploadExcel.PostedFile.FileName;

                    string path = Server.MapPath(Page.ResolveUrl("~\\App_Data\\") + fileuploadExcel.FileName);
                    fileuploadExcel.SaveAs(path);
                    // string a = fileuploadExcel.PostedFile.FileName;


                    string tableName = StringEnum.stringValueOf(Constants.ImportTableName.FinanceTransaction);
                    //Create connection string to Excel work book
                    if (extension == ".xls")
                    {
                        excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path +
                                                ";Extended Properties=Excel 8.0";
                    }
                    else if (extension == ".csv")
                    {
                        excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path +
                                                ";Extended Properties=text;FMT=Delimited()";
                    }
                    else
                    {
                        excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path +
                                                ";Extended Properties=Excel 12.0";
                    }

                    //Create Connection to Excel work book
                    OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
                    //Create OleDbCommand to fetch data from Excel
                    connection.Open();
                    SqlCommand comm = new SqlCommand("delete from " + tableName, connection);
                    comm.ExecuteNonQuery();
                    SqlCommand identityChange = connection.CreateCommand();
                    identityChange.CommandText = "SET IDENTITY_INSERT " + tableName + " ON";
                    OleDbCommand cmd = new OleDbCommand("Select RowID,PSEmployeeID,ComponentCode,Amount from [Sheet1$] where RowID > 0", excelConnection);
                    excelConnection.Open();
                    OleDbDataReader dReader;
                    dReader = cmd.ExecuteReader();
                    identityChange.ExecuteNonQuery();
                    SqlBulkCopy sqlBulk = new SqlBulkCopy(connStr);
                    //Give your Destination table name
                    sqlBulk.DestinationTableName = tableName;
                    sqlBulk.WriteToServer(dReader);
                    excelConnection.Close();
                    connection.Close();
                    // Validate the data in the staging table and return all bad data.


                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.ValidateImportedFinanceTransactions(Int32.Parse(Page.User.Identity.Name.ToString()));
                    if (_DataList.Tables.Count > 0)
                    {
                        if (_DataList.Tables[0].Rows.Count > 0) // Bad Data exists
                        {
                            DataTable _DeductionTable = _DataList.Tables[0];
                            this.Tab1Grid.DataSource = _DeductionTable;
                            this.Tab1Grid.DataBind();
                            Export1.Visible   = true;
                            Tab1_Message.Text = "The following data was not imported due to validation error. Please fix them and re-import.";
                        }
                        else
                        {
                            this.Tab1Grid.DataSource = null;
                            this.Tab1Grid.DataBind();
                            Export1.Visible   = false;
                            Tab1_Message.Text = "All data has been successfully imported into the system";
                        }
                    }
                }
                else
                {
                    Tab1_Message.CssClass = "errorMessage";
                    Tab1_Message.Text     = "Please select the excel(.xlsx) file to import.You should save the file as 'Excel Workbook' for the import process to work.";
                }
            }
            catch (Exception exception)
            {
                this.Tab1_Message.Visible  = true;
                this.Tab1_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please check the data in the import file.");
                this.Tab1_Message.CssClass = "errorMessage";
            }
        }
Exemple #3
0
        private void LoadDataList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveDashBoardDataByEmpID(Int32.Parse(Page.User.Identity.Name.ToString()), Int32.Parse(businessUnitDDList.SelectedValue), Int32.Parse(DivisionLocationList.SelectedValue));

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0) // Employee Divisional PieChart
                    {
                        PieXML = "";
                        DataTable _DataTable = _DataList.Tables[0];
                        PieXML          = CreatePieGraph1(_DataTable, "Employee Count Breakdown By Business Unit/Dept", "", "Count", "Division/Dept");
                        FCLiteral1.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_Pie3D.swf", "", PieXML, "DivisionDeptChart", PieWidth, PieHeight, false);
                    }
                    else
                    {
                        FCLiteral1.Visible = false;
                    }
                    if (_DataList.Tables[1].Rows.Count > 0) // Employee Location PieChart
                    {
                        PieXML = "";
                        DataTable _DataTable = _DataList.Tables[1];
                        PieXML          = CreatePieGraph1(_DataTable, "Employee Count Breakdown By Country", "", "Country", "Count");
                        FCLiteral2.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_Pie3D.swf", "", PieXML, "CountryChart", PieWidth, PieHeight, false);
                    }
                    else
                    {
                        FCLiteral2.Visible = false;
                    }
                    if (_DataList.Tables[2].Rows.Count > 0) // Employee Age Profile PieChart
                    {
                        DataTable _DataTable = _DataList.Tables[2];
                        CreateBarGraph1(_DataTable);
                    }
                    else
                    {
                        FCLiteral3.Visible = false;
                    }
                    if (_DataList.Tables[3].Rows.Count > 0) // Employee Service Profile PieChart
                    {
                        PieXML = "";
                        DataTable _DataTable = _DataList.Tables[3];
                        PieXML          = CreatePieGraph1(_DataTable, "Employee Service Year Profile", "", "Count", "Division/Dept");
                        FCLiteral4.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_Pie3D.swf", "", PieXML, "ServiceChart", PieWidth, PieHeight, false);
                    }
                    else
                    {
                        FCLiteral4.Visible = false;
                    }

                    if (_DataList.Tables[4].Rows.Count > 0) // Expiring Labor Cards in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[4];
                        Grid3.DataSource = _DataTable;
                        Grid3.DataBind();
                    }
                    else
                    {
                        Grid3.DataSource = null;
                        Grid3.DataBind();
                    }

                    if (_DataList.Tables[5].Rows.Count > 0) // Expiring Visa in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[5];
                        Grid4.DataSource = _DataTable;
                        Grid4.DataBind();
                    }
                    else
                    {
                        Grid4.DataSource = null;
                        Grid4.DataBind();
                    }


                    if (_DataList.Tables[6].Rows.Count > 0) // Expiring Passports in the next 6 months.
                    {
                        DataTable _DataTable = _DataList.Tables[6];
                        Grid5.DataSource = _DataTable;
                        Grid5.DataBind();
                    }
                    else
                    {
                        Grid5.DataSource = null;
                        Grid5.DataBind();
                    }

                    if (_DataList.Tables[7].Rows.Count > 0) // Pending Leave in the current week.
                    {
                        DataTable _DataTable = _DataList.Tables[7];
                        Grid1.DataSource = _DataTable;
                        Grid1.DataBind();
                    }
                    else
                    {
                        Grid1.DataSource = null;
                        Grid1.DataBind();
                    }


                    if (_DataList.Tables[8].Rows.Count > 0) // Upcoming Holidays
                    {
                        DataTable _DataTable = _DataList.Tables[8];
                        Grid2.DataSource = _DataTable;
                        Grid2.DataBind();
                    }
                    else
                    {
                        Grid2.DataSource = null;
                        Grid2.DataBind();
                    }

                    if (_DataList.Tables[10].Rows.Count > 0) // Upcoming Probation endings
                    {
                        DataTable _DataTable = _DataList.Tables[10];
                        Grid7.DataSource = _DataTable;
                        Grid7.DataBind();
                    }
                    else
                    {
                        Grid7.DataSource = null;
                        Grid7.DataBind();
                    }
                    if (_DataList.Tables[11].Rows.Count > 0) // Business Visa Expiry
                    {
                        DataTable _DataTable = _DataList.Tables[11];
                        Grid10.DataSource = _DataTable;
                        Grid10.DataBind();
                    }
                    else
                    {
                        Grid10.DataSource = null;
                        Grid10.DataBind();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
            }
        }
        protected void ManualPunch_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)  // Change requestStatusType to be dynamic, currently 1=submitted.
                {
                    Hmessage.Visible  = true;
                    Hmessage.CssClass = "errorMessage";

                    if (Tab1_keyField.Text.ToString() == "")
                    {
                        Tab1_keyField.Text = "0";
                    }

                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.AddUpdateMAPunchRequest(Convert.ToInt32(Tab1_keyField.Text), EmpId,
                                                                                             ConvertDMY_MDY(Tab1_PunchingDate), Tab1_PunchInTime.Text, Tab1_PunchOutTime.Text, Int32.Parse(Tab1_ReasonTypeList.SelectedValue),
                                                                                             Tab1_Comments.Text);
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        String  Result, HRAdminName, HRAdminEmail, LineManagerName, LineManagerEmail, DeptHeadName, DeptHeadEmail, EmpName, EmpEmail, LeaveTypeName;
                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Result = _DataRow["Result"].ToString();

                        if (Result == "")
                        {
                            LineManagerName  = _DataRow["LineManagerName"].ToString();
                            LineManagerEmail = _DataRow["LineManagerEmail"].ToString();
                            HRAdminName      = _DataRow["HRAdminName"].ToString();
                            HRAdminEmail     = _DataRow["HRAdminEmail"].ToString();
                            DeptHeadName     = _DataRow["DeptHeadName"].ToString();
                            DeptHeadEmail    = _DataRow["DeptHeadEmail"].ToString();
                            EmpName          = _DataRow["EmpName"].ToString();
                            EmpEmail         = _DataRow["EmpEmail"].ToString();
                            LeaveTypeName    = _DataRow["LeaveTypeName"].ToString();
                            String PunchingDate = ConvertDMY_MDY(Tab1_PunchingDate);
                            String PunchInTime  = Tab1_PunchInTime.Text.ToString();
                            String PunchOutTime = Tab1_PunchOutTime.Text.ToString();

                            if ((LineManagerEmail != "") || (DeptHeadEmail != "") || (HRAdminEmail != "")) // Notify via Email if Email was used as a user Name
                            {
                                //    NotifyApproversViaEmail(EmpName, EmpEmail, LeaveStartDate, LeaveEndDate, LeaveTypeName, LineManagerName, LineManagerEmail, DeptHeadName, DeptHeadEmail,HRAdminName,HRAdminEmail);
                            }
                            ResetFields();
                        }
                        else
                        {
                            this.Hmessage.Text     = Result;
                            this.Hmessage.CssClass = "errorMessage";
                        }
                    }
                }
                else
                {
                    this.Hmessage.Text     = "Error:Could not save the information. Please check the inputs";
                    this.Hmessage.CssClass = "errorMessage";
                }
                LoadMAPunchRequests();// Refresh the grid
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
        }
Exemple #5
0
 protected void TAConfig_Save_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid == true)
         {
             // Int32 PayType, EnableAccrual, DedAccrual, CarryFWD, DedSPeriod, AllowNegative, PartialDay, AllowESS;
             Boolean EmpEA, EmpDA, SupEA, LunchAllowed, OTAllowed;
             if (Tab1_keyField.Text.ToString() == "")
             {
                 Tab1_keyField.Text = "0";
             }
             if (Tab1_EmpEditAccess1.Checked)
             {
                 EmpEA = true;
             }
             else
             {
                 EmpEA = false;
             }
             if (Tab1_EmpDelAccess1.Checked)
             {
                 EmpDA = true;
             }
             else
             {
                 EmpDA = false;
             }
             if (Tab1_SupervisorAccess1.Checked)
             {
                 SupEA = true;
             }
             else
             {
                 SupEA = false;
             }
             if (Tab1_LunchAllowed1.Checked)
             {
                 LunchAllowed = true;
             }
             else
             {
                 LunchAllowed = false;
             }
             if (Tab1_OTAllowed1.Checked)
             {
                 OTAllowed = true;
             }
             else
             {
                 OTAllowed = false;
             }
             if (Tab1_MaxOTMinsAllowed.Text.ToString() == "")
             {
                 Tab1_MaxOTMinsAllowed.Text = "0";
             }
             String Result = DatabaseManager.Data.DBAccessManager.AddUpdateTAConfig(Int32.Parse(Page.User.Identity.Name.ToString()), Int32.Parse(Tab1_businessUnitDDList.SelectedValue), Int32.Parse(Tab1_DivisionLocationList.SelectedValue), EmpEA, EmpDA, SupEA, LunchAllowed, OTAllowed, Int32.Parse(Tab1_MaxOTMinsAllowed.Text));
             this.LTmessage.Visible = true;
             LTmessage.CssClass     = "errorMessage";
             if (Result == "")
             {
                 ResetFields();
             }
             else
             {
                 this.LTmessage.Text = Result;
             }
         }
         else
         {
             this.LTmessage.Text     = "Error Occured.Please check the input data and try again.";
             this.LTmessage.CssClass = "errorMessage";
         }
         LoadTAConfigList();
     }
     catch (Exception exception)
     {
         this.LTmessage.Visible  = true;
         this.LTmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact support.");
         this.LTmessage.CssClass = "errorMessage";
     }
 }
        private void LoadEmployeeProfile()
        {
            if (Page.User.Identity.Name.ToString() != null)
            {
                this.keyField.Text          = Page.User.Identity.Name.ToString();
                this.EditArea.Visible       = true;
                this.GeneralInfoTab.Visible = true;
                // Load dropdown Controls.
                LoadVisaType(this.Tab1_VisaType);
                LoadCountryList(this.Tab1_PassportCountryDDList);
                LoadCountryList(this.Tab1_VisaCountryDDList);
                LoadCountryList(Tab1_LaborCardCountryDDList);
                LoadCountryList(this.Tab2_CountryDDList);
                LoadCountryList(this.Tab2_WCountryDDList);

                try
                {
                    // Gather Employee Information.
                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeInfo(Int32.Parse(this.keyField.Text.ToString()));
                    if (_DataList.Tables.Count > 0)
                    {
                        if (_DataList.Tables[0].Rows.Count > 0) // General Employee/Job details Information
                        {
                            DataRow _employeeDataRow = _DataList.Tables[0].Rows[0];
                            Tab1_FName.Text          = _employeeDataRow["F_Name"].ToString();
                            Tab1_MidName.Text        = _employeeDataRow["Mid_Initial"].ToString();
                            Tab1_LName.Text          = _employeeDataRow["L_Name"].ToString();
                            lblEmployeeName.Text     = Tab1_FName.Text + " " + Tab1_MidName.Text + " " + Tab1_LName.Text;
                            lblDivision.Text         = _employeeDataRow["DivisionName"].ToString();
                            lblDivisionLocation.Text = _employeeDataRow["DivisionLocationName"].ToString();
                            LoadGenderType(this.Tab1_GenderType);
                            Tab1_GenderType.SelectedValue = _employeeDataRow["GenderID"].ToString();
                            Tab1_DOB.Text = _employeeDataRow["DOB"].ToString();
                            LoadMaritalStatus(this.Tab1_MaritalStatus);
                            Tab1_MaritalStatus.SelectedValue = _employeeDataRow["MaritalStatus_ID"].ToString();
                            LoadEducationList(this.Tab1_Education);
                            if (_employeeDataRow["EducationID"].ToString() != "")
                            {
                                Tab1_Education.SelectedValue = _employeeDataRow["EducationID"].ToString();
                            }
                            Tab1_Citizenship.Text = _employeeDataRow["Citizenship"].ToString();

                            if (_employeeDataRow["Photo_Path"].ToString() != "")
                            {
                                this.profile.ImageUrl = Page.ResolveUrl("~\\PhotoProfiles\\" + _employeeDataRow["Photo_Path"].ToString());
                            }
                            else
                            {
                                this.profile.ImageUrl = Page.ResolveUrl("~\\PhotoProfiles\\" + "d_Photo.jpg");
                            }
                            Tab1_Age.Text                       = _employeeDataRow["Age"].ToString();
                            lblSuperVisorName.Text              = _employeeDataRow["SupervisorName"].ToString();
                            lblSuperVisor_Phone.Text            = _employeeDataRow["Supervisor_Phone"].ToString();
                            lblSuperVisor_EmailAddress.Text     = _employeeDataRow["Supervisor_Email"].ToString();
                            lblSuperVisor_JobLocation.Text      = _employeeDataRow["Supervisor_WorkLocation"].ToString();
                            lblSuperVisor_JobTitle.Text         = _employeeDataRow["Supervisor_Designation"].ToString();
                            lblSuperVisor_Division.Text         = _employeeDataRow["Supervisor_Division"].ToString();
                            lblSuperVisor_DivisionLocation.Text = _employeeDataRow["Supervisor_BULocation"].ToString();
                            // Job Details Tab Information.

                            LoadEmpStatusLookup(Tab5_EmpStatusDDList);
                            LoadDesignationLookup(Tab5_DesignationDDList);
                            LoadDivisionLookup(Tab5_DivisonDDList);
                            this.LoadEmpCategoryLookup(Tab5_EmpCategoryDDList);
                            this.LoadDepartmentLookup(Tab5_DepartmentDDList);
                            LoadSupervisorsListLookup(Tab5_SupervisorDDList);


                            Tab5_EmpID.Text = _employeeDataRow["Employee_ID"].ToString();
                            if (_employeeDataRow["DesignationID"].ToString() != "")
                            {
                                Tab5_DesignationDDList.SelectedValue = _employeeDataRow["DesignationID"].ToString();
                                lblJobTitle.Text = Tab5_DesignationDDList.SelectedItem.ToString();
                            }
                            if (_employeeDataRow["EmployeeStatusID"].ToString() != "")
                            {
                                Tab5_EmpStatusDDList.SelectedValue = _employeeDataRow["EmployeeStatusID"].ToString();
                            }
                            if (_employeeDataRow["EmployeeCategoryID"].ToString() != "")
                            {
                                Tab5_EmpCategoryDDList.SelectedValue = _employeeDataRow["EmployeeCategoryID"].ToString();
                            }

                            if (_employeeDataRow["DepartmentID"].ToString() != "")
                            {
                                Tab5_DepartmentDDList.SelectedValue = _employeeDataRow["DepartmentID"].ToString();
                            }
                            if (_employeeDataRow["DivisionID"].ToString() != "")
                            {
                                Tab5_DivisonDDList.SelectedValue = _employeeDataRow["DivisionID"].ToString();
                            }
                            Tab5_HireDate.Text          = _employeeDataRow["HireDate"].ToString();
                            Tab5_OriginalHDate.Text     = _employeeDataRow["OriginalHireDate"].ToString();
                            Tab5_ResignedDate.Text      = _employeeDataRow["Date_Resigned"].ToString();
                            Tab5_DateLeft.Text          = _employeeDataRow["Date_Left"].ToString();
                            Tab5_TotalServiceYears.Text = _employeeDataRow["TotalYears_Service"].ToString();
                            Tab5_ProbabtionYears.Text   = _employeeDataRow["Probation_Period"].ToString();
                            Tab5_ProbationEndDate.Text  = _employeeDataRow["Probation_EndDate"].ToString();
                            if (_employeeDataRow["Probation_Completed"].ToString() == "1")
                            {
                                Tab5_ProbationCompletedCheckBox.Checked = true;
                                Tab5_ProbationCompletedCheckBox.Enabled = false;
                                Tab5_ProbationEndDate.Enabled           = false;
                                Tab5_ProbabtionYears.Enabled            = false;
                            }
                            else
                            {
                                Tab5_ProbationCompletedCheckBox.Checked = false;
                            }


                            if (_employeeDataRow["SupervisoryRole"].ToString() == "1")
                            {
                                Tab5_SupervisoryCheckBox.Checked = true;
                            }
                            else
                            {
                                Tab5_SupervisoryCheckBox.Checked = false;
                            }

                            if (_employeeDataRow["LineManagerID"].ToString() != "")
                            {
                                Tab5_SupervisorDDList.SelectedValue = _employeeDataRow["LineManagerID"].ToString();
                            }


                            // Immigration Information

                            if (_employeeDataRow["Visa_TypeID"].ToString() != "")
                            {
                                Tab1_VisaType.SelectedValue = _employeeDataRow["Visa_TypeID"].ToString();
                            }

                            if (_employeeDataRow["PP_IssueCountryID"].ToString() != "")
                            {
                                Tab1_PassportCountryDDList.SelectedValue = _employeeDataRow["PP_IssueCountryID"].ToString();
                            }

                            if (_employeeDataRow["Visa_IssueCountryID"].ToString() != "")
                            {
                                Tab1_VisaCountryDDList.SelectedValue = _employeeDataRow["Visa_IssueCountryID"].ToString();
                            }
                            Tab1_PassportNo.Text          = _employeeDataRow["PassportNumber"].ToString();
                            Tab1_VisaNumber.Text          = _employeeDataRow["Visa_Number"].ToString();
                            Tab1_VisaExpiryDate.Text      = _employeeDataRow["Visa_ExpiryDate"].ToString();
                            Tab1_VisaIssueDate.Text       = _employeeDataRow["Visa_IssueDate"].ToString();
                            Tab1_PassportIssueDate.Text   = _employeeDataRow["PP_IssueDate"].ToString();
                            Tab1_PassportExpiryDate.Text  = _employeeDataRow["PP_ExpiryDate"].ToString();
                            Tab1_LaborCardNo.Text         = _employeeDataRow["LaborCardNumber"].ToString();
                            Tab1_LaborCardIssueDate.Text  = _employeeDataRow["LaborCardIssueDate"].ToString();
                            Tab1_LaborCardExpiryDate.Text = _employeeDataRow["LaborCardExpiryDate"].ToString();
                            if (_employeeDataRow["LaborCardIssueCountryID"].ToString() != "")
                            {
                                Tab1_LaborCardCountryDDList.SelectedValue = _employeeDataRow["LaborCardIssueCountryID"].ToString();
                            }

                            // Employee Contact Information.

                            Tab2_HAddress1.Text = _employeeDataRow["Home_Addr1"].ToString();
                            Tab2_HAddress2.Text = _employeeDataRow["Home_Addr2"].ToString();
                            Tab2_WAddress1.Text = _employeeDataRow["Work_Addr1"].ToString();
                            Tab2_WAddress2.Text = _employeeDataRow["Work_Addr2"].ToString();
                            Tab2_HCity.Text     = _employeeDataRow["City"].ToString();
                            Tab2_HState.Text    = _employeeDataRow["Home_State"].ToString();
                            if (_employeeDataRow["Home_CountryID"].ToString() != "")
                            {
                                Tab2_CountryDDList.SelectedValue = _employeeDataRow["Home_CountryID"].ToString();
                            }
                            if (_employeeDataRow["Work_CountryID"].ToString() != "")
                            {
                                Tab2_WCountryDDList.SelectedValue = _employeeDataRow["Work_CountryID"].ToString();
                            }
                            Tab2_WCity.Text      = _employeeDataRow["Work_City"].ToString();
                            Tab5_City.Text       = _employeeDataRow["Work_City"].ToString();
                            Tab2_WState.Text     = _employeeDataRow["Work_State"].ToString();
                            lblJobLocation.Text  = Tab5_City.Text + '/' + Tab5_CountryName.Text;
                            Tab2_HPhone.Text     = _employeeDataRow["Home_Phone"].ToString();
                            Tab2_Mobile.Text     = _employeeDataRow["Mobile_Phone"].ToString();
                            Tab2_WPhone.Text     = _employeeDataRow["Work_Phone"].ToString();
                            Tab2_WorkEmail.Text  = _employeeDataRow["Work_Email"].ToString();
                            lblWorkPhone.Text    = _employeeDataRow["Work_Phone"].ToString();
                            lblMobile.Text       = _employeeDataRow["Mobile_Phone"].ToString();
                            lblEmailAddress.Text = _employeeDataRow["Work_Email"].ToString();
                        }


                        if (_DataList.Tables[1].Rows.Count > 0)  // Employee Dependent Information.
                        {
                            DataRow   _empDependentDataRow   = _DataList.Tables[1].Rows[0];
                            DataTable _empDependentDataTable = _DataList.Tables[1];

                            if (_DataList.Tables[3].Rows.Count > 0)
                            {
                                this.DPGrid.DataSource = _empDependentDataTable;
                                this.DPGrid.DataBind();
                            }
                            else
                            {
                                emptyRow2.Visible  = true;
                                emptyRow2.Text     = "No Dependents Information Available.";
                                emptyRow2.CssClass = "errorMessage";
                            }
                        }
                        else
                        {
                            emptyRow2.Visible  = true;
                            emptyRow2.Text     = "No Dependents Information Available.";
                            emptyRow2.CssClass = "errorMessage";
                        }

                        if (_DataList.Tables[2].Rows.Count > 0)  // Employee Emergency contact Information.
                        {
                            DataRow   _empECDataRow   = _DataList.Tables[2].Rows[0];
                            DataTable _empECDataTable = _DataList.Tables[2];

                            if (_DataList.Tables[4].Rows.Count > 0)
                            {
                                this.ECGrid.DataSource = _empECDataTable;
                                this.ECGrid.DataBind();
                            }
                            else
                            {
                                emptyRow1.Visible  = true;
                                emptyRow1.Text     = "No Emergency Contacts Available.";
                                emptyRow1.CssClass = "errorMessage";
                            }
                        }
                        else
                        {
                            emptyRow1.Visible  = true;
                            emptyRow1.Text     = "No Emergency Contacts Available.";
                            emptyRow1.CssClass = "errorMessage";
                        }
                    }
                }
                catch (Exception exception)
                {
                    ErrorLogging.LogError(exception, "");
                }
            }
        }
        protected void LoadEmployeeMonthlyPayrollInfo(Int32 EmpId, String MonthYear)
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeMonthlyPayrollHistoryInfo(EmpId, MonthYear);

                if (_DataList.Tables.Count > 0)
                {
                    this.message.Text = "";
                    if (_DataList.Tables[0].Rows.Count > 0) // Standard Pay Components.
                    {
                        Tab1Grid.DataSource = _DataList.Tables[0];
                        Tab1Grid.DataBind();
                    }
                    else
                    {
                        Tab1Grid.DataSource = null;
                        Tab1Grid.DataBind();
                    }

                    if (_DataList.Tables[1].Rows.Count > 0) // Leave/Bank Information
                    {
                        DataRow _DataRow = _DataList.Tables[1].Rows[0];
                        Tab1_CurrenyLabel1.Text    = "(All Figures in " + _DataRow["CurrencyCode"].ToString() + ")";
                        Tab1_NoOfDaysPayCycle.Text = _DataRow["TotalDays_PayCycle"].ToString();
                        Tab1_NofUnpaidDays.Text    = _DataRow["TotalDays_Unpaid"].ToString();
                        Tab1_NetPayDays.Text       = _DataRow["NetPayDays"].ToString();
                        Tab1_NetPay.Text           = _DataRow["NetPay"].ToString();
                        if (_DataRow["BankAccount"].ToString() != "")
                        {
                            Tab1_EmployeeBankAccount.Text = _DataRow["BankAccount"].ToString();
                        }
                        if (_DataRow["BankId"].ToString() != "")
                        {
                            Tab1_BankName.SelectedValue = _DataRow["BankId"].ToString();
                        }
                        if (_DataRow["PayrollNote"].ToString() != "")
                        {
                            Tab1_Note.Text = _DataRow["PayrollNote"].ToString();
                        }
                        LoadPayrollStatusTypeLookup(Tab1_PayrollStatusType, (int)Constants.PayrollStatusType.Preview);

                        if (_DataRow["PayrollStatusTypeID"].ToString() == "3") // Processed. Change this later.
                        {
                            LoadPayrollStatusTypeLookup(Tab1_PayrollStatusType, (int)Constants.PayrollStatusType.Processed);
                        }

                        if (_DataRow["PayrollStatusTypeID"].ToString() != "")
                        {
                            Tab1_PayrollStatusType.SelectedValue = _DataRow["PayrollStatusTypeID"].ToString();
                        }
                        if (_DataRow["EOSPayout"].ToString() == "1")
                        {
                            Tab1_EOSCheckBox.Checked = true;
                        }
                        else
                        {
                            Tab1_EOSCheckBox.Checked = false;
                        }

                        // Enable payroll download link
                        WPSDownloadLink.Visible  = true;
                        WPSDownloadLink.Text     = "Click here to view this pay slip";
                        WPSDownloadLink.CssClass = "validationtxt";
                        //   Page.ClientScript.RegisterStartupScript(this.GetType(), "windowopen", @"<script>function openWindow(link){window.open (link,'mywindow','status=1,toolbar=1');return false; }</script>", true);
                        //  WPSDownloadLink.NavigateUrl = "javascript:openWindow('http://localhost:64739/HRMSNet/Payroll/ViewPayStub.aspx?empId='" + EmpId + "'&PayMonthYear='" + MonthYear + ")";
                        WPSDownloadLink.NavigateUrl = "~/Payroll/ViewPayStub.aspx?empId=" + EmpId + "&PayMonthYear=" + MonthYear;
                        WPSDownloadLink.Target      = "_blank";
                    }
                }
                else
                {
                    this.message.Visible    = true;
                    WPSDownloadLink.Visible = false;
                    this.message.Text       = "No Processed payroll data available for this Pay Period.";
                    this.message.CssClass   = "errorMessage";
                    return;
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }
        }
Exemple #8
0
        protected void Tab3_Approve_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    Int32 Approval = 0; Int32 LeavePayType = 0;
                    if (Tab3_keyField.Text.ToString() == "")
                    {
                        Tab3_keyField.Text = "0";
                    }
                    if (Tab3_ApprRB1.Checked)
                    {
                        Approval = 1;
                    }
                    if (Tab3_ApprRB2.Checked)
                    {
                        Approval = 0;
                    }

                    if (Tab3_Rb1_PayType1.Checked)
                    {
                        LeavePayType = 1;
                    }
                    if (Tab3_Rb1_PayType2.Checked)
                    {
                        LeavePayType = 0;
                    }

                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.Appprove_LeaveRequest(Convert.ToInt32(Tab3_keyField.Text), Convert.ToInt32(keyField.Text), Tab3_ApproverComments.Text.ToString(), LeavePayType, Approval, EmpId);
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        String  Result, LineManagerName, LineManagerEmail, EmpName, EmpEmail, LeaveType, LeaveStartDate, LeaveEndDate, StatusName;
                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Result = _DataRow["Result"].ToString();
                        if (Result == "")
                        {
                            LineManagerName  = _DataRow["ApproverName"].ToString();
                            LineManagerEmail = _DataRow["ApproverEmail"].ToString();
                            EmpName          = _DataRow["EmpName"].ToString();
                            EmpEmail         = _DataRow["EmpEmail"].ToString();
                            LeaveStartDate   = _DataRow["LeaveDate"].ToString();
                            LeaveEndDate     = _DataRow["LeaveEndDate"].ToString();
                            LeaveType        = _DataRow["LeaveType"].ToString();
                            StatusName       = _DataRow["StatusName"].ToString();

                            if ((LineManagerEmail != "") && (EmpEmail != "")) // Notify via Email if Email was used as a user Name
                            {
                                LeaveRequestApproval_Notification(EmpName, EmpEmail, LeaveStartDate, LeaveEndDate, LeaveType, StatusName, LineManagerName, LineManagerEmail);
                            }

                            ResetFields();
                        }
                        else
                        {
                            Tab3_Message.Visible  = true;
                            Tab3_Message.Text     = Result;
                            Tab3_Message.CssClass = "errorMessage";
                        }
                    }
                }
                else
                {
                    Tab3_Message.Visible  = true;
                    Tab3_Message.Text     = "Error:Could not save the information. Please check the inputs";
                    Tab3_Message.CssClass = "errorMessage";
                }
                LoadPendingLeaveRequestList();// Refresh the grid
            }
            catch (Exception exception)
            {
                Tab3_Message.Visible  = true;
                Tab3_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                Tab3_Message.CssClass = "errorMessage";
            }
        }
Exemple #9
0
        protected void Tab2_Cancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    if (Tab2_keyField.Text.ToString() == "0")
                    {
                        Tab2_Message2.Visible  = true;
                        Tab2_Message2.Text     = "Please select the leave request to cancel.";
                        Tab2_Message2.CssClass = "errorMessage";
                        return;
                    }
                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.Cancel_ApprovedLeaveRequest(Convert.ToInt32(Tab2_keyField.Text), Convert.ToInt32(keyField.Text), Tab2_ApproverComments.Text.ToString(), EmpId);
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        String  Result, LineManagerName, LineManagerEmail, EmpName, EmpEmail, LeaveType, LeaveStartDate, LeaveEndDate, StatusName;
                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Result = _DataRow["Result"].ToString();
                        if (Result == "")
                        {
                            EmpName        = _DataRow["EmpName"].ToString();
                            EmpEmail       = _DataRow["EmpEmail"].ToString();
                            LeaveStartDate = _DataRow["LeaveDate"].ToString();
                            LeaveEndDate   = _DataRow["LeaveEndDate"].ToString();
                            LeaveType      = _DataRow["LeaveType"].ToString();
                            StatusName     = _DataRow["StatusName"].ToString();

                            if (StatusName != "")
                            {
                                if (EmpEmail != "") // Notify via Email if Email was used as a user Name
                                {
                                    LeaveRequestCancel_Notification(EmpName, EmpEmail, LeaveStartDate, LeaveEndDate, LeaveType, StatusName);
                                }
                                Tab2_Message2.Visible  = true;
                                Tab2_Message2.Text     = "This request has been successfully cancelled and employee has been notified via email.";
                                Tab2_Message2.CssClass = "errorMessage";
                                ResetFields();
                            }
                        }
                        else
                        {
                            Tab2_Message2.Visible  = true;
                            Tab2_Message2.Text     = Result;
                            Tab2_Message2.CssClass = "errorMessage";
                        }
                    }
                }
                else
                {
                    Tab2_Message2.Visible  = true;
                    Tab2_Message2.Text     = "Error:Could not save the information. Please check the inputs";
                    Tab2_Message2.CssClass = "errorMessage";
                }
                LoadPendingLeaveRequestList();// Refresh the grid
            }
            catch (Exception exception)
            {
                Tab2_Message.Visible  = true;
                Tab2_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                Tab2_Message.CssClass = "errorMessage";
            }
        }
        private void EmailNotification_Requests(String HRAdminName, String HRAdminEmail, String LineManagerName, String LineManagerEmail, String FinanceHeadName, String FinanceHeadEmail, String DeptHeadName, String DeptHeadEmail, String ITHeadName, String ITHeadEmail, String EmpName, String EmpEmail, String RequestTypeName, String NewHireName, String NewHireDate, String NewHireDivision, String NewHireDept, String NewHireLocation, String Note, String StatusName)
        {
            string HRSystemLink           = ConfigurationManager.AppSettings["HRSystemURL"].ToString();
            string FromAddressDisplayName = ConfigurationManager.AppSettings["FromEmailDisplayName"].ToString();

            string subject     = "Ark HRMS Alerting Service: ";
            string bodycontent = "";


            // Set the subject
            if (NewHireName != "")
            {
                subject = subject + " " + RequestTypeName + " - " + NewHireName + '(' + NewHireDivision + "->" + NewHireLocation + "->" + NewHireDept + ')';
            }
            else
            {
                subject = subject + " " + RequestTypeName;
            }
            Note = Note.Replace("\r\n", "<br>");   // needed to translate the page break.

            bodycontent = "<html><body leftmargin=10 style=\"font-family: Arial;font-size:11\">" +
                          "<P><br><br> You have received an action alert regarding the request given below." +
                          "<br><br> Please note that you have received this email alert because you are listed as one of the action owners or approvers for this request. To view and act on the request, please go to <a href id=a1 runat=server href=" + HRSystemLink + ">" + FromAddressDisplayName + "</a>" +
                          "<br><br><u><b>Request Details</b></u>" +
                          "<br><br><b>Request Type:</b>" + subject +
                          "<br><b>Request Status:</b> " + StatusName +
                          "<br><b>Request Details:</b><br>" + Note +
                          "<br><br>In case you have received this in error, please contact your HR Administrator." +
                          "<br><br><br><font-size:14>THIS IS AN AUTOMATED,UNMONITORED EMAIL.PLEASE DO NOT REPLY OR FORWARD TO THIS EMAIL ADDRESS." +
                          "</P></body></HTML>";

            try
            {
                string      fromEmail = ConfigurationManager.AppSettings["FromEmail"].ToString();
                MailMessage message   = new MailMessage();
                message.IsBodyHtml = true;
                message.Subject    = subject;
                message.From       = new MailAddress(fromEmail, FromAddressDisplayName);

                if (LineManagerEmail.Trim() != "")
                {
                    message.To.Add(LineManagerEmail.Trim());
                }
                if (DeptHeadEmail.Trim() != "")
                {
                    message.To.Add(DeptHeadEmail.Trim());
                }
                if (HRAdminEmail.Trim() != "")
                {
                    message.To.Add(HRAdminEmail.Trim());
                }
                if (FinanceHeadEmail.Trim() != "")
                {
                    message.To.Add(FinanceHeadEmail.Trim());
                }

                if (ITHeadEmail.Trim() != "")
                {
                    message.To.Add(ITHeadEmail.Trim());
                }


                message.Body = bodycontent;
                // Add a carbon copy recipient.

                if (EmpEmail.Trim() != "")
                {
                    MailAddress copy = new MailAddress(EmpEmail);
                    message.CC.Add(copy);
                }
                // SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
                SmtpClient smtp = new SmtpClient();
                smtp.Send(message);
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "There was an error in notifying your request.");
                this.Hmessage.CssClass = "errorMessage";
            }
        }
        protected void Grid_EditCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Edit")
                {
                    this.Hmessage.Text      = "";
                    this.Hmessage.Visible   = false;
                    this.Tab1_keyField.Text = Grid.DataKeys[e.Item.ItemIndex].ToString();
                    Grid.EditItemIndex      = -1;
                    if (EmptyString(e.Item.Cells[0].Text) != "")
                    {
                        Tab1_RequestType.SelectedValue = Tab1_RequestType.Items.FindByText(e.Item.Cells[0].Text).Value;
                    }


                    if ((EmptyString(e.Item.Cells[0].Text) == StringEnum.stringValueOf(Constants.RequestType.Onboarding)) || (EmptyString(e.Item.Cells[0].Text) == StringEnum.stringValueOf(Constants.RequestType.Personal)))
                    {
                        EmployeeSelection.Visible = true;

                        if (EmptyString(e.Item.Cells[0].Text) == StringEnum.stringValueOf(Constants.RequestType.Onboarding)) // Onboarding Request
                        {
                            LoadNewHiresList(Tab1_NewHiresList, EmpId, (int)Constants.EmpStatusType.PreEmployment);
                        }
                        else if (EmptyString(e.Item.Cells[0].Text) == StringEnum.stringValueOf(Constants.RequestType.Personal)) // Personal Action Request
                        {
                            LoadNewHiresList(Tab1_NewHiresList, EmpId, (int)Constants.EmpStatusType.Payroll);
                        }

                        Tab1_NewHiresList.SelectedValue = Tab1_NewHiresList.Items.FindByValue(e.Item.Cells[5].Text).Value;
                    }
                    if (EmptyString(e.Item.Cells[7].Text) != "")
                    {
                        string   Implementors = EmptyString(e.Item.Cells[7].Text);
                        string[] ImplTypes    = Implementors.Split(';');
                        foreach (string word in ImplTypes)
                        {
                            Tab1_RequestImplType.Items.FindByText(word).Selected = true;
                        }
                    }
                    Tab1_Note.Text = EmptyString(e.Item.Cells[4].Text);
                    if (EmptyString(e.Item.Cells[6].Text) != "")
                    {
                        Tab1_RequestStatusType.Visible       = true;
                        Tab1_RequestStatusType.SelectedValue = Tab1_RequestStatusType.Items.FindByText(e.Item.Cells[6].Text).Value;
                    }

                    // Generate Salary Certificate
                    if ((EmptyString(e.Item.Cells[0].Text) == StringEnum.stringValueOf(Constants.RequestType.SalCertificate)))
                    {
                        GenerateSalaryCertificate();
                    }
                    if ((EmptyString(e.Item.Cells[6].Text) != StringEnum.stringValueOf(Constants.RequestStatusType.Submitted)) && (EmptyString(e.Item.Cells[6].Text) != StringEnum.stringValueOf(Constants.RequestStatusType.PendingApproval)))
                    {
                        this.Hmessage.Visible  = true;
                        this.Hmessage.CssClass = "errorMessage";
                        if (Page.User.IsInRole("HR Administrator") && (EmptyString(e.Item.Cells[6].Text) != StringEnum.stringValueOf(Constants.RequestStatusType.Closed)))
                        {
                            this.Hmessage.Text                = "This request can be only closed at this stage.";
                            this.Send_Request.Enabled         = true;
                            this.Cancel.Enabled               = true;
                            this.Tab1_RequestType.Enabled     = false;
                            this.Tab1_RequestImplType.Enabled = false;
                            this.Tab1_NewHiresList.Enabled    = false;
                        }
                        else
                        {
                            this.Hmessage.Text        = "This request can be only viewed at this stage.";
                            this.Send_Request.Enabled = false;
                            this.Cancel.Enabled       = true;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
        }
        protected void Send_Request_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)  // Change requestStatusType to be dynamic, currently 1=submitted.
                {
                    String  RequestImplTypeID = GetSelectedItems(Tab1_RequestImplType);
                    DataSet _DataList         = null;
                    _DataList             = DatabaseManager.Data.DBAccessManager.AddUpdateEmployeeRequest(Convert.ToInt32(NumericCheck_EmptyString(Tab1_keyField.Text)), EmpId, Int32.Parse(Tab1_RequestType.SelectedValue), RequestImplTypeID, Int32.Parse(Tab1_RequestStatusType.SelectedValue), Int32.Parse(Tab1_NewHiresList.SelectedValue), Tab1_Note.Text);
                    this.Hmessage.Visible = true;
                    Hmessage.CssClass     = "errorMessage";
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        String Result, HRAdminName, HRAdminEmail, LineManagerName, LineManagerEmail, DeptHeadName, DeptHeadEmail, EmpName, EmpEmail, ITHeadName, ITHeadEmail, FinanceHeadName, FinanceHeadEmail;
                        String StatusName, NewHireName, NewHireDate, NewHireDivision, NewHireLocation, NewHireDept, RequestTypeName;

                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Result = _DataRow["Result"].ToString();

                        if (Result == "")
                        {
                            HRAdminName      = _DataRow["HRAdminName"].ToString();
                            HRAdminEmail     = _DataRow["HRAdminEmail"].ToString();
                            LineManagerName  = _DataRow["LineManagerName"].ToString();
                            LineManagerEmail = _DataRow["LineManagerEmail"].ToString();
                            DeptHeadName     = _DataRow["DeptHeadName"].ToString();
                            DeptHeadEmail    = _DataRow["DeptHeadEmail"].ToString();
                            EmpName          = _DataRow["EmpName"].ToString();
                            EmpEmail         = _DataRow["EmpEmail"].ToString();
                            ITHeadName       = _DataRow["ITHeadName"].ToString();
                            ITHeadEmail      = _DataRow["ITHeadEmail"].ToString();
                            FinanceHeadName  = _DataRow["FinanceHeadName"].ToString();
                            FinanceHeadEmail = _DataRow["FinanceHeadEmail"].ToString();
                            NewHireName      = _DataRow["NewHireName"].ToString();
                            NewHireDate      = _DataRow["NewHireHireDate"].ToString();
                            NewHireDivision  = _DataRow["NewHireDivision"].ToString();
                            NewHireDept      = _DataRow["NewHireDeptName"].ToString();
                            NewHireLocation  = _DataRow["NewHireLocation"].ToString();
                            RequestTypeName  = _DataRow["RequestTypeName"].ToString();
                            StatusName       = _DataRow["StatusName"].ToString();
                            EmailNotification_Requests(HRAdminName, HRAdminEmail, LineManagerName, LineManagerEmail, FinanceHeadName, FinanceHeadEmail, DeptHeadName, DeptHeadEmail, ITHeadName, ITHeadEmail, EmpName, EmpEmail, RequestTypeName, NewHireName, NewHireDate, NewHireDivision, NewHireDept, NewHireLocation, Tab1_Note.Text, StatusName);
                            // For Resignation request approval, email has to be sent to HR with explanation. Make email routine come with custom body content.
                            //      if ((Tab1_RequestType.SelectedItem.ToString() == "Resignation Request") && (Tab1_RequestStatusType.SelectedItem.ToString() == "Approved"))
                            //      {
                            //          EmailNotification_Requests(HRAdminName, HRAdminEmail, LineManagerName, LineManagerEmail, FinanceHeadName, FinanceHeadEmail, DeptHeadName, DeptHeadEmail, ITHeadName, ITHeadEmail, EmpName, EmpEmail, RequestTypeName, NewHireName, NewHireDate, NewHireDivision, NewHireDept, NewHireLocation, Tab1_Note.Text);

                            //     }
                            ResetFields();
                        }
                        else
                        {
                            this.Hmessage.Text     = Result;
                            this.Hmessage.CssClass = "errorMessage";
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
            LoadEmployeeRequests();// Refresh the grid
        }
Exemple #13
0
 private void MemberLogin(object sender, System.EventArgs e)
 {
     try
     {
         if (Page.IsValid == true)
         {
             DataSet _DataList      = null;
             String  userName       = string.Empty;
             String  roleName       = string.Empty;
             String  userEmail      = string.Empty;
             String  MemberName     = string.Empty;
             String  PasswordExpiry = string.Empty;
             _DataList = DBAccessManager.ValidateLogin(this.EmailAddress.Text.ToString().Trim(), SchoolNetBase.EncodePasswordToBase64(this.Login_Password.Text.ToString().Trim()));
             if (_DataList.Tables.Count > 0)
             {
                 if (_DataList.Tables[0].Rows.Count > 0) // Member Login Information
                 {
                     DataRow _DataRow = _DataList.Tables[0].Rows[0];
                     userName       = _DataRow["EmpId"].ToString();
                     roleName       = _DataRow["RoleName"].ToString();
                     userEmail      = _DataRow["Work_Email"].ToString();
                     MemberName     = _DataRow["MemberName"].ToString();
                     PasswordExpiry = _DataRow["PasswordExpiry"].ToString();
                 }
                 // If the password has expired, redirect to change password screen
                 if (PasswordExpiry != "")
                 {
                     Tab1_keyField.Text     = EmailAddress.Text.ToString().Trim();
                     Login_Pane.Visible     = false;
                     ChangePassword.Visible = true;
                     errorMessage1.Text     = "";
                 }
                 else
                 {
                     DateTime expiryDate   = DateTime.Now.AddMinutes(60);// Default
                     bool     isPersistent = false;
                     if (login_RememberMe.Checked)
                     {
                         //clear any other tickets that are already in the response
                         Response.Cookies.Clear();
                         //set the new expiry date - to thirty days from now
                         expiryDate = DateTime.Now.AddDays(30);
                         //create a new forms auth ticket
                         isPersistent = true;
                     }
                     FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userName, DateTime.Now, expiryDate, isPersistent, roleName);
                     //encrypt the ticket
                     String encryptedTicket = FormsAuthentication.Encrypt(ticket);
                     //create a new authentication cookie - and set its expiration date
                     HttpCookie authenticationCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                     authenticationCookie.Expires = ticket.Expiration;
                     //add the cookie to the response.
                     Response.Cookies.Add(authenticationCookie);
                     Session["MemberName"]  = MemberName;
                     Session["MemberEmail"] = userEmail;
                     String redirectUrl = "";
                     if (roleName == "HR Administrator")
                     {
                         redirectUrl = FormsAuthentication.GetRedirectUrl(userName, false);
                     }
                     if (roleName == "Payroll Administrator")
                     {
                         redirectUrl = Page.ResolveUrl("~/Payroll/PayrollDashboard.aspx");
                     }
                     if (roleName == "Supervisor" || roleName == "Employee")
                     {
                         redirectUrl = Page.ResolveUrl("~/Common/EmployeeProfile.aspx");
                     }
                     if (roleName == "Data Entry Clerk")
                     {
                         redirectUrl = Page.ResolveUrl("~/Clerical/EnterDailyFNTrans.aspx");
                     }
                     if (redirectUrl.Equals(String.Empty))
                     {
                         redirectUrl = Page.ResolveUrl("~/Common/EmployeeProfile.aspx");
                     }
                     Page.Response.Redirect(redirectUrl);
                 }
             }
             else
             {
                 this.errorMessage1.Visible  = true;
                 this.EmailAddress.Text      = "";
                 this.Login_Password.Text    = "";
                 this.errorMessage1.Text     = "Invalid Email Id or Password. Please check your credentials.";
                 this.errorMessage1.CssClass = "validationtxt2";
             }
         }
     }
     catch (Exception exception)
     {
         this.errorMessage1.Visible  = true;
         this.EmailAddress.Text      = "";
         this.Login_Password.Text    = "";
         this.errorMessage1.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
         this.errorMessage1.CssClass = "validationtxt2";
     }
 }
        protected void LeaveRequest_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)  // Change requestStatusType to be dynamic, currently 1=submitted.
                {
                    Hmessage.Visible  = true;
                    Hmessage.CssClass = "errorMessage";

                    if (Tab1_keyField.Text.ToString() == "")
                    {
                        Tab1_keyField.Text = "0";
                    }

                    Int32 DayType = 1;
                    if (Tab1_DayRB1.Checked)
                    {
                        DayType = 1;
                    }
                    if (Tab1_DayRB2.Checked)
                    {
                        DayType = 0;
                    }
                    if ((ConvertDMY_MDY(Tab1_StartDate).ToString() != ConvertDMY_MDY(Tab1_EndDate).ToString()) && (DayType == 0))
                    {
                        this.Hmessage.Text     = "You can not choose half day option when you file leave for more than 1 days.Please change it to Full Day Option.";
                        this.Hmessage.CssClass = "errorMessage";
                        return;
                    }


                    DataSet _DataList = null;
                    _DataList = DatabaseManager.Data.DBAccessManager.AddUpdateLeaveRequest(Convert.ToInt32(Tab1_keyField.Text), EmpId, ConvertDMY_MDY(Tab1_StartDate), ConvertDMY_MDY(Tab1_EndDate), Int32.Parse(Tab1_LeaveTypeList.SelectedValue), Tab1_Comments.Text.ToString(), DayType);
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        String  Result, HRAdminName, HRAdminEmail, LineManagerName, LineManagerEmail, DeptHeadName, DeptHeadEmail, EmpName, EmpEmail, LeaveTypeName;
                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Result = _DataRow["Result"].ToString();

                        if (Result == "")
                        {
                            LineManagerName  = _DataRow["LineManagerName"].ToString();
                            LineManagerEmail = _DataRow["LineManagerEmail"].ToString();
                            HRAdminName      = _DataRow["HRAdminName"].ToString();
                            HRAdminEmail     = _DataRow["HRAdminEmail"].ToString();
                            DeptHeadName     = _DataRow["DeptHeadName"].ToString();
                            DeptHeadEmail    = _DataRow["DeptHeadEmail"].ToString();
                            EmpName          = _DataRow["EmpName"].ToString();
                            EmpEmail         = _DataRow["EmpEmail"].ToString();
                            LeaveTypeName    = _DataRow["LeaveTypeName"].ToString();
                            String LeaveStartDate = ConvertDMY_MDY(Tab1_StartDate);
                            String LeaveEndDate   = ConvertDMY_MDY(Tab1_EndDate);

                            if ((LineManagerEmail != "") || (DeptHeadEmail != "") || (HRAdminEmail != "")) // Notify via Email if Email was used as a user Name
                            {
                                NotifyApproversViaEmail(EmpName, EmpEmail, LeaveStartDate, LeaveEndDate, LeaveTypeName, LineManagerName, LineManagerEmail, DeptHeadName, DeptHeadEmail, HRAdminName, HRAdminEmail);
                            }
                            ResetFields();
                        }
                        else
                        {
                            this.Hmessage.Text     = Result;
                            this.Hmessage.CssClass = "errorMessage";
                        }
                    }
                }
                else
                {
                    this.Hmessage.Text     = "Error:Could not save the information. Please check the inputs";
                    this.Hmessage.CssClass = "errorMessage";
                }
                LoadLeaveRequestList();// Refresh the grid
            }
            catch (Exception exception)
            {
                this.Hmessage.Visible  = true;
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }
        }
Exemple #15
0
        private void LoadDataList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveDashboardData();

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        DataRow _employeeDataRow = _DataList.Tables[0].Rows[0];
                        lblCattles.Text       = _employeeDataRow["AvailableCattles"].ToString();
                        lblMaleCattles.Text   = _employeeDataRow["MaleCattles"].ToString();
                        lblFemaleCattles.Text = _employeeDataRow["FemaleCattles"].ToString();
                    }
                    else
                    {
                        lblCattles.Text       = "0";
                        lblMaleCattles.Text   = "0";
                        lblFemaleCattles.Text = "0";
                    }
                    if (_DataList.Tables[1].Rows.Count > 0)
                    {
                        DataRow _employeeDataRow = _DataList.Tables[1].Rows[0];
                        lblEmployees.Text     = _employeeDataRow["ActiveEmployees"].ToString();
                        lblVeterinarians.Text = _employeeDataRow["TotalVets"].ToString();
                        lblTrainers.Text      = _employeeDataRow["TotalTrainers"].ToString();
                    }
                    else
                    {
                        lblEmployees.Text     = "0";
                        lblVeterinarians.Text = "0";
                        lblTrainers.Text      = "0";
                    }
                    if (_DataList.Tables[2].Rows.Count > 0)
                    {
                        DataRow _employeeDataRow = _DataList.Tables[2].Rows[0];
                        lblDrugItems.Text = _employeeDataRow["DrugItemsCount"].ToString();
                    }
                    else
                    {
                        lblDrugItems.Text = "0";
                    }
                    if (_DataList.Tables[3].Rows.Count > 0)
                    {
                        DataRow _employeeDataRow = _DataList.Tables[3].Rows[0];
                        lblLocations.Text = _employeeDataRow["LocationCount"].ToString();
                    }
                    else
                    {
                        lblLocations.Text = "0";
                    }
                    if (_DataList.Tables[7].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[7].Rows)
                        {
                            var recentTreatment = new AlertBoardInputs();
                            recentTreatment.monthVal    = row["MonthLabel"].ToString();
                            recentTreatment.dayVal      = Int32.Parse(row["DayLabel"].ToString());
                            recentTreatment.title       = row["Title"].ToString();
                            recentTreatment.description = row["Description"].ToString();
                            recentTreatments.Add(recentTreatment);
                        }
                    }
                    if (_DataList.Tables[8].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[8].Rows)
                        {
                            var recentLabTest = new AlertBoardInputs();
                            recentLabTest.monthVal    = row["MonthLabel"].ToString();
                            recentLabTest.dayVal      = Int32.Parse(row["DayLabel"].ToString());
                            recentLabTest.title       = row["Title"].ToString();
                            recentLabTest.description = row["Description"].ToString();
                            recentLabTests.Add(recentLabTest);
                        }
                    }
                    if (_DataList.Tables[9].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[9].Rows)
                        {
                            var upcomingTreatment = new AlertBoardInputs();
                            upcomingTreatment.monthVal    = row["MonthLabel"].ToString();
                            upcomingTreatment.dayVal      = Int32.Parse(row["DayLabel"].ToString());
                            upcomingTreatment.title       = row["Title"].ToString();
                            upcomingTreatment.description = row["Description"].ToString();
                            upcomingTreatments.Add(upcomingTreatment);
                        }
                    }
                    if (_DataList.Tables[10].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[10].Rows)
                        {
                            var leastStockDrug = new ProgressBarInputs();
                            leastStockDrug.item         = row["ItemName"].ToString();
                            leastStockDrug.itemType     = row["DrugTypeName"].ToString();
                            leastStockDrug.mainvalue    = int.Parse(row["CurrentStock"].ToString());
                            leastStockDrug.valuePercent = float.Parse(row["Availability"].ToString());
                            leastStockDrug.valuedemo    = float.Parse(row["AvailabilityDemo"].ToString());
                            leastStockDrugs.Add(leastStockDrug);
                        }
                    }
                    if (_DataList.Tables[12].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[12].Rows)
                        {
                            var nextRace = new AlertBoardInputs();
                            nextRace.monthVal    = row["MonthLabel"].ToString();
                            nextRace.dayVal      = Int32.Parse(row["DayLabel"].ToString());
                            nextRace.title       = row["Title"].ToString();
                            nextRace.description = row["Description"].ToString();
                            nextRaces.Add(nextRace);
                        }
                    }
                    if (_DataList.Tables[13].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[13].Rows)
                        {
                            var trainer = new TopProfiles();
                            trainer.ID         = Int32.Parse(row["TrainerID"].ToString());
                            trainer.Name       = row["TrainerName"].ToString();
                            trainer.prizeMoney = row["CurrencyPrize"].ToString();
                            trainer.wins       = row["Wins"].ToString();
                            trainer.runs       = Int32.Parse(row["Runs"].ToString());
                            topTrainers.Add(trainer);
                        }
                    }
                    if (_DataList.Tables[14].Rows.Count > 0)
                    {
                        foreach (DataRow row in _DataList.Tables[14].Rows)
                        {
                            var racer = new TopProfiles();
                            racer.ID         = Int32.Parse(row["AnimalID"].ToString());
                            racer.Name       = row["AnimalName"].ToString();
                            racer.prizeMoney = row["CurrencyPrize"].ToString();
                            racer.wins       = row["Wins"].ToString();
                            racer.runs       = Int32.Parse(row["Runs"].ToString());
                            topRacers.Add(racer);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
            }
        }
Exemple #16
0
        protected void Save_Cattle_Click(object sender, EventArgs e)
        {
            Int32 BornOutside; Int32 CattleStatus = (int)Constants.AnimalStatusType.InHouse;

            try
            {
                if (Page.IsValid == true)
                {
                    if (Tab1_BornOutside1.Checked)
                    {
                        BornOutside = 1;
                    }
                    else
                    {
                        BornOutside = 0;
                    }

                    //   if (Tab1_MicrochipID.Text == "") { Tab1_MicrochipID.Text = "0"; }
                    if (Tab1_BirthWeight.Text == "")
                    {
                        Tab1_BirthWeight.Text = "0";
                    }
                    if (Tab1_BirthHeight.Text == "")
                    {
                        Tab1_BirthHeight.Text = "0";
                    }
                    if (Tab1_KeyField.Text.ToString() == "")
                    {
                        Tab1_KeyField.Text = "0";
                    }
                    String Result = DatabaseManager.Data.DBAccessManager.AddUpdateCattle(Int32.Parse(Tab1_KeyField.Text), Tab1_CattleName.Text.ToString(),
                                                                                         Tab1_CattleShortName.Text.ToString(), Tab1_AnimalTagId.Text.ToString(), -1, CattleStatus, Int32.Parse(Tab1_BreedType.SelectedValue), Tab1_MicrochipID.Text.ToString(), Int32.Parse(Tab1_Trainer.SelectedValue), Int32.Parse(Tab1_Veterinary.SelectedValue), Int32.Parse(Tab1_Location.SelectedValue), Int32.Parse(Tab1_GenderType.SelectedValue), ConvertDMY_MDY(Tab1_DOB),
                                                                                         BornOutside, Double.Parse(Tab1_BirthWeight.Text), Double.Parse(Tab1_BirthHeight.Text), Int32.Parse(Tab1_MaleParent.SelectedValue), Int32.Parse(Tab1_FemaleParent.SelectedValue), Tab1_CattleColor.Text.ToString(), ConvertDMY_MDY(Tab1_AnimalAdopted), "", Tab1_Notes.Text.ToString(), EmpId);

                    this.AlertDiv.Visible = true;

                    if (Result == "")
                    {
                        this.AlertDiv.Attributes["class"] = "alert alert-success alert-dismissible fade in";
                        this.message.Text = "Successfully saved.";
                        ResetFields();
                    }
                    else
                    {
                        this.AlertDiv.Attributes["class"] = "alert alert-danger alert-dismissible fade in";
                        this.message.Text = Result;
                    }
                }
                else
                {
                    this.AlertDiv.Attributes["class"] = "alert alert-danger alert-dismissible fade in";
                    this.message.Text = "Error:Could not save the information. Please check the inputs";
                    //this.message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.AlertDiv.Visible             = true;
                this.AlertDiv.Attributes["class"] = "alert alert-danger alert-dismissible fade in";
                this.message.Text = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                //  this.message.CssClass = "errorMessage";
            }
        }
Exemple #17
0
        private void LoadBenefitDeductionList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeBenefitInfo(Int32.Parse(keyField.Text.ToString()));
                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0) // Benefit Information
                    {
                        DataTable _BenefitTable = _DataList.Tables[0];
                        this.Tab1Grid.DataSource = _BenefitTable;
                        this.Tab1Grid.DataBind();
                    }
                    else
                    {
                        this.Tab1Grid.DataSource = null;
                        this.Tab1Grid.DataBind();
                    }


                    if (_DataList.Tables[2].Rows.Count > 0) // Bank Information
                    {
                        DataRow _DataRow = _DataList.Tables[2].Rows[0];
                        if (Tab4_EmployeeBankAccount.Text == "")
                        {
                            Tab4_EmployeeBankAccount.Text = _DataRow["BankAccount"].ToString();
                        }
                        if (_DataRow["BankID"].ToString() != "")
                        {
                            if (Tab4_BankName.SelectedValue == "-1") // do this binding only for the first time.
                            {
                                Tab4_BankName.SelectedValue = _DataRow["BankID"].ToString();
                            }
                        }
                    }
                    if (_DataList.Tables[3].Rows.Count > 0) // Incentives Information
                    {
                        DataTable _IncentivesTable = _DataList.Tables[3];
                        this.Tab2Grid.DataSource = _IncentivesTable;
                        this.Tab2Grid.DataBind();
                    }
                    else
                    {
                        this.Tab2Grid.DataSource = null;
                        this.Tab2Grid.DataBind();
                    }
                    if (_DataList.Tables[4].Rows.Count > 0) // NonPayroll Benefit Information
                    {
                        DataTable _NPBenefitsTable = _DataList.Tables[4];
                        this.Tab3Grid.DataSource = _NPBenefitsTable;
                        this.Tab3Grid.DataBind();
                    }
                    else
                    {
                        this.Tab3Grid.DataSource = null;
                        this.Tab3Grid.DataBind();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }
        }
        protected void LoadEmployeeMonthlyPayrollInfo(Int32 EmpId, String MonthYear)
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeMonthlyPayrollInfo(EmpId, MonthYear, Int32.Parse(Page.User.Identity.Name.ToString()));

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0) // Standard Pay Components.
                    {
                        Tab1Grid.DataSource = _DataList.Tables[0];
                        Tab1Grid.DataBind();
                    }
                    else
                    {
                        Tab1Grid.DataSource = null;
                        Tab1Grid.DataBind();
                        this.message.Visible  = true;
                        this.message.Text     = "Standard Benefit Components(Allowances/Ded) are not setup for this employee.Please setup benefit records via Manage Benefit Screen before payroll process";
                        this.message.CssClass = "errorMessage";
                        Payroll_Save.Enabled  = false;
                        return;
                    }
                    if (_DataList.Tables[1].Rows.Count > 0) // Adhoc Pay Components
                    {
                        Tab2Grid.DataSource = _DataList.Tables[1];
                        Tab2Grid.DataBind();
                    }
                    else
                    {
                        Tab2Grid.DataSource = null;
                        Tab2Grid.DataBind();
                    }
                    if (_DataList.Tables[2].Rows.Count > 0) // Leave/Bank Information
                    {
                        DataRow _DataRow = _DataList.Tables[2].Rows[0];
                        Tab1_CurrenyLabel1.Text    = "(All Figures in " + _DataRow["CurrencyCode"].ToString() + ")";
                        Tab1_NoOfDaysPayCycle.Text = _DataRow["TotalDays_PayCycle"].ToString();
                        Tab1_NofUnpaidDays.Text    = _DataRow["TotalDays_Unpaid"].ToString();
                        Tab1_NetPayDays.Text       = _DataRow["NetPayDays"].ToString();
                        Tab1_UnusedVacDays.Text    = _DataRow["UnusedVacDays"].ToString();
                        payperiod.Visible          = true;
                        Tab1_PayStartDate.Text     = _DataRow["PayStartDate"].ToString();
                        Tab1_PayEndDate.Text       = _DataRow["PayEndDate"].ToString();

                        if (_DataRow["BankAccount"].ToString() != "")
                        {
                            Tab1_EmployeeBankAccount.Text = _DataRow["BankAccount"].ToString();
                        }
                        if (_DataRow["BankId"].ToString() != "")
                        {
                            Tab1_BankName.SelectedValue = _DataRow["BankId"].ToString();
                        }
                        if (_DataRow["PayrollNote"].ToString() != "")
                        {
                            Tab1_Note.Text = _DataRow["PayrollNote"].ToString();
                        }
                        else
                        {
                            Tab1_Note.Text = "";
                        }
                        LoadPayrollStatusTypeLookup(Tab1_PayrollStatusType, (int)Constants.PayrollStatusType.Preview);

                        if (Int32.Parse(_DataRow["PayrollStatusTypeID"].ToString()) == (int)Constants.PayrollStatusType.Processed) // Allow to view pay slip
                        {
                            LoadPayrollStatusTypeLookup(Tab1_PayrollStatusType, (int)Constants.PayrollStatusType.Processed);
                            Payroll_Save.Enabled      = false;
                            Payroll_StartOver.Enabled = false;
                            // Enable payroll download link
                            WPSDownloadLink.Visible     = true;
                            WPSDownloadLink.Text        = "Click here to view this pay slip";
                            WPSDownloadLink.CssClass    = "validationtxt";
                            WPSDownloadLink.NavigateUrl = "~/Payroll/ViewPayStub.aspx?empId=" + EmpId + "&PayMonthYear=" + MonthYear;
                            WPSDownloadLink.Target      = "_blank";
                        }
                        else
                        {
                            Payroll_Save.Enabled      = true;
                            Payroll_StartOver.Enabled = true;
                        }
                        if (Int32.Parse(_DataRow["PayrollStatusTypeID"].ToString()) == (int)Constants.PayrollStatusType.Pending) // Allow Preview
                        {
                            // Enable payroll download link
                            WPSDownloadLink.Visible     = true;
                            WPSDownloadLink.Text        = "Click here to preview this pay slip";
                            WPSDownloadLink.CssClass    = "validationtxt";
                            WPSDownloadLink.NavigateUrl = "~/Payroll/ViewPayStub.aspx?empId=" + EmpId + "&PayMonthYear=" + MonthYear;
                            WPSDownloadLink.Target      = "_blank";
                        }

                        if (Int32.Parse(_DataRow["PayrollStatusTypeID"].ToString()) == (int)Constants.PayrollStatusType.New) // New. Hide the link
                        {
                            WPSDownloadLink.Visible = false;
                        }


                        if (_DataRow["PayrollStatusTypeID"].ToString() != "")
                        {
                            Tab1_PayrollStatusType.SelectedValue = _DataRow["PayrollStatusTypeID"].ToString();
                        }
                        Tab1_NetPay.Text = _DataRow["NetPay"].ToString();
                        if (_DataRow["EOSPayout"].ToString() == "1")
                        {
                            Tab1_EOSCheckBox.Checked = true;
                        }
                        else
                        {
                            Tab1_EOSCheckBox.Checked = false;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }
        }