Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LumluxSSYDB.Model.tPrjectSet GetModelByWhere(string prjectGUID, string sKey)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sGUID,sKey,sValue,sPrjectGUID,sDesc,dCreateTime,dUpdateTime from tPrjectSet ");
            strSql.Append(" where sPrjectGUID=@sprjectGUID and sKey=@sKey");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sprjectGUID", SqlDbType.Char,     36),
                new SqlParameter("@sKey",        SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = prjectGUID;
            parameters[1].Value = sKey;
            LumluxSSYDB.Model.tPrjectSet model = new LumluxSSYDB.Model.tPrjectSet();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 获取用户配置的报警图片路径
 /// </summary>
 /// <param name="datas"></param>
 /// <returns></returns>
 public string GetSetImageUrl(string setName)
 {
     LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
     LumluxSSYDB.Model.tPrjectSet set_mod = set_bll.GetModelByWhere(PrjGUID, setName);
     if (set_mod != null)
     {
         return(set_mod.sValue);
     }
     return("2.png");
 }
Beispiel #3
0
 public string GetLng(string setkey)
 {
     LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
     LumluxSSYDB.Model.tPrjectSet set_mod = set_bll.GetModelByWhere(PrjGUID, setkey);
     if (set_mod != null)
     {
         return(set_mod.sValue);
     }
     return("120.6298828125");
 }
Beispiel #4
0
 public string GetLat(string setkey)
 {
     LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
     LumluxSSYDB.Model.tPrjectSet set_mod = set_bll.GetModelByWhere(PrjGUID, setkey);
     if (set_mod != null)
     {
         return(set_mod.sValue);
     }
     return("31.064698120353743");
 }
Beispiel #5
0
 public string GetSetValue(string setName, string sFeild)
 {
     LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
     LumluxSSYDB.Model.tPrjectSet set_mod = set_bll.GetModelByWhere(PrjGUID, setName);
     if (set_mod != null)
     {
         if (sFeild == "sValue")
         {
             return(set_mod.sValue);
         }
         if (sFeild == "sDesc")
         {
             return(set_mod.sDesc);
         }
     }
     return("");
 }
Beispiel #6
0
        public ControllerBaseHelper()
            : base()
        {
            List <HostInfoVM> list = new List <HostInfoVM>();

            LumluxSSYDB.BLL.tHostInfo bllhost = new LumluxSSYDB.BLL.tHostInfo();
            #region 加载顶部所有单灯报警
            DataTable allhostalarmdt = bllhost.GetHostInfo("dbo.tHostInfo.sProjectInfoGUID='" + PrjGUID + "' and dbo.tHostInfo.iState_Online=1 and dbo.tHostInfo.iState_Alarm=1");

            if (allhostalarmdt != null)
            {
                allhostalarmdt.Columns.Add("hostByLightCount");
                allhostalarmdt.Columns.Add("hostByAlarmLightCount");
                HostInfoVM hvms;
                foreach (DataRow dr in allhostalarmdt.Rows)
                {
                    hvms = addInfo(dr);
                    list.Add(hvms);
                }
                ViewBag.allAlarmhostlist = list;
            }
            else
            {
                ViewBag.allAlarmhostlist = new List <HostInfoVM>();
            }
            #endregion
            #region 加载该项目的logo图片
            LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
            LumluxSSYDB.Model.tPrjectSet set_mod = set_bll.GetModelByWhere(PrjGUID, "logoMain_0001");
            if (set_mod != null)
            {
                ViewBag.logoMain = set_mod.sValue;
            }
            else
            {
                ViewBag.logoMain = imageurl;
            }
            #endregion
            #region 用户相关
            ViewBag.UserName      = this.UserName;
            ViewBag.UserAuthority = this.UserAuthority;
            #endregion
        }
Beispiel #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LumluxSSYDB.Model.tPrjectSet model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tPrjectSet set ");
            strSql.Append("sKey=@sKey,");
            strSql.Append("sValue=@sValue,");
            strSql.Append("sPrjectGUID=@sPrjectGUID,");
            strSql.Append("sDesc=@sDesc,");
            strSql.Append("dCreateTime=@dCreateTime,");
            strSql.Append("dUpdateTime=@dUpdateTime");
            strSql.Append(" where sGUID=@sGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sKey",        SqlDbType.NVarChar,   50),
                new SqlParameter("@sValue",      SqlDbType.NVarChar,   50),
                new SqlParameter("@sPrjectGUID", SqlDbType.Char,       36),
                new SqlParameter("@sDesc",       SqlDbType.NVarChar,  500),
                new SqlParameter("@dCreateTime", SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime", SqlDbType.DateTime),
                new SqlParameter("@sGUID",       SqlDbType.Char, 36)
            };
            parameters[0].Value = model.sKey;
            parameters[1].Value = model.sValue;
            parameters[2].Value = model.sPrjectGUID;
            parameters[3].Value = model.sDesc;
            parameters[4].Value = model.dCreateTime;
            parameters[5].Value = model.dUpdateTime;
            parameters[6].Value = model.sGUID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #8
0
        /// <summary>
        /// 获取主机报了警的单灯总个数
        /// </summary>
        /// <param name="hostGUID"></param>
        /// <returns></returns>
        public int GetLightCountByHostGUID(string hostGUID, string IsAlarm)
        {
            int alarmCount = 0;

            LumluxSSYDB.BLL.tLightInfoes light_bll = new LumluxSSYDB.BLL.tLightInfoes();
            DataTable dt = light_bll.GetLightByWhereInfo(" li.iEnable=1 and sHostInfoGUID='" + hostGUID + "'");

            if (dt != null)
            {
                LumluxSSYDB.BLL.tPrjectSet   set_bll = new LumluxSSYDB.BLL.tPrjectSet();
                LumluxSSYDB.Model.tPrjectSet set_mod = new LumluxSSYDB.Model.tPrjectSet();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int RealTimeAlarm_Fault = Convert.ToInt32(ToString(dt.Rows[i]["iRealTimeAlarm_Fault"]) == "" ? "-1" : ToString(dt.Rows[i]["iRealTimeAlarm_Fault"]));
                    set_mod = set_bll.GetModelByWhere(PrjGUID, "Light_IsAlarm_" + RealTimeAlarm_Fault.ToString("D4"));
                    if (set_mod != null && set_mod.sValue == "Alarm")
                    {
                        alarmCount = alarmCount + 1;
                    }
                }
            }
            return(alarmCount);
        }
Beispiel #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LumluxSSYDB.Model.tPrjectSet model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tPrjectSet(");
            strSql.Append("sGUID,sKey,sValue,sPrjectGUID,sDesc,dCreateTime,dUpdateTime)");
            strSql.Append(" values (");
            strSql.Append("@sGUID,@sKey,@sValue,@sPrjectGUID,@sDesc,@dCreateTime,@dUpdateTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sGUID",       SqlDbType.Char,       36),
                new SqlParameter("@sKey",        SqlDbType.NVarChar,   50),
                new SqlParameter("@sValue",      SqlDbType.NVarChar,   50),
                new SqlParameter("@sPrjectGUID", SqlDbType.Char,       36),
                new SqlParameter("@sDesc",       SqlDbType.NVarChar,  500),
                new SqlParameter("@dCreateTime", SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime", SqlDbType.DateTime)
            };
            parameters[0].Value = model.sGUID;
            parameters[1].Value = model.sKey;
            parameters[2].Value = model.sValue;
            parameters[3].Value = model.sPrjectGUID;
            parameters[4].Value = model.sDesc;
            parameters[5].Value = model.dCreateTime;
            parameters[6].Value = model.dUpdateTime;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #10
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LumluxSSYDB.Model.tPrjectSet DataRowToModel(DataRow row)
 {
     LumluxSSYDB.Model.tPrjectSet model = new LumluxSSYDB.Model.tPrjectSet();
     if (row != null)
     {
         if (row["sGUID"] != null)
         {
             model.sGUID = row["sGUID"].ToString();
         }
         if (row["sKey"] != null)
         {
             model.sKey = row["sKey"].ToString();
         }
         if (row["sValue"] != null)
         {
             model.sValue = row["sValue"].ToString();
         }
         if (row["sPrjectGUID"] != null)
         {
             model.sPrjectGUID = row["sPrjectGUID"].ToString();
         }
         if (row["sDesc"] != null)
         {
             model.sDesc = row["sDesc"].ToString();
         }
         if (row["dCreateTime"] != null && row["dCreateTime"].ToString() != "")
         {
             model.dCreateTime = DateTime.Parse(row["dCreateTime"].ToString());
         }
         if (row["dUpdateTime"] != null && row["dUpdateTime"].ToString() != "")
         {
             model.dUpdateTime = DateTime.Parse(row["dUpdateTime"].ToString());
         }
     }
     return(model);
 }