Exemplo n.º 1
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")
                });
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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")
         });
     }
 }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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")
                });
            }
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
 public void AddDashBoards(List <Dashboard> dashboards)
 {
     dashboards.ForEach(a => Dashboards.Add(a));
 }