Пример #1
0
        // GET: /Powerbi/Details/5
        public ActionResult Details(int id = 0)
        {
            Powerbi powerbi = db.Frames.Find(id) as Powerbi;

            if (powerbi == null)
            {
                return(View("Missing", new MissingItem(id)));
            }
            return(View(powerbi));
        }
        // GET: /Powerbi/Edit/5
        public ActionResult Edit(int id = 0)
        {
            Powerbi powerbi = db.Frames.Find(id) as Powerbi;

            if (powerbi == null)
            {
                return(View("Missing", new MissingItem(id)));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Powerbi, powerbi.TemplateId);
            FillTypesSelectList(powerbi.Type);
            FillAccountsSelectList(powerbi.AccountId);


            return(View(powerbi));
        }
        public ActionResult Create(Powerbi powerbi)
        {
            if (ModelState.IsValid)
            {
                db.Frames.Add(powerbi);
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Powerbi, powerbi.TemplateId);
            FillTypesSelectList(powerbi.Type);
            FillAccountsSelectList(powerbi.AccountId);


            return(View(powerbi));
        }
        public ActionResult Edit(Powerbi powerbi)
        {
            if (ModelState.IsValid)
            {
                db.Entry(powerbi).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index", "Frame"));
            }

            this.FillTemplatesSelectList(db, FrameTypes.Powerbi, powerbi.TemplateId);
            FillTypesSelectList(powerbi.Type);
            FillAccountsSelectList(powerbi.AccountId);


            return(View(powerbi));
        }
        // GET: /Powerbi/Create
        public ActionResult Create()
        {
            Frame frame = TempData[FrameController.SelectorFrameKey] as Frame;

            if (frame == null || frame.PanelId == 0)
            {
                return(RedirectToAction("Create", "Frame"));
            }

            Powerbi powerbi = new Powerbi(frame, db);

            this.FillTemplatesSelectList(db, FrameTypes.Powerbi);
            FillTypesSelectList();
            FillAccountsSelectList();


            return(View(powerbi));
        }
Пример #6
0
        // GET: /Powerbi/Create
        public ActionResult Create()
        {
            Frame frame = TempData[FrameController.SelectorFrameKey] as Frame;

            if (frame == null || frame.PanelId == 0)
            {
                return(RedirectToAction("Create", "Frame"));
            }

            Powerbi powerbi = new Powerbi(frame, db)
            {
                Panel = db.Panels
                        .FirstOrDefault(p => p.PanelId == frame.PanelId),
            };

            this.FillPanelsSelectList(db, powerbi.Panel.CanvasId, powerbi.PanelId);
            this.FillTemplatesSelectList(db, FrameTypes.Powerbi);
            FillTypesSelectList();
            FillAccountsSelectList();


            return(View(powerbi));
        }
Пример #7
0
        public static async Task<Frame> GetNextFrameAsync(int panelId, int displayId, int previousFrameId)
		{
            Frame nci = new Frame()
            {
                PanelId = panelId,
                DisplayId = displayId
            };

            using (SqlCommand cmd = new SqlCommand("sp_GetNextFrame"))
            {
				cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@panelId", SqlDbType.Int).Value = panelId;
                cmd.Parameters.Add("@displayId", SqlDbType.Int).Value = displayId;
                cmd.Parameters.Add("@lastFrameId", SqlDbType.Int).Value = previousFrameId;

                await cmd.ExecuteReaderExtAsync((dr) =>
                {
                    nci._initfromRow(dr);
                    return false;
                });
            }

            if (nci.FrameId > 0)
            {
                switch (nci.FrameType)
                {
                    case FrameTypes.Clock:
                        nci = new Clock(nci);
                        break;

                    case FrameTypes.Html:
                        nci = new Html(nci);
                        break;

                    case FrameTypes.Memo:
                        nci = new Memo(nci);
                        break;

                    //case FrameTypes.News:

                    case FrameTypes.Outlook:
                        nci = new Outlook(nci);
                        break;

                    case FrameTypes.Picture:
                        nci = new Picture(nci);
                        break;

                    case FrameTypes.Powerbi:
                        nci = new Powerbi(nci);
                        break;

                    case FrameTypes.Report:
                        nci = new Report(nci);
                        break;

                    case FrameTypes.Video:
                        nci = new Video(nci);
                        break;

                    case FrameTypes.Weather:
                        nci = new Weather(nci);
                        break;

                    case FrameTypes.YouTube:
                        nci = new YouTube(nci);
                        break;

                    default:
                        break;
                }
            }

            return nci;
		}