Esempio n. 1
0
        /// <summary>
        /// 点击编辑加载
        /// </summary>
        /// <param name="sGUID"></param>
        /// <returns></returns>
        private List <TimeInterval> GetTimeControl(string sGUID)
        {
            List <TimeInterval> listTime = new List <TimeInterval>();

            LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();



            listTime = GetTimeInterval(sGUID);



            return(listTime);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取主机下的时段
        /// </summary>
        /// <param name="hostGUID"></param>
        /// <param name="startCount"></param>
        /// <param name="endCount"></param>
        /// <returns></returns>
        public List <TimeInterval> GetTimeInterval(string hostGUID, int startCount, int endCount)
        {
            List <TimeInterval> tilist = new List <TimeInterval>();

            LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();
            DataTable dtTableOT = lbt.GetTimeCtrlInfo(hostGUID, startCount, endCount);

            if (dtTableOT != null)
            {
                TimeInterval til;
                foreach (DataRow dr in dtTableOT.Rows)
                {
                    til = addTimeInterval(dr);
                    tilist.Add(til);
                }
            }
            return(tilist);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取单个时段
        /// </summary>
        /// <param name="sGUID"></param>
        /// <returns></returns>
        public List <TimeInterval> GetTimeInterval(string sGUID)
        {
            List <TimeInterval> tilist = new List <TimeInterval>();

            LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();
            DataTable dt = lbt.GetTimeCtrlInfoByOne(sGUID);

            if (dt != null)
            {
                TimeInterval til;
                foreach (DataRow dr in dt.Rows)
                {
                    til = addTimeInterval(dr);

                    tilist.Add(til);
                }
            }
            return(tilist);
        }
Esempio n. 4
0
 /// <summary>
 /// 页面初始化
 /// </summary>
 /// <param name="shsotGUID"></param>
 private void InitTimeControl(string shsotGUID)
 {
     LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();
     if (GetTableCount(shsotGUID, 1, 24) == 24)
     {
         #region 加载1-12个时段
         ViewBag.TableOT = GetTimeInterval(shsotGUID, 1, 12);
         #endregion
         #region 加载13-24个时段
         ViewBag.TableTT = GetTimeInterval(shsotGUID, 13, 24);
         #endregion
     }
     else
     {
         int iCount = GetTableCount(shsotGUID, 1, 24) + 1;
         LumluxSSYDB.Model.tTimeCtrlInfoes lmt;
         for (int i = iCount; i <= 24; i++)
         {
             lmt                = new LumluxSSYDB.Model.tTimeCtrlInfoes();
             lmt.sGUID          = Guid.NewGuid().ToString();
             lmt.iID            = i;
             lmt.dTime          = DateTime.Now;
             lmt.iEnable        = 0; //启用:1不启用:0
             lmt.iState_Command = 1; //下放成功:1下放失败:0
             lmt.dCreateDate    = DateTime.Now;
             lmt.dUpdateTime    = DateTime.Now;
             lmt.sHostInfoGUID  = shsotGUID;
             lmt.sTagGUID       = Guid.NewGuid().ToString();//控制对象GUID
             lmt.sDesc          = "自动生成";
             if (lbt.Add(lmt))
             {
                 #region 加载1-12个时段
                 ViewBag.TableOT = GetTimeInterval(shsotGUID, 1, 12);
                 #endregion
                 #region 加载13-24个时段
                 ViewBag.TableTT = GetTimeInterval(shsotGUID, 13, 24);
                 #endregion
             }
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 点击左菜单加载
        /// </summary>
        /// <param name="sHostGUID"></param>
        /// <returns></returns>
        private List <TimeInterval> LoadTimeControl(string sHostGUID)
        {
            List <TimeInterval> listTime = new List <TimeInterval>();

            LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();

            if (GetTableCount(sHostGUID, 1, 24) == 24)
            {
                #region 加载1-24个时段
                listTime = GetTimeInterval(sHostGUID, 1, 24);
                #endregion
            }
            else
            {
                int iCount = GetTableCount(sHostGUID, 1, 24) + 1;
                LumluxSSYDB.Model.tTimeCtrlInfoes lmt;
                for (int i = iCount; i <= 24; i++)
                {
                    lmt                = new LumluxSSYDB.Model.tTimeCtrlInfoes();
                    lmt.sGUID          = Guid.NewGuid().ToString();
                    lmt.iID            = i;
                    lmt.dTime          = DateTime.Now;
                    lmt.iEnable        = 0; //启用:1不启用:0
                    lmt.iState_Command = 1; //下放成功:1下放失败:0
                    lmt.dCreateDate    = DateTime.Now;
                    lmt.dUpdateTime    = DateTime.Now;
                    lmt.sHostInfoGUID  = sHostGUID;
                    lmt.sTagGUID       = Guid.NewGuid().ToString();
                    lmt.sDesc          = "自动生成";
                    if (lbt.Add(lmt))
                    {
                        #region 加载1-24个时段
                        listTime = GetTimeInterval(sHostGUID, 1, 24);
                        #endregion
                    }
                }
            }

            return(listTime);
        }
Esempio n. 6
0
        /// <summary>
        /// 保存设置
        /// </summary>
        /// <param name="TimeCtrGUID">时控GUID</param>
        /// <param name="timeset">所设时间</param>
        /// <param name="IsCheckBox">是否启用</param>
        /// <param name="selecttype_time">类型</param>
        /// <param name="selectcircuitinfo_time">所选回路</param>
        /// <param name="modeswitchhl_time">回路状态</param>
        /// <param name="selectlightgroupinfo_time">群组选择</param>
        /// <param name="modeswitch_time">调光选择</param>
        /// <param name="lightswitch">组状态</param>
        /// <param name="slider1_time">调光值</param>
        /// <returns></returns>
        public JsonResult SaveSets(string TimeCtrGUID, string timeset, string IsCheckBox, string selecttype_time, string selectcircuitinfo_time, string modeswitchhl_time, string selectlightgroupinfo_time, string modeswitch_time, string lightswitch, string slider1_time)
        {
            string iSuccess = "0";

            if (selecttype_time == "mr")
            {
                return(Json(iSuccess));
            }
            if (!string.IsNullOrWhiteSpace(selecttype_time))
            {
                if (Convert.ToInt32(selecttype_time) == Convert.ToInt32(EnumClass.HWType.eLoop))//回路
                {
                    LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();
                    if (!string.IsNullOrWhiteSpace(TimeCtrGUID))
                    {
                        LumluxSSYDB.Model.tTimeCtrlInfoes lmt = lbt.GetModel(TimeCtrGUID);
                        lmt.dTime   = Convert.ToDateTime(timeset);
                        lmt.iEnable = Convert.ToInt32(IsCheckBox);
                        if (lbt.Update(lmt))
                        {
                            LumluxSSYDB.BLL.tCtrlTagInfoes   lbc = new LumluxSSYDB.BLL.tCtrlTagInfoes();
                            LumluxSSYDB.Model.tCtrlTagInfoes lmc = lbc.GetModel(lmt.sTagGUID);
                            if (lmc != null)
                            {
                                lmc.iType           = Convert.ToInt32(selecttype_time); //回路
                                lmc.sRelayState     = modeswitchhl_time;                //回路状态
                                lmc.sRelayInfo_GUID = selectcircuitinfo_time;
                                lbc.Update(lmc);
                            }
                            else
                            {
                                LumluxSSYDB.Model.tCtrlTagInfoes lmcc = new LumluxSSYDB.Model.tCtrlTagInfoes();
                                lmcc.sGUID           = lmt.sTagGUID;
                                lmcc.iType           = Convert.ToInt32(selecttype_time);
                                lmcc.sRelayInfo_GUID = selectcircuitinfo_time;
                                lmcc.sRelayState     = modeswitchhl_time;//回路状态
                                lbc.Add(lmcc);
                            }
                        }
                    }
                }
                else if (Convert.ToInt32(selecttype_time) == Convert.ToInt32(EnumClass.HWType.eGroup))//组
                {
                    LumluxSSYDB.BLL.tTimeCtrlInfoes lbt = new LumluxSSYDB.BLL.tTimeCtrlInfoes();
                    if (!string.IsNullOrWhiteSpace(TimeCtrGUID))
                    {
                        LumluxSSYDB.Model.tTimeCtrlInfoes lmt = lbt.GetModel(TimeCtrGUID);
                        lmt.dTime   = Convert.ToDateTime(timeset);
                        lmt.iEnable = Convert.ToInt32(IsCheckBox);
                        if (lbt.Update(lmt))
                        {
                            LumluxSSYDB.BLL.tCtrlTagInfoes   lbc = new LumluxSSYDB.BLL.tCtrlTagInfoes();
                            LumluxSSYDB.Model.tCtrlTagInfoes lmc = lbc.GetModel(lmt.sTagGUID);
                            if (lmc != null)
                            {
                                lmc.iType = Convert.ToInt32(selecttype_time);                   //回路
                                if (modeswitch_time == "0")                                     //没有调光
                                {
                                    lmc.sLightGroupState = modeswitch_time + "," + lightswitch; //状态
                                }
                                else
                                {
                                    lmc.sLightGroupState = modeswitch_time + "," + lightswitch + "," + slider1_time;//状态
                                }

                                lmc.sLightGroupGUID = selectlightgroupinfo_time;
                                lbc.Update(lmc);
                            }
                            else
                            {
                                LumluxSSYDB.Model.tCtrlTagInfoes lmcc = new LumluxSSYDB.Model.tCtrlTagInfoes();
                                lmcc.sGUID           = lmt.sTagGUID;
                                lmcc.iType           = Convert.ToInt32(selecttype_time);
                                lmcc.sLightGroupGUID = selectlightgroupinfo_time;
                                if (modeswitch_time == "0")                                      //没有调光
                                {
                                    lmcc.sLightGroupState = modeswitch_time + "," + lightswitch; //状态
                                }
                                else
                                {
                                    lmcc.sLightGroupState = modeswitch_time + "," + lightswitch + "," + slider1_time;//状态
                                }
                                lbc.Add(lmcc);
                            }
                        }
                    }
                }
            }

            return(Json(""));
        }