Esempio n. 1
0
        private void CommandBinding_MoveDownWidget(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            DashboardWidgets swid = (DashboardWidgets)int.Parse(obj.ToString());

            UserSettingsVM.Instance.MoveDownDashboardWidget(swid);
            SetWidgetOrder();
        }
Esempio n. 2
0
        public int addDashboardWidget(Add dashboardWidget)
        {
            DBHelper._DashboardWidget dbhelp = new DBHelper._DashboardWidget();
            var newDashboardWidget           = new DashboardWidgets()
            {
                DashboardID     = dashboardWidget.DashboardId,
                WidgetCatalogID = dashboardWidget.WidgetCatalogId,
                RowNo           = dashboardWidget.RowNo,
                ColumnSeq       = dashboardWidget.ColumnSeq,
                WidthSpace      = dashboardWidget.WidthSpace,
                HeightPixel     = dashboardWidget.HeightPixel
            };

            return(dbhelp.Add(newDashboardWidget));
        }
Esempio n. 3
0
        public int MoveUpDashboardWidget(DashboardWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.DashboardWidgetsOrder.Split(';');

            string moveWidget = ((int)swid).ToString();

            // find the position of the language to be moved
            int pos = -1;

            for (int i = 0; i < widgets.Length; i++)
            {
                if (widgets[i].Trim().ToUpper() == moveWidget.Trim().ToUpper())
                {
                    pos = i;
                }
            }

            if (pos == -1)
            {
                return(-1);           // not found
            }
            if (pos == 0)
            {
                return(-1);          // already at top
            }
            string wid1 = widgets[pos - 1];

            widgets[pos - 1] = moveWidget;
            widgets[pos]     = wid1;

            string newWidgetOrder = string.Empty;

            foreach (string wid in widgets)
            {
                if (!string.IsNullOrEmpty(newWidgetOrder))
                {
                    newWidgetOrder += ";";
                }

                newWidgetOrder += wid;
            }

            AppSettings.DashboardWidgetsOrder = newWidgetOrder;

            return(pos - 1);
        }
Esempio n. 4
0
        public Detail getDashboardWidgetById(int id)
        {
            DBHelper._DashboardWidget dbhelp          = new DBHelper._DashboardWidget();
            DashboardWidgets          dashboardWidget = dbhelp.GetByid(id);

            return(new Detail()
            {
                Id = dashboardWidget.Id,
                DashboardId = dashboardWidget.DashboardID,
                WidgetCatalogId = dashboardWidget.WidgetCatalogID,
                WidgetCatalogName = (dashboardWidget.WidgetCatalog == null ? "" : dashboardWidget.WidgetCatalog.Name),
                RowNo = dashboardWidget.RowNo,
                ColumnSeq = dashboardWidget.ColumnSeq,
                WidthSpace = dashboardWidget.WidthSpace,
                HeightPixel = dashboardWidget.HeightPixel
            });
        }
Esempio n. 5
0
        public int GetDashboardWidgetPosition(DashboardWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.DashboardWidgetsOrder.Split(';');

            int i = 1;

            foreach (string widget in widgets)
            {
                DashboardWidgets thisswid = (DashboardWidgets)int.Parse(widget);

                if (thisswid == swid)
                {
                    return(i);
                }
                else
                {
                    i++;
                }
            }

            return(1);
        }
Esempio n. 6
0
        public void updateDashboardWidget(Update dashboardWidget)
        {
            if (dashboardWidget != null && dashboardWidget.Widget != null)
            {
                DBHelper._DashboardWidget dbhelp = new DBHelper._DashboardWidget();
                List <DashboardWidgets>   dashboardWidgetList = new List <DashboardWidgets>();

                foreach (var widget in dashboardWidget.Widget)
                {
                    DashboardWidgets existingWidget = new DashboardWidgets();
                    existingWidget.Id              = widget.Id;
                    existingWidget.DashboardID     = dashboardWidget.DashboardId;
                    existingWidget.WidgetCatalogID = widget.WidgetCatalogId;
                    existingWidget.RowNo           = widget.RowNo;
                    existingWidget.ColumnSeq       = widget.ColumnSeq;
                    existingWidget.WidthSpace      = widget.WidthSpace;
                    existingWidget.HeightPixel     = widget.HeightPixel;
                    dashboardWidgetList.Add(existingWidget);
                }

                dbhelp.Update(dashboardWidgetList);
            }
        }
Esempio n. 7
0
        public int MoveUpDashboardWidget(DashboardWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.DashboardWidgetsOrder.Split(';');

            string moveWidget = ((int)swid).ToString();

            // find the position of the language to be moved
            int pos = -1;
            for (int i = 0; i < widgets.Length; i++)
            {
                if (widgets[i].Trim().ToUpper() == moveWidget.Trim().ToUpper()) pos = i;
            }

            if (pos == -1) return -1; // not found
            if (pos == 0) return -1; // already at top

            string wid1 = widgets[pos - 1];
            widgets[pos - 1] = moveWidget;
            widgets[pos] = wid1;

            string newWidgetOrder = string.Empty;
            foreach (string wid in widgets)
            {

                if (!string.IsNullOrEmpty(newWidgetOrder))
                    newWidgetOrder += ";";

                newWidgetOrder += wid;
            }

            AppSettings.DashboardWidgetsOrder = newWidgetOrder;

            return pos - 1;
        }
Esempio n. 8
0
        public int GetDashboardWidgetPosition(DashboardWidgets swid)
        {
            // read the series widgets order
            string[] widgets = AppSettings.DashboardWidgetsOrder.Split(';');

            int i = 1;
            foreach (string widget in widgets)
            {
                DashboardWidgets thisswid = (DashboardWidgets)int.Parse(widget);

                if (thisswid == swid)
                    return i;
                else
                    i++;
            }

            return 1;
        }