using System;
using System.Data;
using System.Web.UI;
using DevExpress.XtraCharts;
using System.Drawing;
using System.Resources;
using System.Globalization;
using System.Threading;
using System.IO;

public partial class Dashboard_Samsung : Base.BasePage
{
    #region VariableDeclaration
    cls_Common objCommon = new cls_Common();
    ResourceManager rm;
    CultureInfo ci;
    Dashboard objDash = new Dashboard();
    string source_Language;
    string gstrDateFormat = "";
    #endregion
    #region PageLoad
    protected override void Page_Load(object sender, EventArgs e)
    {
        //get the culture info to set the language 
        if (Session["Session_ActiveLanguage"] == null)
        {
            Response.Redirect("index.aspx"); ;
        }
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        if (Convert.ToString(Session["IDateFormat"]) != "")
            Hidden1.Value = Convert.ToString(Session["IDateFormat"]);
        if (Convert.ToString(Session["MDateFormat"]) != "")
            gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
        if (Session["SanctionUrl"] != null)
        {
            Response.Redirect(Convert.ToString((Session["SanctionUrl"])));
        }
        if (!IsPostBack)
        {
            CheckDemoVersion();
            //News.Visible = false;
            ViewState["Board"] = "Bootstrap";
            if (Session["SessionDashboardType"] == null)
            {
                Session.Add("SessionDashboardType", "");
            }
            Session["isDashBoard"] = "No";
            objCommon.menu("Dashboard_Samsung", "312");
            UserRights();
            txtFromdate1.Text = (Convert.ToDateTime(DateTime.Now.AddDays(-1).ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
            txtFromdate2.Text = (Convert.ToDateTime(DateTime.Now.ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
            BindWeekStartDate_WeeklyDeviation();
            BindYears_MonthlyDeviation();
            BindChartControls("A", Convert.ToString(txtFromdate3.Text), "", "", Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), 1, 1, 1, 1, 1, 0, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
        }
    }
    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";
        }
    }
    #endregion
    #region UserDefinedFunctions
    private void UserRights()
    {
        if (Convert.ToString(Session["UserGroupName"]) == "SuperAdmin" || Convert.ToString(Session["IndividualUsers"]) == "False")
        {
        }
        //else
        //    Response.Redirect("../MasterLandingPage.aspx");
    }
    public DataSet getDashboardDatas(string flag, string fromdate, string todate, string empcardNo, string loginEmpId, string usergroupName, int daily, int present, int weekly, int quarterly, int absent, int isExport, int selectedYear)
    {
        DataSet dsDashboardData = new DataSet();
        string gstrDateFormat = Convert.ToString(Session["MDateFormat"]);
        fromdate = objCommon.DateConvertion(gstrDateFormat, fromdate);
        todate = objCommon.DateConvertion(gstrDateFormat, todate);
        dsDashboardData = objDash.GetDashboardData_Samsung(
                                flag,
                                fromdate,
                                todate,
                                empcardNo,
                                loginEmpId,
                                usergroupName, daily, present, weekly, quarterly, absent, isExport, selectedYear);
        return dsDashboardData;
    }
    public void BindChartControls(string flag, string fromdate, string todate, string empcardNo, string loginEmpId, string usergroupName, int daily, int present, int weekly, int quarterly, int absent, int isExport, int selectedYear)
    {
        DataTable dtDailyDeviationBlock = new DataTable();
        DataTable dtWeeklyDeviationBlock = new DataTable();
        DataTable dtMonthlyDeviationBlock = new DataTable();
        DataSet dsDeviation = new DataSet();
        dsDeviation = getDashboardDatas(flag, fromdate, todate, empcardNo, loginEmpId, usergroupName, daily, present, weekly, quarterly, absent, isExport, selectedYear);
        if (dsDeviation.Tables.Count > 0)
        {
            ///Daily Deviation Block
            #region DailyBlock
            if (flag == "A" || flag == "DD")
            {
                dtDailyDeviationBlock = dsDeviation.Tables[0];
                if (dtDailyDeviationBlock.Rows.Count > 0)
                {
                    devBarChart_DailyDeviation.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtDailyDeviationBlock;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    //(PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = true;
                    if (chkboxDaily.Checked)
                    {
                        if (Convert.ToString(dtDailyDeviationBlock.Rows[0]["Reason"]) != string.Empty && Convert.ToString(dtDailyDeviationBlock.Rows[0]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint("13 Hrs", dtDailyDeviationBlock.Rows[0]["TotalEmployee"]));
                        }
                        else
                        {
                            PieSeries1.Points.Add(new SeriesPoint("13 Hrs", 0));
                        }
                    }
                    if (chkboxPresent.Checked)
                    {
                        if (Convert.ToString(dtDailyDeviationBlock.Rows[1]["Reason"]) != string.Empty && Convert.ToString(dtDailyDeviationBlock.Rows[1]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint("7th Day", dtDailyDeviationBlock.Rows[1]["TotalEmployee"]));
                        }
                        else
                        {
                            PieSeries1.Points.Add(new SeriesPoint("7th Day", 0));
                        }
                    }
                    if (chkboxWeekly.Checked)
                    {
                        if (Convert.ToString(dtDailyDeviationBlock.Rows[2]["Reason"]) != string.Empty && Convert.ToString(dtDailyDeviationBlock.Rows[2]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint("Weekly 60 Hrs", dtDailyDeviationBlock.Rows[2]["TotalEmployee"]));
                        }
                        else
                        {
                            PieSeries1.Points.Add(new SeriesPoint("Weekly 60 Hrs", 0));
                        }
                    }
                    if (chkboxQuarterly.Checked)
                    {
                        if (Convert.ToString(dtDailyDeviationBlock.Rows[3]["Reason"]) != string.Empty && Convert.ToString(dtDailyDeviationBlock.Rows[3]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint("Quart. 75 Hrs", dtDailyDeviationBlock.Rows[3]["TotalEmployee"]));
                        }
                        else
                        {
                            PieSeries1.Points.Add(new SeriesPoint("Quart. 75 Hrs", 0));
                        }
                    }
                    if (chkboxAbsent.Checked)
                    {
                        if (Convert.ToString(dtDailyDeviationBlock.Rows[4]["Reason"]) != string.Empty && Convert.ToString(dtDailyDeviationBlock.Rows[4]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtDailyDeviationBlock.Rows[4]["Reason"], dtDailyDeviationBlock.Rows[4]["TotalEmployee"]));
                        }
                        else
                        {
                            PieSeries1.Points.Add(new SeriesPoint("Continuous 7 Days Absent", 0));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Gradient;
                    devBarChart_DailyDeviation.Legend.Visible = false;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devBarChart_DailyDeviation.Series.Add(PieSeries1);
                    XYDiagram diagram = devBarChart_DailyDeviation.Diagram as XYDiagram;
                    string paletteName = "MyPalette";
                    //PaletteEntry entry1 = new PaletteEntry(Color.Green);
                    //Palette palette = new Palette(paletteName, new PaletteEntry[] { entry1 });
                    //devBarChart_DailyDeviation.PaletteRepository.Add(paletteName, palette);
                    //devBarChart_DailyDeviation.PaletteName = paletteName;
                    //SideBySideBarSeriesView v = new SideBySideBarSeriesView();
                    //v.BarWidth = 0.1;

                    //diagram.AxisX.GridLines.Visible = false;
                    //diagram.AxisX.GridLines.MinorVisible = false;
                    //diagram.AxisY.GridLines.Visible = false;
                    //diagram.AxisY.GridLines.MinorVisible = false;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                    //diagram.AxisY.Title.Alignment = StringAlignment.Near;
                    ////diagram.AxisX.Label.TextColor = Color.Red;
                    diagram.AxisY.Title.Text = "No. of Employees";
                    diagram.AxisX.Title.Text = "Policies";
                    //diagram.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
                    //diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
                    //diagram.AxisY.NumericScaleOptions.AutoGrid = false;
                    //devPieChartAssign.BorderOptions.Visibility = DevExpress.Utils.DefaultBoolean.False;
                    //devPieChartAssign.SeriesTemplate.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
                    //devPieChartAssign.CrosshairOptions.CrosshairLabelMode = CrosshairLabelMode.ShowForNearestSeries;
                    //devPieChartAssign.SeriesTemplate.Label.TextPattern = "{V}";
                }
            }
            #endregion
            #region BlockedEmployees
            if (flag == "A" || flag == "BE")
            {
                if (flag == "BE")
                {
                    grdBlockedEmployees.DataSource = dsDeviation.Tables[0];
                    grdBlockedEmployees.DataBind();
                }
                else
                {
                    if (dsDeviation.Tables.Count > 1)
                    {
                        grdBlockedEmployees.DataSource = dsDeviation.Tables[1];
                        grdBlockedEmployees.DataBind();
                    }
                }
            }
            #endregion
            //weekly Block Whole
            //While loading screen and Clicking search button it will load
            #region WeeklyBlock
            if (flag == "A" || flag == "WD")
            {
                if (flag == "WD")
                    dtWeeklyDeviationBlock = dsDeviation.Tables[0];
                else
                {
                    if (dsDeviation.Tables.Count > 2)
                        dtWeeklyDeviationBlock = dsDeviation.Tables[2];
                }
                DataTable dtDailyDeviation, dtContPresent, dtContAbsent, dtWeekly;
                #region FirstChart
                dtWeeklyDeviationBlock.DefaultView.RowFilter = "ReasonID='1'";
                dtDailyDeviation = dtWeeklyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxBarChar_Weekly_DailyDeviation.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtDailyDeviation;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtDailyDeviation.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtDailyDeviation.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtDailyDeviation.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtDailyDeviation.Rows[i]["Blocked Date"], dtDailyDeviation.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxBarChar_Weekly_DailyDeviation.Legend.Visible = false;
                    devxBarChar_Weekly_DailyDeviation.Series.Add(PieSeries1);
                    XYDiagram diagram = devxBarChar_Weekly_DailyDeviation.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
                #region SecondChart
                dtWeeklyDeviationBlock.DefaultView.RowFilter = "ReasonID='5'";
                dtContAbsent = dtWeeklyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxBarChar_Weekly_Absent.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtContAbsent;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtContAbsent.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtContAbsent.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtContAbsent.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtContAbsent.Rows[i]["Blocked Date"], dtContAbsent.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxBarChar_Weekly_Absent.Legend.Visible = false;
                    devxBarChar_Weekly_Absent.Series.Add(PieSeries1);
                    XYDiagram diagram = devxBarChar_Weekly_Absent.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
                #region ThirdChart
                dtWeeklyDeviationBlock.DefaultView.RowFilter = "ReasonID='2'";
                dtContPresent = dtWeeklyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxBarChar_Weekly_Present.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtContPresent;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtContPresent.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtContPresent.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtContPresent.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtContPresent.Rows[i]["Blocked Date"], dtContPresent.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxBarChar_Weekly_Present.Legend.Visible = false;
                    devxBarChar_Weekly_Present.Series.Add(PieSeries1);
                    XYDiagram diagram = devxBarChar_Weekly_Present.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
                #region FourthChart
                dtWeeklyDeviationBlock.DefaultView.RowFilter = "ReasonID='3'";
                dtWeekly = dtWeeklyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxBarChar_Weekly_Weekly.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtWeekly;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtWeekly.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtWeekly.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtWeekly.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtWeekly.Rows[i]["Blocked Date"], dtWeekly.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxBarChar_Weekly_Weekly.Legend.Visible = false;
                    devxBarChar_Weekly_Weekly.Series.Add(PieSeries1);
                    XYDiagram diagram = devxBarChar_Weekly_Weekly.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
            }
            #endregion
            //Monthly Block Whole
            //While loading screen and Clicking search button it will load
            #region MonthlyBlock
            if (flag == "A" || flag == "MD")
            {
                if (flag == "MD")
                    dtMonthlyDeviationBlock = dsDeviation.Tables[0];
                else
                {
                    if (dsDeviation.Tables.Count > 3)
                        dtMonthlyDeviationBlock = dsDeviation.Tables[3];
                }
                DataTable dtDailyDeviation, dtContPresent, dtContAbsent, dtWeekly;
                #region FirstChart
                dtMonthlyDeviationBlock.DefaultView.RowFilter = "ReasonID='1'";
                dtDailyDeviation = dtMonthlyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxChar_Monthly_DailyDeviation.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtDailyDeviation;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtDailyDeviation.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtDailyDeviation.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtDailyDeviation.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtDailyDeviation.Rows[i]["Blocked Date"], dtDailyDeviation.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxChar_Monthly_DailyDeviation.Legend.Visible = false;
                    devxChar_Monthly_DailyDeviation.Series.Add(PieSeries1);
                    XYDiagram diagram = devxChar_Monthly_DailyDeviation.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;

                }
                #endregion
                #region SecondChart
                dtMonthlyDeviationBlock.DefaultView.RowFilter = "ReasonID='5'";
                dtContAbsent = dtMonthlyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxChart_Monthly_Absent.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtContAbsent;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtContAbsent.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtContAbsent.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtContAbsent.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtContAbsent.Rows[i]["Blocked Date"], dtContAbsent.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxChart_Monthly_Absent.Legend.Visible = false;
                    devxChart_Monthly_Absent.Series.Add(PieSeries1);
                    XYDiagram diagram = devxChart_Monthly_Absent.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
                #region ThirdChart
                dtMonthlyDeviationBlock.DefaultView.RowFilter = "ReasonID='2'";
                dtContPresent = dtMonthlyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxChart_Monthly_Present.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtContPresent;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtContPresent.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtContPresent.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtContPresent.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtContPresent.Rows[i]["Blocked Date"], dtContPresent.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxChart_Monthly_Present.Legend.Visible = false;
                    devxChart_Monthly_Present.Series.Add(PieSeries1);
                    XYDiagram diagram = devxChart_Monthly_Present.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
                #region FourthChart
                dtMonthlyDeviationBlock.DefaultView.RowFilter = "ReasonID='3'";
                dtWeekly = dtMonthlyDeviationBlock.DefaultView.ToTable();
                if (dtDailyDeviation.Rows.Count > 0)
                {
                    devxChart_Monthly_Weekly.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtWeekly;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtWeekly.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtWeekly.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtWeekly.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtWeekly.Rows[i]["Blocked Date"], dtWeekly.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxChart_Monthly_Weekly.Legend.Visible = false;
                    devxChart_Monthly_Weekly.Series.Add(PieSeries1);
                    XYDiagram diagram = devxChart_Monthly_Weekly.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                #endregion
            }
            #endregion
            #region Quarterly
            if (flag == "A")
            {
                if (dsDeviation.Tables.Count > 4)
                {
                    dtMonthlyDeviationBlock = dsDeviation.Tables[4];
                    if (dtMonthlyDeviationBlock.Rows.Count > 0)
                    {
                        devChart_Quarterly.Series.Clear();
                        Series PieSeries1 = new Series("Series1", ViewType.Bar);
                        PieSeries1.DataSource = dtMonthlyDeviationBlock;
                        PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                        PieSeries1.ValueScaleType = ScaleType.Numerical;
                        (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                        (PieSeries1.View as BarSeriesView).ColorEach = false;
                        for (int i = 0; i < dtMonthlyDeviationBlock.Rows.Count; i++)
                        {
                            if (Convert.ToString(dtMonthlyDeviationBlock.Rows[i]["Blocked Date"]) != string.Empty && Convert.ToString(dtMonthlyDeviationBlock.Rows[i]["TotalEmployee"]) != string.Empty)
                            {
                                PieSeries1.Points.Add(new SeriesPoint(dtMonthlyDeviationBlock.Rows[i]["Blocked Date"], dtMonthlyDeviationBlock.Rows[i]["TotalEmployee"]));
                            }
                        }
                        PieSeries1.PointOptions.PointView = PointView.Values;
                        PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                        (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                        //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                        //PieSeries1.Label.Visible = true;
                        //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                        PieSeries1.PointOptions.Pattern = "{V:0}";
                        devChart_Quarterly.Legend.Visible = false;
                        devChart_Quarterly.Series.Add(PieSeries1);
                        XYDiagram diagram = devChart_Quarterly.Diagram as XYDiagram;
                        diagram.AxisY.WholeRange.MinValue = 0;
                        diagram.AxisY.WholeRange.MaxValue = 100;
                    }
                }
                if (dsDeviation.Tables.Count > 5)
                {
                    if (dsDeviation.Tables[5].Rows.Count > 0)
                    {
                        QuarterValue.Text = Convert.ToString(dsDeviation.Tables[5].Rows[0][0]);
                    }
                }
            }
            #endregion
            #region Expected
            if (flag == "A")
            {
                if (dsDeviation.Tables.Count > 8)
                    dtMonthlyDeviationBlock = dsDeviation.Tables[8];
                if (dtMonthlyDeviationBlock.Rows.Count > 0)
                {
                    devxChart_Expected.Series.Clear();
                    Series PieSeries1 = new Series("Series1", ViewType.Bar);
                    PieSeries1.DataSource = dtMonthlyDeviationBlock;
                    PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
                    PieSeries1.ValueScaleType = ScaleType.Numerical;
                    (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
                    (PieSeries1.View as BarSeriesView).ColorEach = false;
                    for (int i = 0; i < dtMonthlyDeviationBlock.Rows.Count; i++)
                    {
                        if (Convert.ToString(dtMonthlyDeviationBlock.Rows[i]["TotalEmployee"]) != string.Empty)
                        {
                            PieSeries1.Points.Add(new SeriesPoint(dtMonthlyDeviationBlock.Rows[i]["ReasonID"], dtMonthlyDeviationBlock.Rows[i]["TotalEmployee"]));
                        }
                    }
                    PieSeries1.PointOptions.PointView = PointView.Values;
                    PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
                    (PieSeries1.Label as SideBySideBarSeriesLabel).Position = BarSeriesLabelPosition.Top;
                    //PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
                    //PieSeries1.Label.Visible = true;
                    //PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
                    PieSeries1.PointOptions.Pattern = "{V:0}";
                    devxChart_Expected.Legend.Visible = false;
                    devxChart_Expected.Series.Add(PieSeries1);
                    XYDiagram diagram = devxChart_Expected.Diagram as XYDiagram;
                    diagram.AxisY.WholeRange.MinValue = 0;
                    diagram.AxisY.WholeRange.MaxValue = 100;
                }
                if (dsDeviation.Tables.Count > 9)
                {
                    if (dsDeviation.Tables[9].Rows.Count > 0)
                    {
                        ExpectedValue.Text = Convert.ToString(dsDeviation.Tables[9].Rows[0][0]);
                    }
                }
            }
            #endregion
        }
    }
    public DataTable GetData()
    {
        DataTable table = new DataTable();
        table.Columns.AddRange(new DataColumn[] {
            new DataColumn("Region", typeof(string)),
            new DataColumn("Sales", typeof(decimal))
        });
        table.Rows.Add("Asia", 5.289M);
        table.Rows.Add("North America", 4.182M);
        table.Rows.Add("Europe", 3.725M);
        table.Rows.Add("Australia", 2.272M);
        table.Rows.Add("South America", 2.117M);
        return table;
    }
    public void getdatas(DataSet ds)
    {
        DataTable dt = new DataTable();
        //dt.Columns.Add("Topic", typeof(string));
        //dt.Columns.Add("ValueCount", typeof(decimal));
        //dt.Columns.Add("Date", typeof(DateTime));
        //dt.Rows.Add("Total Active Employees", "160", Convert.ToDateTime("03/07/2022"));
        //dt.Rows.Add("Total Active Employees", "60", Convert.ToDateTime("03/08/2022"));
        //dt.Rows.Add("Total Active Employees", "55", Convert.ToDateTime("03/09/2022"));
        //dt.Rows.Add("Total Active Employees", "28", Convert.ToDateTime("03/10/2022"));
        //dt.Rows.Add("Total Active Employees", "16", Convert.ToDateTime("03/11/2022"));
        //dt.Rows.Add("Total Active Employees", "39", Convert.ToDateTime("03/12/2022"));
        //dt.Rows.Add("Total Active Employees", "39", Convert.ToDateTime("03/13/2022"));
        dt = ds.Tables[2];
        devxBarChar_Weekly_DailyDeviation.Series.Clear();
        devxBarChar_Weekly_Present.Series.Clear();
        devxBarChar_Weekly_Absent.Series.Clear();
        devxBarChar_Weekly_Weekly.Series.Clear();
        Series PieSeries1 = new Series("Series1", ViewType.Bar);
        PieSeries1.DataSource = dt;
        (PieSeries1.View as BarSeriesView).BarWidth = 0.25;
        (PieSeries1.View as BarSeriesView).ColorEach = true;
        PieSeries1.ArgumentScaleType = ScaleType.Qualitative;
        PieSeries1.ValueScaleType = ScaleType.Numerical;
        //(PieSeries1.View as BarSeriesView).Color = color.
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[0][4]).Substring(1, 4), dt.Rows[0][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[1][4]).Substring(1, 4), dt.Rows[1][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[2][4]).Substring(1, 4), dt.Rows[2][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[3][4]).Substring(1, 4), dt.Rows[3][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[4][4]).Substring(1, 4), dt.Rows[4][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[5][4]).Substring(1, 4), dt.Rows[5][0]));
        PieSeries1.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[6][4]).Substring(1, 4), dt.Rows[6][0]));
        PieSeries1.PointOptions.PointView = PointView.Values;
        PieSeries1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        PieSeries1.SeriesPointsSortingKey = SeriesPointKey.Argument;
        PieSeries1.Label.Visible = true;
        PieSeries1.Label.FillStyle.FillMode = FillMode.Solid;
        PieSeries1.PointOptions.Pattern = "{V:0}";
        devxBarChar_Weekly_DailyDeviation.Legend.Visible = false;
        devxBarChar_Weekly_DailyDeviation.Series.Add(PieSeries1);
        //Series PieSeries2 = new Series("Series1", ViewType.Bar);
        //PieSeries2.DataSource = dt;
        //(PieSeries2.View as BarSeriesView).BarWidth = 0.5;
        //(PieSeries2.View as BarSeriesView).ColorEach = true;
        //PieSeries2.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries2.ValueScaleType = ScaleType.Numerical;
        //(PieSeries2.View as BarSeriesView).Color = Color.FromArgb(165, 66, 63);
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[0][2]).Substring(1, 4), dt.Rows[0][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[1][2]).Substring(1, 4), dt.Rows[1][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[2][2]).Substring(1, 4), dt.Rows[2][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[3][2]).Substring(1, 4), dt.Rows[3][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[4][2]).Substring(1, 4), dt.Rows[4][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[5][2]).Substring(1, 4), dt.Rows[5][1]));
        //PieSeries2.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[6][2]).Substring(1, 4), dt.Rows[6][1]));
        //PieSeries2.PointOptions.PointView = PointView.Values;
        //PieSeries2.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries2.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries2.Label.Visible = true;
        //PieSeries2.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries2.PointOptions.Pattern = "{V:0}";
        //WebChartControl2.Legend.Visible = false;
        //WebChartControl2.Series.Add(PieSeries2);
        //Series PieSeries3 = new Series("Series1", ViewType.Bar);
        //PieSeries3.DataSource = dt;
        //(PieSeries3.View as BarSeriesView).BarWidth = 0.5;
        //(PieSeries3.View as BarSeriesView).ColorEach = true;
        //PieSeries3.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries3.ValueScaleType = ScaleType.Numerical;
        //(PieSeries3.View as BarSeriesView).Color = Color.FromArgb(133, 186, 168);
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[0][2]).Substring(1, 4), dt.Rows[0][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[1][2]).Substring(1, 4), dt.Rows[1][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[2][2]).Substring(1, 4), dt.Rows[2][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[3][2]).Substring(1, 4), dt.Rows[3][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[4][2]).Substring(1, 4), dt.Rows[4][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[5][2]).Substring(1, 4), dt.Rows[5][1]));
        //PieSeries3.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[6][2]).Substring(1, 4), dt.Rows[6][1]));
        //PieSeries3.PointOptions.PointView = PointView.Values;
        //PieSeries3.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries3.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries3.Label.Visible = true;
        //PieSeries3.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries3.PointOptions.Pattern = "{V:0}";
        //WebChartControl3.Legend.Visible = false;
        //WebChartControl3.Series.Add(PieSeries3);
        //Series PieSeries4 = new Series("Series1", ViewType.Bar);
        //PieSeries4.DataSource = dt;
        //(PieSeries4.View as BarSeriesView).BarWidth = 0.5;
        //(PieSeries4.View as BarSeriesView).ColorEach = true;
        //PieSeries4.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries4.ValueScaleType = ScaleType.Numerical;
        //(PieSeries4.View as BarSeriesView).Color = Color.FromArgb(67, 159, 184);
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[0][2]).Substring(1, 4), dt.Rows[0][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[1][2]).Substring(1, 4), dt.Rows[1][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[2][2]).Substring(1, 4), dt.Rows[2][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[3][2]).Substring(1, 4), dt.Rows[3][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[4][2]).Substring(1, 4), dt.Rows[4][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[5][2]).Substring(1, 4), dt.Rows[5][1]));
        //PieSeries4.Points.Add(new SeriesPoint(Convert.ToString(dt.Rows[6][2]).Substring(1, 4), dt.Rows[6][1]));
        //PieSeries4.PointOptions.PointView = PointView.Values;
        //PieSeries4.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries4.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries4.Label.Visible = true;
        //PieSeries4.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries4.PointOptions.Pattern = "{V:0}";
        //WebChartControl4.Legend.Visible = false;
        //WebChartControl4.Series.Add(PieSeries4);
        //DataTable dt1 = new DataTable();
        //dt1.Columns.Add("Topic", typeof(string));
        //dt1.Columns.Add("ValueCount", typeof(decimal));
        //dt1.Columns.Add("Date", typeof(string));
        //for (int i = 0; i < 12; i++)
        //{
        //    dt1.Rows.Add("Total Active Employees", i.ToString(), DateTime.Now.AddMonths(i).ToString("MMM") + "-" + DateTime.Now.AddMonths(i).ToString("yy"));
        //}
        //Series PieSeries5 = new Series("Series1", ViewType.Bar);
        //(PieSeries5.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries5.View as BarSeriesView).ColorEach = true;
        //PieSeries5.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries5.ValueScaleType = ScaleType.Numerical;
        //(PieSeries5.View as BarSeriesView).Color = Color.FromArgb(67, 159, 184);
        //for (int i = 0; i < 12; i++)
        //{
        //    PieSeries5.Points.Add(new SeriesPoint(Convert.ToString(dt1.Rows[i][2]), dt1.Rows[i][1]));
        //}
        //PieSeries5.PointOptions.PointView = PointView.Values;
        //PieSeries5.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries5.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries5.Label.Visible = true;
        ////diagram.AxisX.Label.Angle = -90;
        //PieSeries5.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries5.PointOptions.Pattern = "{V:0}";
        //WebChartControl5.Legend.Visible = false;
        //WebChartControl5.Series.Add(PieSeries5);
        //Series PieSeries6 = new Series("Series1", ViewType.Bar);
        //(PieSeries6.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries6.View as BarSeriesView).ColorEach = true;
        //PieSeries6.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries6.ValueScaleType = ScaleType.Numerical;
        //(PieSeries6.View as BarSeriesView).Color = Color.FromArgb(165, 66, 63);
        //for (int i = 0; i < 12; i++)
        //{
        //    PieSeries6.Points.Add(new SeriesPoint(Convert.ToString(dt1.Rows[i][2]), dt1.Rows[i][1]));
        //}
        //PieSeries6.PointOptions.PointView = PointView.Values;
        //PieSeries6.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries6.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries6.Label.Visible = true;
        //PieSeries6.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries6.PointOptions.Pattern = "{V:0}";
        //WebChartControl6.Legend.Visible = false;
        //WebChartControl6.Series.Add(PieSeries6);
        //Series PieSeries7 = new Series("Series1", ViewType.Bar);
        //(PieSeries7.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries7.View as BarSeriesView).ColorEach = true;
        //PieSeries7.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries7.ValueScaleType = ScaleType.Numerical;
        //(PieSeries7.View as BarSeriesView).Color = Color.FromArgb(133, 186, 168);
        //for (int i = 0; i < 12; i++)
        //{
        //    PieSeries7.Points.Add(new SeriesPoint(Convert.ToString(dt1.Rows[i][2]), dt1.Rows[i][1]));
        //}
        //PieSeries7.PointOptions.PointView = PointView.Values;
        //PieSeries7.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries7.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries7.Label.Visible = true;
        //PieSeries7.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries7.PointOptions.Pattern = "{V:0}";
        //WebChartControl7.Legend.Visible = false;
        //WebChartControl7.Series.Add(PieSeries7);
        //Series PieSeries8 = new Series("Series1", ViewType.Bar);
        //(PieSeries8.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries8.View as BarSeriesView).ColorEach = true;
        //PieSeries8.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries8.ValueScaleType = ScaleType.Numerical;
        //(PieSeries8.View as BarSeriesView).Color = Color.FromArgb(67, 159, 184);
        //for (int i = 0; i < 12; i++)
        //{
        //    PieSeries8.Points.Add(new SeriesPoint(Convert.ToString(dt1.Rows[i][2]), dt1.Rows[i][1]));
        //}
        //PieSeries8.PointOptions.PointView = PointView.Values;
        //PieSeries8.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries8.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries8.Label.Visible = true;
        //PieSeries8.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries8.PointOptions.Pattern = "{V:0}";
        //WebChartControl8.Legend.Visible = false;
        //WebChartControl8.Series.Add(PieSeries8);
        //DataTable dt2 = new DataTable();
        //dt2.Columns.Add("Topic", typeof(string));
        //dt2.Columns.Add("ValueCount", typeof(decimal));
        //dt2.Columns.Add("Date", typeof(string));
        //dt2.Rows.Add("Total Active Employees", "10", "Jan");
        //dt2.Rows.Add("Total Active Employees", "8", "Feb");
        //dt2.Rows.Add("Total Active Employees", "12", "Mar");
        //Series PieSeries9 = new Series("Series1", ViewType.Bar);
        //(PieSeries9.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries9.View as BarSeriesView).ColorEach = true;
        //PieSeries9.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries9.ValueScaleType = ScaleType.Numerical;
        //(PieSeries9.View as BarSeriesView).Color = Color.FromArgb(67, 159, 184);
        //PieSeries9.Points.Add(new SeriesPoint(dt2.Rows[0][2], dt2.Rows[0][1]));
        //PieSeries9.Points.Add(new SeriesPoint(dt2.Rows[1][2], dt2.Rows[1][1]));
        //PieSeries9.Points.Add(new SeriesPoint(dt2.Rows[2][2], dt2.Rows[2][1]));
        //PieSeries9.PointOptions.PointView = PointView.Values;
        //PieSeries9.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries9.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries9.Label.Visible = true;
        //PieSeries9.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries9.PointOptions.Pattern = "{V:0}";
        //WebChartControl9.Legend.Visible = false;
        //WebChartControl9.Series.Add(PieSeries9);
        //DataTable dt3 = new DataTable();
        //dt3.Columns.Add("Topic", typeof(string));
        //dt3.Columns.Add("ValueCount", typeof(decimal));
        //dt3.Columns.Add("Date", typeof(string));
        //dt3.Rows.Add("Weekly 60 Hrs Exceed", "10", "Jan");
        //dt3.Rows.Add("Quarterly 75 Hrs Exceed", "8", "Feb");
        //Series PieSeries10 = new Series("Series1", ViewType.Bar);
        //(PieSeries10.View as BarSeriesView).BarWidth = 0.1;
        //(PieSeries10.View as BarSeriesView).ColorEach = true;
        //PieSeries10.ArgumentScaleType = ScaleType.Qualitative;
        //PieSeries10.ValueScaleType = ScaleType.Numerical;
        //(PieSeries10.View as BarSeriesView).Color = Color.FromArgb(67, 159, 184);
        //PieSeries10.Points.Add(new SeriesPoint(dt3.Rows[0][0], dt3.Rows[0][1]));
        //PieSeries10.Points.Add(new SeriesPoint(dt3.Rows[1][0], dt3.Rows[1][1]));
        //PieSeries10.PointOptions.PointView = PointView.Values;
        //PieSeries10.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; ;
        //PieSeries10.SeriesPointsSortingKey = SeriesPointKey.Argument;
        //PieSeries10.Label.Visible = true;
        //PieSeries10.Label.FillStyle.FillMode = FillMode.Solid;
        //PieSeries10.PointOptions.Pattern = "{V:0}";
        //WebChartControl10.Legend.Visible = false;
        //WebChartControl10.Series.Add(PieSeries10);
    }
    private void BindWeekStartDate_WeeklyDeviation()
    {
        DateTime input;
        input = DateTime.Now;
        int intType = 1;
        if (intType == 1)
        {
            DateTime WeekEndDay = input;
            DateTime WeekStartDay = input;
            switch (Convert.ToString(Session["WeekStartDay"]))
            {
                case "1":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Sunday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "2":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Monday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "3":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Tuesday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "4":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Wednesday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "5":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Thursday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "6":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Friday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
                case "7":
                    while (WeekStartDay.DayOfWeek != DayOfWeek.Saturday)
                        WeekStartDay = WeekStartDay.AddDays(-1);
                    break;
            }
            WeekEndDay = WeekStartDay;
            switch (Convert.ToString(Session["WeekEndDay"]))
            {
                case "1":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Sunday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "2":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Monday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "3":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Tuesday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "4":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Wednesday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "5":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Thursday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "6":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Friday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
                case "7":
                    while (WeekEndDay.DayOfWeek != DayOfWeek.Saturday)
                        WeekEndDay = WeekEndDay.AddDays(1);
                    break;
            }
            txtFromdate3.Text = (Convert.ToDateTime(WeekStartDay)).ToString(Convert.ToString(Session["MDateFormat"]));
            txtFromdate4.Text = (Convert.ToDateTime(WeekEndDay)).ToString(Convert.ToString(Session["MDateFormat"]));
        }
    }
    private void BindYears_MonthlyDeviation()
    {
        int FromYear, ToYear;
        ToYear = DateTime.Now.Year;
        FromYear = DateTime.Now.Year - 10;
        //ddlStartYear.Items.Insert(0, rm.GetString("Select", ci));
        for (int YearsCount = ToYear; YearsCount >= FromYear; YearsCount--)
        {
            ddlStartYear.Items.Add(YearsCount.ToString());
        }
    }
    #endregion
    #region ButtonEvents    
    protected void btnDailyDeviation_Click(object sender, EventArgs e)
    {
        try
        {
            //DD means, Daily Deviation. It will show the previous date deviated employee details
            BindChartControls("DD", Convert.ToString(txtFromdate1.Text), Convert.ToString(txtFromdate2.Text), Convert.ToString(txtEmployeeID_Daily.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 0, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnDailyDeviationExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            dsDailyDeviation = getDashboardDatas("DD", Convert.ToString(txtFromdate1.Text), Convert.ToString(txtFromdate1.Text), Convert.ToString(txtEmployeeID_Daily.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 1, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[0];
                //if (dt.Columns.Contains("ReasonID"))
                //    dt.Columns.Remove("ReasonID");
                //if (dt.Columns.Contains("EmployeeAutoID"))
                //    dt.Columns.Remove("EmployeeAutoID");
                //if (dt.Columns.Contains("Company"))
                //    dt.Columns.Remove("Company");
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Daily Deviation&FrmDate=" + Convert.ToString(txtFromdate1.Text) + "&toDate=" + Convert.ToString(txtFromdate1.Text) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnBlockedsearch_Click(object sender, EventArgs e)
    {
        try
        {
            //DD means, Daily Deviation. It will show the previous date deviated employee details
            BindChartControls("BE", Convert.ToString(txtFromdate2.Text), Convert.ToString(txtFromdate2.Text), Convert.ToString(txtEmployeeID_Blocked.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 0, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnBlockedExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            dsDailyDeviation = getDashboardDatas("BE", Convert.ToString(txtFromdate2.Text), Convert.ToString(txtFromdate1.Text), Convert.ToString(txtEmployeeID_Blocked.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 1, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Today Blocked & Active Employees &FrmDate=" + Convert.ToString(txtFromdate1.Text) + "&toDate=" + Convert.ToString(txtFromdate1.Text) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnWeekSearch_Click(object sender, EventArgs e)
    {
        try
        {
            //DD means, Daily Deviation. It will show the previous date deviated employee details
            BindChartControls("WD", Convert.ToString(txtFromdate3.Text), Convert.ToString(txtFromdate4.Text), Convert.ToString(txtEmployeeID_Weekly.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 0, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnWeekExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            dsDailyDeviation = getDashboardDatas("WD",
                Convert.ToString(txtFromdate3.Text),
                Convert.ToString(txtFromdate4.Text), Convert.ToString(txtEmployeeID_Weekly.Text),
                Convert.ToString(Session["EmpAutoID"]),
                Convert.ToString(Session["UserGroupName"]),
                (chkbox_Weekly_Daily.Checked) ? 1 : 0, (chkbox_Weekly_Present.Checked) ? 1 : 0,
                (chkbox_Weekly_Weekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0,
                (chkbox_Weekly_Absent.Checked) ? 1 : 0, 1,
                Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Weekly Deviated&FrmDate=" +
                        Convert.ToString(txtFromdate3.Text) + "&toDate=" +
                        Convert.ToString(txtFromdate3.Text) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnMonthSearch_Click(object sender, EventArgs e)
    {
        //DD means, Daily Deviation. It will show the previous date deviated employee details
        try
        {
            BindChartControls("MD", Convert.ToString(txtFromdate2.Text), Convert.ToString(txtFromdate2.Text), Convert.ToString(txtEmployeeID_Monthly.Text), Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 0, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnMonthExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            dsDailyDeviation = getDashboardDatas("MD", Convert.ToString(txtFromdate1.Text),
                Convert.ToString(txtFromdate1.Text), Convert.ToString(txtEmployeeID_Monthly.Text),
                Convert.ToString(Session["EmpAutoID"]),
                Convert.ToString(Session["UserGroupName"]),
                (chkboxMonth_Daily.Checked) ? 1 : 0, (chkboxMonth_Present.Checked) ? 1 : 0,
                (chkboxMonth_Absent.Checked) ? 1 : 0, (chkboxMonth_Weekly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 1, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    //string strTodate="";
                    //strTodate = txtFromdate1.Text;
                    //strTodate = objCommon.DateConvertion(gstrDateFormat, strTodate);
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Monthly Deviated&FrmDate=" + Convert.ToString(txtFromdate1.Text) + "&toDate=" + Convert.ToString(txtFromdate1.Text) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void btnQuarterExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            DateTime currentDate = DateTime.Now;
            string excelFromdate = "", excelTodate = "";
            if (currentDate.Month == 1 || currentDate.Month == 2 || currentDate.Month == 3 || currentDate.Month == 4)
            {
                excelFromdate = (Convert.ToDateTime(DateTime.Now.AddDays(-(DateTime.Now.Day) + 1).AddMonths(-(currentDate.Month - 1)).ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
            }
            else if (currentDate.Month == 5 || currentDate.Month == 6 || currentDate.Month == 7 || currentDate.Month == 8)
            {
                excelFromdate = (Convert.ToDateTime(DateTime.Now.AddDays(-(DateTime.Now.Day) + 1).AddMonths(-(currentDate.Month - 5)).ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
            }
            else if (currentDate.Month == 9 || currentDate.Month == 10 || currentDate.Month == 11 || currentDate.Month == 11)
            {
                excelFromdate = (Convert.ToDateTime(DateTime.Now.AddDays(-(DateTime.Now.Day) + 1).AddMonths(-(currentDate.Month - 12)).ToShortDateString())).ToString(Convert.ToString(Session["MDateFormat"]));
            }
            excelTodate = currentDate.ToString(Convert.ToString(Session["MDateFormat"]));
            dsDailyDeviation = getDashboardDatas("QD", Convert.ToString(txtFromdate1.Text), Convert.ToString(txtFromdate1.Text), "", Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 1, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Quarterly Deviated&FrmDate=" + Convert.ToString(excelFromdate) + "&toDate=" + Convert.ToString(excelTodate) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    protected void btnExpectedExport_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDailyDeviation = new DataSet();
            dsDailyDeviation = getDashboardDatas("ED", Convert.ToString(txtFromdate1.Text), Convert.ToString(txtFromdate1.Text), "", Convert.ToString(Session["EmpAutoID"]), Convert.ToString(Session["UserGroupName"]), (chkboxDaily.Checked) ? 1 : 0, (chkboxPresent.Checked) ? 1 : 0, (chkboxWeekly.Checked) ? 1 : 0, (chkboxQuarterly.Checked) ? 1 : 0, (chkboxAbsent.Checked) ? 1 : 0, 1, Convert.ToInt32(ddlStartYear.SelectedItem.Value));
            if (dsDailyDeviation.Tables.Count > 0)
            {
                DataTable dt = new DataTable();
                dt = dsDailyDeviation.Tables[4];
                if (dt.Rows.Count > 0)
                {
                    DataSet dsNew = new DataSet();
                    dsNew.Tables.Add(dt.Copy());
                    Session["Export_ExcelData"] = dsNew;
                    Response.Redirect("Reports/Excel_Export.aspx?ReportName=Expected Deviated&FrmDate=" + Convert.ToString(txtFromdate1.Text) + "&toDate=" + Convert.ToString(txtFromdate1.Text) + "");
                }
                else
                {
                    string strScript = "alert('There is no record.');";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                    return;
                }
            }
            else
            {
                string strScript = "alert('There is no record.');";
                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", strScript, true);
                return;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", ex.ToString(), true);
        }
    }
    #endregion

    protected void devChart_Quarterly_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
    {
        //if ((int)e.SeriesPoint.NumericalArgument == 2)
        //    e.SeriesDrawOptions.Color = Color.Yellow;
        string s = e.SeriesPoint.Argument;
        string colorcode = "#5D4978";
        if (Convert.ToString(hdnQuarterly.Value) != "")
            colorcode = Convert.ToString(hdnQuarterly.Value);
        colorcode = colorcode.TrimStart('#');
        Color col; // from System.Drawing or System.Windows.Media
        if (colorcode.Length == 6)
            col = Color.FromArgb(255, // hardcoded opaque
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber));
        else // assuming length of 8
            col = Color.FromArgb(
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(6, 2), NumberStyles.HexNumber));
        e.SeriesDrawOptions.Color = col;
        ((RectangleGradientFillOptions)(((BarDrawOptions)(e.SeriesDrawOptions)).FillStyle.Options)).Color2 = col;
    }

    protected void devxChart_Monthly_Weekly_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
    {
        //if ((int)e.SeriesPoint.NumericalArgument > 0)
        //e.SeriesDrawOptions.Color = Color.Maroon;
        //string colorcode = "#800000";
        //int argb = Int32.Parse(colorcode.Replace("#", ""), NumberStyles.HexNumber);
        //Color clr = Color.FromArgb(argb);
        //e.SeriesDrawOptions.Color = clr;
        //rgb(131, 160, 71)
        string colorcode = "#88A54B";
        if (Convert.ToString(hdnWeeklyWeekly60.Value) != "")
            colorcode = Convert.ToString(hdnWeeklyWeekly60.Value);
        colorcode = colorcode.TrimStart('#');
        Color col; // from System.Drawing or System.Windows.Media
        if (colorcode.Length == 6)
            col = Color.FromArgb(255, // hardcoded opaque
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber));
        else // assuming length of 8
            col = Color.FromArgb(
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(6, 2), NumberStyles.HexNumber));
        e.SeriesDrawOptions.Color = col;
        ((RectangleGradientFillOptions)(((BarDrawOptions)(e.SeriesDrawOptions)).FillStyle.Options)).Color2 = col;
    }

    protected void devxChart_Monthly_Present_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
    {
        string colorcode = "#A74340";
        if (Convert.ToString(hdnWeeklyPresent.Value) != "")
            colorcode = Convert.ToString(hdnWeeklyPresent.Value);
        colorcode = colorcode.TrimStart('#');
        Color col; // from System.Drawing or System.Windows.Media
        if (colorcode.Length == 6)
            col = Color.FromArgb(255, // hardcoded opaque
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber));
        else // assuming length of 8
            col = Color.FromArgb(
                        int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber),
                        int.Parse(colorcode.Substring(6, 2), NumberStyles.HexNumber));
        e.SeriesDrawOptions.Color = col;
        ((RectangleGradientFillOptions)(((BarDrawOptions)(e.SeriesDrawOptions)).FillStyle.Options)).Color2 = col;

    }

    protected void devxBarChar_Weekly_DailyDeviation_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
    {


    }

    protected void devxChart_Expected_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
    {
        if (e.SeriesPoint.Argument == "Quarterly 75 Hrs OT")
        {
            string s = e.SeriesPoint.Argument;
            string colorcode = "#5D4978";
            if (Convert.ToString(hdnQuarterly.Value) != "")
                colorcode = Convert.ToString(hdnQuarterly.Value);
            colorcode = colorcode.TrimStart('#');
            Color col; // from System.Drawing or System.Windows.Media
            if (colorcode.Length == 6)
                col = Color.FromArgb(255, // hardcoded opaque
                            int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber));
            else // assuming length of 8
                col = Color.FromArgb(
                            int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(6, 2), NumberStyles.HexNumber));
            e.SeriesDrawOptions.Color = col;
            ((RectangleGradientFillOptions)(((BarDrawOptions)(e.SeriesDrawOptions)).FillStyle.Options)).Color2 = col;
        }
        else
        {
            string colorcode = "#88A54B";
            if (Convert.ToString(hdnWeeklyWeekly60.Value) != "")
                colorcode = Convert.ToString(hdnWeeklyWeekly60.Value);
            colorcode = colorcode.TrimStart('#');
            Color col; // from System.Drawing or System.Windows.Media
            if (colorcode.Length == 6)
                col = Color.FromArgb(255, // hardcoded opaque
                            int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber));
            else // assuming length of 8
                col = Color.FromArgb(
                            int.Parse(colorcode.Substring(0, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(2, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(4, 2), NumberStyles.HexNumber),
                            int.Parse(colorcode.Substring(6, 2), NumberStyles.HexNumber));
            e.SeriesDrawOptions.Color = col;
            ((RectangleGradientFillOptions)(((BarDrawOptions)(e.SeriesDrawOptions)).FillStyle.Options)).Color2 = col;
        }
    }


    protected void devxChart_Expected_CustomDrawSeries(object sender, CustomDrawSeriesEventArgs e)
    {


    }
}