Example #1
0
        /// <summary>
        /// Get the CIR Pending Analytics Details.
        /// </summary>
        /// <param name="reportDetails">object</param>
        /// <param name="loginUserId">string</param>
        /// <returns>object</returns>
        public CIRPendingAnalyticsModel GetCIRPendingAnalyticsDetails(AnalyticsReport reportDetails, string loginUserId)
        {
            CIRPendingAnalyticsModel oReportModel = new CIRPendingAnalyticsModel();

            try
            {
                using (var connection = Connection())
                {
                    var result = connection.QueryMultiple("Rpt_CIRPENDINGAnalyticsnew", new
                    {
                        DateFrm = reportDetails.DateFrm,
                        DateTo  = reportDetails.DateTo,
                        Filter  = reportDetails.Filter == null ? "0" : reportDetails.Filter,
                        State   = reportDetails.State == null ? "0" : reportDetails.State,
                        Site    = reportDetails.Site == null ? "0" : reportDetails.Site,
                        WTGType = reportDetails.WTGType == null ? "0" : reportDetails.WTGType,
                        UId     = loginUserId
                    }, commandType: CommandType.StoredProcedure);

                    oReportModel.AnalyticsPointDetails = result.Read <CIRPendingAnalyticsPointDetails>().ToList();
                    oReportModel.AnalyticsPoint        = result.Read <CIRPendingAnalyticsPoint>().ToList();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            return(oReportModel);
        }
Example #2
0
        public JsonResult GetCIRPendingAnalyticsDetails(AnalyticsReport rptDetails)
        {
            rptDetails.DateFrm = ConvertDate(rptDetails.DateFrm);
            rptDetails.DateTo  = ConvertDate(rptDetails.DateTo);
            CIRPendingAnalyticsModel result = oReportManager.GetCIRPendingAnalyticsDetails(rptDetails, CookieManager.GetCookie(CookieManager.CookieName).logindetail.EmpID);

            return(Json(new { result }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public JsonResult GetCIRStackedAnalyticsDetails(AnalyticsReport rptDetails)
        {
            string    Data1 = "";
            DataTable dtNew = null;

            rptDetails.DateFrm = ConvertDate(rptDetails.DateFrm);
            rptDetails.DateTo  = ConvertDate(rptDetails.DateTo);
            CIRPendingAnalyticsModel result = oReportManager.GetCIRPendingAnalyticsDetails(rptDetails, CookieManager.GetCookie(CookieManager.CookieName).logindetail.EmpID);

            if (result.AnalyticsPointDetails != null && result.AnalyticsPointDetails.Count > 0)
            {
                DataTable dt = ToDataTable <CIRPendingAnalyticsPointDetails>(result.AnalyticsPointDetails);
                dtNew = GenerateTransposedTable(dt);
                if (dtNew.Rows.Count > 0)
                {
                    string    _tmpLabel = "", _tmpDataValue = "";
                    DataTable dtFinal = new DataTable();
                    dtFinal.Clear();
                    dtFinal.Columns.Add("Label");
                    dtFinal.Columns.Add("Data");
                    /// dtFinal.Columns.Add("BackgroundColor");

                    for (int i = 0; i < dtNew.Rows.Count; i++)
                    {
                        _tmpLabel = _tmpDataValue = "";
                        for (int rCount = 1; rCount < dtNew.Columns.Count; rCount++)
                        {
                            _tmpLabel      = dtNew.Rows[i][0].ToString();
                            _tmpDataValue += _tmpDataValue.Length > 0 ? "," + dtNew.Rows[i][rCount].ToString() : dtNew.Rows[i][rCount].ToString();
                        }
                        DataRow _row = dtFinal.NewRow();
                        _row["Label"] = _tmpLabel;
                        _row["Data"]  = _tmpDataValue;
                        dtFinal.Rows.Add(_row);
                    }
                    Data1 = JsonConvert.SerializeObject(dtFinal);
                }
            }
            return(Json(new { Data1, result }, JsonRequestBehavior.AllowGet));
        }