using System;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Resources;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.XtraCharts;
using System.Web.UI.HtmlControls;
/*
 * 
 * Modified By      :   Manjula.P
 * Modified Date    :   19-Jul-2
 * Descriptions     :   Adding this line for Session["YearSettingsId"] = Convert.ToInt32(ds_Year.Tables[0].Rows[0]["YearSettings_Id"]);
 * */
public partial class DashBoard : Base.BasePage
{
    #region Variable Declaration
    ResourceManager rm;
    cls_Common objCommon = new cls_Common();
    EmployeeEventData ObjEmployeeEventData = new EmployeeEventData();
    userRightsEventData objUserRight = new userRightsEventData();
    Dashboard objDash = new Dashboard();
    DataSet dstAttendance = new DataSet();
    CultureInfo ci;
    GetReports rptEmp = new GetReports();
    Rpt_Common rptcommon = new Rpt_Common();
    Cls_CheckUser objCheckUser = new Cls_CheckUser();
    string SelectedShift = string.Empty;
    string From_Date = string.Empty;
    string LevelId = string.Empty;
    int intIndividualUser = 0;
    string marqText = string.Empty;
    string strEmpAutoId = "0";
    int payrollConfig = 0;
    #endregion
    #region PageLoad
    protected override void Page_Load(object sender, EventArgs e)
    {
        // session checking
        base.Page_Load(sender, e);
        //get the culture info to set the language
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (!Page.IsPostBack)
        {
            //base.CheckPages(50);
            //LoadNews();
            // checking license expiry date 
            CheckDemoVersion();
            News.Visible = false;
            ViewState["Board"] = "Bootstrap";
            if (Session["SessionDashboardType"] == null)
            {
                Session.Add("SessionDashboardType", "");
            }
            Session["isDashBoard"] = "No";
            objCommon.menu("Dashboard", "179");
            LoadStrings(ci);
            string strSetAlert = "";
            strSetAlert = strSetAlert + "<script language='javascript'>";
            strSetAlert = strSetAlert + "MaxLengthh('" + rm.GetString("Alert_MaximumLengthis", ci) + "');";
            strSetAlert = strSetAlert + "SetAlertMessages('" + rm.GetString("Alert_EnterDate", ci) + "','" + rm.GetString("Alert_EnterToDate", ci) + "','" + rm.GetString("Alert_Selectshiftdate", ci) + "');";
            strSetAlert = strSetAlert + "SetAlertCheckDate('" + rm.GetString("Alert_Validmonthdatefourdigit", ci) + "','" + rm.GetString("Alert_Validdatemonthfourdigit", ci) + "','" + rm.GetString("Alert_Invalidyearentry", ci) + "','" + rm.GetString("Alert_Invalidmonthentry", ci) + "','" + rm.GetString("Alert_Invaliddateentry", ci) + "','" + rm.GetString("Alert_IncorrectdateformatDDMONYYYY", ci) + "','" + rm.GetString("Alert_Entertime", ci) + "','" + rm.GetString("Alert_Invalidvalueforhours", ci) + "','" + rm.GetString("Alert_Invalidvalueforminites", ci) + "','" + rm.GetString("Alert_Invalidtimeformat1", ci) + "','" + rm.GetString("Alert_PleaseentervalidDateandTime", ci) + "','" + rm.GetString("Alert_ValiddatemonthMMDDYYHHMM", ci) + "','" + rm.GetString("Alert_ValiddatemonthMMDDYYHHMMTT", ci) + "','" + rm.GetString("Alert_PleaseentervalidDateandTime", ci) + "','" + rm.GetString("Alert_Invalidvalueforhours", ci) + "','" + rm.GetString("Alert_Invalidvalueforminites", ci) + "');";
            strSetAlert = strSetAlert + "</script>";
            Page.RegisterStartupScript("SetAlertMessages", strSetAlert);
        }
        payrollConfig = objCommon.CheckPageExistsInLicense(185);
        LoadDash();
        exportData.Attributes.Add("src", "");
        if (Session["Session_ActiveLanguage"] == null)
        {
            Response.Redirect("Index.aspx");
        }
        if (Session["SanctionUrl"] != null)
        {
            Response.Redirect(Session["SanctionUrl"].ToString());
        }
        //  string source_Language = string.Empty;
        if (Session["Session_ActiveLanguage"] != null)
        {
            source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
            rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
            ci = Thread.CurrentThread.CurrentCulture;
            userRightsEventData objClass = new userRightsEventData();
            DataSet ds = new DataSet();
            ds = objClass.SelectLevelRights(Convert.ToInt32(Session["userGroup_Id"]));
            Session["LevelRights"] = "0";
            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["LevelId"] != DBNull.Value)
                        {
                            string strLevelID = Convert.ToString(ds.Tables[0].Rows[0]["LevelId"]);
                            Session["LevelRights"] = strLevelID;
                        }
                    }
                }
            }
            GenerateMenu();
            CheckMandatoryPage();
        }
        Hidden1.Value = Convert.ToString(Session["IDateFormat"]);
        if (!IsPostBack)
        {
            cls_master_levels class1 = new cls_master_levels();
            DataSet ds = new DataSet();
            if (Session["UserGroupName"] != null)
            {
                ds = class1.getOrgLevelUpdated(0, Convert.ToString(Session["LevelRights"]), 0, Convert.ToString(Session["UserGroupName"]));
            }
            Session["OrgLevels"] = ds;
            if (txtFrom.Text == "")
            {
                txtFrom.Text = (Convert.ToDateTime(System.DateTime.Now.ToShortDateString())).ToString(Session["MDateFormat"].ToString());
                txtTo.Text = (Convert.ToDateTime(System.DateTime.Now.ToShortDateString())).ToString(Session["MDateFormat"].ToString());
                lbldisplayShiftDate.Text = txtFrom.Text;
            }
            fillShift();
            if (Request.QueryString["Shift"] != null)
            {
                SelectedShift = Convert.ToString(Request.QueryString["Shift"]);
            }
            if (Request.QueryString["From_Date"] != null)
            {
                From_Date = Convert.ToString(Request.QueryString["From_Date"]);
            }
        }
        if (From_Date != string.Empty)
        {
            txtFrom.Text = (Convert.ToDateTime(From_Date)).ToString(Convert.ToString(Session["MDateFormat"]));
            txtTo.Text = (Convert.ToDateTime(From_Date)).ToString(Convert.ToString(Session["MDateFormat"]));
        }
        if (Request.QueryString["LevelId"] != null)
            LevelId = Convert.ToString(Request.QueryString["LevelId"]);
        if (ddlShift.SelectedIndex > 0)
            SelectedShift = ddlShift.SelectedItem.Value;
        if (SelectedShift != string.Empty)
            ddlShift.SelectedItem.Value = SelectedShift;
        if (!IsPostBack)
        {
            if (Convert.ToString(Session["IsDashboardEnable"]) == "Yes")
            {
                trFiller.Visible = true;
                trFilterShowHide.Visible = true;
                trDashboard.Visible = true;
                trLanding.Visible = false;
            }
            else
            {
                lblDemo.Visible = true;
                trDashboard.Visible = false;
                trFiller.Visible = false;
                trFilterShowHide.Visible = false;
                trLanding.Visible = true;
            }
            LoadDashBoardDetails();
        }
        //Check whether the employee is Individual User
        if (Convert.ToString(ViewState["Dash_IndividualUser"]) == "")
        {
            intIndividualUser = objCheckUser.CheckIndividualUser(Convert.ToString(Session["UserGroupName"]));
            ViewState["Dash_IndividualUser"] = intIndividualUser;
        }
        else
        {
            intIndividualUser = Convert.ToInt32(ViewState["Dash_IndividualUser"]);
        }
        OrgFilter.Visible = (intIndividualUser >= 1) ? false : true;
    }
    #endregion
    #region UserDefinedFunctions
    private void LoadStrings(CultureInfo ci)
    {
        lnkbtnshiftNotAllocation.Text = rm.GetString("AllocateShift_Dashboard", ci);
        lblDataFor.Text = rm.GetString("AttendanceData_Dashboard", ci);
        lblPresent.Text = rm.GetString("AttendanceCode_Present", ci);
        lblAbsent.Text = rm.GetString("Dash_Absent", ci);
        lblAppLeave.Text = rm.GetString("Dash_ApprovedLeave", ci);
        lblAppOnduty.Text = rm.GetString("Dash_ApprovedOnDuty", ci);
        lblPunctuality.Text = rm.GetString("Dash_Punctuality", ci);
        lblAttSummary.Text = rm.GetString("Dashboard_AttSum", ci);
        lblAttData.Text = rm.GetString("Dashboard_AttData", ci);
        lblAppData.Text = rm.GetString("Dashboard_AppData", ci);
        lblExcData.Text = rm.GetString("Dashboard_ExcData", ci);
        lblLateEntry.Text = rm.GetString("Dashboard_Late", ci);
        lblEarlyExit.Text = rm.GetString("Dash_EarlyExit", ci);
        lblLessWorked.Text = "Shift Not Allocated";
        lblAppOverTime.Text = rm.GetString("Dash_ApprovedOverTime", ci);
        lblDiscrepancy.Text = rm.GetString("Dash_Discrepancy", ci);
        lblNonProcess.Text = rm.GetString("Dash_NonProcessedRecord", ci);
        ImgPermissionExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgAbsentExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgLeaveExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgOndutyExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgPunctualityExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        imgPresentExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgLateExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgEarlyExitExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgLessHoursWorkedExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgOverTimeExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgDiscrepancyExcel.ToolTip = rm.GetString("btn_ExporttoExcel", ci);
        ImgPermissionPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgAbsentPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgLeavePDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgOndutyPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgPunctualityPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        imgPresentPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgLatePDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgEarlyExitPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgLessHoursWorkedPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgOverTimePDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        ImgDiscrepancyPDF.ToolTip = rm.GetString("Export_To_PDF", ci);
        lbl_Leave.Text = rm.GetString("LeaveApplication_Leave", ci);
        lbl_Onduty.Text = rm.GetString("Dash_OnDuty", ci);
        lbl_Permission.Text = rm.GetString("Dash_Permission", ci);
        lbl_Leave2.Text = rm.GetString("LeaveApplication_Leave", ci);
        lbl_Onduty2.Text = rm.GetString("Dash_OnDuty", ci);
        lbl_Permission2.Text = rm.GetString("Dash_Permission", ci);
        lbl_Leave1.Text = rm.GetString("LeaveApplication_Leave", ci);
        lbl_Onduty1.Text = rm.GetString("Dash_OnDuty", ci);
        lbl_Permission1.Text = rm.GetString("Dash_Permission", ci);
        lbl_Lev_Approved.Text = rm.GetString("btn_Approved", ci);
        lbl_Lev_Forwarded.Text = rm.GetString("btn_Forwarded", ci);
        lbl_Lev_Pending.Text = rm.GetString("btn_Pending", ci);
        lbl_OD_Approved.Text = rm.GetString("btn_Approved", ci);
        lbl_OD_Forwarded.Text = rm.GetString("btn_Forwarded", ci);
        lbl_OD_Pending.Text = rm.GetString("btn_Pending", ci);
        lbl_Per_Approved.Text = rm.GetString("btn_Approved", ci);
        lbl_Per_Forwarded.Text = rm.GetString("btn_Forwarded", ci);
        lbl_Per_Pending.Text = rm.GetString("btn_Pending", ci);
        lbl_DashHeader.Text = rm.GetString("Menu_Master_Dashboard", ci);
        lbl_Filter.Text = rm.GetString("lblFilter", ci);
        lblShiftDate.Text = rm.GetString("ShiftDate", ci);
        lbl_ShiftName.Text = rm.GetString("ShiftTiming_ShiftName", ci);
        btnGo.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Search", ci);
        Att_Dash.Attributes.Add("title", rm.GetString("Menu_Master_Dashboard", ci));
        Att_Grid.Attributes.Add("title", rm.GetString("Dash_Grid", ci));
        Att_Chart.Attributes.Add("title", rm.GetString("Dash_Chart", ci));
        App_Dash.Attributes.Add("title", rm.GetString("Menu_Master_Dashboard", ci));
        App_Grid.Attributes.Add("title", rm.GetString("Dash_Grid", ci));
        App_Chart.Attributes.Add("title", rm.GetString("Dash_Chart", ci));
        Exp_Dash.Attributes.Add("title", rm.GetString("Menu_Master_Dashboard", ci));
        Exp_Grid.Attributes.Add("title", rm.GetString("Dash_Grid", ci));
        Exp_Chart.Attributes.Add("title", rm.GetString("Dash_Chart", ci));
        lblShiftDate.Text = rm.GetString("ShiftDate", ci);
        A1.InnerText = rm.GetString("btn_Moreplus", ci);
        HtmlGenericControl li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A1.Controls.Add(li);
        A2.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A2.Controls.Add(li);
        A3.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A3.Controls.Add(li);
        A4.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A4.Controls.Add(li);
        A5.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A5.Controls.Add(li);
        A6.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A6.Controls.Add(li);
        A7.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A7.Controls.Add(li);
        A8.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A8.Controls.Add(li);
        A9.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A9.Controls.Add(li);
        A10.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A10.Controls.Add(li);
        A11.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A11.Controls.Add(li);
        A12.InnerText = rm.GetString("btn_Moreplus", ci);
        li = new HtmlGenericControl("li");
        li.Attributes.Add("class", "fa fa-caret-down");
        A12.Controls.Add(li);
    }
    protected void CheckMandatoryPage()
    {
        cls_Common objClass = new cls_Common();
        DataSet ds = new DataSet();
        if (Convert.ToString(ViewState["MandatoryPageDetails"]) == "")
        {
            ds = objClass.GetCheckMandatory();
            ViewState["MandatoryPageDetails"] = ds;
        }
        else
        {
            ds = (DataSet)ViewState["MandatoryPageDetails"];
        }
        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            if (ds.Tables[0].Rows[0]["MandatoryChecking"] != DBNull.Value && Convert.ToInt16(ds.Tables[0].Rows[0]["MandatoryChecking"]) == 0)
                Session["CheckMandatoryPage"] = "Not Required";
            else
                Session["CheckMandatoryPage"] = "Required";
        }
        else
            Session["CheckMandatoryPage"] = "Required";
    }
    public void fillShift()
    {
        ShiftEvenData getShift = new ShiftEvenData();
        DataSet ds = new DataSet();
        string strusergroup = string.Empty;
        if (Convert.ToString(ViewState["Dash_ShiftDetails"]) == "")
        {
            ds = getShift.SelectShift(Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["LevelRights"]), 0);
            ViewState["Dash_ShiftDetails"] = ds;
        }
        else
            ds = (DataSet)ViewState["Dash_ShiftDetails"];
        ds.Tables[0].DefaultView.RowFilter = "Shift_ShortName='NOS'";
        DataView dv = ds.Tables[0].DefaultView;
        if (dv != null)
            if (dv.Count > 0)
                dv[0]["Shift_Name"] = rm.GetString("Caption_NoShift", ci);
        if (ds.Tables[0].Rows.Count > 0)
        {
            this.ddlShift.DataSource = ds;
            this.ddlShift.DataTextField = "Shift_Name";
            this.ddlShift.DataValueField = "Shift_Id";
            this.ddlShift.DataBind();
        }
        ListItem lstItem = new ListItem();
        lstItem.Value = "0";
        lstItem.Text = rm.GetString("ExportData_All", ci);
        ddlShift.Items.Insert(0, lstItem);
        foreach (ListItem item in ddlShift.Items)
        {
            item.Attributes.Add("title", item.Text);
        }
        if (Request.QueryString["Shift"] != null)
        {
            ddlShift.SelectedValue = SelectedShift;
        }
    }
    protected void GenerateMenu()
    {
        //Get Year Setting Details for Menu constructing and Year Setting Display
        cls_Common objClassCommon = new cls_Common();
        DataSet ds_Year = new DataSet();
        string strYearData = string.Empty;
        string StartYear = string.Empty, EndYear = string.Empty, StartMonth = string.Empty, EndMonth = string.Empty;
        if (Convert.ToString(ViewState["YearDetails"]) == "")
        {
            ds_Year = objClassCommon.GetYearsetting();
            ViewState["YearDetails"] = ds_Year;
        }
        else
        {
            ds_Year = (DataSet)ViewState["YearDetails"];
        }
        if (ds_Year.Tables[0].Rows.Count > 0)
        {
            Session["YearSettingsId"] = Convert.ToInt32(ds_Year.Tables[0].Rows[0]["YearSettings_Id"]);
            Session["YearSettingFromDate"] = Convert.ToString(ds_Year.Tables[0].Rows[0]["YearSettingFromDate"]);
            Session["YearSettingToDate"] = Convert.ToString(ds_Year.Tables[0].Rows[0]["YearSettingToDate"]);
            StartYear = Convert.ToString(ds_Year.Tables[0].Rows[0]["StartYear"]);
            StartMonth = Convert.ToString(ds_Year.Tables[0].Rows[0]["StartMonth"]);
            EndYear = Convert.ToString(ds_Year.Tables[0].Rows[0]["EndYear"]);
            EndMonth = Convert.ToString(ds_Year.Tables[0].Rows[0]["EndMonth"]);
            Session["SearchFromDate"] = Convert.ToDateTime(ds_Year.Tables[0].Rows[0]["FromDate"]);
            strYearData = StartMonth + " " + StartYear + " - " + EndMonth + " " + EndYear;
            string sYearValue = Convert.ToString(Cache["ActiveYearSetting"]);
            if (sYearValue == null || sYearValue == String.Empty)
            {
                TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
                HttpContext.Current.Cache.Insert("ActiveYearSetting", strYearData, null, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, null); // cache handling
            }
            else if (strYearData != sYearValue)
            {
                TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
                HttpContext.Current.Cache.Remove("ActiveYearSetting");
                HttpContext.Current.Cache.Insert("ActiveYearSetting", strYearData, null, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, null); // cache handling
            }
        }
        else
        {
            TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
            HttpContext.Current.Cache.Remove("ActiveYearSetting");
            HttpContext.Current.Cache.Insert("ActiveYearSetting", "", null, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, null); // cache handling
            Session["SearchFromDate"] = (Convert.ToDateTime(System.DateTime.Now.ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
        }
    }
    protected void CheckDemoVersion()
    {
        string[] fileArr = Directory.GetFiles(Server.MapPath("LicenseFile"), "*.lic");
        int arrCount = fileArr.Length;
        if (arrCount > 0)
        {
            // continue with license file
            lblDemo.Visible = false;
            lblDemo.Text = "Welcome" + "<br />" + Convert.ToString(Session["user"]).ToUpper();
            int expiryDays = Convert.ToInt32(Session["sExpiryDays"]);
            string expiryDate = Convert.ToString(Session["sExpiryDate"]);
            if ((expiryDays <= 5) && (expiryDays >= 0))
            {
                if (expiryDays == 0)
                    Message("Your Software License will be expired Today, Please update license On / Before " + expiryDate);
                else
                    Message("Your Software License will be expired within " + Convert.ToString(expiryDays) + " day(s) , Please update license On / Before " + expiryDate);
            }
        }
        else
        {
            lblDemo.Visible = false;
            lblDemo.Text = "Demo Version";
        }
    }
    public void LoadDashBoardDetails()
    {
        DataSet dsDashboardRights = new DataSet();
        if (Session["userGroup_Id"] != null)
        {
            dsDashboardRights = objUserRight.SelectDashboardRights(Convert.ToInt32(Session["userGroup_Id"]));
        }
        else
        {
            dsDashboardRights = null;
        }
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (dsDashboardRights != null)
        {
            if (dsDashboardRights.Tables.Count > 0)
            {
                if (dsDashboardRights.Tables[3].Rows.Count > 0)
                {
                    //To check whether the display option has been set for this usergroup or not. 
                    //if yes then it will proceed the below steps.
                    if (Convert.ToInt32(dsDashboardRights.Tables[3].Rows[0]["Gridview"]) == 1 ||
                        Convert.ToInt32(dsDashboardRights.Tables[3].Rows[0]["Dashboard"]) == 1 ||
                        Convert.ToInt32(dsDashboardRights.Tables[3].Rows[0]["Chart"]) == 1)
                    {
                        #region Common
                        Hidden1.Value = Convert.ToString(Session["IDateFormat"]);
                        int payrollConfig = 0; string employeeID = "";
                        if (Session["ReportsBasedOn"] != null)
                        {
                            if (Convert.ToString(Session["ReportsBasedOn"]) == "False")
                                employeeID = "0";
                            else
                                employeeID = Convert.ToString(Session["EmpAutoID"]);
                        }
                        string gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
                        if (LevelId.Contains(","))
                        {
                            LevelId = string.Empty;
                        }
                        if (LevelId == string.Empty)
                        {
                            dstAttendance = objDash.GetTheDashboardInformation(
                                Convert.ToString(""),
                                objCommon.DateConvertion(gstrDateFormat, txtFrom.Text),
                                objCommon.DateConvertion(gstrDateFormat, txtTo.Text),
                                0,
                                Convert.ToInt32(ddlShift.SelectedValue),
                                Convert.ToInt32(Session["parentLevelId"]),
                                Convert.ToString(Session["UserGroupName"]),
                                Convert.ToString(Session["GradeLevel"]), employeeID);
                        }
                        else
                        {
                            dstAttendance = objDash.GetTheDashboardInformation(Convert.ToString(""), objCommon.DateConvertion(gstrDateFormat, txtFrom.Text), objCommon.DateConvertion(gstrDateFormat, txtTo.Text), 0, Convert.ToInt32(ddlShift.SelectedValue), Convert.ToInt32(LevelId), Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]), employeeID);
                        }
                        DataTable dtAttendance = new DataTable();
                        dtAttendance = dstAttendance.Tables[0];
                        dtAttendance.TableName = "AttendanceData";
                        DataTable dtException = new DataTable();
                        dtException = dstAttendance.Tables[1];
                        dtException.TableName = "ExceptionData";
                        DataTable dtdetailsboard = new DataTable();
                        dtdetailsboard = dstAttendance.Tables[2];
                        dtdetailsboard.TableName = "ApprovalData";
                        string strEmpcount, strEmpPer;
                        strEmpcount = rm.GetString("Dash_TotEmp", ci) + " : " + Convert.ToString(dstAttendance.Tables[3].Rows[0]["Employeecount"]);
                        strEmpPer = rm.GetString("Dash_PresentEmp", ci) + " : " + Convert.ToString(dstAttendance.Tables[3].Rows[0]["EmployeePresentcount"]);
                        Session["TotalEmployee"] = strEmpcount;
                        Session["TotalEmployeePer"] = strEmpPer;
                        if (dstAttendance.Tables[2].Rows.Count > 0)
                        {
                            WebChartControl1.Series.Clear();
                            WebChartControl2.Series.Clear();
                            WebChartControl3.Series.Clear();
                            WebChartControl1.Titles.Clear();
                            WebChartControl2.Titles.Clear();
                            WebChartControl3.Titles.Clear();
                            devChartLeave.Series.Clear();
                            devChartOnduty.Series.Clear();
                            devChartPermission.Series.Clear();
                            devChartLeave.Titles.Clear();
                            devChartOnduty.Titles.Clear();
                            devChartPermission.Titles.Clear();
                        }
                        #endregion
                        bool isDashboardOption = false, isGridviewOption = false;
                        bool isLeaveOption = false, isOnDutyOption = false;
                        #region DashboardOptionEnabledOrNot
                        if (Convert.ToInt16(dsDashboardRights.Tables[3].Rows[0]["Dashboard"]) == 1)
                        {
                            #region FirstBoardFirstTab
                            DataTable dt1stBFirstTab = new DataTable();
                            if (Convert.ToInt16(dsDashboardRights.Tables[0].Rows.Count) > 0)
                            {
                                // Board display option is selected but attendance data is not selected means, it will display the data as empty.
                                if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                {
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Present'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardPresent.Style.Add("display", "block");
                                            lblCountPresent.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardPresent.Style.Add("display", "block");
                                            lblCountPresent.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardPresent.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Absent'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardAbsent.Style.Add("display", "block");
                                            lblCountAbsent.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardAbsent.Style.Add("display", "block");
                                            lblCountAbsent.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardAbsent.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved Leave'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardLeave.Style.Add("display", "block");
                                            lblCountLeaveTaken.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardLeave.Style.Add("display", "block");
                                            lblCountLeaveTaken.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardLeave.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved OnDuty'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardOnduty.Style.Add("display", "block");
                                            lblCountOnduty.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardOnduty.Style.Add("display", "block");
                                            lblCountOnduty.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardOnduty.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Punctuality'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardPunctuality.Style.Add("display", "block");
                                            lblCountPunctuality.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardPunctuality.Style.Add("display", "block");
                                            lblCountPunctuality.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardPunctuality.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Attendance Summary'";
                                        dt1stBFirstTab = dtAttendance.DefaultView.ToTable();
                                        if (dt1stBFirstTab.Rows.Count > 0)
                                        {
                                            FirstboardAttendance.Style.Add("display", "block");
                                            lblAttendanceSummary.Text = Convert.ToString(dt1stBFirstTab.Rows[0]["ValueCount"]);
                                        }
                                        else
                                        {
                                            FirstboardAttendance.Style.Add("display", "block");
                                            lblAttendanceSummary.Text = "0";
                                        }
                                    }
                                    else
                                    {
                                        FirstboardAttendance.Style.Add("display", "none");
                                    }
                                    dtAttendance.DefaultView.RowFilter = string.Empty;
                                    AttendanceData.Style.Add("display", "block");
                                }
                                else
                                {
                                    AttendanceData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            #region SecondBoardFirstTab
                            DataTable dtSecondBoardFirstTabFilter = new DataTable();
                            if (Convert.ToInt16(dsDashboardRights.Tables[1].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                {
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtdetailsboard.DefaultView.RowFilter = "Approval='Leave'";
                                        dtSecondBoardFirstTabFilter = dtdetailsboard.DefaultView.ToTable();
                                        if (dtSecondBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            btnLeavePending.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Pending"]);
                                            btnLeaveForwarded.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Forwarded"]);
                                            btnLeaveApproved.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Approved"]);
                                        }
                                        else
                                        {
                                            btnLeavePending.Text = "0";
                                            btnLeaveForwarded.Text = "0";
                                            btnLeaveApproved.Text = "0";
                                        }
                                        SecondboardLeave.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SecondboardLeave.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtdetailsboard.DefaultView.RowFilter = "Approval='Onduty'";
                                        dtSecondBoardFirstTabFilter = dtdetailsboard.DefaultView.ToTable();
                                        if (dtSecondBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            btnOndutyPending.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Pending"]);
                                            btnOndutyForwarded.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Forwarded"]);
                                            btnOndutyApproved.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Approved"]);
                                        }
                                        else
                                        {
                                            btnOndutyPending.Text = "0";
                                            btnOndutyForwarded.Text = "0";
                                            btnOndutyApproved.Text = "0";
                                        }
                                        SecondboardOnDuty.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SecondboardOnDuty.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtdetailsboard.DefaultView.RowFilter = "Approval='Permission'";
                                        dtSecondBoardFirstTabFilter = dtdetailsboard.DefaultView.ToTable();
                                        if (dtSecondBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            btnPermissionForwarded.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Forwarded"]);
                                            btnPermissionApproved.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Approved"]);
                                            btnPermissionPending.Text = Convert.ToString(dtSecondBoardFirstTabFilter.Rows[0]["Pending"]);
                                        }
                                        else
                                        {
                                            btnPermissionForwarded.Text = "0";
                                            btnPermissionApproved.Text = "0";
                                            btnPermissionPending.Text = "0";
                                        }
                                        SecondboardPermission.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SecondboardPermission.Style.Add("display", "none");
                                    }
                                    dtdetailsboard.DefaultView.RowFilter = string.Empty;
                                    ApprovalData.Style.Add("display", "block");
                                }
                                else
                                {
                                    ApprovalData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            #region ThirdBoardFirstTab
                            DataTable dtThirdBoardFirstTabFilter = new DataTable();
                            if (Convert.ToInt16(dsDashboardRights.Tables[2].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                {
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Late Entry'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblCountLateEntry.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblCountLateEntry.Text = "0";
                                        }
                                        ThirdboardLate.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardLate.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Early Exit'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblCountEarlyExit.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblCountEarlyExit.Text = "0";
                                        }
                                        ThirdboardEarly.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardEarly.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Shift Not Allocated'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblShiftNotAllocated.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblShiftNotAllocated.Text = "0";
                                        }
                                        ThirdboardLess.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardLess.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Approved Over Time'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblCountOverTime.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblCountOverTime.Text = "0";
                                        }
                                        ThirdboardOverTime.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardOverTime.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Discrepancy'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblCountDiscrepancy.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblCountDiscrepancy.Text = "0";
                                        }
                                        ThirdboardDiscrepancy.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardDiscrepancy.Style.Add("display", "none");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtException.DefaultView.RowFilter = "TOPIC='Non Processed Record'";
                                        dtThirdBoardFirstTabFilter = dtException.DefaultView.ToTable();
                                        if (dtThirdBoardFirstTabFilter.Rows.Count > 0)
                                        {
                                            lblCountNoProcessRecord.Text = Convert.ToString(dtThirdBoardFirstTabFilter.Rows[0]["COUNT"]);
                                        }
                                        else
                                        {
                                            lblCountNoProcessRecord.Text = "0";
                                        }
                                        ThirdboardNonProcessed.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        ThirdboardNonProcessed.Style.Add("display", "none");
                                    }
                                    dtException.DefaultView.RowFilter = string.Empty;
                                    ExceptionData.Style.Add("display", "block");
                                }
                                else
                                {
                                    ExceptionData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            FBTab1.Style.Add("display", "block");
                            FBTab1.Attributes.Add("class", "active border-line2");
                            FBTab2.Attributes.Add("class", "border-line1");
                            FBTab3.Attributes.Add("class", "border-line1");
                            tab1.Attributes.Add("class", "tab-pane active");
                            tab2.Attributes.Add("class", "tab-pane");
                            tab3.Attributes.Add("class", "tab-pane");
                            SBTabl1.Style.Add("display", "block");
                            SBTabl1.Attributes.Add("class", "active border-line2");
                            SBTabl2.Attributes.Add("class", "border-line1");
                            SBTabl3.Attributes.Add("class", "border-line1");
                            tab4.Attributes.Add("class", "tab-pane active");
                            tab5.Attributes.Add("class", "tab-pane");
                            tab6.Attributes.Add("class", "tab-pane");
                            TTab1.Style.Add("display", "block");
                            TTab1.Attributes.Add("class", "active border-line2");
                            TTab2.Attributes.Add("class", "border-line1");
                            TTab3.Attributes.Add("class", "border-line1");
                            tab7.Attributes.Add("class", "tab-pane active");
                            tab8.Attributes.Add("class", "tab-pane");
                            tab9.Attributes.Add("class", "tab-pane");
                            isDashboardOption = true;
                        }
                        else
                        {
                            FBTab1.Style.Add("display", "none");
                            FirstboardPresent.Style.Add("display", "none");
                            FirstboardAbsent.Style.Add("display", "none");
                            FirstboardLeave.Style.Add("display", "none");
                            FirstboardOnduty.Style.Add("display", "none");
                            FirstboardPunctuality.Style.Add("display", "none");
                            FirstboardAttendance.Style.Add("display", "none");
                            SBTabl1.Style.Add("display", "none");
                            SecondboardLeave.Style.Add("display", "none");
                            SecondboardOnDuty.Style.Add("display", "none");
                            SecondboardPermission.Style.Add("display", "none");
                            TTab1.Style.Add("display", "none");
                            ThirdboardLate.Style.Add("display", "none");
                            ThirdboardEarly.Style.Add("display", "none");
                            ThirdboardLess.Style.Add("display", "none");
                            ThirdboardNonProcessed.Style.Add("display", "none");
                            ThirdboardDiscrepancy.Style.Add("display", "none");
                            ThirdboardOverTime.Style.Add("display", "none");
                        }
                        #endregion
                        #region GridviewOptionEnabledOrNot
                        DataTable dtExecptionChart = dtException;
                        if (Convert.ToInt16(dsDashboardRights.Tables[3].Rows[0]["Gridview"]) == 1)
                        {
                            if (isDashboardOption == false)
                            {
                                FBTab2.Attributes.Add("class", "active border-line2");
                                FBTab3.Attributes.Add("class", "border-line1");
                                SBTabl2.Attributes.Add("class", "active border-line2");
                                SBTabl3.Attributes.Add("class", "border-line1");
                                TTab2.Attributes.Add("class", "active border-line2");
                                TTab3.Attributes.Add("class", "border-line1");
                                isGridviewOption = true;
                                tab1.Attributes.Add("class", "tab-pane");
                                tab2.Attributes.Add("class", "tab-pane active");
                                tab3.Attributes.Add("class", "tab-pane");
                                tab4.Attributes.Add("class", "tab-pane");
                                tab5.Attributes.Add("class", "tab-pane active");
                                tab6.Attributes.Add("class", "tab-pane");
                                tab7.Attributes.Add("class", "tab-pane");
                                tab8.Attributes.Add("class", "tab-pane active");
                                tab9.Attributes.Add("class", "tab-pane");
                            }
                            //First Board
                            #region SecondTab
                            DataTable dt1stBSecondTab = new DataTable();
                            int FirstBoard2ndTabRecordCount = 0;
                            if (Convert.ToInt16(dsDashboardRights.Tables[0].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                {
                                    AttendanceData.Style.Add("display", "block");
                                    dgrdException.DataSource = dtAttendance;
                                    dgrdException.DataBind();
                                    #region SecondTabChart
                                    int rownum = 0;
                                    devPieChartAdd.Series.Clear();
                                    Series PieSeries1 = new Series("Series1", ViewType.Pie);
                                    PieSeries1.DataSource = dtAttendance;
                                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Present'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            //PieSeries1.Points.Add(new SeriesPoint("Present", 0.000001));
                                            FirstBoard2ndTabRecordCount += 1;
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("AttendanceCode_Present", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Absent'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard2ndTabRecordCount += 1;
                                            //PieSeries1.Points.Add(new SeriesPoint("Absent", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_Absent", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved Leave'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard2ndTabRecordCount += 1;
                                            //PieSeries1.Points.Add(new SeriesPoint("LeaveTaken", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_LeaveTaken", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved OnDuty'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard2ndTabRecordCount += 1;
                                            //PieSeries1.Points.Add(new SeriesPoint("OnDuty", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_OnDuty", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Punctuality'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard2ndTabRecordCount += 1;
                                            //PieSeries1.Points.Add(new SeriesPoint("Punctuality", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_Punctuality", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Attendance Summary'";
                                        dt1stBSecondTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBSecondTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard2ndTabRecordCount += 1;
                                            //PieSeries1.Points.Add(new SeriesPoint("AttendanceSummary", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_AttendanceSummary", ci), dt1stBSecondTab.Rows[0][1]));
                                        }
                                    }
                                    if (FirstBoard2ndTabRecordCount == 6)
                                    {
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("AttendanceCode_Present", ci), 0.000001));
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_Absent", ci), 0.000001));
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_LeaveTaken", ci), 0.000001));
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_OnDuty", ci), 0.000001));
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_Punctuality", ci), 0.000001));
                                        PieSeries1.Points.Add(new SeriesPoint(rm.GetString("Dash_AttendanceSummary", ci), 0.000001));
                                    }
                                    PieSeries1.PointOptions.PointView = PointView.Values;
                                    PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                                    PieSeries1.Label.Visible = true;
                                    ((PieSeriesLabel)PieSeries1.Label).Position = PieSeriesLabelPosition.Inside;
                                    PieSeries1.PointOptions.Pattern = "{V:0}";
                                    ((PiePointOptions)PieSeries1.PointOptions).PercentOptions.ValueAsPercent = false;
                                    ((PieSeriesLabel)PieSeries1.Label).BackColor = System.Drawing.Color.Transparent;
                                    PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                                    PieSeries1.Label.TextColor = Color.White;
                                    PieSeries1.Label.Font = new Font("robotoregular", 13.0f, FontStyle.Bold);
                                    PieSeries1.Label.LineVisible = true;
                                    PieSeries1.Label.LineLength = 2;
                                    PieSeries1.Label.Border.Visible = false;
                                    PieSeries1.LegendPointOptions.PointView = PointView.Argument;
                                    devPieChartAdd.Legend.Visible = false;
                                    devPieChartAdd.Legend.BackColor = System.Drawing.Color.Transparent;
                                    devPieChartAdd.Legend.Font = new Font("robotoregular", 8.0f, FontStyle.Regular);
                                    devPieChartAdd.Legend.FillStyle.FillMode = FillMode.Solid;
                                    devPieChartAdd.Series.Add(PieSeries1);
                                    dtAttendance.DefaultView.RowFilter = string.Empty;
                                    #endregion
                                }
                                else
                                {
                                    AttendanceData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            //Second Board
                            #region SecondTab
                            if (Convert.ToInt16(dsDashboardRights.Tables[1].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                {
                                    gvBoardDetails.DataSource = dstAttendance.Tables[2];
                                    gvBoardDetails.DataBind();
                                    GetSanctionPageRight(Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]),
                                        Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]),
                                        Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"])
                                        );
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "0")
                                    {
                                        SB3rdTabLeave.Style.Add("display", "none");
                                    }
                                    else
                                    {
                                        SB3rdTabLeave.Style.Add("display", "block");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "0")
                                    {
                                        SB3rdTabOnduty.Style.Add("display", "none");
                                    }
                                    else
                                    {
                                        SB3rdTabOnduty.Style.Add("display", "block");
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "0")
                                    {
                                        SB3rdTabPermission.Style.Add("display", "none");
                                    }
                                    else
                                    {
                                        SB3rdTabPermission.Style.Add("display", "block");
                                    }
                                    ApprovalData.Style.Add("display", "block");
                                }
                                else
                                {
                                    ApprovalData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            #region SecondTabChart  
                            DataTable dtSBSecondTabFilter = new DataTable();
                            if (Convert.ToInt16(dsDashboardRights.Tables[1].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1")
                                {
                                    #region LeaveChartControl
                                    Series series2 = new Series(rm.GetString("LeaveApplication_Leave", ci), ViewType.Pie);
                                    series2.DataSource = dtdetailsboard;
                                    series2.ArgumentScaleType = ScaleType.Qualitative;
                                    series2.ValueScaleType = ScaleType.Numerical;
                                    dtdetailsboard.DefaultView.RowFilter = "Approval='Leave'";
                                    dtSBSecondTabFilter = dtdetailsboard.DefaultView.ToTable();
                                    if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) == 0)
                                    {
                                        series2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                        series2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                        series2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                    }
                                    else
                                    {
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) > 0)
                                            series2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dtSBSecondTabFilter.Rows[0]["Pending"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) > 0)
                                            series2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dtSBSecondTabFilter.Rows[0]["Forwarded"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) > 0)
                                            series2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dtSBSecondTabFilter.Rows[0]["Approved"]));
                                    }
                                    series2.Label.Visible = true;
                                    ((PieSeriesLabel)series2.Label).Position = PieSeriesLabelPosition.Inside;
                                    series2.PointOptions.Pattern = "{V:0}";
                                    ((PiePointOptions)series2.PointOptions).PercentOptions.ValueAsPercent = false;
                                    ((PieSeriesLabel)series2.Label).BackColor = System.Drawing.Color.Transparent;
                                    series2.Label.FillStyle.FillMode = FillMode.Solid;
                                    series2.Label.TextColor = Color.White;
                                    series2.Label.Font = new Font("robotoregular", 13.0f, FontStyle.Bold);
                                    series2.Label.LineVisible = true;
                                    series2.Label.LineLength = 2;
                                    series2.Label.Border.Visible = false;
                                    series2.LegendPointOptions.PointView = PointView.Argument;
                                    devChartLeave.Legend.Visible = false;
                                    devChartLeave.Legend.BackColor = System.Drawing.Color.Transparent;
                                    devChartLeave.Legend.Font = new Font("robotoregular", 9.0f, FontStyle.Regular);
                                    devChartLeave.Legend.FillStyle.FillMode = FillMode.Solid;
                                    devChartLeave.Series.Add(series2);
                                    SBSTabChart1.Attributes.Add("class", "item active");
                                    isLeaveOption = true;
                                    dtdetailsboard.DefaultView.RowFilter = string.Empty;
                                    #endregion
                                }
                                else
                                {
                                    SBSTabChart1.Style.Add("display", "none");
                                }
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1")
                                {
                                    #region OnDutyChartControl
                                    if (isLeaveOption == false)
                                    {
                                        SBSTabChart2.Attributes.Add("class", "item active");
                                        isLeaveOption = true;
                                    }
                                    else
                                    {
                                        SBSTabChart2.Attributes.Add("class", "item");
                                    }
                                    Series Ondutyseries2 = new Series(rm.GetString("Dash_OnDuty", ci), ViewType.Pie);
                                    Ondutyseries2.DataSource = dtdetailsboard;
                                    Ondutyseries2.ArgumentScaleType = ScaleType.Qualitative;
                                    Ondutyseries2.ValueScaleType = ScaleType.Numerical;
                                    dtdetailsboard.DefaultView.RowFilter = "Approval='OnDuty'";
                                    dtSBSecondTabFilter = dtdetailsboard.DefaultView.ToTable();
                                    if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) == 0)
                                    {
                                        Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                        Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                        Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                    }
                                    else
                                    {
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) > 0)
                                            Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dtSBSecondTabFilter.Rows[0]["Forwarded"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) > 0)
                                            Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dtSBSecondTabFilter.Rows[0]["Pending"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) > 0)
                                            Ondutyseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dtSBSecondTabFilter.Rows[0]["Approved"]));
                                    }
                                    Ondutyseries2.Label.Visible = true;
                                    ((PieSeriesLabel)Ondutyseries2.Label).Position = PieSeriesLabelPosition.Inside;
                                    Ondutyseries2.PointOptions.Pattern = "{V:0}";
                                    ((PiePointOptions)Ondutyseries2.PointOptions).PercentOptions.ValueAsPercent = false;
                                    ((PieSeriesLabel)Ondutyseries2.Label).BackColor = System.Drawing.Color.Transparent;
                                    Ondutyseries2.Label.FillStyle.FillMode = FillMode.Solid;
                                    Ondutyseries2.Label.TextColor = Color.White;
                                    Ondutyseries2.Label.Font = new Font("robotoregular", 13.0f, FontStyle.Bold);
                                    Ondutyseries2.Label.LineVisible = true;
                                    Ondutyseries2.Label.LineLength = 2;
                                    Ondutyseries2.Label.Border.Visible = false;
                                    Ondutyseries2.LegendPointOptions.PointView = PointView.Argument;
                                    devChartOnduty.Legend.Visible = false;
                                    devChartOnduty.Legend.BackColor = System.Drawing.Color.Transparent;
                                    devChartOnduty.Legend.Font = new Font("robotoregular", 9.0f, FontStyle.Regular);
                                    devChartOnduty.Legend.FillStyle.FillMode = FillMode.Solid;
                                    devChartOnduty.Series.Add(Ondutyseries2);
                                    dtdetailsboard.DefaultView.RowFilter = string.Empty;
                                    #endregion
                                }
                                else
                                {
                                    SBSTabChart2.Style.Add("display", "none");
                                }
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                {
                                    #region Permission
                                    if (isLeaveOption == false)
                                    {
                                        SBSTabChart3.Attributes.Add("class", "item active");
                                    }
                                    else
                                    {
                                        SBSTabChart3.Attributes.Add("class", "item");
                                    }
                                    Series Permissionseries2 = new Series(rm.GetString("Dash_Permission", ci), ViewType.Pie);
                                    Permissionseries2.DataSource = dtdetailsboard;
                                    Permissionseries2.ArgumentScaleType = ScaleType.Qualitative;
                                    Permissionseries2.ValueScaleType = ScaleType.Numerical;
                                    dtdetailsboard.DefaultView.RowFilter = "Approval='Permission'";
                                    dtSBSecondTabFilter = dtdetailsboard.DefaultView.ToTable();
                                    if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) == 0 &&
                                        Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) == 0)
                                    {
                                        Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                        Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                        Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                    }
                                    else
                                    {
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Forwarded"]) > 0)
                                            Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dtSBSecondTabFilter.Rows[0]["Forwarded"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Pending"]) > 0)
                                            Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dtSBSecondTabFilter.Rows[0]["Pending"]));
                                        if (Convert.ToInt32(dtSBSecondTabFilter.Rows[0]["Approved"]) > 0)
                                            Permissionseries2.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dtSBSecondTabFilter.Rows[0]["Approved"]));
                                    }
                                    // Add the series to the chart.
                                    Permissionseries2.Label.Visible = true;
                                    ((PieSeriesLabel)Permissionseries2.Label).Position = PieSeriesLabelPosition.Inside;
                                    Permissionseries2.PointOptions.Pattern = "{V:0}";
                                    ((PiePointOptions)Permissionseries2.PointOptions).PercentOptions.ValueAsPercent = false;
                                    ((PieSeriesLabel)Permissionseries2.Label).BackColor = System.Drawing.Color.Transparent;
                                    Permissionseries2.Label.FillStyle.FillMode = FillMode.Solid;
                                    Permissionseries2.Label.TextColor = Color.White;
                                    Permissionseries2.Label.Font = new Font("robotoregular", 13.0f, FontStyle.Bold);
                                    Permissionseries2.Label.LineVisible = true;
                                    Permissionseries2.Label.LineLength = 2;
                                    Permissionseries2.Label.Border.Visible = false;
                                    Permissionseries2.LegendPointOptions.PointView = PointView.Argument;
                                    devChartPermission.Legend.Visible = false;
                                    devChartPermission.Legend.BackColor = System.Drawing.Color.Transparent;
                                    devChartPermission.Legend.Font = new Font("robotoregular", 9.0f, FontStyle.Regular);
                                    devChartPermission.Legend.FillStyle.FillMode = FillMode.Solid;
                                    devChartPermission.Series.Add(Permissionseries2);
                                    dtdetailsboard.DefaultView.RowFilter = string.Empty;
                                    #endregion
                                }
                                else
                                {
                                    SBSTabChart3.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            //Third Board   
                            #region SecondTab
                            if (Convert.ToInt16(dsDashboardRights.Tables[2].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                {
                                    dgdLeaveDetails.DataSource = dtException;
                                    dgdLeaveDetails.DataBind();
                                    ExceptionData.Style.Add("display", "block");
                                }
                                else
                                {
                                    ExceptionData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            #region SecondTabChart
                            DataTable dt3rdBSecondTabFilter = new DataTable();
                            int ThirdBoard2ndTabRecordCount = 0;
                            if (Convert.ToInt16(dsDashboardRights.Tables[2].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1" ||
                                Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                {
                                    devChartException.Series.Clear();
                                    int rownum1 = 0;
                                    Series PieSeriesException1 = new Series("Series1", ViewType.Pie);
                                    PieSeriesException1.DataSource = dtExecptionChart;
                                    PieSeriesException1.ArgumentScaleType = ScaleType.Qualitative;
                                    //PieSeriesException1.ArgumentDataMember = "TITLE";
                                    PieSeriesException1.ValueScaleType = ScaleType.Numerical;
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Late Entry'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("Late Entry", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dashboard_Late", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Early Exit'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("Early Exit", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_EarlyExit", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Shift Not Allocated'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("Less Hrs Work", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_LessHrsWork", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Approved Over Time'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("App Over Time", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_AppOverTime", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Discrepancy'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("Discrepancy", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_Discrepancy", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "Topic='Non Processed Record'";
                                        dt3rdBSecondTabFilter = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBSecondTabFilter.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard2ndTabRecordCount += 1;
                                            //PieSeriesException1.Points.Add(new SeriesPoint("Non Process", 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_NonProcess", ci), dt3rdBSecondTabFilter.Rows[0][1]));
                                        }
                                    }
                                    if (ThirdBoard2ndTabRecordCount == 6)
                                    {
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dashboard_Late", ci), 0.000001));
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_EarlyExit", ci), 0.000001));
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_LessHrsWork", ci), 0.000001));
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_AppOverTime", ci), 0.000001));
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_Discrepancy", ci), 0.000001));
                                        PieSeriesException1.Points.Add(new SeriesPoint(rm.GetString("Dash_NonProcess", ci), 0.000001));
                                    }
                                    PieSeriesException1.PointOptions.PointView = PointView.Values;
                                    PieSeriesException1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                                    PieSeriesException1.Label.Visible = true;
                                    ((PieSeriesLabel)PieSeriesException1.Label).Position = PieSeriesLabelPosition.Inside;
                                    PieSeriesException1.PointOptions.Pattern = "{V:0}";
                                    ((PiePointOptions)PieSeriesException1.PointOptions).PercentOptions.ValueAsPercent = false;
                                    ((PieSeriesLabel)PieSeriesException1.Label).BackColor = System.Drawing.Color.Transparent;
                                    PieSeriesException1.Label.FillStyle.FillMode = FillMode.Solid;
                                    PieSeriesException1.Label.TextColor = Color.White;
                                    PieSeriesException1.Label.Font = new Font("robotoregular", 13.0f, FontStyle.Bold);
                                    PieSeriesException1.Label.LineVisible = true;
                                    PieSeriesException1.Label.LineLength = 2;
                                    PieSeriesException1.Label.Border.Visible = false;
                                    PieSeriesException1.LegendPointOptions.PointView = PointView.Argument;
                                    devChartException.Legend.Visible = false;
                                    devChartException.Legend.BackColor = System.Drawing.Color.Transparent;
                                    devChartException.Legend.Font = new Font("robotoregular", 8.0f, FontStyle.Regular);
                                    devChartException.Legend.FillStyle.FillMode = FillMode.Solid;
                                    devChartException.Series.Add(PieSeriesException1);
                                    dtExecptionChart.DefaultView.RowFilter = string.Empty;
                                }
                            }
                            #endregion
                            FBTab2.Style.Add("display", "block");
                            SBTabl2.Style.Add("display", "block");
                            TTab2.Style.Add("display", "block");
                        }
                        else
                        {
                            FBTab2.Style.Add("display", "none");
                            SBTabl2.Style.Add("display", "none");
                            TTab2.Style.Add("display", "none");
                        }
                        #endregion
                        #region ChartOptionEnabledOrNor
                        if (Convert.ToInt16(dsDashboardRights.Tables[3].Rows[0]["Chart"]) == 1)
                        {
                            if (isDashboardOption == false && isGridviewOption == false)
                            {
                                FBTab3.Attributes.Add("class", "active border-line2");
                                SBTabl3.Attributes.Add("class", "active border-line2");
                                TTab3.Attributes.Add("class", "active border-line2");
                                tab1.Attributes.Add("class", "tab-pane");
                                tab2.Attributes.Add("class", "tab-pane");
                                tab3.Attributes.Add("class", "tab-pane active");
                                tab4.Attributes.Add("class", "tab-pane");
                                tab5.Attributes.Add("class", "tab-pane");
                                tab6.Attributes.Add("class", "tab-pane active");
                                tab7.Attributes.Add("class", "tab-pane");
                                tab8.Attributes.Add("class", "tab-pane");
                                tab9.Attributes.Add("class", "tab-pane active");
                            }
                            //First Board
                            #region ThirdTabChart
                            DataTable dt1stBThirdTab = new DataTable();
                            int FirstBoard3ndTabRecordCount = 0;
                            if (Convert.ToInt16(dsDashboardRights.Tables[0].Rows.Count) > 0)
                            {
                                // Board display option is selected but attendance data is not selected means, it will display the data as empty.
                                if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                {
                                    devPieChartAssign.Series.Clear();
                                    Series PieSeries = new Series("Series1", ViewType.Pie3D);
                                    PieSeries.DataSource = dtAttendance;
                                    PieSeries.ArgumentScaleType = ScaleType.Qualitative;
                                    //PieSeries.ArgumentDataMember = "TITLE";
                                    PieSeries.ValueScaleType = ScaleType.Numerical;
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Present'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("AttendanceCode_Present", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("AttendanceCode_Present", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Absent'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_Absent", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_Absent", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved Leave'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedLeave", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedLeave", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Approved OnDuty'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedOnDuty", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedOnDuty", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Punctuality'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_Punctuality", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_Punctuality", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[0].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtAttendance.DefaultView.RowFilter = "TOPIC='Attendance Summary'";
                                        dt1stBThirdTab = dtAttendance.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt1stBThirdTab.Rows[0][1]) == 0)
                                        {
                                            FirstBoard3ndTabRecordCount += 1;
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_AttendanceSummary", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeries.Points.Add(new SeriesPoint(rm.GetString("Dash_AttendanceSummary", ci), dt1stBThirdTab.Rows[0][1]));
                                        }
                                    }
                                    //if (FirstBoard3ndTabRecordCount == 6)
                                    //{
                                    //    //PieSeries.Points.Add(new SeriesPoint("Present", 0.000001));
                                    //    //PieSeries.Points.Add(new SeriesPoint("Absent", 0.000001));
                                    //    //PieSeries.Points.Add(new SeriesPoint("LeaveTaken", 0.000001));
                                    //    //PieSeries.Points.Add(new SeriesPoint("OnDuty", 0.000001));
                                    //    //PieSeries.Points.Add(new SeriesPoint("Punctuality", 0.000001));
                                    //    //PieSeries.Points.Add(new SeriesPoint("AttendanceSummary", 0.000001));
                                    //}
                                    PieSeries.PointOptions.Pattern = "{A}";
                                    devPieChartAssign.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.RightOutside;
                                    ((PiePointOptions)PieSeries.PointOptions).PercentOptions.ValueAsPercent = false;
                                    PieSeries.Label.Visible = false;
                                    devPieChartAssign.Series.Add(PieSeries);
                                    PieSeries.LegendPointOptions.PointView = PointView.ArgumentAndValues;
                                    PieSeries.LegendTextPattern = "{A}: {V:0}";
                                    Pie3DSeriesView myView = (Pie3DSeriesView)PieSeries.View;
                                    dtAttendance.DefaultView.RowFilter = string.Empty;
                                    AttendanceData.Style.Add("display", "block");
                                }
                                else
                                {
                                    AttendanceData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            //Second Board
                            #region ThirdTabChart
                            DataTable dt2ndBThirdTabFiltered = new DataTable();
                            if (Convert.ToInt16(dsDashboardRights.Tables[1].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                {
                                    #region LeaveChart
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        Series series1 = new Series(rm.GetString("LeaveApplication_Leave", ci), ViewType.Pie3D);
                                        series1.DataSource = dstAttendance.Tables[2];
                                        series1.ArgumentScaleType = ScaleType.Qualitative;
                                        series1.ValueScaleType = ScaleType.Numerical;
                                        dstAttendance.Tables[2].DefaultView.RowFilter = "Approval='Leave'";
                                        dt2ndBThirdTabFiltered = dstAttendance.Tables[2].DefaultView.ToTable();
                                        if (Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Pending"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Approved"]) == 0
                                            )
                                        {
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                        }
                                        else
                                        {
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]));
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dt2ndBThirdTabFiltered.Rows[0]["Pending"]));
                                            series1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dt2ndBThirdTabFiltered.Rows[0]["Approved"]));
                                        }
                                        // Add the series to the chart.
                                        series1.PointOptions.Pattern = "{A}";
                                        series1.Label.Visible = false;
                                        WebChartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                                        ((PiePointOptions)series1.PointOptions).PercentOptions.ValueAsPercent = false;
                                        WebChartControl1.Series.Add(series1);
                                        series1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
                                        series1.LegendTextPattern = "{A}: {V:0}";
                                        dstAttendance.Tables[2].DefaultView.RowFilter = string.Empty;
                                        SB3rdTabLeave.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SB3rdTabLeave.Style.Add("display", "none");
                                    }
                                    #endregion
                                    #region OnDutyChart
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        Series Ondutyseries1 = new Series(rm.GetString("Dash_OnDuty", ci), ViewType.Pie3D);
                                        Ondutyseries1.DataSource = dstAttendance.Tables[2];
                                        Ondutyseries1.ArgumentScaleType = ScaleType.Qualitative;
                                        Ondutyseries1.ValueScaleType = ScaleType.Numerical;
                                        dstAttendance.Tables[2].DefaultView.RowFilter = "Approval='Onduty'";
                                        dt2ndBThirdTabFiltered = dstAttendance.Tables[2].DefaultView.ToTable();
                                        if (Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Pending"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Approved"]) == 0
                                            )
                                        {
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                        }
                                        else
                                        {
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]));
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dt2ndBThirdTabFiltered.Rows[0]["Pending"]));
                                            Ondutyseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dt2ndBThirdTabFiltered.Rows[0]["Approved"]));
                                        }
                                        // Add the series to the chart.
                                        Ondutyseries1.PointOptions.Pattern = "{A}";
                                        Ondutyseries1.Label.Visible = false;
                                        WebChartControl2.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                                        ((PiePointOptions)Ondutyseries1.PointOptions).PercentOptions.ValueAsPercent = false;
                                        WebChartControl2.Series.Add(Ondutyseries1);
                                        Ondutyseries1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
                                        Ondutyseries1.LegendTextPattern = "{A}: {V:0}";
                                        dstAttendance.Tables[2].DefaultView.RowFilter = string.Empty;
                                        SB3rdTabOnduty.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SB3rdTabOnduty.Style.Add("display", "none");
                                    }
                                    #endregion
                                    #region Permission
                                    if (Convert.ToString(dsDashboardRights.Tables[1].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        Series Permissionseries1 = new Series(rm.GetString("Dash_Permission", ci), ViewType.Pie3D);
                                        Permissionseries1.DataSource = dstAttendance.Tables[2];
                                        Permissionseries1.ArgumentScaleType = ScaleType.Qualitative;
                                        Permissionseries1.ValueScaleType = ScaleType.Numerical;
                                        dstAttendance.Tables[2].DefaultView.RowFilter = "Approval='Permission'";
                                        dt2ndBThirdTabFiltered = dstAttendance.Tables[2].DefaultView.ToTable();
                                        if (Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Pending"]) == 0 &&
                                            Convert.ToInt32(dt2ndBThirdTabFiltered.Rows[0]["Approved"]) == 0
                                            )
                                        {
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), 0.000001));
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), 0.000001));
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), 0.000001));
                                        }
                                        else
                                        {
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Forwarded", ci), dt2ndBThirdTabFiltered.Rows[0]["Forwarded"]));
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Pending", ci), dt2ndBThirdTabFiltered.Rows[0]["Pending"]));
                                            Permissionseries1.Points.Add(new SeriesPoint(rm.GetString("btn_Approved", ci), dt2ndBThirdTabFiltered.Rows[0]["Approved"]));
                                        }
                                        // Add the series to the chart.
                                        Permissionseries1.PointOptions.Pattern = "{A}";
                                        Permissionseries1.Label.Visible = false;
                                        WebChartControl3.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
                                        ((PiePointOptions)Permissionseries1.PointOptions).PercentOptions.ValueAsPercent = false;
                                        WebChartControl3.Series.Add(Permissionseries1);
                                        Permissionseries1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
                                        Permissionseries1.LegendTextPattern = "{A}: {V:0}";
                                        dstAttendance.Tables[2].DefaultView.RowFilter = string.Empty;
                                        SB3rdTabPermission.Style.Add("display", "block");
                                    }
                                    else
                                    {
                                        SB3rdTabPermission.Style.Add("display", "none");
                                    }
                                    ApprovalData.Style.Add("display", "block");
                                    #endregion
                                }
                                else
                                {
                                    ApprovalData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            //Third Board
                            #region ThirdTabChart
                            DataTable dt3rdBThirdTabFiltered = new DataTable();
                            int ThirdBoard3rdTabRecordCount = 0;
                            if (Convert.ToInt16(dsDashboardRights.Tables[2].Rows.Count) > 0)
                            {
                                if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1" ||
                                    Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                {
                                    devxchartException.Series.Clear();
                                    Series PieSeriesException = new Series("Series1", ViewType.Pie3D);
                                    PieSeriesException.DataSource = dtExecptionChart;
                                    PieSeriesException.ArgumentScaleType = ScaleType.Qualitative;
                                    // PieSeriesException.ArgumentDataMember = "TITLE";
                                    PieSeriesException.ValueScaleType = ScaleType.Numerical;
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[0]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Late Entry'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dashboard_Late", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dashboard_Late", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[1]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Early Exit'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_EarlyExit", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_EarlyExit", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[2]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Shift Not Allocated'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Alert_Shiftnotallocated", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Alert_Shiftnotallocated", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[3]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Approved Over Time'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedOverTime", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_ApprovedOverTime", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[4]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Discrepancy'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_Discrepancy", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_Discrepancy", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    if (Convert.ToString(dsDashboardRights.Tables[2].Rows[5]["ViewPrev"]) == "1")
                                    {
                                        dtExecptionChart.DefaultView.RowFilter = "TOPIC='Non Processed Record'";
                                        dt3rdBThirdTabFiltered = dtExecptionChart.DefaultView.ToTable();
                                        if (Convert.ToInt32(dt3rdBThirdTabFiltered.Rows[0][1]) == 0)
                                        {
                                            ThirdBoard3rdTabRecordCount += 1;
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_NonProcessedRecord", ci), 0.000001));
                                        }
                                        else
                                        {
                                            PieSeriesException.Points.Add(new SeriesPoint(rm.GetString("Dash_NonProcessedRecord", ci), dt3rdBThirdTabFiltered.Rows[0][1]));
                                        }
                                    }
                                    //if (ThirdBoard3rdTabRecordCount == 6)
                                    //{
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Late Entry", 0.000001));
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Early Exit", 0.000001));
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Less Hours Worked", 0.000001));
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Approved Over Time", 0.000001));
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Discrepancy", 0.000001));
                                    //    //PieSeriesException.Points.Add(new SeriesPoint("Non Processed Record", 0.000001));
                                    //}
                                    PieSeriesException.PointOptions.Pattern = "{A}";
                                    PieSeriesException.Label.Visible = false;
                                    devxchartException.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.RightOutside;
                                    ((PiePointOptions)PieSeriesException.PointOptions).PercentOptions.ValueAsPercent = false;
                                    devxchartException.Series.Add(PieSeriesException);
                                    PieSeriesException.LegendPointOptions.PointView = PointView.ArgumentAndValues;
                                    PieSeriesException.LegendTextPattern = "{A}: {V:0}";
                                    Pie3DSeriesView myViewException = (Pie3DSeriesView)PieSeriesException.View;
                                    dtExecptionChart.DefaultView.RowFilter = string.Empty;
                                    ExceptionData.Style.Add("display", "block");
                                }
                                else
                                {
                                    ExceptionData.Style.Add("display", "none");
                                }
                            }
                            #endregion
                            FBTab3.Style.Add("display", "block");
                            SBTabl3.Style.Add("display", "block");
                            TTab3.Style.Add("display", "block");
                        }
                        else
                        {
                            FBTab3.Style.Add("display", "none");
                            devPieChartAssign.Style.Add("display", "none");
                            SBTabl3.Style.Add("display", "none");
                            WebChartControl1.Style.Add("display", "none");
                            WebChartControl2.Style.Add("display", "none");
                            WebChartControl3.Style.Add("display", "none");
                            TTab3.Style.Add("display", "none");
                            devxchartException.Style.Add("display", "none");
                        }
                        #endregion
                    }
                    else
                    {
                        //Display option is not selected for this usergroup.
                        trDashboard.Style.Add("display", "none");
                    }
                }
                else
                {
                    trDashboard.Style.Add("display", "none");
                }
            }
        }
    }
    //Get the UserRight 
    private bool UserRightsFromID(int pageID)
    {
        //Leave-->24
        //Onduty-->174
        //Permission-->25
        DataSet ds_Checkuser = new DataSet();
        ds_Checkuser = objCheckUser.checkRights(pageID, Convert.ToInt32(Session["userGroup_Id"]), "viewPrv");
        if (ds_Checkuser.Tables[0].Rows.Count == 0)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    private void GetSanctionPageRight(string leave, string onduty, string permission)
    {
        bool blLeave = false, blPermission, blOnduty;
        if (leave == "1")
        {
            if (Convert.ToString(ViewState["blLeave"]) == "")
            {
                blLeave = UserRightsFromID(248);
                ViewState["blLeave"] = blLeave;
            }
            else
            {
                blLeave = (bool)ViewState["blLeave"];
            }
            EnableDisableLeaveControls(blLeave);
        }
        if (permission == "1")
        {
            if (Convert.ToString(ViewState["blPermission"]) == "")
            {
                blPermission = UserRightsFromID(248);
                ViewState["blPermission"] = blPermission;
            }
            else
            {
                blPermission = (bool)ViewState["blPermission"];
            }
            EnableDisablePermissionControls(blPermission);
        }
        if (onduty == "1")
        {
            if (Convert.ToString(ViewState["blOnduty"]) == "")
            {
                blOnduty = UserRightsFromID(248);
                ViewState["blOnduty"] = blOnduty;
            }
            else
            {
                blOnduty = (bool)ViewState["blOnduty"];
            }
            EnableDisableOndutyControls(blOnduty);
        }
    }
    private void EnableDisableOndutyControls(bool isTrue)
    {
        btnOndutyApproved.Enabled = isTrue;
        btnOndutyForwarded.Enabled = isTrue;
        btnLeavePending.Enabled = isTrue;
    }
    private void EnableDisablePermissionControls(bool isTrue)
    {
        btnPermissionApproved.Enabled = isTrue;
        btnPermissionForwarded.Enabled = isTrue;
        btnPermissionPending.Enabled = isTrue;
    }
    private void EnableDisableLeaveControls(bool isTrue)
    {
        btnLeaveApproved.Enabled = isTrue;
        btnLeaveForwarded.Enabled = isTrue;
        btnLeavePending.Enabled = isTrue;
    }
    #endregion
    #region PieChartEvents
    protected void WebChartControl1_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        try
        {
            PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
            GradientFillOptionsBase gradientOptions = ((GradientFillOptionsBase)options.FillStyle.Options);
            options.FillStyle.FillMode = FillMode.Solid;
            switch (Convert.ToString(e.SeriesPoint.Argument))
            {
                case "Pending":
                    options.Color = Color.FromArgb(0, 166, 90);
                    e.LegendDrawOptions.Color = Color.FromArgb(0, 166, 90);
                    break;
                case "Forwarded":
                    options.Color = Color.FromArgb(210, 0, 0);
                    e.LegendDrawOptions.Color = Color.FromArgb(210, 0, 0);
                    break;
                case "Approved":
                    options.Color = Color.FromArgb(60, 141, 188);
                    e.LegendDrawOptions.Color = Color.FromArgb(60, 141, 188);
                    break;
            }
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void devPieChartAdd_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode.Solid;
        ((PieSeriesLabel)e.Series.Label).Position = PieSeriesLabelPosition.Inside;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Present":
                options.Color = Color.FromArgb(131, 218, 246);
                e.LegendDrawOptions.Color = Color.FromArgb(131, 218, 246);
                break;
            case "Absent":
                options.Color = Color.FromArgb(255, 174, 174);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 174, 174);
                break;
            case "LeaveTaken":
                options.Color = Color.FromArgb(0, 204, 113);
                e.LegendDrawOptions.Color = Color.FromArgb(0, 204, 113);
                break;
            case "OnDuty":
                options.Color = Color.FromArgb(171, 220, 131);
                e.LegendDrawOptions.Color = Color.FromArgb(171, 220, 131);
                break;
            case "AttendanceSummary":
                options.Color = Color.FromArgb(203, 151, 225);
                e.LegendDrawOptions.Color = Color.FromArgb(203, 151, 225);
                break;
            case "Punctuality":
                options.Color = Color.FromArgb(255, 182, 108);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 182, 108);
                break;
        }
    }
    protected void devPieChartAssign_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        Pie3DDrawOptions options = (Pie3DDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode3D.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Present":
                options.Color = Color.FromArgb(131, 218, 246);
                e.LegendDrawOptions.Color = Color.FromArgb(131, 218, 246);
                break;
            case "Absent":
                options.Color = Color.FromArgb(255, 174, 174);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 174, 174);
                break;
            case "Approved Leave":
                options.Color = Color.FromArgb(0, 204, 113);
                e.LegendDrawOptions.Color = Color.FromArgb(0, 204, 113);
                break;
            case "Approved OnDuty":
                options.Color = Color.FromArgb(171, 220, 131);
                e.LegendDrawOptions.Color = Color.FromArgb(171, 220, 131);
                break;
            case "AttendanceSummary":
                options.Color = Color.FromArgb(203, 151, 225);
                e.LegendDrawOptions.Color = Color.FromArgb(203, 151, 225);
                break;
            case "Punctuality":
                options.Color = Color.FromArgb(255, 182, 108);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 182, 108);
                break;
        }
    }
    protected void devPieChartAssign_ObjectSelected(object sender, HotTrackEventArgs e)
    {
        Series series = e.Object as Series;
        if (series != null)
        {
            ExplodedSeriesPointCollection explodedPoints = ((PieSeriesViewBase)series.View).ExplodedPoints;
            SeriesPoint point = (SeriesPoint)e.AdditionalObject;
            explodedPoints.ToggleExplodedState(point);
        }
        e.Cancel = series == null;
    }
    protected void devchartException_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Late Entry":
                options.Color = Color.FromArgb(225, 81, 81);
                e.LegendDrawOptions.Color = Color.FromArgb(225, 81, 81);
                break;
            case "Early Exit":
                options.Color = Color.FromArgb(208, 69, 123);
                e.LegendDrawOptions.Color = Color.FromArgb(208, 69, 123);
                break;
            case "Shift Not Allocated":
                options.Color = Color.FromArgb(251, 177, 103);
                e.LegendDrawOptions.Color = Color.FromArgb(251, 177, 103);
                break;
            case "App Over Time":
                options.Color = Color.FromArgb(47, 182, 123);
                e.LegendDrawOptions.Color = Color.FromArgb(47, 182, 123);
                break;
            case "Discrepancy":
                options.Color = Color.FromArgb(131, 134, 255);
                e.LegendDrawOptions.Color = Color.FromArgb(131, 134, 255);
                break;
            case "Non Process":
                options.Color = Color.FromArgb(47, 148, 209);
                e.LegendDrawOptions.Color = Color.FromArgb(47, 148, 209);
                break;
        }
    }
    protected void devChartLeave_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Forwarded":
                options.Color = Color.FromArgb(255, 127, 0);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 127, 0);
                break;
            case "Approved":
                options.Color = Color.FromArgb(0, 204, 113);
                e.LegendDrawOptions.Color = Color.FromArgb(0, 204, 113);
                break;
            case "Pending":
                options.Color = Color.FromArgb(221, 75, 57);
                e.LegendDrawOptions.Color = Color.FromArgb(221, 75, 57);
                break;
        }
    }
    protected void devChartOnduty_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Forwarded":
                options.Color = Color.FromArgb(255, 127, 0);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 127, 0);
                break;
            case "Approved":
                options.Color = Color.FromArgb(91, 192, 222);
                e.LegendDrawOptions.Color = Color.FromArgb(91, 192, 222);
                break;
            case "Pending":
                options.Color = Color.FromArgb(221, 75, 57);
                e.LegendDrawOptions.Color = Color.FromArgb(221, 75, 57);
                break;
        }
    }
    protected void devChartPermission_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        PieDrawOptions options = (PieDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Forwarded":
                options.Color = Color.FromArgb(255, 127, 0);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 127, 0);
                break;
            case "Approved":
                options.Color = Color.FromArgb(87, 154, 208);
                e.LegendDrawOptions.Color = Color.FromArgb(87, 154, 208);
                break;
            case "Pending":
                options.Color = Color.FromArgb(221, 75, 57);
                e.LegendDrawOptions.Color = Color.FromArgb(221, 75, 57);
                break;
        }
    }
    protected void devWebChartLeave_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        GetLegendAndOptionColor(e, "Leave");
    }
    private static void GetLegendAndOptionColor(CustomDrawSeriesPointEventArgs e, string type)
    {
        Pie3DDrawOptions options = (Pie3DDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode3D.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Forwarded":
                options.Color = Color.FromArgb(255, 127, 0);
                e.LegendDrawOptions.Color = Color.FromArgb(255, 127, 0);
                break;
            case "Approved":
                if (type == "Leave")
                {
                    options.Color = Color.FromArgb(0, 204, 113);
                    e.LegendDrawOptions.Color = Color.FromArgb(0, 204, 113);
                }
                else if (type == "Onduty")
                {
                    options.Color = Color.FromArgb(91, 192, 222);
                    e.LegendDrawOptions.Color = Color.FromArgb(91, 192, 222);
                }
                else if (type == "Permission")
                {
                    options.Color = Color.FromArgb(87, 154, 208);
                    e.LegendDrawOptions.Color = Color.FromArgb(87, 154, 208);
                }
                break;
            case "Pending":
                options.Color = Color.FromArgb(221, 75, 57);
                e.LegendDrawOptions.Color = Color.FromArgb(221, 75, 57);
                break;
        }
    }
    protected void devWebChartOnduty_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        GetLegendAndOptionColor(e, "Onduty");
    }
    protected void devWebChartPermission_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        GetLegendAndOptionColor(e, "Permission");
    }
    protected void devxchartException_CustomDrawSeriesPoint(object sender, DevExpress.XtraCharts.CustomDrawSeriesPointEventArgs e)
    {
        Pie3DDrawOptions options = (Pie3DDrawOptions)e.SeriesDrawOptions;
        options.FillStyle.FillMode = FillMode3D.Solid;
        switch (Convert.ToString(e.SeriesPoint.Argument))
        {
            case "Late Entry":
                options.Color = Color.FromArgb(225, 81, 81);
                e.LegendDrawOptions.Color = Color.FromArgb(225, 81, 81);
                break;
            case "Early Exit":
                options.Color = Color.FromArgb(208, 69, 123);
                e.LegendDrawOptions.Color = Color.FromArgb(208, 69, 123);
                break;
            case "Shift Not Allocated":
                options.Color = Color.FromArgb(251, 177, 103);
                e.LegendDrawOptions.Color = Color.FromArgb(251, 177, 103);
                break;
            case "Approved Over Time":
                options.Color = Color.FromArgb(47, 182, 123);
                e.LegendDrawOptions.Color = Color.FromArgb(47, 182, 123);
                break;
            case "Discrepancy":
                options.Color = Color.FromArgb(131, 134, 255);
                e.LegendDrawOptions.Color = Color.FromArgb(131, 134, 255);
                break;
            case "Non Processed Record":
                options.Color = Color.FromArgb(47, 148, 209);
                e.LegendDrawOptions.Color = Color.FromArgb(47, 148, 209);
                break;
        }
    }
    #endregion
    #region Button Click Events
    protected void imgbtnSearch_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["LevelId"] != null)
        {
            LevelId = Convert.ToString(Session["parentLevelId"]);
        }
        LoadDashBoardDetails();
        lbldisplayShiftDate.Text = txtFrom.Text;
        trFiller.Style.Add("display", "");
    }
    protected void btnCloseNews_Click(object sender, EventArgs e)
    {
        News.Visible = false;
        Session["newsClose"] = "close";
    }
    protected void lbtn_logout_Click(object sender, EventArgs e)
    {
        if (Session["EmployeeId"] != null)
        {
            string userId = Convert.ToString(Session["EmployeeId"]);
            string sUser = Convert.ToString(Cache[Convert.ToString(Session["EmployeeId"]).ToUpper()]);
            if (sUser != null && sUser != String.Empty)
            {
                ObjEmployeeEventData.InsertUpdateLastLogout(userId);
                HttpContext.Current.Cache.Remove(Convert.ToString(Session["EmployeeId"]).ToUpper());
                Session.Clear();
            }
        }
        HttpContext.Current.Response.Redirect("~/Index.aspx");
    }
    protected void Present_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("MonthlyAttendance", Convert.ToInt32(lblCountPresent.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void Absent_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("Absentees", Convert.ToInt32(lblCountAbsent.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void Leave_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("Leave", Convert.ToInt32(lblCountLeaveTaken.Text));
            // The below will uncommented during the angler hosting.
            //getReport("Leave_Angler", Convert.ToInt32(lblCountLeaveTaken.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void Late_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("LateEntry", Convert.ToInt32(lblCountLateEntry.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void Punctuality_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("Punctuality", Convert.ToInt32(lblCountPunctuality.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void EarlyExit_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("EarlyExit", Convert.ToInt32(lblCountEarlyExit.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void OnDutyEntry_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("OnDutyEntry", Convert.ToInt32(lblCountOnduty.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void AttendanceSummary_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("AttendanceSummary", Convert.ToInt32(lblAttendanceSummary.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void LessHoursWorked_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("ShiftNotAllocated", Convert.ToInt32(lblShiftNotAllocated.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void OverTime_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("OverTime", Convert.ToInt32(lblCountOverTime.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void Discrepancy_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("Discrepancy", Convert.ToInt32(lblCountDiscrepancy.Text));
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void NonProcessRecord_Click(object sender, EventArgs e)
    {
        try
        {
            getReport("NonProcessedData", Convert.ToInt32(lblCountNoProcessRecord.Text));
        }
        catch (Exception ex)
        {
        }
    }
    protected void LoadLeave(string status, int Counts)
    {
        if (Counts == 0)
        {
            Message(rm.GetString("Alert_Norecordfound", ci));
        }
        else
        {
            btnLeaveApproved.OnClientClick = "document.forms[0].target = '_blank';";
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            int LevelId = Convert.ToInt32(Session["parentLevelId"]);
            Session["isDashBoard"] = "Yes";
            switch (payrollConfig)
            {
                case 1:
                    Response.Redirect("Transactions/TA_UI_Transactions_LeaveSanctionView_Angler.aspx?LevelId=" + LevelId + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    break;
                default:
                    Response.Redirect("Transactions/TA_UI_Transactions_LeaveSanctionView.aspx?LevelId=" + LevelId + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    break;
            }
        }
    }
    protected void LoadOnduty(string status, int Counts)
    {
        if (Counts == 0)
        {
            Message(rm.GetString("Alert_Norecordfound", ci));
        }
        else
        {
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            Session["isDashBoard"] = "Yes";
            switch (status)
            {
                case "Approved":
                    Response.Redirect("Transactions/TA_UI_Transactions_OnDutySanctionView.aspx?EmpId=&EmpName=&EmpCategory=0&EmpType=0&FromDate=" + txtFrom.Text + "&ToDate=" + txtFrom.Text + "&Status=" + status + "&SwipeCard=&Shift=" + SelectedShift, false);
                    break;
                default:
                    Response.Redirect("Transactions/TA_UI_Transactions_OnDutySanctionView.aspx?EmpId=&EmpName=&EmpCategory=0&EmpType=0&FromDate=" + txtFrom.Text + "&ToDate=" + txtFrom.Text + "&Status=" + status + "&SwipeCard=&Shift=" + SelectedShift, false);
                    break;
            }
        }
    }
    protected void LoadPermission(string status, int Counts)
    {
        if (Counts == 0)
        {
            Message(rm.GetString("Alert_Norecordfound", ci));
        }
        else
        {
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            int Level = Convert.ToInt32(Session["parentLevelId"]);
            Session["isDashBoard"] = "Yes";
            switch (status)
            {
                case "Approved":
                    if (payrollConfig == 1)
                    {
                        Response.Redirect("Transactions/TA_UI_Transactions_PermissionSanctionView_Angler.aspx?LevelId=" + Convert.ToString(Level) + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    }
                    else
                    {
                        Response.Redirect("Transactions/TA_UI_Transactions_PermissionSanctionView.aspx?LevelId=" + Convert.ToString(Level) + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    }
                    break;
                default:
                    if (payrollConfig == 1)
                    {
                        Response.Redirect("Transactions/TA_UI_Transactions_PermissionBulkSanction_Angler.aspx?LevelId=" + Convert.ToString(Level) + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    }
                    else
                    {
                        Response.Redirect("Transactions/TA_UI_Transactions_PermissionBulkSanction.aspx?LevelId=" + Convert.ToString(Level) + "&Status=" + status + "&From_Date=" + txtFrom.Text + "&To_Date=" + txtFrom.Text + "&strSwipeCardNo=&strEmployeeName=&strEmployeeCodeId=&Shift=" + SelectedShift, false);
                    }
                    break;
            }
        }
    }
    protected void btnOndutyApproved_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton btnbutton = (LinkButton)sender;
            switch (Convert.ToString(btnbutton.CommandArgument))
            {
                case "Approved":
                    LoadOnduty("Approved", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Forwarded":
                    LoadOnduty("Forwarded", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Pending":
                    LoadOnduty("Pending", Convert.ToInt32(btnbutton.Text));
                    break;
            }
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void btnLeaveApproved_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton btnbutton = (LinkButton)sender;
            switch (Convert.ToString(btnbutton.CommandArgument))
            {
                case "Approved":
                    LoadLeave("Approved", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Forwarded":
                    LoadLeave("Forwarded", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Pending":
                    LoadLeave("Pending", Convert.ToInt32(btnbutton.Text));
                    break;
            }
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void btnBoardApproved_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton btnbutton = (LinkButton)sender;
            switch (Convert.ToString(btnbutton.CommandName))
            {
                case "Leave":
                    switch (Convert.ToString(btnbutton.CommandArgument))
                    {
                        case "Approved":
                            LoadLeave("Approved", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Forwarded":
                            LoadLeave("Forwarded", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Pending":
                            LoadLeave("Pending", Convert.ToInt32(btnbutton.Text));
                            break;
                    }
                    break;
                case "Onduty":
                    switch (Convert.ToString(btnbutton.CommandArgument))
                    {
                        case "Approved":
                            LoadOnduty("Approved", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Forwarded":
                            LoadOnduty("Forwarded", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Pending":
                            LoadOnduty("Pending", Convert.ToInt32(btnbutton.Text));
                            break;
                    }
                    break;
                case "Permission":
                    switch (Convert.ToString(btnbutton.CommandArgument))
                    {
                        case "Approved":
                            LoadPermission("Approved", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Forwarded":
                            LoadPermission("Forwarded", Convert.ToInt32(btnbutton.Text));
                            break;
                        case "Pending":
                            LoadPermission("Pending", Convert.ToInt32(btnbutton.Text));
                            break;
                    }
                    break;
            }
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void btnPermissionApproved_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton btnbutton = (LinkButton)sender;
            switch (Convert.ToString(btnbutton.CommandArgument))
            {
                case "Approved":
                    LoadPermission("Approved", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Forwarded":
                    LoadPermission("Forwarded", Convert.ToInt32(btnbutton.Text));
                    break;
                case "Pending":
                    LoadPermission("Pending", Convert.ToInt32(btnbutton.Text));
                    break;
            }
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void getReport(string ReportName, int countvalue)
    {
        if (countvalue == 0)
        {
            Message(rm.GetString("Alert_Thereisnorecord", ci));
            exportData.Attributes.Add("src", "");
            return;
        }
        else
        {
            string employeeID;
            intIndividualUser = objCheckUser.CheckIndividualUser(Convert.ToString(Session["UserGroupName"]));
            if (intIndividualUser >= 1)
            {
                employeeID = Convert.ToString(Session["EmployeeCodeId"]);
            }
            else
            {
                employeeID = "";
            }
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);
            int shift;
            shift = Convert.ToInt32(ddlShift.SelectedValue);
            string Level = rptcommon.getNodes(Convert.ToInt32(Session["parentLevelId"]), Convert.ToString(Session["LevelRights"]));
            string strScript = "";
            strScript = strScript + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
            strScript = strScript + "<meta http-equiv='X-UA-Compatible' content='IE=edge' />";
            strScript = strScript + "<script language='javascript'>";
            switch (ReportName)
            {
                case "Absentees":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Absentees&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both&absentType=3','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "Leave_Angler":
                case "Leave":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=" + ReportName + "&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=true&LeaveType=All&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both&LeaveReportType=Details','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "MonthlyAttendance":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=" + ReportName + "&isPresentReport=1&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both&Dashboard=MonthlyAtt','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "LateEntry":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=LateEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal" + "&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "Punctuality":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Punctuality&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "EarlyExit":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=EarlyExit&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "OnDutyEntry":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OnDutyEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "AttendanceSummary":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=MonthlyAttendance&isPresentReport=0&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "ShiftNotAllocated":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=ShiftNotAllocated&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]) + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&Gender=Both','','left=10px, top=60px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "LessHoursWorked":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=LessHoursWorked&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&LessHoursWorked_SummaryOrDetail=D&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "OverTime":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OverTime&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&SanctionType=OverTime&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "Discrepancy":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Discrepancy&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
                case "NonProcessedData":
                    strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=RawData&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&EmpName=&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&Designation=0&Gender=Both&RawDataDashboard=" + 1 + "&ProcessType=2','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    break;
            }
            strScript = strScript + "</script>";
            Response.Write(strScript);
        }
    }
    protected void dgrdException_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        HiddenField HdfReportName = (HiddenField)dgrdException.Rows[e.RowIndex].FindControl("hdfReportname");
        HiddenField HdfCount = (HiddenField)dgrdException.Rows[e.RowIndex].FindControl("hdfCount");
        if (Convert.ToInt32(HdfCount.Value) != 0)
        {
            string employeeID;
            intIndividualUser = objCheckUser.CheckIndividualUser(Convert.ToString(Session["UserGroupName"]));
            if (intIndividualUser >= 1)
            {
                employeeID = Convert.ToString(Session["EmployeeCodeId"]);
            }
            else
            {
                employeeID = "";
            }
            string ReportName = Convert.ToString(HdfReportName.Value.ToString());
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);
            int shift;
            shift = Convert.ToInt32(ddlShift.SelectedValue);
            string Level = rptcommon.getNodes(Convert.ToInt32(Session["parentLevelId"]), Convert.ToString(Session["LevelRights"]));
            string strScript = "";
            strScript = strScript + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
            strScript = strScript + "<meta http-equiv='X-UA-Compatible' content='IE=edge' />";
            strScript = strScript + "<script language='javascript'>";
            if (ReportName == "MonthlyAttendance")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=" + ReportName + "&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both&Dashboard=MonthlyAtt','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "Absentees")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Absentees&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both&absentType=3','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "Leave_Angler" || ReportName == "Leave")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=" + ReportName + "&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=true&LeaveType=All&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both&LeaveReportType=Details','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "OnDuty")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OnDutyEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "AttendanceSummary")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=MonthlyAttendance&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "Punctuality")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Punctuality&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            strScript = strScript + "</script>";
            Response.Write(strScript);
        }
        else
        {
            Message(rm.GetString("Alert_Norecordfound", ci));
        }
    }
    protected void dgdLeaveDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        HiddenField HdfReportName = (HiddenField)dgdLeaveDetails.Rows[e.RowIndex].FindControl("hdfLeaveReportname");
        HiddenField HdfCount = (HiddenField)dgdLeaveDetails.Rows[e.RowIndex].FindControl("hdfCount");
        if (Convert.ToInt32(HdfCount.Value) != 0)
        {
            string employeeID;
            intIndividualUser = objCheckUser.CheckIndividualUser(Convert.ToString(Session["UserGroupName"]));
            if (intIndividualUser >= 1)
            {
                employeeID = Convert.ToString(Session["EmployeeCodeId"]);
            }
            else
            {
                employeeID = "";
            }
            string ReportName = Convert.ToString(HdfReportName.Value.ToString());
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);
            int shift;
            shift = Convert.ToInt32(ddlShift.SelectedValue);
            string Level = rptcommon.getNodes(Convert.ToInt32(Session["parentLevelId"]), Convert.ToString(Session["LevelRights"]));
            string strScript = "";
            strScript = strScript + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
            strScript = strScript + "<meta http-equiv='X-UA-Compatible' content='IE=edge' />";
            strScript = strScript + "<script language='javascript'>";
            if (ReportName == "LateEntry")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=LateEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal" + "&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "EarlyExit")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=EarlyExit&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal&SwipeCard=" + "" + "&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "LessHoursWorked")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=LessHoursWorked&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&LessHoursWorked_SummaryOrDetail=D&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "OverTime")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OverTime&SanctionType=OverTime&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "Discrepancy")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Discrepancy&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&Gender=Both','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            else if (ReportName == "Non Process")
            {
                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=RawData&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&EmpName=&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&Designation=0&Gender=Both&RawDataDashboard=" + 1 + "&ProcessType=2','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
            }
            strScript = strScript + "</script>";
            Response.Write(strScript);
        }
        else
        {
            Message(rm.GetString("Alert_Norecordfound", ci));
        }
    }
    protected void btnGridView_Click(object sender, EventArgs e)
    {
        try
        {
            //trBootstrap.Style.Add("display", "none");
            trDashboard.Style.Remove("display");
            //ModalPopupExtender1.TargetControlID = "btnAttChart";
            //ModalPopupExtender2.TargetControlID = "btnExpChart";
            ViewState["Board"] = "GridView";
            Session["SessionDashboardType"] = "GridView";
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void btnDashBoard_Click(object sender, EventArgs e)
    {
        try
        {
            trDashboard.Style.Add("display", "none");
            //trBootstrap.Style.Remove("display");
            //ModalPopupExtender1.TargetControlID = "btnChart1";
            //ModalPopupExtender2.TargetControlID = "btnChart2";
            ViewState["Board"] = "Bootstrap";
            Session["SessionDashboardType"] = "Bootstrap";
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void ExportXLPDF(string ReportName, int countvalue, string ExportType)
    {
        // problem found in OM_Books , so added
        if (Session["ReportsBasedOn"] != null)
        {
            if (Convert.ToString(Session["ReportsBasedOn"]) == "False")
            {
                strEmpAutoId = "0";
            }
            else
            {
                strEmpAutoId = Convert.ToString(Session["EmpAutoID"]);
            }
        }
        //end
        if (countvalue == 0)
        {
            Message(rm.GetString("Alert_Thereisnorecord", ci));
            return;
        }
        else
        {
            string employeeID;
            intIndividualUser = objCheckUser.CheckIndividualUser(Convert.ToString(Session["UserGroupName"]));
            if (intIndividualUser >= 1)
            {
                employeeID = Convert.ToString(Session["EmployeeCodeId"]);
            }
            else
            {
                employeeID = "";
            }
            DataSet dsEmp = new DataSet();
            string strFromdate, gstrDateFormat;
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
            strFromdate = txtFrom.Text;
            strFromdate = objCommon.DateConvertion(gstrDateFormat, strFromdate);
            int shift;
            shift = Convert.ToInt32(ddlShift.SelectedValue);
            string Level = rptcommon.getNodes(Convert.ToInt32(Session["parentLevelId"]), Convert.ToString(Session["LevelRights"]));
            string strScript = "";
            if (ExportType == "PDF")
            {
                strScript = strScript + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
                strScript = strScript + "<meta http-equiv='X-UA-Compatible' content='IE=edge' />";
                strScript = strScript + "<script language='javascript'>";
            }
            switch (ReportName)
            {
                case "Absentees":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Absentees&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both&absentType=3&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectAbsent(strFromdate, strFromdate, employeeID, shift, "", Level, 0,
                           0, Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]),
                           Convert.ToString(""), Convert.ToInt32(Session["parentLevelId"]),
                           0, Convert.ToString("Both"), 3,
                           Convert.ToInt64(strEmpAutoId), 1);
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "Leave_Angler":
                case "Leave":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=" + ReportName + "&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=true&LeaveType=All&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both&LeaveReportType=Details&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectLeave(strFromdate, strFromdate, employeeID, shift, "", Level,
                       "All", "Approved", 0, 0,
                       Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]),
                       "", Convert.ToInt32(Session["parentLevelId"]), 0, "Both", Convert.ToInt32(Session["EmpAutoID"]));
                        if (ReportName == "Leave_Angler") ReportName = "Leave";
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "MonthlyAttendance":
                case "AttendanceSummary":
                    if (ExportType == "PDF")
                    {
                        switch (ReportName)
                        {
                            case "MonthlyAttendance":
                                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?Dashboard=MonthlyAtt&isPresentReport=1&ReportName=MonthlyAttendance&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                                break;
                            case "AttendanceSummary":
                                strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?Dashboard=MonthlyAtt&isPresentReport=0&ReportName=MonthlyAttendance&MonthlydataLoadingVer=0&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&MinWorkHours=&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                                break;
                        }
                    }
                    else
                    {
                        switch (ReportName)
                        {
                            case "MonthlyAttendance":
                                if (Convert.ToString(Session["packageID"]) != "" && Convert.ToString(Session["packageID"]) == "161")
                                {
                                    //Ardlysis
                                    dsEmp = rptEmp.SelectMonthlyAttendance_Ardlysis("", strFromdate, strFromdate, "", Level, employeeID,
                                        0, 0, Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]),
                                        "", Convert.ToInt16(Session["parentLevelId"]), 0, "Both", shift,
                                        0, Convert.ToInt64(strEmpAutoId), 1);
                                    ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                                }
                                else
                                {
                                    dsEmp = rptEmp.SelectMonthlyAttendanceReport("Proc_TA_RptMonthlyAttendance", "", strFromdate, strFromdate,
                               "", Level, employeeID, 0, 0, Convert.ToString(Session["UserGroupName"]),
                               Convert.ToString(Session["GradeLevel"]), "", Convert.ToInt32(Session["parentLevelId"]),
                               0, "Both", shift, 0, Convert.ToInt64(strEmpAutoId), 0);
                                    if (dsEmp.Tables.Count > 0)
                                    {
                                        if (dsEmp.Tables[0].Rows.Count > 0)
                                        {
                                            dsEmp.Tables[0].DefaultView.RowFilter = "FIRSTSESSION='Present (On Duty)' or FIRSTSESSION='Present (On Duty)  #' or FIRSTSESSION='Present' or FIRSTSESSION='Present #' ";
                                            dsEmp.AcceptChanges();
                                            DataTable dt = dsEmp.Tables[0].DefaultView.ToTable();
                                            DataSet ds = new DataSet();
                                            ds.Tables.Add(dt);
                                            if (ReportName == "MonthlyAttendance")
                                                ReportName = "Present";
                                            ExportToExcel(ReportName, ds, txtFrom.Text);
                                        }
                                    }
                                }
                                break;
                            default:
                                if (ReportName == "AttendanceSummary")
                                    ReportName = "Attendance Summary";
                                dsEmp = rptEmp.SelectMonthlyAttendanceReport("Proc_TA_RptMonthlyAttendance", "", strFromdate, strFromdate,
                                "", Level, employeeID, 0, 0, Convert.ToString(Session["UserGroupName"]),
                                Convert.ToString(Session["GradeLevel"]), "", Convert.ToInt32(Session["parentLevelId"]),
                                0, "Both", shift, 0, Convert.ToInt64(strEmpAutoId), 0);
                                ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                                break;
                        }
                    }
                    break;
                case "LateEntry":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=LateEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal" + "&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectLateInstanceReport(employeeID, Level, strFromdate, strFromdate, "",
                            Convert.ToInt32(shift), 0,
                            0, Convert.ToString(Session["UserGroupName"]),
                           Convert.ToString(Session["GradeLevel"]), employeeID, Convert.ToInt32(Session["parentLevelId"]),
                            0, "Both", Convert.ToInt64(strEmpAutoId), 1, "");
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "Punctuality":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Punctuality&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=True&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectPunctuality(strFromdate, strFromdate, employeeID, shift, "", Level,
                       0, 0, Convert.ToString(Session["UserGroupName"]),
                       Convert.ToString(Session["GradeLevel"]), "", Convert.ToInt32(Session["parentLevelId"]),
                       0, "Both", Convert.ToInt64(strEmpAutoId), 1);
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "EarlyExit":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=EarlyExit&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Normal=Normal&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=PDF','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectEarlyOutReportNew(strFromdate, strFromdate, employeeID,
                            Convert.ToInt32(shift), "", Level,
                            0, 0, Convert.ToString(Session["UserGroupName"]),
                            Convert.ToString(Session["GradeLevel"]), employeeID,
                            Convert.ToInt32(Session["parentLevelId"]),
                            0, "Both", 1, "", Convert.ToInt32(Session["EmpAutoID"]));
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "OnDutyEntry":
                case "OnDuty":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OnDutyEntry&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + "" + "&shft=" + shift + "&EmpName=" + "" + "&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=" + "" + "&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectOnDutyEntryReport("", "", strFromdate, strFromdate, Level, 0, 0,
                        Convert.ToString(Session["UserGroupName"]), Convert.ToString(Session["GradeLevel"]),
                        "Approved", "", Convert.ToInt32(Session["parentLevelId"]),
                        0, "Both", Convert.ToInt32(Session["EmpAutoID"]));
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "ShiftNotAllocated":
                case "Shift Not Allocated":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=ShiftNotAllocated&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]) + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=10px, top=60px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectNotAllocationReport(
                            strFromdate, strFromdate, "", Level, employeeID, 0, 0, Convert.ToString(Session["UserGroupName"]),
                            Convert.ToString(Session["GradeLevel"]), "",
                            Convert.ToInt32(Session["parentLevelId"]),
                            0, "Both", 0);
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "OverTime":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=OverTime&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&SanctionType=OverTime&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&Status=Approved&SwipeCard=&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectOverTime(strFromdate, strFromdate, employeeID, shift, "", Level,
                       0, 0, Convert.ToString(Session["UserGroupName"]),
                       Convert.ToString(Session["GradeLevel"]), "Approved", "", Convert.ToInt32(Session["parentLevelId"]),
                       0, "Both", "OverTime", Convert.ToInt32(strEmpAutoId));
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "Discrepancy":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=Discrepancy&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&shft=" + shift + "&EmpName=&Level=" + Level + "&EmpCategory=0&EmpType=0&ParentLevelId" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&GradeLevel=" + Convert.ToString(Session["GradeLevel"]) + "&SwipeCard=&Designation=0&Gender=Both&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.SelectDiscrepancy(strFromdate, strFromdate, employeeID, shift, "", Level,
                       0, 0, Convert.ToString(Session["UserGroupName"]),
                       Convert.ToString(Session["GradeLevel"]),
                       "", Convert.ToInt32(Session["parentLevelId"]),
                       0, "Both",
                       Convert.ToInt32(strEmpAutoId), 1);
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
                case "RawData":
                    if (ExportType == "PDF")
                        strScript = strScript + "window.open('Reports/TA_UI_Report_ReportViewer.aspx?ReportName=RawData&dtFrom=" + strFromdate + "&dtTo=" + strFromdate + "&empid=" + employeeID + "&EmpName=&EmpCategory=0&EmpType=0&ParentLevelId=" + Convert.ToInt32(Session["parentLevelId"]).ToString() + "&UserGroupName=" + Convert.ToString(Session["UserGroupName"]) + "&Designation=0&Gender=Both&RawDataDashboard=" + 1 + "&ProcessType=2&isPDFExcel=" + ExportType + "','','left=150px, top=200px, width=1000px, height=600px, scrollbars=yes, status=no, resizable=yes');";
                    else
                    {
                        dsEmp = rptEmp.RawData(strFromdate, strFromdate, employeeID, "",
                        Convert.ToString(Session["UserGroupName"]), Convert.ToInt32(Session["parentLevelId"]),
                        0, 0, 0, "Both", 2, Convert.ToInt32(Session["EmpAutoID"]), "");
                        ExportToExcel(ReportName, dsEmp, txtFrom.Text);
                    }
                    break;
            }
            if (ExportType == "PDF")
            {
                strScript = strScript + "</script>";
                Response.Write(strScript);
            }
        }
    }
    private void ExportToExcel(string ReportName, DataSet dsEmp, string strFromdate)
    {
        if (dsEmp.Tables["Table"] == null || dsEmp.Tables["Table"].Rows.Count == 0)
        {
            Message(rm.GetString("Alert_Thereisnorecord", ci));
        }
        else
        {
            Session["Export_ExcelData"] = dsEmp;
            Response.Redirect("Reports/Excel_Export.aspx?ReportName=" + ReportName + "&FrmDate=" + Convert.ToString(strFromdate) + "&toDate=" + Convert.ToString(strFromdate) + "");
            //exportData.Attributes.Add("src", "ExportReportData.aspx?ReportName=Absentees&FromDate=" + Convert.ToString(txtFrom.Text) + "&Todate=" + strFromdate);
        }
    }
    protected void ImgAbsentExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ImageButton Export = (ImageButton)(sender);
            Int32 countValue = 0;
            countValue = GetDataCountValue(Export, countValue);
            ExportXLPDF(Export.CommandArgument.ToString(), Convert.ToInt32(countValue), "Excel");
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    protected void ImgAbsentPDF_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ImageButton Export = (ImageButton)(sender);
            Int32 countValue = 0;
            countValue = GetDataCountValue(Export, countValue);
            ExportXLPDF(Export.CommandArgument.ToString(), Convert.ToInt32(countValue), "PDF");
        }
        catch (Exception ex)
        {
            Message(ex.ToString());
        }
    }
    private int GetDataCountValue(ImageButton Export, int countValue)
    {
        switch (Export.CommandArgument.ToString())
        {
            case "MonthlyAttendance":
                countValue = Convert.ToInt32(lblCountPresent.Text);
                break;
            case "Absentees":
                countValue = Convert.ToInt32(lblCountAbsent.Text);
                break;
            case "Leave":
            case "Leave_Angler":
                countValue = Convert.ToInt32(lblCountLeaveTaken.Text);
                break;
            case "OnDutyEntry":
            case "OnDuty":
                countValue = Convert.ToInt32(lblCountOnduty.Text);
                break;
            case "AttendanceSummary":
                countValue = Convert.ToInt32(lblAttendanceSummary.Text);
                break;
            case "Punctuality":
                countValue = Convert.ToInt32(lblCountPunctuality.Text);
                break;
            case "LateEntry":
                countValue = Convert.ToInt32(lblCountLateEntry.Text);
                break;
            case "EarlyExit":
                countValue = Convert.ToInt32(lblCountEarlyExit.Text);
                break;
            case "ShiftNotAllocated":
            case "Shift Not Allocated":
                countValue = Convert.ToInt32(lblShiftNotAllocated.Text);
                break;
            case "OverTime":
                countValue = Convert.ToInt32(lblCountOverTime.Text);
                break;
            case "Discrepancy":
                countValue = Convert.ToInt32(lblCountDiscrepancy.Text);
                break;
            case "RawData":
                countValue = Convert.ToInt32(lblCountNoProcessRecord.Text);
                break;
        }
        return countValue;
    }
    #endregion
    protected void dgrdException_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (e.Row.RowType == DataControlRowType.Header)
        {
            Label lblHeader = (Label)e.Row.Cells[0].FindControl("lblHeaderName");
            Label lblCount = (Label)e.Row.Cells[0].FindControl("lblHeadCount");
            lblHeader.Text = Convert.ToString(Session["TotalEmployee"]);
            lblCount.Text = rm.GetString("Dash_Count", ci);
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lbl = (Label)e.Row.Cells[0].FindControl("lbltopic");
            ImageButton imgtopic = (ImageButton)e.Row.Cells[0].FindControl("imgtips");
            switch (lbl.Text)
            {
                case "Present":
                    lbl.Text = rm.GetString("AttendanceCode_Present", ci);
                    imgtopic.ImageUrl = "dist/img/icon1.jpg";
                    break;
                case "Absent":
                    lbl.Text = rm.GetString("Dash_Absent", ci);
                    imgtopic.ImageUrl = "dist/img/icon2.jpg";
                    break;
                case "Approved Leave":
                    lbl.Text = rm.GetString("Dash_ApprovedLeave", ci);
                    imgtopic.ImageUrl = "dist/img/icon3.jpg";
                    break;
                case "Approved OnDuty":
                    lbl.Text = rm.GetString("Dash_ApprovedOnDuty", ci);
                    imgtopic.ImageUrl = "dist/img/icon4.jpg";
                    break;
                case "Punctuality":
                    lbl.Text = rm.GetString("Dash_Punctuality", ci);
                    imgtopic.ImageUrl = "dist/img/icon5.jpg";
                    break;
                case "Attendance Summary":
                    lbl.Text = rm.GetString("Dash_AttendanceSummary", ci);
                    imgtopic.ImageUrl = "dist/img/icon6.jpg";
                    break;
            }
        }
    }
    protected void OnDataBound(object sender, EventArgs e)
    {
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
        TableHeaderCell cell = new TableHeaderCell();
        cell.Text = "";
        cell.ColumnSpan = 1;
        cell.CssClass = "head2";
        row.Controls.Add(cell);
        ImageButton imbut1 = new ImageButton();
        Label lbl1 = new Label();
        imbut1.ImageUrl = "dist/img/pending-icon.jpg";
        imbut1.Style.Add("vertical-align", "middle");
        imbut1.Style.Add("padding-right", "2px");
        imbut1.Enabled = false;
        cell = new TableHeaderCell();
        cell.ColumnSpan = 2;
        cell.CssClass = "head2 pen-text";
        lbl1.Text = rm.GetString("btn_Pending", ci);
        cell.Controls.Add(imbut1);
        cell.Controls.Add(lbl1);
        row.Controls.Add(cell);
        cell = new TableHeaderCell();
        ImageButton imbut2 = new ImageButton();
        Label lbl2 = new Label();
        cell.ColumnSpan = 2;
        cell.CssClass = "head2 for-text";
        imbut2.ImageUrl = "dist/img/forwarded-icon.jpg";
        imbut2.Style.Add("vertical-align", "middle");
        imbut2.Style.Add("padding-right", "2px");
        imbut2.Enabled = false;
        lbl2.Text = rm.GetString("btn_Forwarded", ci);
        cell.Controls.Add(imbut2);
        cell.Controls.Add(lbl2);
        row.Controls.Add(cell);
        cell = new TableHeaderCell();
        ImageButton imbut3 = new ImageButton();
        Label lbl3 = new Label();
        cell.ColumnSpan = 2;
        cell.CssClass = "head2 app-text";
        imbut3.ImageUrl = "dist/img/approved-icon.jpg";
        imbut3.Style.Add("vertical-align", "middle");
        imbut3.Style.Add("padding-right", "2px");
        imbut3.Enabled = false;
        lbl3.Text = rm.GetString("btn_Approved", ci);
        cell.Controls.Add(imbut3);
        cell.Controls.Add(lbl3);
        row.VerticalAlign = VerticalAlign.Top;
        row.Controls.Add(cell);
        //row.BackColor = ColorTranslator.FromHtml("#3AC0F2");
        gvBoardDetails.HeaderRow.Parent.Controls.AddAt(0, row);
    }
    protected void gvBoardDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (e.Row.RowType == DataControlRowType.Header)
        {
            Label lblHeader = (Label)e.Row.Cells[0].FindControl("lblHeaderNameBoard");
            lblHeader.Text = Convert.ToString(Session["TotalEmployee"]);
            Label lblBoardCount3 = (Label)e.Row.Cells[0].FindControl("lblBoardCount3");
            lblBoardCount3.Text = rm.GetString("Dash_Count", ci);
            Label lblBoardCount2 = (Label)e.Row.Cells[0].FindControl("lblBoardCount2");
            lblBoardCount2.Text = rm.GetString("Dash_Count", ci);
            Label lblBoardCount1 = (Label)e.Row.Cells[0].FindControl("lblBoardCount1");
            lblBoardCount1.Text = rm.GetString("Dash_Count", ci);
            //lblHeader.Text = Convert.ToString(Session["TotalEmployeePer"]);
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lbl = (Label)e.Row.Cells[0].FindControl("lblHeading");
            ImageButton imgtopic = (ImageButton)e.Row.Cells[0].FindControl("imgbtn");
            switch (lbl.Text)
            {
                case "Leave":
                    lbl.Text = rm.GetString("LeaveApplication_Leave", ci);
                    imgtopic.ImageUrl = "dist/img/lea-icon.jpg";
                    break;
                case "Onduty":
                    lbl.Text = rm.GetString("Dash_OnDuty", ci);
                    imgtopic.ImageUrl = "dist/img/ond-icon.jpg";
                    break;
                case "Permission":
                    lbl.Text = rm.GetString("Dash_Permission", ci);
                    imgtopic.ImageUrl = "dist/img/per-icon.jpg";
                    break;
            }
        }
    }
    protected void dgdLeaveDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (e.Row.RowType == DataControlRowType.Header)
        {
            Label lblHeader = (Label)e.Row.Cells[0].FindControl("lblHeaderNameBoard");
            lblHeader.Text = Convert.ToString(Session["TotalEmployeePer"]);
            Label lblHeadCount = (Label)e.Row.Cells[0].FindControl("lblHeadCount");
            lblHeadCount.Text = rm.GetString("Dash_Count", ci);
            //lblHeader.Text = Convert.ToString(Session["TotalEmployee"]);
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lbl = (Label)e.Row.Cells[0].FindControl("lbltopic");
            ImageButton imgtopic = (ImageButton)e.Row.Cells[0].FindControl("imgbtn");
            ImageButton btnExcel = (ImageButton)e.Row.Cells[3].FindControl("btnImagExcel");
            ImageButton btnPDF = (ImageButton)e.Row.Cells[4].FindControl("btnimgPDF");
            switch (lbl.Text)
            {
                case "Late Entry":
                    lbl.Text = rm.GetString("Dashboard_Late", ci);
                    imgtopic.ImageUrl = "dist/img/icon7.jpg";
                    break;
                case "Early Exit":
                    lbl.Text = rm.GetString("Dash_EarlyExit", ci);
                    imgtopic.ImageUrl = "dist/img/icon8.jpg";
                    break;
                case "Shift Not Allocated":
                    lbl.Text = rm.GetString("Alert_Shiftnotallocated", ci);
                    imgtopic.ImageUrl = "dist/img/icon9.jpg";
                    break;
                case "Approved Over Time":
                    lbl.Text = rm.GetString("Dash_ApprovedOverTime", ci);
                    imgtopic.ImageUrl = "dist/img/icon10.jpg";
                    break;
                case "Discrepancy":
                    lbl.Text = rm.GetString("Dash_Discrepancy", ci);
                    imgtopic.ImageUrl = "dist/img/icon11.jpg";
                    break;
                case "Non Processed Record":
                    lbl.Text = rm.GetString("Dash_NonProcessedRecord", ci);
                    imgtopic.ImageUrl = "dist/img/icon12.jpg";
                    btnExcel.Enabled = false;
                    btnPDF.Enabled = false;
                    break;
            }
        }
    }
    private void LoadNews()
    {
        DataSet ds = new DataSet();
        ds = objCommon.getNewsBanner("LeftNewsEvent");
        if (ds.Tables[0].Rows.Count > 0)
        {
            News.Visible = true;
        }
        else
        {
            News.Visible = false;
        }
        this.litLeftNews.Text = "";
        marqText = "<marquee direction='up' onmouseover='this.stop();' onmouseout='this.start();' scrollamount='2' height='100' style='text-align:center;'>";
        for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
        {
            if (ds.Tables[0].Rows[i]["NewsEventTitle"] != DBNull.Value && ds.Tables[0].Rows[i]["NewsEventDescription"] != DBNull.Value)
                marqText = marqText + "<div class='config-hdr' style='margin:0;padding:0'> <b style='color:red'>" + ds.Tables[0].Rows[i]["NewsEventTitle"] + "</b></div>" + ds.Tables[0].Rows[i]["NewsEventDescription"] + "<br>";
        }
        marqText = marqText + " </marquee>";
        this.litLeftNews.Text = marqText;
    }
    private void LoadDash()
    {
        string str1, str2, str3;
        str1 = Convert.ToString(hdAttendance.Value);
        str2 = Convert.ToString(hdApproval.Value);
        str3 = Convert.ToString(hdException.Value);
        if (str1 != "")
            Session["AttData"] = str1;
        if (str2 != "")
            Session["AppData"] = str2;
        if (str3 != "")
            Session["ExcData"] = str3;
        //Board 1
        string strSetAlert1 = "";
        strSetAlert1 = strSetAlert1 + "<script language='javascript'>";
        if (Request.QueryString["From_Date"] != null)
        {
            //Board 1
            switch (Convert.ToString(Session["AttData"]))
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab1\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab2\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab3\"]').tab('show');";
                    break;
            }
            switch (Convert.ToString(Session["AppData"]))
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab4\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab5\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab6\"]').tab('show');";
                    break;
            }
            switch (Convert.ToString(Session["ExcData"]))
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab7\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab8\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab9\"]').tab('show');";
                    break;
            }
        }
        else
        {
            //Board 1
            switch (str1)
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab1\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab2\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist1 a[href=\"#tab3\"]').tab('show');";
                    break;
            }
            switch (str2)
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab4\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab5\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist2 a[href=\"#tab6\"]').tab('show');";
                    break;
            }
            switch (str3)
            {
                case "1":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab7\"]').tab('show');";
                    break;
                case "2":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab8\"]').tab('show');";
                    break;
                case "3":
                    strSetAlert1 = strSetAlert1 + "$('#tablist3 a[href=\"#tab9\"]').tab('show');";
                    break;
            }
        }
        strSetAlert1 = strSetAlert1 + "</script>";
        Page.RegisterStartupScript("SetAlertMessages", strSetAlert1);
    }
    protected void lnkbtnshiftNotAllocation_Click(object sender, EventArgs e)
    {
        Response.Redirect("Transactions/TA_UI_Transaction_ShiftAllocationAdd.aspx");
    }

    protected void Timer1_Tick(object sender, EventArgs e)
    {
        LoadDashBoardDetails();
        TimeOfPrice.Text = DateTime.Now.ToLongTimeString();
    }
    protected void Page_Unload(object sender, EventArgs e)
    {
        
    }
}
