Exemple #1
0
    /// <summary>
    /// Description: Method to load data based on selected vessel and date range
    /// </summary>
    private void LoadData()
    {
        try
        {
            hdnVessel_IDs.Value = null;
            string Qtr        = "";
            string sStartDate = txtStartDate.Text;
            string sEndDate   = txtEndDate.Text;
            if (sStartDate != "" && sEndDate != "")
            {
                DateTime StartDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));      //ConvertToDefaultDt() method is used to change the user selected date format to the default format, the format in which date is saved in database.
                DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

                //hdnLastMonth.Value = lastMonth;
                DataSet   ds        = objKPI.Get_Vetting_KPI_ByCompany(Qtr, 0, StartDate, EndDate);
                DataTable dt        = ds.Tables[0];
                string[]  Pkey_cols = new string[] { "KPI_ID" };
                string[]  Hide_cols = new string[] { "ID", "Qtr_Start", "Qtr_End", "Code" };
                DataTable dt1       = objKPI.PivotTable("Qtr", "KPI_Value", "", Pkey_cols, Hide_cols, dt);

                gvCompanyKPI.DataSource = dt1;
                gvCompanyKPI.DataBind();

                IntializeControls();
                string jsMethodName = null;
                jsMethodName = "$(document).ready(function () {searchInitialize();});";
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "uniqueKey", jsMethodName, true);
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }