public async Task <IActionResult> Update([FromBody] Dashboards item)
        {
            var notFoundResponse   = new { status = 404, message = "NOT FOUND: Data is not found" };
            var badRequestResponse = new { status = 404, message = "BAD REQUEST: " };
            var successResponse    = new { status = 200, message = "Update data is successfully" };

            try {
                if (item == null)
                {
                    return(Json(badRequestResponse));
                }
                var dashboardObj = await DashboardsRepo.Find(item.SPBUCode);

                if (dashboardObj == null)
                {
                    return(Json(notFoundResponse));
                }
                await DashboardsRepo.Update(item);

                return(Json(successResponse));
            } catch (Exception ex) {
                Debug.WriteLine("Update Data Exception: " + ex.Message);
                throw;
            }
        }
コード例 #2
0
        public async Task <IActionResult> PutDashboards(int id, Dashboards dashboards)
        {
            if (id != dashboards.Id)
            {
                return(BadRequest());
            }

            _context.Entry(dashboards).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DashboardsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public string TerceiroGrafico()
        {
            Dashboards d   = new Dashboards();
            string     txt = JsonConvert.SerializeObject(d.TerceiroGrafico());

            return(txt);
        }
コード例 #4
0
        public void AddPenjualan()
        {
            if (User.CanAccess(MethodBase.GetCurrentMethod()))
            {
                var date    = DateTime.Now;
                var newDate = new DateTime(date.Year, date.Month, 1);
                var newLast = newDate.AddMonths(1).AddDays(-1);

                var data = laporan.GetDataLaporan(newDate, newLast).Result;
                Dashboards.Add(new DashboarTile
                {
                    TitleTile       = "Penjualan Bulan Ini",
                    Nilai           = string.Format("Rp.{0:N2}", data.Sum(O => O.Total)),
                    BackgroundColor = GenerateColorGradient("#7FF90B0B")
                });

                newDate = newDate.AddMonths(-1);
                newLast = newLast.AddMonths(-1);
                var data1 = laporan.GetDataLaporan(newDate, newLast).Result;
                Dashboards.Add(new DashboarTile
                {
                    TitleTile       = "Penjualan Bulan Lalu",
                    Nilai           = string.Format("Rp.{0:N2}", data1.Sum(O => O.Total)),
                    BackgroundColor = GenerateColorGradient("#6AEA38")
                });
            }
        }
コード例 #5
0
        public async Task <ActionResult <Dashboards> > PostDashboards(Dashboards dashboards)
        {
            _context.Dashboards.Add(dashboards);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDashboards", new { id = dashboards.Id }, dashboards));
        }
コード例 #6
0
        private void dashBoardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Dashboards dashboard = new Dashboards();

            this.Hide();
            dashboard.ShowDialog();
            this.Close();
        }
コード例 #7
0
 public void InitDashboardOrders()
 {
     foreach (var dOrder in DefaultDashboards)
     {
         dOrder.Dashboard     = Dashboards.FirstOrDefault(i => i.GUID == dOrder.GUID);
         dOrder.SecurityGroup = this;
     }
     DefaultDashboards.RemoveAll(i => Dashboards == null);
 }
コード例 #8
0
        static Dashboard GetDashboardOrAdd(string key)
        {
            var dashbord = Dashboards.SingleOrDefault(d => d.Text == key);

            if (dashbord == null)
            {
                dashbord = new Dashboard(key);
                Dashboards.Add(dashbord);
            }
            return(dashbord);
        }
コード例 #9
0
ファイル: Workspace.cs プロジェクト: msdevno/PowerBIDotNet
        /// <summary>
        /// Initializes a new instance of <see cref="Workspace"/> for a given <see cref="Token"/> with a given <see cref="ICommunication"/>
        /// </summary>
        /// <param name="token"><see cref="Token">Access token to use</see></param>
        /// <param name="communication"><see cref="ICommunication"/> to use</param>
        public Workspace(Token token, ICommunication communication)
        {
            _communication = communication;

            Groups = new Groups(token, communication);
            Datasets = new Datasets(token, communication);
            Tables = new Tables(token, communication);
            Rows = new Rows(token, communication);
            Dashboards = new Dashboards(token, communication);
            Reports = new Reports(token, communication);
            Tiles = new Tiles(token, communication);
        }
コード例 #10
0
 public PBIDashboard GetDashboardByID(string id)
 {
     try
     {
         return(Dashboards.Single(x => string.Equals(x.Id, id, StringComparison.InvariantCultureIgnoreCase)));
     }
     catch (Exception e)
     {
         //return null;
         throw new KeyNotFoundException(string.Format("No Dashboard with ID '{0}' could be found in PowerBI!", id), e);
     }
 }
コード例 #11
0
 public void AddBorderelCargo()
 {
     if (User.CanAccess(MethodBase.GetCurrentMethod()))
     {
         var data3 = laporan.GetDataBorderelCargo(DateTime.Now).Result;
         Dashboards.Add(new DashboarTile
         {
             TitleTile       = "BORDEREL CARGO HARI INI",
             Nilai           = string.Format("Rp. {0:N2}", data3.Sum(O => (O.TotalWeight * O.Price) + (O.TotalWeight * O.Price * 0.1))),
             BackgroundColor = GenerateColorGradient("#F3A239")
         });
     }
 }
        public async Task Update(Dashboards item)
        {
            var itemToUpdate = await _context.Dashboards.SingleOrDefaultAsync(r => r.SPBUCode == item.SPBUCode);

            if (itemToUpdate != null)
            {
                itemToUpdate.Name            = item.Name;
                itemToUpdate.Value           = item.Value;
                itemToUpdate.LastReadingTime = item.LastReadingTime;
                itemToUpdate.Status          = item.Status;
                //itemToUpdate.UpdatedAt = item.UpdatedAt;
                await _context.SaveChangesAsync();
            }
        }
コード例 #13
0
        public void Build()
        {
            if (report == null || !Dashboards.Any())
            {
                return;
            }

            if (ViewerControl != null && Controls.Contains(ViewerControl))
            {
                Controls.Remove(ViewerControl);
            }

            ViewerControl      = new StiDashboardViewerControl(Report);
            ViewerControl.Dock = DockStyle.Fill;
            Controls.Add(ViewerControl);
            Controls.SetChildIndex(ViewerControl, 0);
        }
        public async Task <IActionResult> Create([FromBody] Dashboards item)
        {
            var badRequestResponse = new { status = 404, message = "BAD REQUEST: " };
            var successResponse    = new { status = 200, message = "Insert data is successfully" };

            try {
                if (item == null)
                {
                    return(Json(badRequestResponse));
                }
                await DashboardsRepo.Add(item);

                return(Json(successResponse));
            } catch (Exception ex) {
                Debug.WriteLine("Insert Data Exception: " + ex.Message);
                throw;
            }
        }
コード例 #15
0
        internal async void LoadDashboard()
        {
            Dashboards.Clear();
            var data2 = await laporan.GetDataBufferStock();

            var dataBuffer = data2.Sum(O => O.TotalWeight);

            Dashboards.Add(new DashboarTile
            {
                TitleTile       = "BUFFER STOK",
                Nilai           = string.Format("{0:N2} Ton", (dataBuffer * 0.001)),
                BackgroundColor = GenerateColorGradient("#EA38D8")
            });

            ScheduleBussines schedule = new ScheduleBussines();
            var schedules             = await schedule.GetSchedules(DateTime.Now);

            var data5 = schedules.Where(O => O.Start >= DateTime.Now.TimeOfDay).FirstOrDefault();

            if (data5 != null)
            {
                Dashboards.Add(new DashboarTile
                {
                    TitleTile       = "NEXT SCHEDULE",
                    Nilai           = string.Format("{0} - {1}", data5.FlightNumber, data5.Start.ToString()),
                    BackgroundColor = GenerateColorGradient("#D4F339")
                });
            }
            else
            {
                Dashboards.Add(new DashboarTile
                {
                    TitleTile       = "NEXT SCHEDULE",
                    Nilai           = "",
                    BackgroundColor = GenerateColorGradient("#D4F339")
                });
            }


            AddPenjualan();
            AddSisaSaldo();

            AddBorderelCargo();
        }
コード例 #16
0
 public bool Any()
 {
     return(HubVariables.Any() ||
            Datajobs.Any() ||
            Datalinks.Any() ||
            Connections.Any() ||
            Tables.Any() ||
            ColumnValidations.Any() ||
            CustomFunctions.Any() ||
            FileFormats.Any() ||
            RemoteAgentHubs.Any() ||
            DatalinkTests.Any() ||
            Views.Any() ||
            Apis.Any() ||
            Dashboards.Any() ||
            ListOfValues.Any() ||
            Tags.Any() ||
            TagObjects.Any());
 }
コード例 #17
0
        public IActionResult SingleDashboard()
        {
            var dashboards = new Dashboards();
            var dashboard  = new Dashboard()
            {
                Name = "Financial KPIs"
            };

            dashboard.GetDummyData(2);
            dashboards.List.Add(dashboard);

            ViewBag.KPICount = dashboards.List.Count;


            ViewBag.Dashboards = dashboards.ToJson();
            Debug.WriteLine(dashboards.ToJson());

            return(View());
        }
コード例 #18
0
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            if (Dashboards.Count == 0 && TargetIdiom.Tablet != Device.Idiom)
            {
                Dashboards.Add(new Dashboard());
                Dashboards.Add(new Dashboard()
                {
                    Stock        = "0",
                    Empty        = "0",
                    InUse        = "0",
                    Total        = "0",
                    AverageCycle = "0 day",
                    Atriskegs    = "0"
                });
            }
            CheckDraftmaniFests();
            await LoadMetadData();

            base.OnNavigatedTo(parameters);
        }
コード例 #19
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Datasets              = new Datasets(this);
     Imports               = new Imports(this);
     Reports               = new Reports(this);
     Dashboards            = new Dashboards(this);
     Tiles                 = new Tiles(this);
     Apps                  = new Apps(this);
     Dataflows             = new Dataflows(this);
     Gateways              = new Gateways(this);
     Groups                = new Groups(this);
     Capacities            = new Capacities(this);
     AvailableFeatures     = new AvailableFeatures(this);
     BaseUri               = new System.Uri("https://api.powerbi.com");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
コード例 #20
0
        public IActionResult Index()
        {
            var dashboards = new Dashboards();
            var dashboard  = new Dashboard()
            {
                Name = "Financial KPIs"
            };

            dashboard.GetDummyData(2);
            dashboards.List.Add(dashboard);

            dashboard = new Dashboard()
            {
                Name = "Product KPIs"
            };
            dashboard.GetDummyData(3);
            dashboards.List.Add(dashboard);

            dashboard = new Dashboard()
            {
                Name = "Something 1 KPIs"
            };
            dashboard.GetDummyData(4);
            dashboards.List.Add(dashboard);

            dashboard = new Dashboard()
            {
                Name = "Something 2 KPIs",
            };
            dashboard.GetDummyData(5);
            dashboards.List.Add(dashboard);

            ViewBag.KPICount = dashboards.List.Count;


            ViewBag.Dashboards = dashboards.ToJson();
            Debug.WriteLine(dashboards.ToJson());

            return(View());
        }
コード例 #21
0
        public void AddSisaSaldo()
        {
            if (User.CanAccess(MethodBase.GetCurrentMethod()))
            {
                CustomerBussiness custs = new CustomerBussiness();
                var result = custs.GetCustomersDeposites();

                double saldo = 0;

                foreach (var item in result)
                {
                    saldo += custs.GetSisaSaldo(item.Id).Result;
                }


                Dashboards.Add(new DashboarTile
                {
                    TitleTile       = "Sisa Saldo Deposite Customer",
                    Nilai           = string.Format("Rp.{0:N2}", saldo),
                    BackgroundColor = GenerateColorGradient("#BF018A")
                });
            }
        }
コード例 #22
0
        public async void RefreshDashboardRecieverAsync(bool refresh = false)
        {
            if (refresh)
            {
                await NavigationService.ClearPopupStackAsync(animated : false);
            }
            var result = await ApiManager.GetDeshboardDetail(Settings.SessionId);

            if (result.IsSuccessStatusCode)
            {
                var response = await result.Content.ReadAsStringAsync();

                var model = await Task.Run(() => JsonConvert.DeserializeObject <DashboardResponseModel>(response, GetJsonSetting()));

                var total = model.Stock + model.Empty + model.InUse;

                if (TargetIdiom.Tablet == Device.Idiom)
                {
                    Stock        = model.Stock.ToString("0,0", CultureInfo.InvariantCulture);
                    Empty        = model.Empty.ToString("0,0", CultureInfo.InvariantCulture);
                    InUse        = model.InUse.ToString("0,0", CultureInfo.InvariantCulture);
                    Total        = total.ToString("0,0", CultureInfo.InvariantCulture);
                    AverageCycle = model.AverageCycle.ToString() + " days";
                    Atriskegs    = model.InactiveKegs.ToString();
                }
                else
                {
                    Dashboards.LastOrDefault().Stock        = model.Stock.ToString("0,0", CultureInfo.InvariantCulture);
                    Dashboards.LastOrDefault().Empty        = model.Empty.ToString("0,0", CultureInfo.InvariantCulture);
                    Dashboards.LastOrDefault().InUse        = model.InUse.ToString("0,0", CultureInfo.InvariantCulture);
                    Dashboards.LastOrDefault().Total        = total.ToString("0,0", CultureInfo.InvariantCulture);
                    Dashboards.LastOrDefault().AverageCycle = model.AverageCycle.ToString() + " days";
                    Dashboards.LastOrDefault().Atriskegs    = model.InactiveKegs.ToString();
                }
            }
        }
コード例 #23
0
 public Dashboard GetCurrentDashboard(string dashboardId)
 {
     return(Dashboards.Where(d => d.Id == dashboardId).FirstOrDefault());
 }
        public async Task Add(Dashboards item)
        {
            await _context.Dashboards.AddAsync(item);

            await _context.SaveChangesAsync();
        }
コード例 #25
0
        /// <summary>
        /// Adds one of the properties to the relevant area.
        /// </summary>
        /// <param name="property"></param>
        /// <param name="operation"></param>
        public bool Add(object property, EImportAction operation)
        {
            try
            {
                switch (property)
                {
                case DexihHubVariable a:
                    HubVariables.Add(a, operation);
                    break;

                case DexihDatajob a:
                    Datajobs.Add(a, operation);
                    break;

                case DexihDatalink a:
                    Datalinks.Add(a, operation);
                    break;

                case DexihConnection a:
                    Connections.Add(a, operation);
                    break;

                case DexihTable a:
                    Tables.Add(a, operation);
                    break;

                case DexihColumnValidation a:
                    ColumnValidations.Add(a, operation);
                    break;

                case DexihCustomFunction a:
                    CustomFunctions.Add(a, operation);
                    break;

                case DexihFileFormat a:
                    FileFormats.Add(a, operation);
                    break;

                case DexihRemoteAgentHub a:
                    RemoteAgentHubs.Add(a, operation);
                    break;

                case DexihDatalinkTest a:
                    DatalinkTests.Add(a, operation);
                    break;

                case DexihView a:
                    Views.Add(a, operation);
                    break;

                case DexihApi a:
                    Apis.Add(a, operation);
                    break;

                case DexihDashboard a:
                    Dashboards.Add(a, operation);
                    break;

                case DexihListOfValues a:
                    ListOfValues.Add(a, operation);
                    break;

                case DexihTag a:
                    Tags.Add(a, operation);
                    break;

                case DexihTagObject a:
                    TagObjects.Add(a, operation);
                    break;

                default:
                    return(false);
                }

                return(true);
            } catch (Exception ex)
            {
                throw new AggregateException($"Failed to add item.  {ex.Message}", ex);
            }
        }
コード例 #26
0
 public void AddDashBoards(List <Dashboard> dashboards)
 {
     dashboards.ForEach(a => Dashboards.Add(a));
 }
コード例 #27
0
        void loadDashboard(string path, string folderPath, string folderName, bool editable, bool isPersonal)
        {
            try
            {
                var dashboard = Dashboards.FirstOrDefault(i => i.Path == path);
                if (dashboard == null || dashboard.LastModification != File.GetLastWriteTime(path))
                {
                    if (dashboard != null)
                    {
                        Dashboards.Remove(dashboard);
                    }
                    dashboard = Dashboard.LoadFromFile(path);
                    Dashboards.Add(dashboard);
                }
                dashboard.IsPersonal = isPersonal;
                dashboard.Editable   = editable;
                dashboard.Folder     = folderPath;

                dashboard.DisplayName = Security.Repository.TranslateDashboardName(path.Replace(Security.Repository.DashboardPublicFolder, ""), dashboard.Name);
                var repositoryPath = path.Replace(Security.Repository.DashboardPublicFolder, "");

                if (dashboard.IsPersonal)
                {
                    dashboard.FullName = string.Format("{0} ({1})", dashboard.DisplayName, Security.Repository.TranslateWeb("Personal"));
                }
                else if (!string.IsNullOrEmpty(folderName))
                {
                    dashboard.FullName = string.Format("{0} ({1})", dashboard.DisplayName, Security.Repository.TranslateDashboardFolder(Path.GetDirectoryName(repositoryPath), folderName));
                }
                else
                {
                    dashboard.FullName = dashboard.DisplayName;
                }
                dashboard.ReinitGroupOrders();
                //Init items and translate labels
                foreach (var item in dashboard.Items)
                {
                    var widget = DashboardWidgetsPool.Widgets.ContainsKey(item.WidgetGUID) ? DashboardWidgetsPool.Widgets[item.WidgetGUID] : null;
                    if (widget == null)
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(item.Name) && item.Name != widget.Name)
                    {
                        item.DisplayName = Security.Repository.TranslateDashboardItemName(repositoryPath, item.Name);
                    }
                    else
                    {
                        var instance = widget.ReportPath.Replace(Security.Repository.ReportsFolder, Path.DirectorySeparatorChar.ToString());
                        item.DisplayName = Security.Repository.TranslateWidgetName(instance, widget.Name);
                    }
                    item.SetWidget(widget);

                    if (!string.IsNullOrEmpty(item.GroupName))
                    {
                        item.DisplayGroupName = Security.Repository.TranslateDashboardItemGroupName(repositoryPath, item.GroupName);
                    }
                }
                //Remove lost widgets...
                dashboard.Items.RemoveAll(i => i.Widget == null);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #28
0
        private void PublishComponents()
        {
            ExecuteAction("", "Publish", delegate
            {
                WriteProgress(new ProgressRecord(1, "Publishing Components", "Initializing components to publish...")
                {
                    RecordType = ProgressRecordType.Processing
                });
                List <PublishComponentInfo> solutioncomponents = new List <PublishComponentInfo>();
                if (Entities != null && Entities.Length > 0)
                {
                    solutioncomponents.AddRange(Entities.Select(e => new PublishComponentInfo()
                    {
                        ComponentType = 1,
                        LogicalName   = e
                    }));
                }

                if (Optionsets != null && Optionsets.Length > 0)
                {
                    solutioncomponents.AddRange(Optionsets.Select(e => new PublishComponentInfo()
                    {
                        ComponentType = 9,
                        LogicalName   = e
                    }));
                }

                if (Dashboards != null && Dashboards.Length > 0)
                {
                    solutioncomponents.AddRange(Dashboards.Select(e => new PublishComponentInfo()
                    {
                        ComponentType = 60,
                        ObjectId      = e
                    }));
                }

                if (Webresources != null && Webresources.Length > 0)
                {
                    solutioncomponents.AddRange(Webresources.Select(e => new PublishComponentInfo()
                    {
                        ComponentType = 61,
                        ObjectId      = e
                    }));
                }

                string publishXml = ConstructPublishXml(solutioncomponents, PublishRibbon.ToBool(), PublishSiteMap.ToBool());

                base.WriteVerboseWithTimestamp(publishXml);
                WriteProgress(new ProgressRecord(1, "Publishing Components", "Publishing selected components...")
                {
                    RecordType = ProgressRecordType.Processing
                });

                OrganizationRequest request = new OrganizationRequest("PublishXml")
                {
                    Parameters = new ParameterCollection()
                };
                request.Parameters.Add("ParameterXml", publishXml);

                OrganizationResponse response = _repository.Execute(request);
            });
        }
コード例 #29
0
        public JsonResult SegundoGrafico()
        {
            Dashboards d = new Dashboards();

            return(Json(d.SegundoGrafico(), JsonRequestBehavior.AllowGet));
        }