Пример #1
0
        public JsonResult GetLoopControl(string sGUID, string ttype)
        {
            List <LumluxSSYDB.Model.tRelayInfoes> lmtlist = new List <LumluxSSYDB.Model.tRelayInfoes>();

            LumluxSSYDB.BLL.tRelayInfoes lbt = new LumluxSSYDB.BLL.tRelayInfoes();
            if (!string.IsNullOrWhiteSpace(sGUID) && !string.IsNullOrWhiteSpace(ttype))
            {
                if (!lbt.ExistLoop(sGUID))
                {
                    AddLoop(lbt, sGUID);
                }
                if (Convert.ToInt32(ttype) == Convert.ToInt32(EnumClass.SYType.eSixLoop))
                {
                    lmtlist = lbt.GetModelList(" sHostInfoGUID='" + sGUID + "' and iID between 0 and 6 order by iID") == null ? (new List <LumluxSSYDB.Model.tRelayInfoes>()) : lbt.GetModelList(" sHostInfoGUID='" + sGUID + "' and iID between 0 and 6  order by iID");
                }
                else
                {
                    lmtlist = lbt.GetModelList(" sHostInfoGUID='" + sGUID + "' and iID between 0 and 3 order by iID") == null ? (new List <LumluxSSYDB.Model.tRelayInfoes>()) : lbt.GetModelList(" sHostInfoGUID='" + sGUID + "' and iID between 0 and 3 order by iID");
                }
            }

            return(Json(lmtlist));
        }
Пример #2
0
        //
        // GET: /Lamp/TimeControl/

        public ActionResult Index()
        {
            #region 加载左侧所有主机信息

            ViewBag.PrjectGUID = PrjGUID;
            LumluxSSYDB.BLL.tHostInfo         bllhost       = new LumluxSSYDB.BLL.tHostInfo();
            List <HostInfoVM>                 list          = new List <HostInfoVM>();
            List <TimeInterval>               TableOTList   = new List <TimeInterval>();
            List <TimeInterval>               TableTTList   = new List <TimeInterval>();
            LumluxSSYDB.BLL.tLightGroupInfoes blllightgroup = new LumluxSSYDB.BLL.tLightGroupInfoes();
            LumluxSSYDB.BLL.tRelayInfoes      lbt           = new LumluxSSYDB.BLL.tRelayInfoes();
            //mainVM.MapCenterLat = GetLat("Prject_CenterPoint_Lat");
            //mainVM.MapCenterLng = GetLng("Prject_CenterPoint_Lng");
            DataTable allhostdt = bllhost.GetHostInfo("dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "'");

            if (allhostdt != null)
            {
                allhostdt.Columns.Add("hostByLightCount");
                allhostdt.Columns.Add("hostByAlarmLightCount");
                HostInfoVM hvm;
                foreach (DataRow dr in allhostdt.Rows)
                {
                    hvm = addInfo(dr);

                    list.Add(hvm);
                }
            }
            #endregion

            if (list.Count > 0)
            {
                ViewBag.hostlist = list;

                // 初始化主机下的24个时段
                InitTimeControl(list[0].GUID);
                if (!lbt.ExistLoop(list[0].GUID))
                {
                    AddLoop(lbt, list[0].GUID);
                }
                ViewBag.LightGroup = blllightgroup.GetModelListByHostGUID(list[0].GUID) == null ? (new List <LumluxSSYDB.Model.tLightGroupInfoes>()) : (blllightgroup.GetModelListByHostGUID(list[0].GUID));
                if (Convert.ToInt32(list[0].iHardware_Type) == Convert.ToInt32(EnumClass.SYType.eSixLoop))
                {
                    ViewBag.LoopInfo = lbt.GetModelList(" sHostInfoGUID='" + list[0].GUID + "' and iID between 0 and 6 order by iID") == null ? (new List <LumluxSSYDB.Model.tRelayInfoes>()) : lbt.GetModelList(" sHostInfoGUID='" + list[0].GUID + "' and iID between 0 and 6 order by iID");
                }
                else
                {
                    ViewBag.LoopInfo = lbt.GetModelList(" sHostInfoGUID='" + list[0].GUID + "' and iID  between 0 and 3 order by iID") == null ? (new List <LumluxSSYDB.Model.tRelayInfoes>()) : lbt.GetModelList(" sHostInfoGUID='" + list[0].GUID + "' and iID  between 0 and 3 order by iID");
                }
                //查询单灯分组
                //List<LumluxSSYDB.Model.tLightGroupInfoes> dt2 =
            }
            else
            {
                ViewBag.hostlist   = new List <HostInfoVM>();
                ViewBag.TableOT    = new List <TimeInterval>();
                ViewBag.TableTT    = new List <TimeInterval>();
                ViewBag.LightGroup = new List <LumluxSSYDB.Model.tLightGroupInfoes>();
                ViewBag.LoopInfo   = new List <LumluxSSYDB.Model.tRelayInfoes>();
            }
            return(View());
        }