Пример #1
0
 public ViewResult Index()
 {
     try
     {
         return(View(BaseChartRepository.GetChartList(GetUserId())));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #2
0
 public ActionResult DeleteConfirmed(long id)
 {
     try
     {
         BaseChartRepository.DeleteChart(id, GetUserId());
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #3
0
 public ActionResult Delete(long id)
 {
     try
     {
         ViewChart viewchart = BaseChartRepository.GetChart(id, GetUserId());
         return(View(viewchart));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #4
0
 public ViewResult Details(long id)
 {
     try
     {
         ViewChart viewchart = BaseChartRepository.GetChart(id, GetUserId());
         ViewBag.ChartTypes = new SelectList(ChartTypes, viewchart != null ? viewchart.ChartType.TrimEnd() : ChartTypes[0]);
         return(View("Details", viewchart));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #5
0
        public ActionResult ShowDiagram(Int64 id /*chart id.*/)
        {
            try
            {
                Guid      userId    = GetUserId();
                ViewChart viewchart = BaseChartRepository.GetChart(id, userId);

                return(View(viewchart));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                //  this view is showed in frame, so
                //  it should show error message by itself
                return(View());
            }
        }
Пример #6
0
 public ActionResult Edit(ViewChart viewchart)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BaseChartRepository.UpdateChart(viewchart, GetUserId());
             return(RedirectToAction("ShowChart", "Chart", new { viewchart.ID }));
         }
         return(View(viewchart));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #7
0
        public ActionResult ShowChart(Int64 id /*chart id.*/)
        {
            try
            {
                Guid      userId = GetUserId();
                ViewChart v      = BaseChartRepository.GetChart(id, userId);
                ViewBag.ChartID = v.ID;
                ViewBag.Width   = v.Width;
                ViewBag.Height  = v.Height;

                return(View("ShowChart", v));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
Пример #8
0
        public ActionResult Edit(long id)
        {
            try
            {
                ViewChart v = BaseChartRepository.GetChart(id, GetUserId());
                SetCreateEditViewBag(v);

                if (v.ChartType.ToLower() == Diagram.ToLower())
                {
                    return(View("EditDiagram", v));
                }
                return(View("Edit", v));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
Пример #9
0
        public ActionResult Create(ViewChart viewchart)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    BaseChartRepository.AddChart(viewchart, GetUserId());
                    return(RedirectToAction("Index"));
                }

                SetCreateEditViewBag(viewchart);
                return(View(viewchart));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
Пример #10
0
        //  this method renders the chart demo page;
        //  name must be the same as in ChartController to utilize the updating script;
        //  https://www.evernote.com/shard/s132/nl/14501366/7dea6933-c310-4df8-906c-a0457ca00fac
        public ActionResult ShowChart()
        {
            try
            {
                var v = BaseChartRepository.GetChart(_chartId, _userId);
                ViewBag.ChartID = v.ID;
                ViewBag.Width   = v.Width;
                ViewBag.Height  = v.Height;

                if (v.ChartType.ToLower() == Line.ToLower())
                {
                    return(View("DemoChart"));
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
Пример #11
0
 public ActionResult SelectElement(Int64 id /*chart id.*/, long?groupId, String group, long?ownerId,
                                   String owner, long?locationId, String location, String element)
 {
     try
     {
         List <ViewElementInstanceName> v = BaseChartRepository.GetElementInstanceNameList();
         ViewBag.ChartID    = id;
         ViewBag.Group      = group;
         ViewBag.GroupID    = groupId;
         ViewBag.Owner      = owner;
         ViewBag.OwnerID    = ownerId;
         ViewBag.Location   = location;
         ViewBag.LocationID = locationId;
         ViewBag.Element    = element;
         return(View(v));
     }
     catch (Exception e)
     {
         ExceptionMessageToViewBag(e);
         return(View("Error"));
     }
 }
Пример #12
0
        public ActionResult ShowDiagramDataSet(Int64 id /*chart id.*/)
        {
            try
            {
                Guid      userId = GetUserId();
                ViewChart v      = BaseChartRepository.GetChart(id, userId);

                if (v.ChartType.ToLower() == Diagram.ToLower())
                {
                    ViewBag.ChartID = v.ID;
                    ViewBag.Width   = v.Width;
                    ViewBag.Height  = v.Height;
                    return(View("ShowDiagramDataSet", v));
                }
                return(RedirectToAction("ShowChart", new { id }));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }
Пример #13
0
        /*
         * public ActionResult XLSX(Int64 id/*chart id.* /)
         * {
         *  try
         *  {
         *      //  here should be export to XLSX realization
         *      ViewChart viewchart = chartRepository.GetChart(id, GetUserID());
         *      return View(viewchart);
         *  }
         *  catch (Exception e)
         *  {
         *      ExceptionMessageToViewBag(e);
         *      return View("Error");
         *  }
         * }
         */

        public ActionResult DataSet(Int64 id /*chart id.*/, long?groupId, String group, long?ownerId, String owner,
                                    long?locationId, String location, String element, String svgId)
        {
            try
            {
                ViewChart viewchart = BaseChartRepository.GetChart(id, GetUserId());
                ViewBag.Group      = group;
                ViewBag.GroupID    = groupId;
                ViewBag.Owner      = owner;
                ViewBag.OwnerID    = ownerId;
                ViewBag.Location   = location;
                ViewBag.LocationID = locationId;
                ViewBag.Element    = element;
                ViewBag.SVGID      = svgId;
                List <ViewElementFiltered> v = BaseChartRepository.GetElementFilteredList(element, ownerId, groupId, locationId, GetUserId(), id);
                ViewBag.ElementList = v;
                return(View(viewchart));
            }
            catch (Exception e)
            {
                ExceptionMessageToViewBag(e);
                return(View("Error"));
            }
        }