/// <summary> /// 更新一条数据 /// </summary> public bool Update(LumluxSSYDB.Model.tLightInfoLightGroupInfoes model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tLightInfoLightGroupInfoes set "); strSql.Append("sLightInfoGUID=@sLightInfoGUID,"); strSql.Append("sLightGroupInfoGUID=@sLightGroupInfoGUID,"); strSql.Append("dCreateTime=@dCreateTime,"); strSql.Append("dUpdateTime=@dUpdateTime"); strSql.Append(" where sGUID=@sGUID "); SqlParameter[] parameters = { new SqlParameter("@sLightInfoGUID", SqlDbType.Char, 36), new SqlParameter("@sLightGroupInfoGUID", SqlDbType.Char, 36), new SqlParameter("@dCreateTime", SqlDbType.DateTime), new SqlParameter("@dUpdateTime", SqlDbType.DateTime), new SqlParameter("@sGUID", SqlDbType.Char, 36) }; parameters[0].Value = model.sLightInfoGUID; parameters[1].Value = model.sLightGroupInfoGUID; parameters[2].Value = model.dCreateTime; parameters[3].Value = model.dUpdateTime; parameters[4].Value = model.sGUID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public LumluxSSYDB.Model.tLightInfoLightGroupInfoes DataRowToModel(DataRow row) { LumluxSSYDB.Model.tLightInfoLightGroupInfoes model = new LumluxSSYDB.Model.tLightInfoLightGroupInfoes(); if (row != null) { if (row["sGUID"] != null) { model.sGUID = row["sGUID"].ToString(); } if (row["sLightInfoGUID"] != null) { model.sLightInfoGUID = row["sLightInfoGUID"].ToString(); } if (row["sLightGroupInfoGUID"] != null) { model.sLightGroupInfoGUID = row["sLightGroupInfoGUID"].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); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(LumluxSSYDB.Model.tLightInfoLightGroupInfoes model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tLightInfoLightGroupInfoes("); strSql.Append("sGUID,sLightInfoGUID,sLightGroupInfoGUID,dCreateTime,dUpdateTime)"); strSql.Append(" values ("); strSql.Append("@sGUID,@sLightInfoGUID,@sLightGroupInfoGUID,@dCreateTime,@dUpdateTime)"); SqlParameter[] parameters = { new SqlParameter("@sGUID", SqlDbType.Char, 36), new SqlParameter("@sLightInfoGUID", SqlDbType.Char, 36), new SqlParameter("@sLightGroupInfoGUID", SqlDbType.Char, 36), new SqlParameter("@dCreateTime", SqlDbType.DateTime), new SqlParameter("@dUpdateTime", SqlDbType.DateTime) }; parameters[0].Value = model.sGUID; parameters[1].Value = model.sLightInfoGUID; parameters[2].Value = model.sLightGroupInfoGUID; parameters[3].Value = model.dCreateTime; parameters[4].Value = model.dUpdateTime; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public LumluxSSYDB.Model.tLightInfoLightGroupInfoes GetModel(string sGUID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 sGUID,sLightInfoGUID,sLightGroupInfoGUID,dCreateTime,dUpdateTime from tLightInfoLightGroupInfoes "); strSql.Append(" where sGUID=@sGUID "); SqlParameter[] parameters = { new SqlParameter("@sGUID", SqlDbType.Char, 36) }; parameters[0].Value = sGUID; LumluxSSYDB.Model.tLightInfoLightGroupInfoes model = new LumluxSSYDB.Model.tLightInfoLightGroupInfoes(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }