Exemplo n.º 1
0
        private void BindTrendLineChart(DashboardSummary d)
        {
            System.Text.StringBuilder sbPresent = new System.Text.StringBuilder();
            System.Text.StringBuilder sbDates   = new System.Text.StringBuilder();


            List <FilterAttendance> ds = d.Trends;// SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "GetAttendanceDataBetweenTwoDatesForTrends", m).Tables[0];

            if (ds.Count > 0)
            {
                foreach (FilterAttendance fa in ds)
                {
                    double countPresent = Convert.ToDouble(fa.TotalStudentPresent);


                    if (countPresent != 0)
                    {
                        double PresentPercent = Math.Round(Convert.ToDouble(Convert.ToDouble(countPresent * 100 / (Convert.ToDouble(fa.TotalStudent)))));
                        sbPresent.Append(PresentPercent + ",");
                        sbDates.Append("'" + Convert.ToDateTime(fa.PrimaryColoumn).ToShortDateString() + "',");
                    }
                    else
                    {
                    }
                }
            }
            if (sbPresent.Length > 0)
            {
                PresentSeriesforLineChart = "[" + sbPresent.ToString().Substring(0, sbPresent.Length - 1) + "]";
                DateSeries = "[" + sbDates.ToString().Substring(0, sbDates.Length - 1) + "]";
            }
        }
Exemplo n.º 2
0
        private void BindTrendLineChartTeacher(DashboardSummary d)
        {
            System.Text.StringBuilder sbAbsent  = new System.Text.StringBuilder();
            System.Text.StringBuilder sbPresent = new System.Text.StringBuilder();
            System.Text.StringBuilder sbDates   = new System.Text.StringBuilder();
            List <FilterAttendance>   ds        = d.Trends;

            if (ds.Count > 0)
            {
                foreach (FilterAttendance fa in ds)
                {
                    double countPresent = Convert.ToDouble(fa.TotalTeacherPresent);


                    if (countPresent != 0)
                    {
                        double PresentPercent = Math.Round(Convert.ToDouble(Convert.ToDouble(countPresent * 100 / (Convert.ToDouble(fa.TotalTeacher)))));
                        sbPresent.Append(PresentPercent + ",");
                        sbDates.Append("'" + Convert.ToDateTime(fa.PrimaryColoumn).ToShortDateString() + "',");
                    }
                    else
                    {
                    }
                }
            }
            if (sbPresent.Length > 0)
            {
                PresentSeriesforLineChartTeacher = "[" + sbPresent.ToString().Substring(0, sbPresent.Length - 1) + "]";
                DateSeriesTeacher = "[" + sbDates.ToString().Substring(0, sbDates.Length - 1) + "]";
            }
        }
Exemplo n.º 3
0
        private void BindTop5(DashboardSummary d)
        {
            IList <KeyValue> topFive = d.TopFive;// new KeyValueController().GetTopFiveSchoolForADate(Convert.ToDateTime(txtDate.Text),Convert.ToInt32(Session["ClientID"]));

            if (topFive.Count > 0)
            {
                Top1 = topFive.FirstOrDefault().Key;
                if (topFive.Count > 1)
                {
                    Top2 = topFive[1].Key;
                }
                if (topFive.Count > 2)
                {
                    Top3 = topFive[2].Key;
                }
                if (topFive.Count > 3)
                {
                    Top4 = topFive[3].Key;
                }
                if (topFive.Count > 4)
                {
                    Top5 = topFive[4].Key;
                }

                divTopFive.Visible = true;
            }
        }
Exemplo n.º 4
0
        public ReturnModel <DashboardSummary> GetDashboardSummary()
        {
            try
            {
                var result = new DashboardSummary();

                using (var reader = GetNewAppReader().OpenSession <AppLog>())
                {
                    var appLog = reader.Query().Where(x => x.LogType == (int)StoredLogType.AppLog);
                    //result.ErrorAppLogCount = appLog.AsQueryable<AppLog>().Where(x => x.Severity == "ERROR").Count();
                    //result.ErrorSqlAppLogCount = appLog.AsQueryable<AppLog>().Where(x => x.Severity == "SqlError").Count();
                    //result.WarningAppLogCount = appLog.AsQueryable<AppLog>().Where(x => x.Severity == "WARN").Count();
                    //result.TotalAppLogCount = appLog.AsQueryable<AppLog>().Count();
                    //result.LastestAppLogs = appLog.AsQueryable<AppLog>().OrderByDescending(x => x.Longdate).Take(20).ToList();
                    //result.LastestErrorAppLogs = appLog.AsQueryable<AppLog>().Where(x => x.Severity == "ERROR").OrderByDescending(x => x.Longdate).Take(20).ToList();
                }

                return(new ReturnModel <DashboardSummary>(result));
            }
            catch (Exception ex)
            {
                log.Error(ex, "Error when getting Dashboard Summary");
                return(new ReturnModel <DashboardSummary>(ex));
            }
        }
Exemplo n.º 5
0
        private void BindDistrictData(DashboardSummary d)
        {
            gvClusterLevel.DataSource = null;
            gvClusterLevel.DataBind();
            gvBlockLevel.DataSource = null;
            gvBlockLevel.DataBind();
            gvSchoolLevel.DataSource = null;
            gvSchoolLevel.DataBind();
            gvClassLevel.DataSource = null;
            gvClassLevel.DataBind();
            litDistrict.Text = string.Empty;
            litBlock.Text    = string.Empty;
            litCluster.Text  = string.Empty;
            litScholl.Text   = string.Empty;
            //SqlParameter[] m = new SqlParameter[1];
            //m[0] = new SqlParameter("@Date", txtDate.Text);

            //DataTable ds = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "DistrictLevelTotalStudentForADate", m).Tables[0];
            //DataTable ds1 = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "DistrictLevelTotalStudentPresentForADate", m).Tables[0];
            //DataTable ds2 = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "DistrictLevelTotalTeacherForADate", m).Tables[0];
            //DataTable ds3 = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "DistrictLevelTotalTeacherPresentForADate", m).Tables[0];
            //ds.PrimaryKey = new DataColumn[] { ds.Columns["District"] };
            //ds1.PrimaryKey = new DataColumn[] { ds1.Columns["District"] };
            //ds2.PrimaryKey = new DataColumn[] { ds2.Columns["District"] };
            //ds3.PrimaryKey = new DataColumn[] { ds3.Columns["District"] };
            //ds.Merge(ds1);
            //ds.Merge(ds2);
            //ds.Merge(ds3);
            // gvDistrictLevel.DataSource = d.DistrictLevelData;
            gvDistrictLevel.DataBind();
        }
Exemplo n.º 6
0
        private void BindBottom5(DashboardSummary d)
        {
            IList <KeyValue> BottomFive = d.BottomFive;// new KeyValueController().GetBottomFiveSchoolForADate(Convert.ToDateTime(txtDate.Text),Convert.ToInt32(Session["ClientID"]));

            if (BottomFive.Count > 0)
            {
                Bottom1 = BottomFive.FirstOrDefault().Key;
                if (BottomFive.Count > 1)
                {
                    Bottom2 = BottomFive[1].Key;
                }
                if (BottomFive.Count > 2)
                {
                    Bottom3 = BottomFive[2].Key;
                }
                if (BottomFive.Count > 3)
                {
                    Bottom4 = BottomFive[3].Key;
                }
                if (BottomFive.Count > 4)
                {
                    Bottom5 = BottomFive[4].Key;
                }
                divBottom5.Visible = true;
            }
        }
Exemplo n.º 7
0
        protected void txtDate_TextChanged(object sender, EventArgs e)
        {
            if (txtDate.Text != "")
            {
                try
                {
                    string           userID = Context.User.Identity.Name;
                    User             u      = new UserController().GetUser(userID);
                    string           owner  = string.Empty;
                    DashboardSummary d      = new DashboardSummary();
                    if (u.ClientID == 1)
                    {
                        owner = u.MobileNo;
                        //litSchoolName.Text = u.UserGroup.FirstOrDefault().Group_Name;
                        d = new AnalyticsController().GetDashboardSummary(Convert.ToDateTime(txtDate.Text), owner, u.ClientID);
                    }
                    else
                    {
                        //imgGroup.ImageUrl = "../images/" + u.ClientID.ToString() + ".jpg";
                        //string Query = string.Format("Select OrganizationName from Clients where ID=" + u.ClientID + "");
                        //SqlCommand cmd = new SqlCommand(Query);
                        //String constr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                        //SqlConnection con = new SqlConnection(constr);
                        //cmd.CommandType = CommandType.Text;
                        //cmd.Connection = con;
                        //con.Open();
                        //string ClientName = cmd.ExecuteScalar().ToString();
                        //con.Close();
                        //imgGroup.AlternateText = ClientName;
                        d = new AnalyticsController().GetDashboardSummary(Convert.ToDateTime(txtDate.Text), string.Empty, u.ClientID);
                    }
                    TotalStudentsonDate        = Convert.ToInt32(d.TotalStudents);
                    TotalMaleonDate            = Convert.ToInt32(d.TotalMale);
                    TotalFemaleonDate          = Convert.ToInt32(d.TotalFemale);
                    TotalStudentsPresentonDate = Convert.ToInt32(d.TotalStudentsPresent);
                    TotalMalePresentonDate     = Convert.ToInt32(d.TotalMalePresent);
                    TotalFemalePresentonDate   = Convert.ToInt32(d.TotalFemalePresent);
                    //TotalDistrictonDate = Convert.ToInt32(d.TotalDistrict);
                    //TotalSchoolonDate = Convert.ToInt32(d.TotalSchool);
                    TotalTeacheronDate        = Convert.ToInt32(d.TotalTeachers);
                    TotalTeacherPresentonDate = Convert.ToInt32(d.TotalTeachersPresent);

                    BindGraph(d);
                    BindGraphTeacher(d);
                    BindCasteChart(owner);
                    BindGenderChart(d, owner);
                    BindTrendLineChart(owner);
                    BindTrendLineChartTeacher(owner);
                    BindData(owner);
                }
                catch (Exception)
                {
                    General.ShowAlertMessage("Something is not write, no records found! Please try again.");
                }
            }
        }
Exemplo n.º 8
0
        public DashboardSummary GetDashboardSummary(string hCode)
        {
            DashboardSummary result = new DashboardSummary();

            using (GBHODBEntities db = new GBHODBEntities())
            {
                result.AllMembers = db.Members.Count(x => x.RecState == "A" && x.Type != "System");
                result.MyMembers  = db.Members.Count(x => x.RecState == "A" && x.HierarchyCode.StartsWith(hCode + "0") || x.HierarchyCode.StartsWith(hCode + "1"));
                result.MyLeft     = db.Members.Count(x => x.RecState == "A" && x.HierarchyCode.StartsWith(hCode + "0"));
                result.MyRight    = db.Members.Count(x => x.RecState == "A" && x.HierarchyCode.StartsWith(hCode + "1"));
            }
            return(result);
        }
Exemplo n.º 9
0
        public async Task <DashboardSummary> GetDashboardSummary()
        {
            try
            {
                using (var conn = new NpgsqlConnection(Connstring))
                {
                    var results = new DashboardSummary();
                    var cmd     = new NpgsqlCommand("\"GetDashboardSummary\"", conn);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    conn.Open(); var reader = await cmd.ExecuteReaderAsync();

                    while (reader.Read())
                    {
                        results = new DashboardSummary
                        {
                            TotalProducts = reader.GetFieldValue <object>(0) == DBNull.Value? 0: reader.GetFieldValue <long>(0),
                            TotalCost     = reader.GetFieldValue <object>(1) == DBNull.Value ? 0 : reader.GetFieldValue <double>(1),
                            TotalPrice    = reader.GetFieldValue <object>(2) == DBNull.Value ? 0 : reader.GetFieldValue <double>(2),
                            Weekly        = new TimeSummary {
                                ProductsAdded = reader.GetFieldValue <object>(3) == DBNull.Value ? 0 : reader.GetFieldValue <long>(3),
                                Amount        = reader.GetFieldValue <object>(4) == DBNull.Value ? 0 : reader.GetFieldValue <double>(4),
                                QuantityAdded = reader.GetFieldValue <object>(5) == DBNull.Value ? 0 : reader.GetFieldValue <long>(5),
                            },
                            Monthly = new TimeSummary
                            {
                                ProductsAdded = reader.GetFieldValue <object>(6) == DBNull.Value ? 0 : reader.GetFieldValue <long>(6),
                                Amount        = reader.GetFieldValue <object>(7) == DBNull.Value ? 0 : reader.GetFieldValue <double>(7),
                                QuantityAdded = reader.GetFieldValue <object>(8) == DBNull.Value ? 0 : reader.GetFieldValue <long>(8),
                            },
                            Annual = new TimeSummary
                            {
                                ProductsAdded = reader.GetFieldValue <object>(9) == DBNull.Value ? 0 : reader.GetFieldValue <long>(9),
                                Amount        = reader.GetFieldValue <object>(10) == DBNull.Value ? 0 : reader.GetFieldValue <double>(10),
                                QuantityAdded = reader.GetFieldValue <object>(11) == DBNull.Value ? 0 : reader.GetFieldValue <long>(11),
                            }
                        };
                    }
                    conn.Close();
                    conn.Dispose();
                    return(results);
                }
            }
            catch (Exception ex)
            {
                Logger.logError(ex);
                return(new DashboardSummary());
            }
        }
Exemplo n.º 10
0
        private void BindGraph(DashboardSummary d)
        {
            double countAbsent = Convert.ToDouble(Convert.ToInt32(d.TotalStudents) - Convert.ToInt32(d.TotalStudentsPresent));

            double countPresent = Convert.ToDouble(Convert.ToInt32(d.TotalStudentsPresent));

            if (countAbsent != 0 || countPresent != 0)
            {
                double AbsentPercent  = Math.Round(Convert.ToDouble(Convert.ToDouble(countAbsent * 100 / (countPresent + countAbsent))), 2);
                double PresentPercent = Math.Round(Convert.ToDouble(Convert.ToDouble(countPresent * 100 / (countPresent + countAbsent))), 2);
                PerAbsent    = AbsentPercent;
                PerPresent   = PresentPercent;
                DateSelected = Convert.ToDateTime(txtDate.Text).ToShortDateString();
            }
        }
Exemplo n.º 11
0
        private void BindGraphTeacher(DashboardSummary d)
        {
            double countAbsent = Convert.ToDouble(Convert.ToInt32(d.TotalTeachers) - Convert.ToInt32(d.TotalTeachersPresent));

            double countPresent = Convert.ToDouble(d.TotalTeachersPresent);


            if (countAbsent != 0 || countPresent != 0)
            {
                double AbsentPercent  = Math.Round(Convert.ToDouble(Convert.ToDouble(countAbsent * 100 / (countPresent + countAbsent))), 2);
                double PresentPercent = Math.Round(Convert.ToDouble(Convert.ToDouble(countPresent * 100 / (countPresent + countAbsent))), 2);
                PerAbsentTeacher  = AbsentPercent;
                PerPresentTeacher = PresentPercent;
                DateSelected      = General.GetCurrentSession;// Convert.ToDateTime(txtDate.Text).ToShortDateString();
            }
        }
        public DashboardSummary Build(string userId)
        {
            var stories          = expenseStoryManager.GetAllExpenseStories(userId);
            var dashboardSummary = new DashboardSummary();
            List <ExpenseStorySummary> eSummaries = new List <ExpenseStorySummary>();

            foreach (var story in stories)
            {
                var expenseStorySummary = expenseStorySummaryBuilder.Build(story.ExpenseStoryId);
                expenseStorySummary.ExpenseStory = story;
                eSummaries.Add(expenseStorySummary);
            }

            dashboardSummary.ExpenseStorySummaries = eSummaries;

            return(dashboardSummary);
        }
Exemplo n.º 13
0
        public DashboardSummary GetDashboardSummaryAttendance(int ClientID, DateTime FromDate, DateTime Todate)
        {
            try
            {
                SqlParameter[] m = new SqlParameter[3];
                m[0] = new SqlParameter("@ClientID", ClientID);
                m[1] = new SqlParameter("@FromDate", FromDate);
                m[2] = new SqlParameter("@Todate", Todate);

                DataSet          ds = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "GetDashboardSummary2", m);
                DashboardSummary _DashboardSummary = new DashboardSummary();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    _DashboardSummary.TotalStudents = ds.Tables[0].Rows[0]["TotalStudent"].ToString();
                    _DashboardSummary.TotalMale     = ds.Tables[0].Rows[0]["TotalMale"].ToString();
                    _DashboardSummary.TotalFemale   = ds.Tables[0].Rows[0]["TotalFemale"].ToString();
                    _DashboardSummary.TotalTeachers = ds.Tables[0].Rows[0]["TotalTeacher"].ToString();

                    _DashboardSummary.TotalStudentsPresent = ds.Tables[0].Rows[0]["TotalPresent"].ToString();
                    _DashboardSummary.TotalMalePresent     = ds.Tables[0].Rows[0]["TotalMalePresent"].ToString();
                    _DashboardSummary.TotalFemalePresent   = ds.Tables[0].Rows[0]["TotalFemalePresent"].ToString();
                    _DashboardSummary.TotalTeachersPresent = ds.Tables[0].Rows[0]["TotalTeacherPresent"].ToString();

                    _DashboardSummary.TotalClasses = ds.Tables[0].Rows[0]["TotalClasses"].ToString();
                    try
                    {
                        _DashboardSummary.Trends = GetTrends(FromDate.AddDays(-11).Date, FromDate.AddDays(-1).Date, ClientID).ToList();
                    }
                    catch
                    {
                    }
                    _DashboardSummary.TopFive    = null; // new SqlServerKeyValueDao().GetTopFiveSchoolForADate(date, ClientID).ToList();
                    _DashboardSummary.BottomFive = null; // new SqlServerKeyValueDao().GetBottomFiveSchoolForADate(date, ClientID).ToList();
                }
                else
                {
                    _DashboardSummary = null;
                }
                return(_DashboardSummary);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 14
0
        private void BindGenderChart(DashboardSummary d)
        {
            System.Text.StringBuilder sbMale   = new System.Text.StringBuilder();
            System.Text.StringBuilder sbFemale = new System.Text.StringBuilder();
            if (Convert.ToInt32(d.TotalStudentsPresent) > 0)
            {
                double MalePercentage1 = Math.Round(Convert.ToInt32(d.TotalMalePresent) * 100.0 / Convert.ToInt32(d.TotalStudentsPresent));
                int    MalePercentage  = Convert.ToInt32(MalePercentage1);

                double FemalePercentage1 = Math.Round((Convert.ToInt32(d.TotalFemalePresent) * 100.0) / Convert.ToInt32(d.TotalStudentsPresent));
                int    FemalePercentage  = Convert.ToInt32(FemalePercentage1);

                sbMale.Append("['Gender', " + MalePercentage + "]");
                sbFemale.Append("['Gender', " + FemalePercentage + "]");
                MaleSeries   = "[" + sbMale.ToString() + "]";
                FemaleSeries = "[" + sbFemale.ToString() + "]";
            }
        }
Exemplo n.º 15
0
        //public List<AbsenceSummary> GetAbsenceSummary(string userId, int year)
        //{
        //    using (var connection = base.GetConnection)
        //    {
        //        var sql = "[Absence].[GetAbsenceSummary]";
        //        var param = new DynamicParameters();
        //        param.Add("@UserId", userId);
        //        param.Add("@Year", year);
        //        return connection.Query<AbsenceSummary>(sql, param, commandType: System.Data.CommandType.StoredProcedure).ToList();
        //    }
        //}

        public DashboardSummary GetAbsenceSummary(string userId, int year)
        {
            using (var connection = base.GetConnection)
            {
                var sql   = "[Subzz_Users].[Users].[DashboardSummary]";
                var param = new DynamicParameters();
                param.Add("@UserId", userId);
                param.Add("@Year", year);
                var Results = connection.QueryMultiple(sql, param, commandType: CommandType.StoredProcedure);
                DashboardSummary dasboardSummary = new DashboardSummary();
                dasboardSummary.AbsenceSummary = Results.Read <AbsenceSummary>().ToList();
                dasboardSummary.TopTenTeachers.AddRange(Results.Read <TopTenTeachers>().ToList());
                dasboardSummary.AbsenceBySubject.AddRange(Results.Read <AbsenceBySubject>().ToList());
                dasboardSummary.AbsenceByGradeLevel.AddRange(Results.Read <AbsenceByGradeLevel>().ToList());
                dasboardSummary.TopFourAbsenceReasons.AddRange(Results.Read <TopFourAbsenceReasons>().ToList());
                return(dasboardSummary);
            }
        }
Exemplo n.º 16
0
        public DashboardSummary GetDashboardSummary(DateTime date, int ClientID)
        {
            try
            {
                SqlParameter[] m = new SqlParameter[2];
                m[0] = new SqlParameter("@Date", date);
                m[1] = new SqlParameter("@ClientID", ClientID);
                DataSet          ds = SqlHelper.ExecuteDataset(Connection.Connection_string, CommandType.StoredProcedure, "GetDashboardSummary1", m);
                DashboardSummary _DashboardSummary = new DashboardSummary();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    _DashboardSummary.TotalStudents = ds.Tables[0].Rows[0]["TotalStudent"].ToString();
                    _DashboardSummary.TotalMale     = ds.Tables[0].Rows[0]["TotalMale"].ToString();
                    _DashboardSummary.TotalFemale   = ds.Tables[0].Rows[0]["TotalFemale"].ToString();
                    _DashboardSummary.TotalTeachers = ds.Tables[0].Rows[0]["TotalTeacher"].ToString();

                    _DashboardSummary.TotalStudentsPresent = ds.Tables[0].Rows[0]["TotalPresent"].ToString();
                    _DashboardSummary.TotalMalePresent     = ds.Tables[0].Rows[0]["TotalMalePresent"].ToString();
                    _DashboardSummary.TotalFemalePresent   = ds.Tables[0].Rows[0]["TotalFemalePresent"].ToString();
                    _DashboardSummary.TotalTeachersPresent = ds.Tables[0].Rows[0]["TotalTeacherPresent"].ToString();

                    //_DashboardSummary.TotalDistrict = ds.Tables[0].Rows[0]["TotalDistrict"].ToString();
                    //_DashboardSummary.TotalSchool = ds.Tables[0].Rows[0]["TotalSchools"].ToString();
                    //_DashboardSummary.DistrictLevelData = GetDistrictLevelDataForADate(date, ClientID).ToList();
                    _DashboardSummary.Trends = GetTrends(date.AddDays(-11), date.AddDays(-1), ClientID).ToList();
                    //_DashboardSummary.TopFive = new SqlServerKeyValueDao().GetTopFiveSchoolForADate(date, ClientID).ToList();
                    //_DashboardSummary.BottomFive = new SqlServerKeyValueDao().GetBottomFiveSchoolForADate(date, ClientID).ToList();
                    //_DashboardSummary.Caste = new SqlServerKeyValueDao().GetCastWiseDataForADate(date, ClientID).ToList();
                }
                else
                {
                    _DashboardSummary = null;
                }
                return(_DashboardSummary);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 17
0
        public DashboardSummary GetDashboard(int empId)
        {
            var dashboardSummary = dashboardRepository.GetDashboard(empId);

            if (null != dashboardSummary && dashboardSummary.Tables.Count > 0)
            {
                DashboardSummary dashboard = new DashboardSummary();
                int i = -1;
                foreach (DataTable table in dashboardSummary.Tables)
                {
                    i++;
                    switch (i)
                    {
                    case 0:
                        dashboard.TotalProfileViewes = Convert.ToInt32(table.Rows[0]["TotalViewed"]);
                        break;

                    case 1:
                        dashboard.TotalResumeList = Convert.ToInt32(table.Rows[0]["TotalApplications"]);
                        break;

                    case 2:
                        dashboard.TotalMessages = Convert.ToInt32(table.Rows[0]["TotalMessages"]);
                        break;

                    case 3:
                        dashboard.RespondTime = Convert.ToInt32(table.Rows[0]["RespondTime"]);
                        break;

                    default:
                        break;
                    }
                }
                return(dashboard);
            }
            throw new DataNotFound("Dashboard Summary not found");
        }
Exemplo n.º 18
0
        public ReturnModel <DashboardSummary> GetDashboardSummary()
        {
            try
            {
                var result = new DashboardSummary();

                using (var reader = GetNewAppReader())
                {
                    var searcher = new IndexSearcher(reader);
                    var appLog   = searcher.AsQueryable <AppLog>().Where(x => x.LogType == (int)StoredLogType.AppLog);
                    result.ErrorAppLogCount    = appLog.AsQueryable <AppLog>().Where(x => x.Severity == "ERROR").Count();
                    result.ErrorSqlAppLogCount = appLog.AsQueryable <AppLog>().Where(x => x.Severity == "SqlError").Count();
                    result.WarningAppLogCount  = appLog.AsQueryable <AppLog>().Where(x => x.Severity == "WARN").Count();
                    result.TotalAppLogCount    = appLog.AsQueryable <AppLog>().Count();
                    result.LastestAppLogs      = appLog.AsQueryable <AppLog>().OrderByDescending(x => x.Longdate).Take(20).ToList();
                    result.LastestErrorAppLogs = appLog.AsQueryable <AppLog>().Where(x => x.Severity == "ERROR").OrderByDescending(x => x.Longdate).Take(20).ToList();

                    var perfLog = searcher.AsQueryable <AppLog>().Where(x => x.LogType == (int)StoredLogType.PerfLog);

                    var errorLst = perfLog.AsQueryable <AppLog>().Where(x => x.PerfStatus == "ERROR");
                    var allLst   = perfLog.AsQueryable <AppLog>();

                    result.ErrorPerformanceLogCount = errorLst.AsQueryable().Count();
                    result.TotalPerformanceLogCount = allLst.AsQueryable().Count();

                    result.LastestPerformanceLogs      = allLst.AsQueryable().OrderByDescending(x => x.Longdate).Take(20).ToList();
                    result.LastestErrorPerformanceLogs = errorLst.AsQueryable().OrderByDescending(x => x.Longdate).Take(20).ToList();
                }

                return(new ReturnModel <DashboardSummary>(result));
            }
            catch (Exception ex)
            {
                log.Error(ex, "Error when getting Dashboard Summary");
                return(new ReturnModel <DashboardSummary>(ex));
            }
        }
Exemplo n.º 19
0
        public async Task <DashboardSummary> GetSummaryCounters(int hotelId)
        {
            DashboardSummary counters = new DashboardSummary()
            {
                Orders = 0, Reservations = 0, Bookings = 0, Keepings = 0
            }
            ;
            DateTime startDate = DateTime.Now.Date;
            DateTime endDate   = startDate.AddHours(23).AddMinutes(59).AddSeconds(59);

            counters.Orders = await _context.MenuOrders.CountAsync(o => o.HotelId == hotelId &&
                                                                   o.CreatedOn >= startDate && o.CreatedOn <= endDate);

            counters.Reservations = await _context.Reservations.CountAsync(o => o.HotelId == hotelId &&
                                                                           o.CreatedOn >= startDate && o.CreatedOn <= endDate);

            counters.Bookings = await _context.Bookings.CountAsync(o => o.HotelId == hotelId &&
                                                                   o.CreatedOn >= startDate && o.CreatedOn <= endDate);

            counters.Keepings = await _context.Taxis.CountAsync(o => o.HotelId == hotelId &&
                                                                o.CreatedOn >= startDate && o.CreatedOn <= endDate);

            return(counters);
        }
Exemplo n.º 20
0
        private void BindCasteChart(DashboardSummary d)
        {
            //  System.Text.StringBuilder sbGen = new System.Text.StringBuilder();
            //  System.Text.StringBuilder sbObc = new System.Text.StringBuilder();
            //  System.Text.StringBuilder sbSC = new System.Text.StringBuilder();
            //  System.Text.StringBuilder sbST = new System.Text.StringBuilder();
            //  System.Text.StringBuilder sbMinority = new System.Text.StringBuilder();
            //  System.Text.StringBuilder sbOther = new System.Text.StringBuilder();
            ////  IList<KeyValue> CastWiseDataForADate = d.Caste;// new KeyValueController().GetCastWiseDataForADate(Convert.ToDateTime(txtDate.Text), Convert.ToInt32(Session["ClientID"]));
            //  int TotalStudents = TotalStudentsPresentonDate;
            //  if (TotalStudents > 0)
            //  {
            //      double TotalGen = 0;
            //      try
            //      {
            //          TotalGen = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "Gen") == null) ? 0 :
            //                         Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "Gen").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }
            //      double GenPercentage = Math.Round((TotalGen * 100 / TotalStudents));

            //      double TotalObc = 0;
            //      try
            //      {
            //          TotalObc = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "OBC") == null) ? 0 :
            //           Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "OBC").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }

            //      double ObcPercentage = Math.Round((TotalObc * 100 / TotalStudents));
            //      double TotalSC = 0;
            //      try
            //      {
            //          TotalSC = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "SC") == null) ? 0 :
            //           Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "SC").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }

            //      double SCPercentage = Math.Round((TotalSC * 100 / TotalStudents));
            //      double TotalST = 0;
            //      try
            //      {
            //          TotalST = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "ST") == null) ? 0 :
            //           Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "ST").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }

            //      double STPercentage = Math.Round((TotalST * 100 / TotalStudents));
            //      double TotalMinority = 0;
            //      try
            //      {
            //          TotalMinority = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "Minority") == null) ? 0 :
            //                         Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "Minority").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }

            //      double MinorityPercentage = Math.Round((TotalMinority * 100 / TotalStudents));

            //      double TotalOther = 0;
            //      try
            //      {
            //          TotalOther = Convert.ToDouble((CastWiseDataForADate.Where(ss => ss.Key == "Other") == null) ? 0 :
            //                 Convert.ToInt32(CastWiseDataForADate.Where(ss => ss.Key == "Other").FirstOrDefault().Value));
            //      }
            //      catch
            //      {
            //      }

            //      double OtherPercentage = Math.Round((TotalOther * 100 / TotalStudents));

            //      sbGen.Append(",['Gen', " + GenPercentage + "]");
            //      sbObc.Append(",['Obc', " + ObcPercentage + "]");
            //      sbSC.Append(",['SC', " + SCPercentage + "]");
            //      sbST.Append(",['ST', " + STPercentage + "]");
            //      sbMinority.Append(",['Minority', " + MinorityPercentage + "]");
            //      sbOther.Append(",['Other', " + OtherPercentage + "]");

            //      CasteSeries = "[" + sbGen.ToString() + "" + sbObc.ToString() + "" + sbSC.ToString() + "" + sbST.ToString() + "" + sbMinority.ToString() + "" + sbOther.ToString() + "]";
            //  }
        }
Exemplo n.º 21
0
        public DashboardSummary CreateSummary(
            DashboardRequest request,
            SliceDataModel[] sliceData,
            ActivityGroup[] activities,
            CostCentre centre)
        {
            var configuration = Configurations[request.Section];
            var uomLong       = string.Empty;
            var showCo2       = false;
            var groupNodes    = activities.Select(a => a.Node).ToArray();
            var summary       = new DashboardSummary
            {
                costCentre    = centre.Name,
                activityGroup = (request.ActivityGroupId == null)
                    ? configuration.DisplayName
                    : activities[0].Name,
                displayTotal = true
            };
            var slices = sliceData
                         .OrderBy(s => s.OrderId)
                         .Select(s =>
            {
                var slice = new SliceModel
                {
                    activityGroupId = s.ActivityGroupId,
                    color           = s.Color,
                    costCode        = s.CostCode,
                    description     = s.Description,
                    title           = s.Title,
                    sliceId         = CreateSliceId(s.ActivityGroupId, s.CostCode),
                };
                var noUnits =
                    (string.IsNullOrEmpty(s.UomShort)) ||
                    (string.IsNullOrEmpty(s.UomLong));

                if (configuration.ShowCo2 || noUnits)
                {
                    showCo2        = true;
                    slice.co2label = Constants.Constants.Co2LabelShort;
                    slice.amount   = GetTotal(
                        TotalEmissions,
                        request.StartDate,
                        request.EndDate,
                        s.ActivityGroupNode,
                        s.CentreNode,
                        groupNodes) / 1000;
                }
                if (configuration.ShowCo2 && !noUnits)
                {
                    slice.uom   = s.UomShort;
                    slice.units = GetTotal(
                        TotalUnits,
                        request.StartDate,
                        request.EndDate,
                        s.ActivityGroupNode,
                        s.CentreNode,
                        groupNodes);
                }
                if (!configuration.ShowCo2 && !noUnits)
                {
                    slice.co2label = s.UomShort;
                    uomLong        = s.UomLong;
                    slice.amount   = GetTotal(
                        TotalUnits,
                        request.StartDate,
                        request.EndDate,
                        s.ActivityGroupNode,
                        s.CentreNode,
                        groupNodes);
                }
                return(slice);
            }).ToArray();

            decimal lastYearTotal;
            decimal totalAmount;

            if (showCo2)
            {
                totalAmount = GetTotal(
                    TotalEmissions,
                    request.StartDate,
                    request.EndDate,
                    null,
                    centre.Node,
                    groupNodes) / 1000;
                lastYearTotal = GetTotal(
                    TotalEmissions,
                    request.StartDate.AddYears(-1),
                    request.EndDate.AddYears(-1),
                    null,
                    centre.Node,
                    groupNodes) / 1000;
            }
            else
            {
                totalAmount = GetTotal(
                    TotalUnits,
                    request.StartDate,
                    request.EndDate,
                    null,
                    centre.Node,
                    groupNodes);
                lastYearTotal = GetTotal(
                    TotalUnits,
                    request.StartDate.AddYears(-1),
                    request.EndDate.AddYears(-1),
                    null,
                    centre.Node,
                    groupNodes);
            }

            var yoy = (lastYearTotal == 0)
                ? 0
                : ((totalAmount - lastYearTotal) / lastYearTotal) * 100;
            var currencies = GetCurrencies(
                request.StartDate,
                request.EndDate,
                groupNodes,
                centre.Node);

            summary.co2label = (showCo2)
                ? Constants.Constants.Co2LabelLong
                : uomLong;
            summary.currencies = currencies;
            summary.slices     = slices;
            summary.total      = totalAmount;
            summary.yoy        = yoy;
            return(summary);
        }