Beispiel #1
0
        private void DeleteLeaveRequest(Int32 LeaveRequestID)
        {
            try
            {
                String result = DatabaseManager.Data.DBAccessManager.DeleteLeaveRequest(LeaveRequestID, Int32.Parse(keyField.Text.ToString()));

                if (result != "")
                {
                    Tab2_Message.Visible  = true;
                    Tab2_Message.Text     = result;
                    Tab2_Message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                Tab2_Message.Visible  = true;
                Tab2_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                Tab2_Message.CssClass = "errorMessage";
            }
            LGrid.CurrentPageIndex = 0;
            LoadLeaveRequestList();
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    if (Tab1_KeyField.Text.ToString() == "")
                    {
                        Tab1_KeyField.Text = "0";
                    }
                    String Result = DatabaseManager.Data.DBAccessManager.AddUpdatePharmacyPurchase(Int32.Parse(Tab1_KeyField.Text), Int32.Parse(DrugId.SelectedValue), BillReference.Text, ConvertDMY_MDY(PurchaseDate), Int32.Parse(Quantity.Text), Double.Parse(UnitPrice.Text), ConvertDMY_MDY(ExpiryDate), Comments.Text, Int32.Parse(Page.User.Identity.Name.ToString()));

                    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";
                }
            }
            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.");
            }
            LoadDataList(); // Refresh the Grid after Save.
        }
Beispiel #3
0
        private void LoadPayrollDataList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrievePayrollDashBoardDataByEmpID(Int32.Parse(Page.User.Identity.Name.ToString()), Int32.Parse(businessUnitDDList.SelectedValue), Int32.Parse(DivisionLocationList.SelectedValue));

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[2].Rows.Count > 0) // Current Month Payroll data/Status
                    {
                        DataTable _DataTable = _DataList.Tables[2];
                        Grid8.DataSource = _DataTable;
                        Grid8.DataBind();
                    }
                    else
                    {
                        Grid8.DataSource = null;
                        Grid8.DataBind();
                    }

                    if (_DataList.Tables[3].Rows.Count > 0) // Historical data for payroll
                    {
                        DataTable _DataTable = _DataList.Tables[3];
                        Grid9.DataSource = _DataTable;
                        Grid9.DataBind();
                    }
                    else
                    {
                        Grid9.DataSource = null;
                        Grid9.DataBind();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
            }
        }
        protected void EmpTrain_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)  // Change requestStatusType to be dynamic, currently 1=submitted.
                {
                    if (Tab1_keyField.Text.ToString() == "")
                    {
                        Tab1_keyField.Text = "0";
                    }
                    if (Tab1_Duration.Text.ToString() == "")
                    {
                        Tab1_Duration.Text = "0";
                    }


                    String Result = DatabaseManager.Data.DBAccessManager.AddUpdateEmployeeTraining(Convert.ToInt32(Tab1_keyField.Text), EmpId, Tab1_TrainingName.Text.ToString(), Int32.Parse(Tab1_TrainingType.SelectedValue), Tab1_Description.Text.ToString(), ConvertDMY_MDY(Tab1_DateCompleted), Int32.Parse(Tab1_Duration.Text.ToString()));

                    this.Hmessage.Visible = true;
                    Hmessage.CssClass     = "errorMessage";
                    if (Result == "")
                    {
                        ResetFields();
                    }
                }
                else
                {
                    this.Hmessage.Text     = "Error:Could not save the information. Please check the inputs";
                    this.Hmessage.CssClass = "errorMessage";
                }
                LoadEmployeeTrainingList();// 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";
            }
        }
Beispiel #5
0
        private void DeleteUserAccount(Int32 Emp_Id)
        {
            try
            {
                String result = DatabaseManager.Data.DBAccessManager.DeleteUserAccount(Emp_Id);

                if (result != "")
                {
                    this.Hmessage.Text     = "Error:Could not delete the user account. Please check the data";
                    this.Hmessage.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.Hmessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.Hmessage.CssClass = "errorMessage";
            }


            UsersGrid.CurrentPageIndex = 0;
            LoadPortalUserAccounts();
        }
        protected void Save_Preference_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    keyField.Text = EmpId.ToString(); // Hardcoded value
                    Int32 Alerting = 0;
                    if (Tab1_ApprCheckBox1.Checked)
                    {
                        Alerting = 1;
                    }
                    if (Tab1_PersistDays.Text.ToString() == "")
                    {
                        Tab1_PersistDays.Text = "0";
                    }

                    String Result = DatabaseManager.Data.DBAccessManager.SavePreferences(Int32.Parse(this.keyField.Text.ToString()), Alerting, Tab1_EmailAddress.Text.ToString(), Tab1_EmergencyPhone.Text.ToString(), Int32.Parse(Tab1_PersistDays.Text.ToString()));
                    this.message.Visible = true;
                    if (Result == "")
                    {
                        this.message.Text     = "Successfully saved.";
                        this.message.CssClass = "errorMessage";
                    }
                }
                else
                {
                    this.message.Text     = "Error:Could not save the information. Please check the inputs";
                    this.message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.message.Visible  = true;
                this.message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.message.CssClass = "errorMessage";
            }
        }
Beispiel #7
0
        private void LoadDependentsList()
        {
            DataTable _empDependentDataTable = null;

            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeInfo(Int32.Parse(this.keyField.Text.ToString()));
                if (_DataList.Tables[1].Rows.Count > 0)  // Employee Dependent Information.
                {
                    _empDependentDataTable = _DataList.Tables[1];
                    this.DPGrid.DataSource = _empDependentDataTable;
                    this.DPGrid.DataBind();
                    DPmessage.Text    = "";
                    DPmessage.Visible = false;
                    emptyRow2.Text    = "";
                    emptyRow2.Visible = false;
                }
                else
                {
                    this.DPGrid.DataSource = null;
                    this.DPGrid.DataBind();
                }
            }
            catch (Exception exception)
            {
                if (DPGrid.CurrentPageIndex >= DPGrid.PageCount)
                {
                    DPGrid.CurrentPageIndex -= 1;
                    this.DPGrid.DataSource   = _empDependentDataTable;
                    this.DPGrid.DataBind();
                }
                else
                {
                    ErrorLogging.LogError(exception, " ");
                }
            }
        }
Beispiel #8
0
        /* Used for saving as PDF. This is not complete due to htmlparser error. */

        protected void SavePDF_Click(object sender, EventArgs e)
        {
            try
            {
                string HRSystemLink = ConfigurationManager.AppSettings["HRSystemURL"].ToString();
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "attachment;filename=payslip.pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                StringWriter   sw = new StringWriter();
                HtmlTextWriter hw = new HtmlTextWriter(sw);
                LoadEmployeePayrollInfo(Int32.Parse(Page.User.Identity.Name.ToString()), Payroll_Date.Text);
                PayStubViewPaycomponents.RenderControl(hw);
                StringBuilder sb = new StringBuilder();
                /* html to parse */
                //  sb.Append("<html><head><title>AON ME HR System-Payroll</title>");
                //   sb.Append("<link rel=stylesheet type=text/css href=\"http://localhost:56141/HRMSNet_Dev/CSS/CommonStyles.css \" />");
                //  sb.Append("<link rel=stylesheet type=text/css href=\""+HRSystemLink+"/CSS/CommonStyles.css media=all\" />");
                sb.Append("<html><body><table>");
                sb.Append(sw.ToString());
                sb.Append("</table></body></html>");
                StringReader sr     = new StringReader(sb.ToString());
                Document     pdfDoc = new Document(PageSize.A4, 7f, 7f, 7f, 0f);
                // pdfDoc.HtmlStyleClass = "mainheadtxt4";
                HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
                PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
                pdfDoc.Open();
                htmlparser.Parse(sr);
                pdfDoc.Close();
                Response.Write(pdfDoc);
                Response.End();
            }
            catch (Exception exception)
            {
                this.message.Visible  = true;
                this.message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                this.message.CssClass = "errorMessage";
            }
        }
Beispiel #9
0
        protected void Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    Int32 Status = 0;
                    if (Radio1.Checked)
                    {
                        Status = 1;
                    }
                    if (Tab1_KeyField.Text.ToString() == "")
                    {
                        Tab1_KeyField.Text = "0";
                    }
                    String Result = DatabaseManager.Data.DBAccessManager.AddUpdateDepartment(Int32.Parse(Page.User.Identity.Name.ToString()), Int32.Parse(Tab1_KeyField.Text), DeptName.Text, DeptPrefix.Text, GLCode.Text, Status);

                    this.Tab1_Message.Visible  = true;
                    this.Tab1_Message.CssClass = "errorMessage";
                    if (Result == "")
                    {
                        ResetFields();
                    }
                }
                else
                {
                    this.Tab1_Message.Text     = "Error:Could not save the information. Please check the inputs";
                    this.Tab1_Message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.Tab1_Message.Visible  = true;
                this.Tab1_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                this.Tab1_Message.CssClass = "errorMessage";
            }
            LoadDataList(); // Refresh the Grid after Save.
        }
Beispiel #10
0
        protected void PreviewEmployeeMonthlyPayroll(String Pay_MonthYear, Int32 DivisionID, Int32 DivisionLocationID, Int32 RequestingEmpId)
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeMonthlyPayroll_Preview(Pay_MonthYear, DivisionID, DivisionLocationID, RequestingEmpId);

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0)
                    {
                        this.message.Visible = false;
                        this.message.Text    = "";
                        DataTable _dataTable = _DataList.Tables[0];
                        ExportToExcel(_dataTable);
                    }
                    else
                    {
                        this.message.Visible  = true;
                        this.message.Text     = "No matching data found!.";
                        this.message.CssClass = "errorMessage";
                    }
                }
                else
                {
                    this.message.Visible  = true;
                    this.message.Text     = "No Pending Payroll data exists to process";
                    this.message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                // ErrorLogging.LogError(exception, "");
                this.message.Visible  = true;
                this.message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.message.CssClass = "errorMessage";
            }
        }
Beispiel #11
0
        protected void Tab2_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true)
                {
                    if (Tab2_keyField.Text.ToString() == "")
                    {
                        Tab2_keyField.Text = "0";
                    }
                    String Result = DatabaseManager.Data.DBAccessManager.AddUpdateDailyFNTransactions(Int32.Parse(Tab2_EmployeeList.SelectedValue), Int32.Parse(Tab2_PayComponentList.SelectedValue), Decimal.Parse(NumericCheck_EmptyString(Tab2_Amount.Text)), Int32.Parse(Page.User.Identity.Name.ToString()));

                    this.Tab2_Message.Visible  = true;
                    this.Tab2_Message.CssClass = "errorMessage";
                    if (Result == "")
                    {
                        this.Tab2_Message.Text = "Successfully saved.";
                        ClearTab2();
                    }
                    else
                    {
                        this.Tab2_Message.Text = Result;
                    }
                }
                else
                {
                    this.Tab2_Message.Text     = "Error:Could not save the information. Please check the inputs and submit again";
                    this.Tab2_Message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.Tab2_Message.Visible  = true;
                this.Tab2_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                this.Tab2_Message.CssClass = "errorMessage";
            }
            LoadDailyFNTransactionsList();
        }
Beispiel #12
0
        protected void LGrid_EditCommand(object source, DataGridCommandEventArgs e)
        {
            Tab2_KeyField.Text = LGrid.DataKeys[e.Item.ItemIndex].ToString(); // LocationID
            DivisionName.Text  = EmptyString(e.Item.Cells[0].Text);
            Int32 DivisionID = Int32.Parse(EmptyString(e.Item.Cells[1].Text));

            LoadSupervisorsListLookupByDivisionID(SupervisorDDList, DivisionID);
            if (EmptyString(e.Item.Cells[8].Text.Trim()) != "")
            {
                try
                {
                    Tab2_CountryList.SelectedValue = Tab2_CountryList.Items.FindByValue(e.Item.Cells[8].Text.Trim()).Value;
                }
                catch (Exception exception)
                {
                    Tab2_CountryList.SelectedValue = "-1";
                    ErrorLogging.LogError(exception, "");
                }
            }
            if (EmptyString(e.Item.Cells[3].Text.Trim()) != "")
            {
                try
                {
                    Tab2_SuperVisorList.SelectedValue = Tab2_SuperVisorList.Items.FindByText(e.Item.Cells[3].Text.Trim()).Value;
                }
                catch (Exception exception)
                {
                    Tab2_SuperVisorList.SelectedValue = "-1";
                    ErrorLogging.LogError(exception, "");
                }
            }
            Tab2_EmployerID.Text          = EmptyString(e.Item.Cells[4].Text);
            Tab2_EmployerRef.Text         = EmptyString(e.Item.Cells[5].Text);
            Tab2_EmployerRoutingCode.Text = EmptyString(e.Item.Cells[6].Text);
            Tab2_GLCode.Text         = EmptyString(e.Item.Cells[7].Text);
            Tab2_CountryList.Enabled = false;
            LGrid.EditItemIndex      = -1;
        }
Beispiel #13
0
        private void LoadEContactList()
        {
            DataTable _empECDataTable = null;

            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeInfo(Int32.Parse(this.keyField.Text.ToString()));
                if (_DataList.Tables[2].Rows.Count > 0)  // Employee Emergency Contacts Information.
                {
                    _empECDataTable        = _DataList.Tables[2];
                    this.ECGrid.DataSource = _empECDataTable;
                    this.ECGrid.DataBind();
                    ECmessage.Text    = "";
                    ECmessage.Visible = false;
                    emptyRow1.Text    = "";
                    emptyRow1.Visible = false;
                }
                else
                {
                    this.ECGrid.DataSource = null;
                    this.ECGrid.DataBind();
                }
            }
            catch (Exception exception)
            {
                if (ECGrid.CurrentPageIndex >= ECGrid.PageCount)
                {
                    ECGrid.CurrentPageIndex -= 1;
                    this.ECGrid.DataSource   = _empECDataTable;
                    this.ECGrid.DataBind();
                }
                else
                {
                    ErrorLogging.LogError(exception, " ");
                }
            }
        }
Beispiel #14
0
        private void DeleteDivisionLocation(Int32 DivisionID, Int32 LocationID)
        {
            try
            {
                String result = DatabaseManager.Data.DBAccessManager.DeleteDivisionLocation(Int32.Parse(Page.User.Identity.Name.ToString()), DivisionID, LocationID);

                if (result != "")
                {
                    this.Tab2_Message.Text     = result;
                    this.Tab2_Message.Visible  = true;
                    this.Tab2_Message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.Tab2_Message.Visible  = true;
                this.Tab2_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                this.Tab2_Message.CssClass = "errorMessage";
            }

            LGrid.CurrentPageIndex = 0;
            LoadDivisionLocationList(DivisionID);
        }
        private void DeleteDependent(Int32 DependentID)
        {
            try
            {
                String result = DatabaseManager.Data.DBAccessManager.DeleteEmployeeDependent(Int32.Parse(keyField.Text.ToString()), DependentID);

                if (result != "")
                {
                    this.DPmessage.Text = "Error:Could not delete the dependent. Please check the data";
                    this.DPmessage.CssClass = "errorMessage";

                }
            }
            catch (Exception exception)
            {
                this.DPmessage.Text = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
                this.DPmessage.CssClass = "errorMessage";

            }
            DPGrid.CurrentPageIndex = 0;
            LoadDependentsList();

        }
 private void LoadEmployeePositionList()
 {
     try
     {
         DataSet _DataList = null;
         _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeInfo(Int32.Parse(this.keyField.Text.ToString()));
         if (_DataList.Tables[4].Rows.Count > 0)  // Employee Emergency Contacts Information.
         {
             DataTable _DataTable = _DataList.Tables[4];
             this.EPGrid.DataSource = _DataTable;
             this.EPGrid.DataBind();
         }
         else
         {
             this.EPGrid.DataSource = null;
             this.EPGrid.DataBind();
         }
     }
     catch (Exception exception)
     {
         ErrorLogging.LogError(exception, " ");
     }
 }
        private void LoadCurrentEntitlement()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveLeaveEntitlements(Int32.Parse(keyField.Text.ToString()));

                if (_DataList.Tables[0].Rows.Count > 0)
                {
                    this.EGrid.DataSource = _DataList;
                    this.EGrid.DataBind();
                }
                else
                {
                    this.EGrid.DataSource = null;
                    this.EGrid.DataBind();
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, " ");
            }
        }
 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.BTGrid.DataSource = _BenefitTable;
                 this.BTGrid.DataBind();
             }
             else
             {
                 this.BTGrid.DataSource = null;
                 this.BTGrid.DataBind();
             }
             if (_DataList.Tables[1].Rows.Count > 0) // Deductions Information
             {
                 DataTable _DeductionTable = _DataList.Tables[1];
                 this.DedGrid.DataSource = _DeductionTable;
                 this.DedGrid.DataBind();
             }
             else
             {
                 this.DedGrid.DataSource = null;
                 this.DedGrid.DataBind();
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLogging.LogError(exception, "");
     }
 }
Beispiel #19
0
 protected void Save_Click(object sender, EventArgs e)
 {
     try {
         if (Page.IsValid == true)
         {
             if (Tab1_KeyField.Text.ToString() == "")
             {
                 Tab1_KeyField.Text = "0";
             }
             String Result = DatabaseManager.Data.DBAccessManager.AddUpdateCattleRaceSampling(Int32.Parse(Tab1_KeyField.Text), Int32.Parse(AnimalID.Text), Int32.Parse(TrainerID.Text), Int32.Parse(RaceID.Text), Int32.Parse(LocationID.Text), Int32.Parse(TrialNumber.Text), ConvertDMY_MDY(SamplingStartTime), Duration.Text, Int32.Parse(PlaceTypeID.Text), 0, 0, Int32.Parse(Page.User.Identity.Name.ToString()));
             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";
         }
     }
     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.");
     }
     LoadDataList(); // Refresh the Grid after Save.
 }
Beispiel #20
0
        private void LoadHolidaysList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveHolidayList(Int32.Parse(Page.User.Identity.Name.ToString()));

                if (_DataList.Tables[0].Rows.Count > 0)
                {
                    this.Grid.DataSource = _DataList;
                    this.Grid.DataBind();
                }
                else
                {
                    emptyRow.Visible  = true;
                    emptyRow.Text     = "There are no records found.";
                    emptyRow.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }
        }
Beispiel #21
0
        private void LoadEmployeeLanguagesList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmployeeLanguages(EmpId);

                if (_DataList.Tables[0].Rows.Count > 0)
                {
                    emptyRow.Visible     = false;
                    this.Grid.DataSource = _DataList;
                    this.Grid.DataBind();
                }
                else
                {
                    this.Grid.DataSource = null;
                    this.Grid.DataBind();
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }
        }
 protected void Tab1_Save_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid == true)
         {
             if (Tab1_keyField.Text.ToString() == "")
             {
                 Tab1_keyField.Text = "0";
             }
             String Result = DatabaseManager.Data.DBAccessManager.AddUpdateGenTransactions(Int32.Parse(Tab1_EmployeeList.SelectedValue), Int32.Parse(Tab1_ImportDataTypeList.SelectedValue), Tab1_InstrumentNo.Text, ConvertDMY_MDY(Tab1_VisaIssueDate), ConvertDMY_MDY(Tab1_VisaExpiryDate), Int32.Parse(Tab1_CountryList.SelectedValue), Int32.Parse(Tab1_VisaType.SelectedValue), Int32.Parse(Page.User.Identity.Name.ToString()));
             this.Tab1_Message.Visible  = true;
             this.Tab1_Message.CssClass = "errorMessage";
             if (Result == "")
             {
                 this.Tab1_Message.Text = "Successfully saved.";
                 ClearTab2();
             }
             else
             {
                 this.Tab1_Message.Text = Result;
             }
         }
         else
         {
             this.Tab1_Message.Text     = "Error:Could not save the information. Please check the inputs and submit again";
             this.Tab1_Message.CssClass = "errorMessage";
         }
     }
     catch (Exception exception)
     {
         this.Tab1_Message.Visible  = true;
         this.Tab1_Message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
         this.Tab1_Message.CssClass = "errorMessage";
     }
 }
Beispiel #23
0
 protected void Payroll_StartOver_Click(object sender, EventArgs e)
 {
     try
     {
         String result = DatabaseManager.Data.DBAccessManager.DeleteEmployeeMonthlyPayrollInfo(Int32.Parse(this.keyField.Text), Payroll_Date.Text, Int32.Parse(Page.User.Identity.Name.ToString()));
         this.message.Visible = true;
         message.CssClass     = "errorMessage";
         if (result == "")
         {
             LoadEmployeeMonthlyPayrollInfo(Int32.Parse(this.keyField.Text), Payroll_Date.Text);
             this.message.Text = "Successfully started over again.";
         }
         else
         {
             this.message.Text = result;
         }
     }
     catch (Exception exception)
     {
         this.message.Visible  = true;
         this.message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact support.");
         this.message.CssClass = "errorMessage";
     }
 }
Beispiel #24
0
        protected void Save_Employee_Click(object sender, EventArgs e)
        {
            Int32 AccountStatus; Int32 PhotoProfile; String PhotoPath; String FilePath;

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

                    if (Tab1_ProfilePhoto.PostedFile != null && Tab1_ProfilePhoto.PostedFile.FileName != "") // Checked Photo is uploaded.
                    {
                        HttpPostedFile myFile = Tab1_ProfilePhoto.PostedFile;
                        String         Ext    = System.IO.Path.GetExtension(myFile.FileName);
                        FilePath = Server.MapPath(Page.ResolveUrl("~\\PhotoProfiles\\" + Tab1_FName.Text.ToString() + "_" + Tab1_LName.Text.ToString() + Ext));
                        myFile.SaveAs(FilePath);
                        PhotoPath    = Tab1_FName.Text.ToString() + "_" + Tab1_LName.Text.ToString() + Ext;
                        PhotoProfile = 1;
                    }
                    else
                    {
                        PhotoPath    = "";
                        PhotoProfile = 0;
                    }
                    if (Tab1_Probation.Text == "")
                    {
                        Tab1_Probation.Text = "0";
                    }

                    String Result = DatabaseManager.Data.DBAccessManager.AddNewEmployee(Int32.Parse(Tab1_SaluationType.SelectedValue), Tab1_FName.Text.ToString(), Tab1_MidName.Text.ToString(), Tab1_LName.Text.ToString(), ConvertDMY_MDY(Tab1_DOB), Int32.Parse(Tab1_GenderType.SelectedValue), Int32.Parse(Tab1_MaritalStatus.SelectedValue), ConvertDMY_MDY(Tab1_HireDate), Tab1_EmployeeID.Text.ToString(), Int32.Parse(Tab1_EmpCategory.SelectedValue), Int32.Parse(Tab1_EmpStatus.SelectedValue), Int32.Parse(Tab1_Designation.SelectedValue), Int32.Parse(Tab1_Department.SelectedValue), Int32.Parse(Tab1_Division.SelectedValue), Int32.Parse(Tab1_Education.SelectedValue), PhotoProfile, PhotoPath, Tab1_UserName.Text.ToString(), EncodePasswordToBase64(Tab1_password.Text.ToString()), Int32.Parse(Tab1_Location.SelectedValue), Int32.Parse(Tab1_Probation.Text.ToString()), Tab1_PSEmployeeID.Text.ToString(), Tab1_HAddress1.Text.ToString(), Tab1_HAddress2.Text.ToString(), Tab1_HCity.Text.ToString(), Tab1_HState.Text.ToString(), Int32.Parse(Tab1_CountryDDList.SelectedValue), Tab1_WAddress1.Text.ToString(), Tab1_WAddress2.Text.ToString(), Tab1_WCity.Text.ToString(), Tab1_WState.Text.ToString(), Int32.Parse(Tab1_WCountryDDList.SelectedValue), Tab1_HPhone.Text.ToString(), Tab1_Mobile.Text.ToString(), Tab1_WPhone.Text.ToString(), Tab1_WorkEmail.Text.ToString(), Int32.Parse(Tab1_Supervisor.SelectedValue), Int32.Parse(Tab1_AccessLevel.SelectedValue), Int32.Parse(Page.User.Identity.Name.ToString()), AccountStatus);
                    this.message.Visible  = true;
                    this.message.CssClass = "errorMessage";
                    if (Result == "")
                    {
                        String Emp_FullName = Tab1_FName.Text.ToString() + ' ' + Tab1_MidName.Text.ToString() + ' ' + Tab1_LName.Text.ToString();
                        String EmpEmail     = Tab1_WorkEmail.Text.ToString();
                        String UserName     = Tab1_UserName.Text.ToString();
                        String Password     = Tab1_password.Text.ToString();
                        if (CheckEmail(EmpEmail))  // Notify via Email if Email was used as a user Name
                        {
                            NotifyEmployee_PortaLoginViaEmail(Emp_FullName, EmpEmail, UserName, Password);
                        }
                        this.message.Text = "Successfully saved.";
                        ResetFields();
                    }
                    else
                    {
                        this.message.Text = Result;

                        // System.IO.File.Delete(FilePath);
                    }
                }
                else
                {
                    this.message.Text     = "Error:Could not save the information. Please check the inputs";
                    this.message.CssClass = "errorMessage";
                }
            }
            catch (Exception exception)
            {
                this.message.Visible  = true;
                this.message.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
                this.message.CssClass = "errorMessage";
            }
        }
Beispiel #25
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";
            }
        }
Beispiel #26
0
        private void LoadDataList()
        {
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrievePayrollDashBoardDataByEmpID(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");
                        FCLiteral2.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_Pie3D.swf", "", PieXML, "DivisionDeptChart", PieWidth, PieHeight, false);
                    }
                    else
                    {
                        FCLiteral2.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");
                        FCLiteral3.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_Pie3D.swf", "", PieXML, "CountryChart", PieWidth, PieHeight, false);
                    }
                    else
                    {
                        FCLiteral3.Visible = false;
                    }


                    if (_DataList.Tables[2].Rows.Count > 0) // Current Month Payroll data/Status
                    {
                        DataTable _DataTable = _DataList.Tables[2];
                        Grid1.DataSource = _DataTable;
                        Grid1.DataBind();
                    }
                    else
                    {
                        Grid1.DataSource = null;
                        Grid1.DataBind();
                    }

                    if (_DataList.Tables[3].Rows.Count > 0) // Historical data for payroll
                    {
                        DataTable _DataTable = _DataList.Tables[3];
                        Grid2.DataSource = _DataTable;
                        Grid2.DataBind();
                    }
                    else
                    {
                        Grid2.DataSource = null;
                        Grid2.DataBind();
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "Unknown Exception Occured. Please contact support.");
            }
        }
        protected void DPGrid_EditCommand(object source, DataGridCommandEventArgs e)
        {

            keyField.Text = DPGrid.DataKeys[e.Item.ItemIndex].ToString();
            DPGrid.EditItemIndex = -1;
            try
            {
                DataSet _DataList = null;
                _DataList = DatabaseManager.Data.DBAccessManager.RetrieveEmpDependentInfo(Int32.Parse(keyField.Text.ToString()));

                if (_DataList.Tables.Count > 0)
                {
                    if (_DataList.Tables[0].Rows.Count > 0) // Leave Request Information.
                    {
                        DataRow _DataRow = _DataList.Tables[0].Rows[0];
                        Tab3_Name.Text = _DataRow["FullName"].ToString();
                        Tab3_DOB.Text = _DataRow["DOB"].ToString();
                        Tab3_PassportExpiryDate.Text = _DataRow["PP_ExpiryDate"].ToString();
                        Tab3_PassportIssueDate.Text = _DataRow["PP_IssueDate"].ToString();
                        Tab3_PassportNo.Text = _DataRow["PassportNumber"].ToString();
                        Tab3_VisaExpiryDate.Text = _DataRow["Visa_ExpiryDate"].ToString();
                        Tab3_VisaIssueDate.Text = _DataRow["Visa_IssueDate"].ToString();
                        Tab3_VisaNumber.Text = _DataRow["Visa_Number"].ToString();


                        if (_DataRow["GenderTypeID"].ToString() != "")
                        {
                            Tab3_GenderType.SelectedValue = _DataRow["GenderTypeID"].ToString();

                        }
                        if (_DataRow["PP_IssueCountryID"].ToString() != "")
                        {
                            Tab3_PassportCountryDDList.SelectedValue = _DataRow["PP_IssueCountryID"].ToString();

                        }

                        if (_DataRow["RelationshipID"].ToString() != "")
                        {
                            Tab3_RelationshipDDList.SelectedValue = _DataRow["RelationshipID"].ToString();

                        }

                        if (_DataRow["Visa_TypeID"].ToString() != "")
                        {
                            Tab3_VisaType.SelectedValue = _DataRow["Visa_TypeID"].ToString();

                        }
                        if (_DataRow["Visa_IssueCountryID"].ToString() != "")
                        {
                            Tab3_VisaIssueCountryID.SelectedValue = _DataRow["Visa_IssueCountryID"].ToString();

                        }
                    }
                }

            }
            catch (Exception exception)
            {
                ErrorLogging.LogError(exception, "");
            }

       }
Beispiel #28
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";
            }
        }
Beispiel #29
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";
            }
        }
Beispiel #30
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;
                     errorMessage.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.errorMessage.Visible  = true;
                 this.EmailAddress.Text     = "";
                 this.Login_Password.Text   = "";
                 this.errorMessage.Text     = "Invalid Email Id or Password. Please check your credentials.";
                 this.errorMessage.CssClass = "errorMessage";
             }
         }
     }
     catch (Exception exception)
     {
         this.errorMessage.Visible  = true;
         this.EmailAddress.Text     = "";
         this.Login_Password.Text   = "";
         this.errorMessage.Text     = ErrorLogging.LogError(exception, "Unknown Exception Occured.Please contact Support.");
         this.errorMessage.CssClass = "errorMessage";
     }
 }