예제 #1
0
        public ActionResult DefinedPlantChartList(int id, string cid)
        {
            int temp = 0;

            int.TryParse(cid, out temp);
            Plant plant = PlantService.GetInstance().GetPlantInfoById(id);

            SetDeviceList(plant);
            SetMI(null);
            CustomChart cus = null;

            if (string.IsNullOrEmpty(cid))
            {
                cus         = new CustomChart();
                cus.groupId = 0;
                cus.plantId = plant.id;
            }
            else
            {
                cus = CustomChartService.GetInstance().Get(new CustomChart()
                {
                    id = temp
                });
                Analysis(ref cus);
            }
            ViewData["charts"] = CustomChartService.GetInstance().GetListByPlant(cus.plantId);
            return(View("CustomChartList", cus));
        }
예제 #2
0
        public ActionResult DeleteChart(int id)
        {
            CustomChart mode = new CustomChart();

            mode.id = id;
            CustomChartService.GetInstance().Remove(mode);
            return(Content("success"));
        }
예제 #3
0
        public ActionResult Delete(int id, string returnUrl)
        {
            CustomChart mode = new CustomChart();

            UpdateModel(mode, Request.Form.AllKeys);

            int flag = CustomChartService.GetInstance().Remove(mode);

            return(new RedirectResult(returnUrl));
        }
예제 #4
0
        /// <summary>
        /// 废弃
        /// </summary>
        /// <param name="userid"></param>
        public void SetReportGroups(int userid)
        {
            IList <ChartGroup> reportGroup = ChartGroupService.GetInstance().GetReportGroupList(userid);

            Session[ComConst.ChartGroup] = reportGroup;

            IList <CustomChart> outlist = CustomChartService.GetInstance().GetListOutGroup(userid);

            Session[ComConst.ChartOutGroup] = outlist;
        }
예제 #5
0
        public ActionResult DeleteReport(int id)
        {
            CustomChart mode = new CustomChart();

            mode.id = id;
            int  flag = CustomChartService.GetInstance().Remove(mode);
            User user = UserUtil.getCurUser();

            string ret = GetHtml(user.id);

            return(RedirectToAction("ReportGroup", ret));
        }
예제 #6
0
        /// <summary>
        /// 删除分组
        /// </summary>
        /// <param name="customReport"></param>
        /// <returns></returns>
        public ActionResult DeleteGroup(string id, string returnUrl)
        {
            User       user = UserUtil.getCurUser();
            ChartGroup mode = new ChartGroup();

            mode.id = int.Parse(id);
            ChartGroupService.GetInstance().Remove(mode);
            CustomChartService.GetInstance().Delete(mode.id);

            //  string ret = GetHtml(user.id);
            return(new RedirectResult(returnUrl));
        }
예제 #7
0
        public ActionResult DefinedUserChart()
        {
            User user = UserUtil.getCurUser();

            SetDeviceList(user.plants);
            SetMI(null);
            CustomChart cus = new CustomChart();

            cus.groupId        = 0;
            cus.userId         = user.id;
            ViewData["charts"] = CustomChartService.GetInstance().GetListByGroup(user.id, 0);
            return(View("CustomChart", cus));
        }
예제 #8
0
        public ActionResult CustomChartPage2()
        {
            int id = int.Parse(Session["customID"].ToString());

            ViewData["cid"] = id;
            CustomChart cc = CustomChartService.GetInstance().Get(new CustomChart()
            {
                id = id
            });

            ViewData["gid"]         = cc.groupId;
            ViewData["customChart"] = cc;
            FillYearsList();
            return(View("CustomChartPage"));
        }
예제 #9
0
        public ActionResult modifyDefined(string id)
        {
            CustomChart cus = null;

            if (!string.IsNullOrEmpty(id))
            {
                cus    = new CustomChart();
                cus.id = int.Parse(id);
                cus    = CustomChartService.GetInstance().Get(cus);
            }
            Plant plant = PlantService.GetInstance().GetPlantInfoById(cus.plantId);

            SetDeviceList(plant);

            Analysis(ref cus);

            ViewData["charts"] = CustomChartService.GetInstance().GetListByPlant(cus.plantId);
            return(View("CustomChart", cus));
        }
예제 #10
0
        /// <summary>
        /// 生成自定义图表
        /// </summary>
        /// <returns>自定义报表页面</returns>
        public ActionResult ChartView(int id, string startTime, string endTime)
        {
            string report = "";

            DateTime dt = DateTime.Now;

            switch (id)
            {
            default:    ///自定义
                CustomChart crt = new CustomChart();
                crt.id        = id;
                crt           = CustomChartService.GetInstance().Get(crt);
                crt.startTime = startTime;
                crt.endTime   = endTime;
                report        = GetCustomReport(crt);
                break;
            }
            return(Content(report));
        }
예제 #11
0
        public ActionResult CreateGroup(string id)
        {
            ChartGroup group = new ChartGroup();
            User       user  = UserUtil.getCurUser();

            IList <CustomChart> ilistcc = CustomChartService.GetInstance().GetListByGroup(user.id, 0);

            Session[ComConst.ChartGroupDefault] = ilistcc;

            if (user != null && group != null)
            {
                group.userId = user.id;
                SetReportGroups(user.id);
            }
            if (!string.IsNullOrEmpty(id))
            {
                group.id = int.Parse(id);
                group    = ChartGroupService.GetInstance().Get(group);
            }
            return(View("ReportGroup", group));
        }
예제 #12
0
        public ActionResult Save(CustomChart customReport, string cid)
        {
            int temp = 0;

            int.TryParse(cid, out temp);
            customReport.id      = temp;
            customReport.groupId = 0;
            string ret = Resources.SunResource.CUSTOM_SAVE_SUCCESSFULLY;

            if (customReport != null)
            {
                if (!customReport.customType.Equals("2") && string.IsNullOrEmpty(customReport.product))
                {
                    customReport.product = customReport.ProIdType;
                }
            }
            User user = UserUtil.getCurUser();

            if (null != user && UserUtil.demousername.Equals(user.username))
            {
                ret = "Sorry,exampleuser prohibit to save";
                return(Content(ret));
            }
            else if (string.IsNullOrEmpty(customReport.reportName))
            {
                ret = Resources.SunResource.CUSTOMREPORT_SAVE_FAILED_NAME;
                return(Content(ret));
            }
            else if (customReport.customType.Trim().Equals("2") && string.IsNullOrEmpty(customReport.product))
            {
                ret = Resources.SunResource.CUSTOMREPORT_SAVE_FAILED_EQUIPMENT;
                return(Content(ret));
            }
            else if (customReport.customType.Trim().Equals("3") && string.IsNullOrEmpty(customReport.times))
            {
                ret = Resources.SunResource.CUSTOMREPORT_SAVE_FAILED_TIME;
                return(Content(ret));
            }

            int flag = 0;

            try
            {
                if (customReport.id <= 0)
                {
                    flag = CustomChartService.GetInstance().Insert(customReport);
                }
                else if (CustomChartService.GetInstance().Get(customReport) != null)
                {
                    flag = CustomChartService.GetInstance().Update(customReport);
                }
                else
                {
                    flag = CustomChartService.GetInstance().Insert(customReport);
                }
            }
            catch (Exception ee)
            {
                ret = "Save failed!" + ee.Message;
                return(Content(ret));
            }
            return(Content(ret));
        }