Exemple #1
0
        /// <summary>
        /// 返回单灯分组
        /// </summary>
        /// <returns></returns>
        public JsonResult ReturnLightGroup(string sGUID)
        {
            LumluxSSYDB.BLL.tLightGroupInfoes   blllightgroup = new LumluxSSYDB.BLL.tLightGroupInfoes();
            LumluxSSYDB.Model.tLightGroupInfoes modlightgroup = new LumluxSSYDB.Model.tLightGroupInfoes();
            LightGroupViewModel lightGroupVM = new LightGroupViewModel();
            LightGroupInfoeVM   lgvm;

            if (!string.IsNullOrWhiteSpace(sGUID))
            {
                //查询单灯分组
                List <LumluxSSYDB.Model.tLightGroupInfoes> dt2 = blllightgroup.GetModelListByHostGUID(sGUID);
                if (dt2 != null)
                {
                    foreach (var item2 in dt2)
                    {
                        lgvm      = new LightGroupInfoeVM();
                        lgvm.GUID = item2.sGUID.ToString();
                        if (string.IsNullOrWhiteSpace(item2.sName))
                        {
                            lgvm.Name = "未命名";
                        }
                        else
                        {
                            lgvm.Name = item2.sName.ToString();
                        }
                        lightGroupVM.LightGroupInfoes.Add(lgvm);
                    }
                }
                return(Json(lightGroupVM));
            }
            else
            {
                return(Json(""));
            }
        }
Exemple #2
0
        /// <summary>
        /// 获取组名
        /// </summary>
        /// <param name="sGUID"></param>
        /// <returns></returns>
        private string GetGroupNameByGUID(string sGUID)
        {
            string GroupName = null;

            LumluxSSYDB.BLL.tLightGroupInfoes   lbtg = new LumluxSSYDB.BLL.tLightGroupInfoes();
            LumluxSSYDB.Model.tLightGroupInfoes lmtg = lbtg.GetModel(sGUID);
            if (lmtg != null)
            {
                GroupName = lmtg.sName;
            }
            return(GroupName);
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LumluxSSYDB.Model.tLightGroupInfoes model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tLightGroupInfoes set ");
            strSql.Append("sName=@sName,");
            strSql.Append("sHostInfoGUID=@sHostInfoGUID,");
            strSql.Append("sID=@sID,");
            strSql.Append("dCreateTime=@dCreateTime,");
            strSql.Append("dUpdateTime=@dUpdateTime,");
            strSql.Append("sRemark=@sRemark");
            strSql.Append(" where sGUID=@sGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sName",         SqlDbType.NVarChar,  100),
                new SqlParameter("@sHostInfoGUID", SqlDbType.Char,       36),
                new SqlParameter("@sID",           SqlDbType.VarChar,    10),
                new SqlParameter("@dCreateTime",   SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@sRemark",       SqlDbType.NVarChar,  500),
                new SqlParameter("@sGUID",         SqlDbType.Char, 36)
            };
            parameters[0].Value = model.sName;
            parameters[1].Value = model.sHostInfoGUID;
            parameters[2].Value = model.sID;
            parameters[3].Value = model.dCreateTime;
            parameters[4].Value = model.dUpdateTime;
            parameters[5].Value = model.sRemark;
            parameters[6].Value = model.sGUID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LumluxSSYDB.Model.tLightGroupInfoes model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tLightGroupInfoes(");
            strSql.Append("sGUID,sName,sHostInfoGUID,sID,dCreateTime,dUpdateTime,sRemark)");
            strSql.Append(" values (");
            strSql.Append("@sGUID,@sName,@sHostInfoGUID,@sID,@dCreateTime,@dUpdateTime,@sRemark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sGUID",         SqlDbType.Char,       36),
                new SqlParameter("@sName",         SqlDbType.NVarChar,  100),
                new SqlParameter("@sHostInfoGUID", SqlDbType.Char,       36),
                new SqlParameter("@sID",           SqlDbType.VarChar,    10),
                new SqlParameter("@dCreateTime",   SqlDbType.DateTime),
                new SqlParameter("@dUpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@sRemark",       SqlDbType.NVarChar, 500)
            };
            parameters[0].Value = model.sGUID;
            parameters[1].Value = model.sName;
            parameters[2].Value = model.sHostInfoGUID;
            parameters[3].Value = model.sID;
            parameters[4].Value = model.dCreateTime;
            parameters[5].Value = model.dUpdateTime;
            parameters[6].Value = model.sRemark;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LumluxSSYDB.Model.tLightGroupInfoes DataRowToModel(DataRow row)
 {
     LumluxSSYDB.Model.tLightGroupInfoes model = new LumluxSSYDB.Model.tLightGroupInfoes();
     if (row != null)
     {
         if (row["sGUID"] != null)
         {
             model.sGUID = row["sGUID"].ToString();
         }
         if (row["sName"] != null)
         {
             model.sName = row["sName"].ToString();
         }
         if (row["sHostInfoGUID"] != null)
         {
             model.sHostInfoGUID = row["sHostInfoGUID"].ToString();
         }
         if (row["sID"] != null)
         {
             model.sID = row["sID"].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());
         }
         if (row["sRemark"] != null)
         {
             model.sRemark = row["sRemark"].ToString();
         }
     }
     return(model);
 }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LumluxSSYDB.Model.tLightGroupInfoes GetModel(string sGUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 sGUID,sName,sHostInfoGUID,sID,dCreateTime,dUpdateTime,sRemark from tLightGroupInfoes ");
            strSql.Append(" where sGUID=@sGUID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sGUID", SqlDbType.Char, 36)
            };
            parameters[0].Value = sGUID;

            LumluxSSYDB.Model.tLightGroupInfoes model = new LumluxSSYDB.Model.tLightGroupInfoes();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }