public ActionResult GetProbeData(DateTime fromdate, DateTime todate) { using (var ctx = new AdventureEntities()) { var gamelines = (from od in ctx.prc_eprobe_avg() select new ProbeDetail { UsageDate = od.datatime_hour, GameName = od.GameName, RTT = od.RTT.Value, UsuageDateStr = od.datatime_hour.ToString("dd-MMM-yyyy HH:mm:00") }) .Where(x => (x.UsageDate >= fromdate && x.UsageDate <= todate)) .ToList(); List <GameEProbeData> gameProbeDatas = gamelines.GroupBy(g => g.GameName) .Select(g => new GameEProbeData { GameName = g.Key, ProbeDetail = g.OrderBy(x => x.UsageDate).ToList() }).ToList(); return(Json(new { gameProbeDatas = gameProbeDatas }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetSparkData() { using (var ctx = new AdventureEntities()) { var f_header = ctx.prc_sum_apps_usage_date1().Select(x => x.applicationname).Distinct(); var f_lines = (from od in ctx.prc_combined_vol() select new UsuageDetail { UsuageDate = od.date.Value, ApplicationName = od.applicationname, Mobile_Usage = od.mobile.HasValue ? od.mobile.Value : 0, Fixed_Usage = [email protected] ? [email protected] : 0, UsuageDateStr = od.date.Value.ToString("dd-MMM-yyyy") }).ToList(); List <ApplicationDailyComparisionData> applicationData = f_lines.GroupBy(g => g.ApplicationName) .Select(g => new ApplicationDailyComparisionData { ApplicationName = g.Key, UsuageDetails = g.OrderBy(x => x.UsuageDate) .ToList() }).ToList(); foreach (var header in applicationData) { //header.UsuageDetails = header.UsuageDetails.OrderByDescending(i => i.UsuageDate).Take(10).ToList(); var currentData = header.UsuageDetails.OrderByDescending(i => i.UsuageDate).FirstOrDefault(); var previousData = header.UsuageDetails.OrderByDescending(i => i.UsuageDate).Skip(1).Take(1).SingleOrDefault(); var fixed_avgData = header.UsuageDetails.Select(x => x.Fixed_Usage).Average(); var mobile_avgData = header.UsuageDetails.Select(x => x.Mobile_Usage).Average(); header.FixedPreviousDate = previousData.UsuageDate; header.MobilePreviousDate = previousData.UsuageDate; header.FixedPreviousUsage = previousData.Fixed_Usage; header.MobilePreviousUsage = previousData.Mobile_Usage; header.FixedCurrentDate = currentData.UsuageDate; header.MobileCurrentDate = currentData.UsuageDate; header.FixedCurrentUsage = currentData.Fixed_Usage; header.MobileCurrentUsage = currentData.Mobile_Usage; header.Fixed_Avg_Usage = Math.Round(fixed_avgData, 3); header.Mobile_Avg_Usage = Math.Round(mobile_avgData, 3); //header.UsuageDifference = Math.Round(header.PreviousUsage - header.CurrentUsage, 2); header.Fixed_UsuageDifference = Math.Round((header.FixedPreviousUsage - header.FixedCurrentUsage), 3); header.Mobile_UsuageDifference = Math.Round((header.MobilePreviousUsage - header.MobileCurrentUsage), 3); header.IsFixed_Up = header.Fixed_UsuageDifference > 0; header.IsMobile_Up = header.Mobile_UsuageDifference > 0; } return(Json(new { applicationData = applicationData }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetProbeData() { using (var ctx = new AdventureEntities()) { var GetProbeData = ctx.prc_ets_probe_data().ToList(); return(Json(new { GetProbeData }, JsonRequestBehavior.AllowGet)); } }
public override string[] GetRolesForUser(string username) { AdventureEntities db = new AdventureEntities(); var roles = db.Users.FirstOrDefault(x => x.UserName == username).Role.RoleName; string[] role = { roles }; return(role); }
//Get Fixed Data summary public JsonResult GetBubbleJson_all() { int i = 0; using (var ctx = new AdventureEntities()) { var bubble = (from od in ctx.prc_sum_apps_usage_date1() select new { _date = od.date.Value.ToString("MM/dd/yyyy"), _ApplicationName = od.applicationname, _Usage = od.usage.HasValue ? od.usage.Value : 0 }).ToList(); List <bubble> bubble_points = new List <bubble>(); foreach (var header in bubble) { string s_date = header._date; DateTime dateTime = DateTime.ParseExact(s_date, "MM-dd-yyyy", CultureInfo.InvariantCulture); int year = dateTime.Year; int month = dateTime.Month; int day = dateTime.Day; string groups = ""; if (header._Usage >= 2) { groups = "high"; } else if (header._Usage < 1) { groups = "low"; } else { groups = "medium"; } bubble_points.Add(new bubble() { id = i++, ApplicationName = header._ApplicationName, Grant_start_date = header._date, group = groups, OrganizationName = header._ApplicationName, Usage = header._Usage, start_day = day, start_month = month, start_year = year }); } //string json = JsonConvert.SerializeObject(bubble_points.ToArray()); return(Json(new { bubble_points }, JsonRequestBehavior.AllowGet)); } }
private static List <bubble> GetBubbleSummaryByDateFormat(string format) { int i = 0; List <bubble> bubble_points = new List <bubble>(); using (var ctx = new AdventureEntities()) { var bubble = ctx.prc_combined_vol().GroupBy(p => p.date.Value.ToString(format)). Select(g => new { _date = g.Key, _fixed = g.Sum(y => y.@fixed), _mobile = g.Sum(x => x.mobile) }).ToList(); foreach (var header in bubble) { string s_date = header._date; DateTime dateTime = DateTime.ParseExact(s_date, "dd-MM-yyyy", CultureInfo.InvariantCulture); int year = dateTime.Year; int month = dateTime.Month; int day = dateTime.Day; string groups = ""; double Usage = 0; Usage = (double)(header._fixed + header._mobile); if (Usage >= 2) { groups = "high"; } else if (Usage < 1) { groups = "low"; } else { groups = "medium"; } bubble_points.Add(new bubble() { id = i++, Grant_start_date = header._date, group = groups, //Usage = header._Usage.HasValue ? header._Usage.Value : 0, start_day = day, start_month = month, start_year = year, Usage = Usage }); } } return(bubble_points); }
public ActionResult Index() { using (var ctx = new AdventureEntities()) { var cmbdata = ctx.ets_eprobe_avg_server().Select(x => x.GameName).Distinct().ToList(); ViewBag.cmbdata = cmbdata.Select(r => new SelectListItem { Text = r, Value = r }); } return(View()); }
public ActionResult GetOrders1() { using (var ctx = new AdventureEntities()) { var query1 = ctx.Orders.Include("Customer") .GroupBy(p => p.Customer.FirstName) .Select(g => new { name = g.Key, count = g.Sum(x => x.TotalAmount) }).ToList(); return(Json(query1, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetDataGrid() { using (var ctx = new AdventureEntities()) { var date = (from fd in ctx.fixed_top_ups orderby fd.Date select new { fd.Date.Value }).ToList(); List <string> lstDate = new List <string>(); foreach (var item in date) { lstDate.Add(item.Value.ToString()); } var columnnames = (from t in typeof(fixed_top_ups).GetProperties() select t.Name).ToList(); var x_column = ctx.prc_sum_apps_usage().ToList(); var x_header = ctx.prc_sum_fixed().ToList(); var x_detail = ctx.prc_sum_apps_usage_date1().ToList(); List <DrillDownHeader> drillDownHeaders = new List <DrillDownHeader>(); foreach (var header in x_column) { drillDownHeaders.Add(new DrillDownHeader() { ApplicationName = header.applicationname, TotalUsage = header.usage.Value }); } List <DrillDownDetails> drillDownDetails = new List <DrillDownDetails>(); foreach (var det in x_detail) { drillDownDetails.Add(new DrillDownDetails() { ApplicationName = det.applicationname, drillDownDate = det.date.Value, Usage = det.usage.Value, CreateDateString = det.date.Value.ToString("MM/dd/yyyy") }); } chartaxis chartaxis = new chartaxis(); chartaxis.drillDownHeader = drillDownHeaders; chartaxis.drillDownDetail = drillDownDetails; return(Json(new { chartaxis }, JsonRequestBehavior.AllowGet)); // return Json(griddata, JsonRequestBehavior.AllowGet); } }
public ActionResult Get_Iptv_Count() { using (var ctx = new AdventureEntities()) { var get_iptv_count = (from od in ctx.prc_iptv_count() select new { count = od.IPTV_Users_Count.HasValue ? od.IPTV_Users_Count : 0, daily = od.date.Value.Date, monthly = new DateTime(od.date.Value.Year, od.date.Value.Month, 1, 0, 0, 0), hourly = new DateTime(od.date.Value.Year, od.date.Value.Month, od.date.Value.Day, int.Parse(od.Hour.Value.ToString()), 0, 0) }).ToList(); var get_daily = get_iptv_count.GroupBy(x => x.daily).Select(g => new { name = g.Key, count = Math.Round(g.Average(x => x.count).Value) }).ToList(); var get_monthly = get_iptv_count.GroupBy(x => x.monthly).Select(g => new { name = g.Key, count = Math.Round(g.Average(x => x.count).Value) }).ToList(); var get_hourly = get_iptv_count.OrderByDescending(x => x.daily).GroupBy(x => x.hourly).Select(g => new { name = g.Key, count = g.Average(x => Math.Round(x.count.Value)) }).Take(24).ToList(); List <IPTV_User_Count> iPTV_User_Counts_d = new List <IPTV_User_Count>(); foreach (var item in get_daily) { iPTV_User_Counts_d.Add(new IPTV_User_Count() { Day = item.name.ToString("MMM-dd"), Daily_Count = item.count.ToString() }); } List <IPTV_User_Count> iPTV_User_Counts_m = new List <IPTV_User_Count>(); foreach (var item in get_monthly) { iPTV_User_Counts_m.Add(new IPTV_User_Count() { Month = item.name.ToString("MMM-yyyy"), Monthly_Count = item.count.ToString() }); } List <IPTV_User_Count> iPTV_User_Counts_h = new List <IPTV_User_Count>(); foreach (var item in get_hourly) { iPTV_User_Counts_h.Add(new IPTV_User_Count() { Hour = item.name.ToString("HH:mm"), Hourly_Count = item.count.ToString() }); } var data = new { Daily = iPTV_User_Counts_d, Monthly = iPTV_User_Counts_m, Hourly = iPTV_User_Counts_h }; return(Json(data, JsonRequestBehavior.AllowGet)); } }
// GET: Master public ActionResult Index() { using (var ctx = new AdventureEntities()) { var get_peeks_fixed = ctx.prc_sum_apps_usage_date1().GroupBy(p => p.date) .Select(g => new { date = g.Key.Value.ToString("MM/dd/yyyy"), count = g.Sum(x => x.usage) }) .OrderByDescending(x => x.count).FirstOrDefault(); ViewBag.getpeeks = get_peeks_fixed.ToExpando(); } return(View()); }
public ActionResult GetSunBurst() { using (var ctx = new AdventureEntities()) { var sunburst = (from od in ctx.prc_sum_apps_usage_date1() select new { date = od.date.Value.ToString("MM/dd/yyyy"), apps = od.applicationname, usage = od.usage.HasValue ? od.usage : 0 }).ToList(); var appnames = ctx.prc_sum_apps_usage_date1().Select(p => p.applicationname).Distinct(); List <sb_ring_header> _sbring_hd = new List <sb_ring_header>(); List <SbHeader> _sbHeaders = new List <SbHeader>(); foreach (var header in appnames) { _sbring_hd.Add(new sb_ring_header() { U_Id = header }); foreach (var dtl in sunburst.Where(i => i.apps == header)) { _sbHeaders.Add(new SbHeader { sburnDate = dtl.date, ApplicationName = dtl.apps }); } } List <SbDetail> _sbDetail = new List <SbDetail>(); foreach (var detail in sunburst) { _sbDetail.Add(new SbDetail() { TotalUsage = detail.usage.Value, sburnDate = detail.date, d_ApplicationName = detail.apps }); } sunburstpoints sbpoints = new sunburstpoints(); sbpoints.s_burn_Header = _sbHeaders; sbpoints.s_burn_Detail = _sbDetail; sbpoints.s_sbring_hd = _sbring_hd; return(Json(new { sbpoints }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetDataCombine_mobile() { using (var ctx = new AdventureEntities()) { var get_pie_master_mobile = (from od in ctx.prc_top5_mobile() select new { apps = od.applicationname, usage = od.usage.HasValue ? od.usage.Value : 0 }).Take(5).ToList(); return(Json(new { get_pie_master_mobile }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetHighBub_Mob() { using (var ctx = new AdventureEntities()) { var bubble_h = ctx.prc_combined_vol().GroupBy(p => p.applicationname). Select(g => new { _ApplicationName = g.Key, _fixed = g.Sum(x => x.@fixed), _mobile = g.Sum(y => y.mobile) }).ToList(); return(Json(new { bubble_h }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetDataMaster() { using (var ctx = new AdventureEntities()) { var datausage = (from od in ctx.prc_data_summary().OrderByDescending(x => x.date) select new { date = od.date.Value.ToString("MMM/dd"), m_usage = od.Mobile_Data__TB_.HasValue ? od.Mobile_Data__TB_.Value : 0, f_usage = od.Fixed_Data__PB_.HasValue ? od.Fixed_Data__PB_.Value : 0 }).Take(20).ToList(); return(Json(new { datausage }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetVoiceMaster() { using (var ctx = new AdventureEntities()) { var voicedata = (from od in ctx.prc_voice_summary().OrderByDescending(x => x.date) select new { date = od.date.Value.ToString("MMM/dd"), m_voice = od.Mobile_Voice__erlang_.HasValue ? od.Mobile_Voice__erlang_.Value : 0, f_voice = od.Fixed_Voice__mins_.HasValue ? od.Fixed_Voice__mins_.Value : 0, idd_voice = od.IDD_OG__mins_.HasValue ? od.IDD_OG__mins_.Value : 0 }).Take(20).ToList(); return(Json(new { voicedata }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetTopAppsMaster() { using (var ctx = new AdventureEntities()) { var top_combinedtable = (from od in ctx.prc_top_apps_summary() select new { date = od.date.Value.ToString("MMM/dd"), t_mob = od.Mobile_Top_Apps_Volume__TB_.HasValue ? od.Mobile_Top_Apps_Volume__TB_.Value : 0, t_fix = od.Fixed_Top_Apps_Volume__PB_.HasValue ? od.Fixed_Top_Apps_Volume__PB_.Value : 0, c_iptv = od.IPTV_users_count.HasValue ? od.IPTV_users_count.Value : 0 }).Take(10).ToList(); return(Json(new { top_combinedtable }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetBubbleJson_application() { int i = 0; using (var ctx = new AdventureEntities()) { var bubble = ctx.prc_combined_vol().GroupBy(p => p.applicationname). Select(g => new { _ApplicationName = g.Key, _fixed = g.Sum(x => x.@fixed), _mobile = g.Sum(y => y.mobile) }).ToList(); List <bubble> bubble_points = new List <bubble>(); foreach (var header in bubble) { string groups = ""; if (header._fixed >= 2) { groups = "high"; } else if (header._fixed < 1) { groups = "low"; } else { groups = "medium"; } bubble_points.Add(new bubble() { id = i++, ApplicationName = header._ApplicationName, group = groups, OrganizationName = header._ApplicationName, //Usage = header._Usage.HasValue ? header._Usage.Value : 0 Usage = (double)(header._fixed + header._mobile) }); } return(Json(new { bubble_points }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetIsupMaster() { using (var ctx = new AdventureEntities()) { var sup_combinedtable = (from od in ctx.prc_isup_summary().OrderByDescending(x => x.date) select new { date = od.date.Value.ToString("MMM/dd"), asr = od.ISUP_ASR__perc_.HasValue ? od.ISUP_ASR__perc_.Value : 0, nernw = od.ISUP_NER_NW__perc_.HasValue ? od.ISUP_NER_NW__perc_.Value : 0, sipasr = od.ISUP_SIP_ASR__perc_.HasValue ? od.ISUP_SIP_ASR__perc_.Value : 0, sipnernw = od.ISUP_SIP_NER_NW__perc_.HasValue ? od.ISUP_SIP_NER_NW__perc_.Value : 0 }).Take(7).ToList(); return(Json(new { sup_combinedtable }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetLineGameData(string GName, string hours) { using (var ctx = new AdventureEntities()) { DateTime hours_in = Convert.ToDateTime(hours); var GetLine = (from od in ctx.ets_eprobe_avg_server() select new GameDetails { GameName = od.GameName, ServerLocation = od.ServerLocation, RTT = od.Avg_RTT.Value, UsuageDateStr = od.datatime_hour.ToString("dd-MMM-yyyy HH:mm"), UsageDate = od.datatime_hour }).Where(x => x.GameName == GName && x.UsageDate >= hours_in) .ToList(); var ServerNames = ctx.ets_eprobe_avg_server().Where(y => y.GameName == GName && y.datatime_hour >= hours_in).Select(x => x.ServerLocation).Distinct().ToList(); List <GameDetails> gameDetails = new List <GameDetails>(); foreach (var lines in GetLine) { gameDetails.Add(new GameDetails() { GameName = lines.GameName, RTT = lines.RTT, ServerLocation = lines.ServerLocation, UsuageDateStr = lines.UsuageDateStr }); } List <DistinctServer> distinctServers = new List <DistinctServer>(); foreach (var item in ServerNames) { distinctServers.Add(new DistinctServer() { ServerLocation = item }); } GameMaster gameProbeData = new GameMaster(); gameProbeData.GameDetails = gameDetails; gameProbeData.GameServer = distinctServers; return(Json(new { gameProbeData }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetActiviyDaily() { using (var ctx = new AdventureEntities()) { var get_activity = ctx.prc_combined_vol().GroupBy(p => p.date.Value.ToString("MM/dd/yyyy")). Select(g => new { date = g.Key, f_usage = Math.Round((g.Sum(y => [email protected])), 0), m_usage = Math.Round((g.Sum(x => x.mobile.Value)), 0) }).OrderByDescending(x => x.date).FirstOrDefault(); return(Json(new { get_activity }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetDataMaster() { using (var ctx = new AdventureEntities()) { var combinedtable = (from od in ctx.prc_comb_master() select new { date = od.date.Value.ToString("MM/dd/yyyy"), m_usage = od.mobile.HasValue ? od.mobile.Value : 0, f_usage = [email protected] ? [email protected] : 0 }).ToList(); return(Json(new { combinedtable }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetBubbleJson_application() { int i = 0; using (var ctx = new AdventureEntities()) { var bubble = ctx.prc_mobile_sum_apps_usage().GroupBy(p => p.applicationname). Select(g => new { _ApplicationName = g.Key, _Usage = g.Sum(x => x.usage) }).ToList(); List <bubble> bubble_points = new List <bubble>(); foreach (var header in bubble) { string groups = ""; if (header._Usage >= 2) { groups = "high"; } else if (header._Usage < 1) { groups = "low"; } else { groups = "medium"; } bubble_points.Add(new bubble() { id = i++, ApplicationName = header._ApplicationName, group = groups, OrganizationName = header._ApplicationName, Usage = header._Usage.HasValue ? header._Usage.Value : 0 }); } //string json = JsonConvert.SerializeObject(bubble_points.ToArray()); return(Json(new { bubble_points }, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetDataGrid2() { using (var ctx = new AdventureEntities()) { //var griddata = (from od in ctx.Orders // join cus in ctx.Customers on od.CustomerId equals cus.Id // where cus.Id==85 // orderby od.TotalAmount // select new // { // cus.FirstName, // od.OrderNumber, // od.TotalAmount // }).ToList(); var griddata2 = ctx.order_master.Where(a => a.FirstName == "Paul").OrderBy(a => a.TotalAmount).ToList(); return(Json(new { griddata = griddata2 }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetProbeScatter() { using (var ctx = new AdventureEntities()) { var ScatterData = (from od in ctx.ets_eprobe_avg_server() select new { UsageDate = od.datatime_hour, GameName = od.GameName, Server = od.ServerLocation, RTT = od.Avg_RTT.Value, UsuageDateStr = od.datatime_hour.ToString("dd-MMM-yyyy HH:mm:00") }) .ToList(); return(Json(new { ScatterData }, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetDataCombine_fixed() { using (var ctx = new AdventureEntities()) { var get_pie_master_fixed = (from od in ctx.prc_top5_fixed() select new { apps = od.applicationname, usage = od.usage.HasValue ? od.usage.Value : 0 }).Take(5).ToList(); var get_peeks_fixed = ctx.prc_sum_apps_usage_date1().GroupBy(p => p.date) .Select(g => new { date = g.Key, count = g.Sum(x => x.usage) }) .OrderByDescending(x => x.count).FirstOrDefault(); //ViewBag.peeks = get_peeks_fixed; return(Json(new { get_pie_master_fixed }, JsonRequestBehavior.AllowGet)); } }