示例#1
0
    /// <summary>
    /// Method to  get the category wise retention data
    /// Inputs of RankIds and Years as querystring
    /// </summary>

    protected void BindRetentionDetail()
    {
        try
        {
            BLL_TMSA_KPI objKPI = new BLL_TMSA_KPI();
            Category_Id = Convert.ToInt32(Request.QueryString[0]);
            string RankIDs = Request.QueryString[1];
            string Year    = Request.QueryString[2];
            lblformula.Text = "Formula : 100 - (PI 41- PI 16)/PI 06*100";
            DataTable dtRetention = objKPI.Search_CrewRetention(RankIDs, Year, Category_Id).Tables[0];

            if (Request.QueryString["Category"] != null)
            {
                ltTitle.Text = "Crew Retention Details : " + Request.QueryString["Category"];
            }
            if (dtRetention.Rows.Count > 0)
            {
                gvCategory.DataSource = dtRetention;
                gvCategory.DataBind();
            }
        }
        catch (Exception ex)
        {
            string ERR = ex.ToString();
        }
    }
    /// <summary>
    /// Description: Event added to export the gridview data to excel.
    /// Created By: Krishnapriya
    /// </summary>
    protected void btnExportToExcel_Click(object sender, EventArgs e)
    {
        try
        {
            Category_Id = 0;
            string    RankIDs = hdnRanks.Value;
            string    Year    = hdnYears.Value;
            DataTable dt      = objKPI.Search_CrewRetention(RankIDs, Year, Category_Id).Tables[0];

            string[] HeaderCaptions  = { "Quarter", "Employed Crew(PI06)", "NTBR(PI16)", "Total Left(PI41)", "Retention Rate" };
            string[] DataColumnsName = { "Qtr", "AvgAvailable", "NTBR", "LeftAll", "KPI_Value" };
            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "Crew_Retention_Details", "Crew Retention Details:Selected Ranks");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }