예제 #1
0
        public void UpdateDashItem(DashboardItem itemToUpdate)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("dbo.UpdateDashItem", _conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@DashboardItemID", SqlDbType.Int).Value       = itemToUpdate.DashboardItemID;
                cmd.Parameters.Add("@DashboardTypeID", SqlDbType.Int).Value       = itemToUpdate.DashboardTypeID;
                cmd.Parameters.Add("@DashboardItemStatusID", SqlDbType.Int).Value = itemToUpdate.DashboardItemStatusID;
                cmd.Parameters.Add("@DashboardID", SqlDbType.Int).Value           = itemToUpdate.DashboardID;
                cmd.Parameters.Add("@Title", SqlDbType.VarChar).Value             = itemToUpdate.Title;
                cmd.Parameters.Add("@StartDateTime", SqlDbType.DateTime).Value    = itemToUpdate.StartDateTime;
                cmd.Parameters.Add("@EndDateTime", SqlDbType.DateTime).Value      = itemToUpdate.EndDateTime;
                cmd.Parameters.Add("@SortOrder", SqlDbType.Int).Value             = itemToUpdate.SortOrder;

                cmd.Parameters.Add("@SourceURL", SqlDbType.VarChar).Value    = itemToUpdate.SourceURL ?? "";
                cmd.Parameters.Add("@LogonUser", SqlDbType.VarChar).Value    = itemToUpdate.LogonUser ?? "";
                cmd.Parameters.Add("@LogonPwd", SqlDbType.VarChar).Value     = itemToUpdate.LogonPwd ?? "";
                cmd.Parameters.Add("@ClickThruUrl", SqlDbType.VarChar).Value = itemToUpdate.ClickThruURL ?? "";
                cmd.Parameters.Add("@CssSelector", SqlDbType.VarChar).Value  = itemToUpdate.CssSelector ?? "";
                cmd.Parameters.Add("@ImageURI", SqlDbType.VarChar).Value     = itemToUpdate.ImageURI ?? "";

                cmd.Parameters.Add("@DisplayText", SqlDbType.VarChar).Value = itemToUpdate.DisplayText ?? "";


                _conn.Open();
                cmd.ExecuteNonQuery();
                _conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Data);
            }
        }
예제 #2
0
        private void SetSign()
        {
            this.chkSignEnable.Checked = true;
            SignName    = _sign.Name;
            SignItem    = _sign.Sign;
            LiveMessage = _sign.Message;
            chkButtonGraphic.Checked = _sign.ButtonGraphic;

            for (int queueCtlIndex = 0; queueCtlIndex < _sign.QueueControl.Length; queueCtlIndex++)
            {
                for (int i = 0; i < chkQueueControl.Items.Count; i++)
                {
                    if (_sign.QueueControl[queueCtlIndex].ToString() == chkQueueControl.Items[i].Value.ToString())
                    {
                        chkQueueControl.Items[i].CheckState = CheckState.Checked;
                        break;
                    }
                }
            }

            for (int i = 0; i < rdoMediaControl.Properties.Items.Count; i++)
            {
                if (rdoMediaControl.Properties.Items[i].Value.ToString() == _sign.MediaControl.ToString())
                {
                    rdoMediaControl.SelectedIndex = i;
                    break;
                }
            }

            SetLogicDisplayState();
        }
예제 #3
0
        private async Task handleHttpAsync(DashboardItem item)
        {
            var parameters = item.parameter.Split("|");

            try
            {
                WebRequest  request  = WebRequest.Create(parameters[0]);
                WebResponse response = await request.GetResponseAsync();

                item.value = await new StreamReader(response.GetResponseStream()).ReadToEndAsync();
                if (item.value.Contains(parameters[1]))
                {
                    item.value = "ok";
                }
                else
                {
                    item.value = "error";
                }
            }
            catch (WebException e)
            {
                if (parameters[1] == "auth" && e.Message.Contains("401"))
                {
                    item.value = "ok";
                }
                else
                {
                    item.value = "error";
                }
            }
        }
예제 #4
0
        public DashboardItem AddDashboardItem(DashboardItem item)
        {
            DashboardItem dbi = context.Dashboarditems.Add(item);

            context.SaveChanges();
            return(dbi);
        }
        private List <DashboardItem> GetLast7RegisteredOrgs()
        {
            var result = new List <DashboardItem>();
            // Get last 7 registered organisations
            var last7Orgs = _organisations.All().OrderByDescending(i => i.CreatedAt).AsEnumerable();

            if (last7Orgs.Count() > 7)
            {
                last7Orgs = last7Orgs.Take(7);
            }

            // Setup result model
            foreach (var org in last7Orgs)
            {
                var item = new DashboardItem
                {
                    Name = org.Name,
                    Date = org.CreatedAt
                };

                result.Add(item);
            }

            // Return result
            return(result);
        }
예제 #6
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            DashboardItem vh = holder as DashboardItem;

            // Load the photo image resource from the photo album:
            if (itemList[position].imageUrl != null && itemList[position].imageUrl != "")
            {
                Picasso.With(vh.Image.Context).Load(itemList[position].imageUrl).Into(vh.Image);
            }
            else
            {
                try
                {
#pragma warning disable CS0618 // Type or member is obsolete
                    vh.Image.SetBackgroundColor(vh.Image.Context.Resources.GetColor(Resource.Color.my_blue));
#pragma warning restore CS0618 // Type or member is obsolete
                }
                catch { }
            }

            if (itemList[position].isFav)
            {
                vh.favImage.SetImageResource(Resource.Drawable.heart_on);
            }
            else
            {
                vh.favImage.SetImageResource(Resource.Drawable.heart_off);
            }

            // Load the photo caption from the photo album:
            vh.Caption.Text = itemList[position].name;
        }
예제 #7
0
        public IHttpActionResult PutDashboardItem(int id, DashboardItem dashboardItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dashboardItem.itemId)
            {
                return(BadRequest());
            }

            db.Entry(dashboardItem).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DashboardItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IActionResult> PutDashboardItem([FromRoute] int?id, [FromBody] DashboardItem dashboardItem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dashboardItem.Id)
            {
                return(BadRequest());
            }

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

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

            return(Ok(dashboardItem));
        }
예제 #9
0
        private async Task <bool> ProcessSingleDashboardRequest(FeedOperationDetails fod)
        {
            BackendResult <WallData, ResultCode> wall = await WallService.Current.GetWall(RemoteIdHelper.GetItemIdByRemoteId(fod.OwnerRemoteId), 0, 1, "owner");

            if (wall.ResultCode == ResultCode.Succeeded && wall.ResultData.wall.Count > 0)
            {
                WallPost wallPost = wall.ResultData.wall[0];
                FeedItem feedItem = this.CreateFeedItem(wallPost, wall.ResultData.groups, wall.ResultData.profiles, false);
                if (feedItem != null)
                {
                    DashboardItem dashboardItem = await SocialManager.OpenContactDashboardAsync(fod);

                    dashboardItem.DefaultTarget = feedItem.DefaultTarget;
                    dashboardItem.Timestamp     = new DateTimeOffset(ExtensionsBase.UnixTimeStampToDateTime((double)wallPost.date, true));
                    if (!string.IsNullOrEmpty(feedItem.PrimaryContent.Title) || !string.IsNullOrEmpty(feedItem.PrimaryContent.Message))
                    {
                        dashboardItem.Content.Title   = feedItem.PrimaryContent.Title;
                        dashboardItem.Content.Message = feedItem.PrimaryContent.Message;
                    }
                    else
                    {
                        dashboardItem.Content.Title   = feedItem.SecondaryContent.Title;
                        dashboardItem.Content.Message = feedItem.SecondaryContent.Message;
                    }
                    dashboardItem.Content.Target = feedItem.PrimaryContent.Target;
                    await dashboardItem.SaveAsync();

                    return(true);
                }
                wallPost = null;
                feedItem = null;
            }
            return(false);
        }
예제 #10
0
        public string AddDashboardItems(DashboardItem dashItem, ModelStateDictionary ModelState)
        {
            Exception accessorError = null;

            if (ModelState.IsValid)
            {
                if (dashItem.DashboardItemID == 0) // creating new item
                {
                    accessorError = accessor.InsertDashItem(dashItem);
                }
                else // editing pre-existing item
                {
                    accessorError = accessor.UpdateDashItem(dashItem);
                }

                if (accessorError == null)
                {
                    return("/DashManager");
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "DB Error: " + accessorError.Message);
                }
            }
            return(JsonConvert.SerializeObject(ToolEngine.GetErrorMessages(ModelState)));
        }
        public DashboardItem GetDashItem(string id)
        {
            SqlDataReader reader;
            DashboardItem result = new DashboardItem();


            SqlCommand cmd = new SqlCommand("dbo.GetDashItem", _conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@DashboardItemID", SqlDbType.Int).Value = id;

            _conn.Open();
            reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                try
                {
                    result = new DashboardItem().Create(reader);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Data);
                }
            }
            _conn.Close();
            return(result);
        }
예제 #12
0
        protected override void Delete()
        {
            if (dashboardTree1.FocusedNode == null ||
                dashboardTree1.FocusedNode.Tag == null)
            {
                return;
            }
            DashboardItem item    = (dashboardTree1.FocusedNode.Tag) as DashboardItem;
            string        confirm = "";

            if (item.DashboardType == DashboardType.Sign)
            {
                confirm = Resources.Resource.GetString(Resources.Resource.Strings.ConfirmDeleteSign);
            }
            else
            {
                confirm = Resources.Resource.GetString(Resources.Resource.Strings.ConfirmDeleteGroup);
            }
            if (MsgBox.Confirm(confirm) == DialogResult.No)
            {
                return;
            }
            //if (MsgBox.Confirm(Resources.Resource.GetString(Resources.Resource.Strings.ConfirmDeleteItem)) != DialogResult.Yes)
            //    return;
            dashboardTree1.Delete();
        }
        public Exception InsertDashItem(DashboardItem newItem)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("dbo.InsertDashItem", _conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@DashboardID", SqlDbType.Int).Value           = newItem.DashboardID;
                cmd.Parameters.Add("@Title", SqlDbType.VarChar).Value             = newItem.Title;
                cmd.Parameters.Add("@StartDateTime", SqlDbType.DateTime).Value    = newItem.StartDateTime;
                cmd.Parameters.Add("@EndDateTime", SqlDbType.DateTime).Value      = newItem.EndDateTime;
                cmd.Parameters.Add("@SortOrder", SqlDbType.Int).Value             = newItem.SortOrder;
                cmd.Parameters.Add("@DashboardTypeID", SqlDbType.Int).Value       = newItem.DashboardTypeID;
                cmd.Parameters.Add("@DashboardItemStatusID", SqlDbType.Int).Value = newItem.DashboardItemStatusID;

                cmd.Parameters.Add("@ImageURI", SqlDbType.VarChar).Value     = newItem.ImageURI ?? "";
                cmd.Parameters.Add("@SourceURL", SqlDbType.VarChar).Value    = newItem.SourceURL ?? "";
                cmd.Parameters.Add("@LogonUser", SqlDbType.VarChar).Value    = newItem.LogonUser ?? "";
                cmd.Parameters.Add("@LogonPwd", SqlDbType.VarChar).Value     = newItem.LogonPwd ?? "";
                cmd.Parameters.Add("@ClickThruUrl", SqlDbType.VarChar).Value = newItem.ClickThruURL ?? "";
                cmd.Parameters.Add("@CssSelector", SqlDbType.VarChar).Value  = newItem.CssSelector ?? "";

                cmd.Parameters.Add("@DisplayText", SqlDbType.VarChar).Value = newItem.DisplayText ?? "";

                _conn.Open();
                cmd.ExecuteNonQuery();
                _conn.Close();
                return(null);
            }
            catch (Exception e)
            {
                _conn.Close();
                return(e);
            }
        }
        public async Task <IActionResult> EditDashboardItem(string DashboardItemId)
        {
            if (DashboardItemId == null)
            {
            }

            TempData["EditID"] = DashboardItemId;
            DbAccessor    accessor = new DbAccessor();
            DashboardItem item     = accessor.GetDashItem(DashboardItemId);


            switch (item.DashboardTypeID)
            {
            case 1:     //Url Scrapping
                return(RedirectToAction("ImageHtmlScrapping"));

            case 2:     //Image Upload
                return(RedirectToAction("ImageUpload"));

            case 3:     // Text/HTML based
                return(RedirectToAction("TextOnly"));

            default:
                break;
            }

            return(Redirect("/AdminTools/DashManager"));
        }
        public async Task DashboardItem_Create_DoesCreate()
        {
            // Arrange
            var dashboardItem = await DashboardHelpers.CreateDashboardItem(DbContext);

            // Assert
            DashboardItem               dbDashboardItem        = DbContext.DashboardItems.AsNoTracking().First();
            List <DashboardItem>        dashboardItems         = DbContext.DashboardItems.AsNoTracking().ToList();
            DashboardItemVersion        dbDashboardItemVersion = DbContext.DashboardItemVersions.AsNoTracking().First();
            List <DashboardItemVersion> dashboardItemVersions  = DbContext.DashboardItemVersions.AsNoTracking().ToList();

            Assert.NotNull(dbDashboardItem);
            Assert.NotNull(dbDashboardItemVersion);
            Assert.AreEqual(1, dashboardItems.Count);
            Assert.AreEqual(1, dashboardItemVersions.Count);

            Assert.AreEqual(dashboardItem.Id, dbDashboardItem.Id);
            Assert.AreEqual(1, dbDashboardItem.Version);
            Assert.AreEqual(dashboardItem.WorkflowState, dbDashboardItem.WorkflowState);
            Assert.AreEqual(dashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture),
                            dbDashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture));
            Assert.AreEqual(dashboardItem.CreatedByUserId, dbDashboardItem.CreatedByUserId);
            Assert.AreEqual(dashboardItem.UpdatedAt.ToString(), dbDashboardItem.UpdatedAt.ToString());
            Assert.AreEqual(dashboardItem.UpdatedByUserId, dbDashboardItem.UpdatedByUserId);
            Assert.AreEqual(dashboardItem.Position, dbDashboardItem.Position);
            Assert.AreEqual(dashboardItem.CalculateAverage, dbDashboardItem.CalculateAverage);
            Assert.AreEqual(dashboardItem.ChartType, dbDashboardItem.ChartType);
            Assert.AreEqual(dashboardItem.CompareEnabled, dbDashboardItem.CompareEnabled);
            Assert.AreEqual(dashboardItem.FilterAnswerId, dbDashboardItem.FilterAnswerId);
            Assert.AreEqual(dashboardItem.FilterQuestionId, dbDashboardItem.FilterQuestionId);
            Assert.AreEqual(dashboardItem.Period, dbDashboardItem.Period);
        }
예제 #16
0
        private void btnUpdateLayout_Click(object sender, EventArgs e)
        {
            Dashboard dashboard = new Dashboard();

            dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
            DashboardItem grid  = (GridDashboardItem)dashboard.Items[0];
            DashboardItem chart = (ChartDashboardItem)dashboard.Items[1];
            DashboardItem range = (RangeFilterDashboardItem)dashboard.Items[2];

            // Creates layout items used to display dashboard items.
            DashboardLayoutItem gridItem  = new DashboardLayoutItem(grid, 35);
            DashboardLayoutItem chartItem = new DashboardLayoutItem(chart, 65);
            DashboardLayoutItem rangeItem = new DashboardLayoutItem(range, 20);

            // Creates a layout group that contains two layout items.
            DashboardLayoutGroup group1 =
                new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Horizontal, 80,
                                         gridItem, chartItem);
            // Creates a root layout group that contains the previously created group and
            // the layout item displaying the Range Filter dashboard item.
            DashboardLayoutGroup rootGroup =
                new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Vertical, 1,
                                         group1, rangeItem);

            // Specifies the root dashboard layout group.
            dashboard.LayoutRoot = rootGroup;

            dashboardViewer1.Dashboard = dashboard;
        }
        private List <DashboardItem> GetLast7PublishedSchemas()
        {
            var result = new List <DashboardItem>();

            // Get last 7 published schemas
            var last7Schemas = _dataSchemas.Where(i => i.Status == (int)TemplateStatus.Active).OrderByDescending(i => i.PublishedAt).AsEnumerable();

            if (last7Schemas.Count() > 7)
            {
                last7Schemas = last7Schemas.Take(7);
            }

            // Setup result model
            foreach (var org in last7Schemas)
            {
                var item = new DashboardItem
                {
                    Name = org.Name,
                    Date = org.CreatedAt
                };

                result.Add(item);
            }

            // Return result
            return(result);
        }
예제 #18
0
        public async Task <ActionResult <DashboardItem> > PostDashboardItem(DashboardItem dashboardItem)
        {
            _context.DashboardItems.Add(dashboardItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDashboardItem", new { id = dashboardItem.Id }, dashboardItem));
        }
예제 #19
0
        public async Task <IActionResult> PutDashboardItem(int id, DashboardItem dashboardItem)
        {
            if (id != dashboardItem.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #20
0
        public void UpdateDashboardItem(DashboardItem dBI)
        {
            DashboardItem item = context.Dashboarditems.Where(i => i.Id == dBI.Id).First();

            context.Dashboarditems.Remove(item);
            context.Dashboarditems.Add(dBI);
            context.SaveChanges();
        }
예제 #21
0
        public ActionResult RemoveDashboardItem(DashboardItem dbi)
        {
            dbmanager.RemoveDashboardItem(dbi);
            List <DashboardItem> dbitems = dbmanager.GetAllDashboardItems();

            ViewBag.persons = subjectManager.GetPersonen().Select(p => p.Full_Name);
            return(View(dbitems));
        }
예제 #22
0
        public void Remove(DashboardItem item)
        {
            DashboardItem i = context.Dashboarditems.Include("Graph").Where(dbi => dbi.Id == item.Id).First();

            context.Graphs.Remove(i.Graph);
            context.Dashboarditems.Remove(i);
            context.SaveChanges();
        }
        public bool EditDataItemLength(DashboardItem dashboardItem)
        {
            StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext();

            dbmlObject.EditDataItemLength(dashboardItem.StartDate, dashboardItem.EndDate, dashboardItem.DashboardID, dashboardItem.ItemID);
            dbmlObject.SubmitChanges();
            return(true);
        }
예제 #24
0
        public ActionResult Index()
        {
            if (ViewData["uiv"] == null)
            {
                ViewBag.TotalCountApproved = TotalCountApproved();
                ViewBag.TotalInProcess     = TotalCountInProcess();
                ViewBag.TotalRejected      = TotalCountrejected();
                ViewBag.TotalPayment       = TotalCountPayment();
                ViewBag.HistoryChart       = GetHistoryDataDefitition();

                ViewBag.SpaceUsed = GetTotalSpaceUsed();
                ViewBag.DemoDonut = GetDonutDataDemo();
                //DashboardItem pendings =  new DashboardItem();
                ViewBag.GeoMapData = GetGeoDataDemo();



                #region lists
                List <DashboardItemList> lists = new List <DashboardItemList>();

                //DashboardItemList listMovements = new DashboardItemList();
                //listMovements.UrlView = VirtualPathUtility.ToAbsolute("~/") + "SFSdotNetFrameworkSecurity/secMoneyMovements/ListViewGen?usemode=myaccount";
                //listMovements.Title = "Mis movimientos";
                //listMovements.UrlCatalog = VirtualPathUtility.ToAbsolute("~/") + "SFSdotNetFrameworkSecurity/secMoneyMovements";

                //lists.Add(listMovements);
                DashboardItemList list = new DashboardItemList();


                //if ((new SFSdotNet.Framework.Security.Permissions()).IsAllowed(SFSdotNet.Framework.My.Context.CurrentContext.User, "SFSServiceDesk", accIncomeExpens.EntityName + "_money-in", "r"))
                //{
                //    list = new DashboardItemList();
                //    list.UrlView = VirtualPathUtility.ToAbsolute("~/") + "SFSServiceDesk/accIncomeExpenses/ListViewGen?usemode=money-in";
                //    list.Title = "Ingresos";
                //    list.UrlCatalog = VirtualPathUtility.ToAbsolute("~/") + "SFSServiceDesk/accIncomeExpenses?usemode=money-in";

                //    lists.Add(list);
                //}
                //if ((new SFSdotNet.Framework.Security.Permissions()).IsAllowed(SFSdotNet.Framework.My.Context.CurrentContext.User, "SFSServiceDesk", accIncomeExpens.EntityName + "_money-out-request", "r"))
                //{
                //    list = new DashboardItemList();
                //    list.UrlView = VirtualPathUtility.ToAbsolute("~/") + "SFSServiceDesk/accIncomeExpenses/ListViewGen?usemode=money-out-request";
                //    list.Title = "Solicitudes de egreso";
                //    list.UrlCatalog = VirtualPathUtility.ToAbsolute("~/") + "SFSServiceDesk/accIncomeExpenses?usemode=money-out-request";

                //    lists.Add(list);
                //}
                DashboardItem item = new DashboardItem();
                item.ItemType = DashboardItemTypes.ListView;
                item.Lists    = lists;

                #endregion
                ViewBag.MyPendings = item;
            }
            DashboardModel model   = new DashboardModel();
            UIModel        uiModel = new UIModel();
            return(ResolveView("Dashboard", uiModel, model));
        }
        public async Task DashboardItem_Delete_DoesDelete()
        {
            // Arrange
            var dashboardItem = await DashboardHelpers.CreateDashboardItem(DbContext);

            // Act
            var oldUpdatedAt = dashboardItem.UpdatedAt.GetValueOrDefault();

            await dashboardItem.Delete(DbContext);

            // Assert
            DashboardItem               dbDashboardItem       = DbContext.DashboardItems.AsNoTracking().First();
            List <DashboardItem>        dashboardItems        = DbContext.DashboardItems.AsNoTracking().ToList();
            List <DashboardItemVersion> dashboardItemVersions = DbContext.DashboardItemVersions.AsNoTracking().ToList();

            Assert.NotNull(dbDashboardItem);
            Assert.AreEqual(1, dashboardItems.Count);
            Assert.AreEqual(2, dashboardItemVersions.Count);

            Assert.AreEqual(dashboardItem.Id, dbDashboardItem.Id);
            Assert.AreEqual(2, dbDashboardItem.Version);
            Assert.AreEqual(Constants.WorkflowStates.Removed, dbDashboardItem.WorkflowState);
            Assert.AreEqual(dashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture), dbDashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture));
            Assert.AreEqual(dashboardItem.CreatedByUserId, dbDashboardItem.CreatedByUserId);
            Assert.AreEqual(dashboardItem.UpdatedByUserId, dbDashboardItem.UpdatedByUserId);

            Assert.AreEqual(dashboardItem.Id, dashboardItemVersions[0].DashboardItemId);
            Assert.AreEqual(1, dashboardItemVersions[0].Version);
            Assert.AreEqual(Constants.WorkflowStates.Created, dashboardItemVersions[0].WorkflowState);
            Assert.AreEqual(dashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture), dashboardItemVersions[0].CreatedAt.ToString(CultureInfo.InvariantCulture));
            Assert.AreEqual(dashboardItem.CreatedByUserId, dashboardItemVersions[0].CreatedByUserId);
            Assert.AreEqual(oldUpdatedAt.ToString(), dashboardItemVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(dashboardItem.UpdatedByUserId, dashboardItemVersions[0].UpdatedByUserId);

            Assert.AreEqual(dashboardItem.Position, dashboardItemVersions[0].Position);
            Assert.AreEqual(dashboardItem.CalculateAverage, dashboardItemVersions[0].CalculateAverage);
            Assert.AreEqual(dashboardItem.ChartType, dashboardItemVersions[0].ChartType);
            Assert.AreEqual(dashboardItem.CompareEnabled, dashboardItemVersions[0].CompareEnabled);
            Assert.AreEqual(dashboardItem.FilterAnswerId, dashboardItemVersions[0].FilterAnswerId);
            Assert.AreEqual(dashboardItem.FilterQuestionId, dashboardItemVersions[0].FilterQuestionId);
            Assert.AreEqual(dashboardItem.Period, dashboardItemVersions[0].Period);

            Assert.AreEqual(dashboardItem.Id, dashboardItemVersions[1].DashboardItemId);
            Assert.AreEqual(2, dashboardItemVersions[1].Version);
            Assert.AreEqual(Constants.WorkflowStates.Removed, dashboardItemVersions[1].WorkflowState);
            Assert.AreEqual(dashboardItem.CreatedAt.ToString(CultureInfo.InvariantCulture), dashboardItemVersions[1].CreatedAt.ToString(CultureInfo.InvariantCulture));
            Assert.AreEqual(dashboardItem.CreatedByUserId, dashboardItemVersions[1].CreatedByUserId);
            Assert.AreEqual(dashboardItem.UpdatedByUserId, dashboardItemVersions[1].UpdatedByUserId);

            Assert.AreEqual(dashboardItem.Position, dashboardItemVersions[1].Position);
            Assert.AreEqual(dashboardItem.CalculateAverage, dashboardItemVersions[1].CalculateAverage);
            Assert.AreEqual(dashboardItem.ChartType, dashboardItemVersions[1].ChartType);
            Assert.AreEqual(dashboardItem.CompareEnabled, dashboardItemVersions[1].CompareEnabled);
            Assert.AreEqual(dashboardItem.FilterAnswerId, dashboardItemVersions[1].FilterAnswerId);
            Assert.AreEqual(dashboardItem.FilterQuestionId, dashboardItemVersions[1].FilterQuestionId);
            Assert.AreEqual(dashboardItem.Period, dashboardItemVersions[1].Period);
        }
예제 #26
0
        public async Task <IActionResult> TestImage(DashboardItem newDashboardItem)
        {
            TransformEngine yeah     = new TransformEngine();
            string          location = yeah.ConvertOneTEMP(newDashboardItem.LogonUser, newDashboardItem.LogonPwd, newDashboardItem.SourceURL,
                                                           "#widgets-container");

            ViewData["ImageSrc"] = location;
            return(View("AddDashboardItem", newDashboardItem));
        }
        public HttpResponseMessage Save([FromBody] List <DashboardViewModel> model)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            // dashboard data is stored using the user id so, we need to get the user
            var currentUser = PortalsHelpers.GetCurrentUser();

            // loop through the dashboard items and get them ready for persisting
            foreach (var dashboardModel in model)
            {
                // this will be our final list of items that we'll store
                var dashboardItems = new List <DashboardItem>();

                foreach (var dashboardItem in dashboardModel.DashboardItems)
                {
                    // this ensures that the user has access to the dashboard item they're trying to save
                    ToolboxItem toolboxItem = null;
                    if (PortalsHelpers.GetToolboxItem(dashboardItem.ControllerType, out toolboxItem))
                    {
                        // get the properties that users are able to change on the front end
                        var configurableProperties = PortalsHelpers.GetConfigurableProperties(toolboxItem.ControllerType);

                        var configuredProperties = dashboardItem.Properties;//.FromJson<List<PortalsItemProperty>>();

                        // just to keep things tidy...
                        configuredProperties.RemoveAll(p => p.Value == string.Empty);

                        // if the user has actually set any configurable property values, make sure they're valid
                        foreach (var property in configuredProperties)
                        {
                            // check to make sure a previously configurable property is still configurable
                            if (!configurableProperties.Any(p => p.Name == property.Name))
                            {
                                configuredProperties.Remove(property);
                            }
                        }

                        // done with sanitization, let's build the item we're going to persist
                        var item = new DashboardItem()
                        {
                            ControllerType = dashboardItem.ControllerType,
                            Properties     = configuredProperties.Select(p => new PortalsItemProperty()
                            {
                                Name = p.Name, Value = p.Value
                            }).ToList()
                        };

                        dashboardItems.Add(item);
                    }
                }

                currentUser.SaveDashboard(dashboardModel.DashboardId, dashboardItems);
            }

            return(response);
        }
        private void NavigateToSelectedPage(DashboardItem dashboardItem)
        {
            var currentFrame = Windows.UI.Xaml.Window.Current;
            var frame        = currentFrame.Content as Frame;

            var args = new Dictionary <string, string> {
            };

            frame.Navigate(dashboardItem.PageType, args);
        }
예제 #29
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.list_item_dashboard, parent, false);

            // Create a ViewHolder to hold view references inside the CardView:
            DashboardItem vh = new DashboardItem(itemView);

            return(vh);
        }
예제 #30
0
 public static SelectedDashboardItem Build(DashboardItem item, Widget widget)
 {
     return(new SelectedDashboardItem()
     {
         Widget = widget,
         X = item.X,
         Y = item.Y,
         Stations = item.Filters.Select(s => s.StationId)
     });
 }
예제 #31
0
 public ContentView(DashboardItem dashboardItem)
 {
     InitializeComponent();
     _dashboardItem = dashboardItem;
     this.DataContext = new ContentVM(dashboardItem.Name);
 }
예제 #32
0
 public static void WriteGetItemsResult(this DataOutputStream output, DashboardItem[] value)
 {
     if (value == null)
         throw new ArgumentNullException("value");
     output.WriteInt32(value.Length);
     foreach (var item in value)
     {
         output.WriteString(item.AskQuestion);
         output.WriteDateTime(item.DateTime.ToDateTime());
         output.WriteInt32(item.FeedItemType);
         output.WriteString(item.Friend1FullName);
         output.WriteString(item.Friend2FullName);
         output.WriteString(item.FriendNickname1);
         output.WriteString(item.FriendNickname2);
         output.WriteString(item.FriendWebMemberID1);
         output.WriteString(item.FriendWebMemberID2);
         output.WriteString(item.Text);
         output.WriteString(item.ThumbnailUrl);
         output.WriteString(item.Title);
         output.WriteInt32(item.ObjectID);
         output.WriteString(item.WebPhotoCollectionID);
         output.WriteString(item.WebPhotoID);
     }
 }