Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.UserRelation.UserGroup DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.UserRelation.UserGroup model=new KryptonAccessController.SQLite.Model.UserRelation.UserGroup();
     if (row != null)
     {
         if(row["UserGroupID"]!=null && row["UserGroupID"].ToString()!="")
         {
             model.UserGroupID=int.Parse(row["UserGroupID"].ToString());
         }
         if(row["UserGroupName"]!=null)
         {
             model.UserGroupName=row["UserGroupName"].ToString();
         }
         if(row["UserGroupDes"]!=null)
         {
             model.UserGroupDes=row["UserGroupDes"].ToString();
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.UserRelation.UserGroup GetModel(int UserGroupID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select UserGroupID,UserGroupName,UserGroupDes from UserGroup ");
            strSql.Append(" where [email protected] ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@UserGroupID", DbType.Int32,4)			};
            parameters[0].Value = UserGroupID;

            KryptonAccessController.SQLite.Model.UserRelation.UserGroup model=new KryptonAccessController.SQLite.Model.UserRelation.UserGroup();
            DataSet ds=DbHelperSQLite.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }