示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.userfun DataRowToModel(DataRow row)
 {
     Maticsoft.Model.userfun model=new Maticsoft.Model.userfun();
     if (row != null)
     {
         if(row["funid"]!=null && row["funid"].ToString()!="")
         {
             model.funid=int.Parse(row["funid"].ToString());
         }
         if(row["funno"]!=null)
         {
             model.funno=row["funno"].ToString();
         }
         if(row["funname"]!=null)
         {
             model.funname=row["funname"].ToString();
         }
         if(row["fatherid"]!=null && row["fatherid"].ToString()!="")
         {
             model.fatherid=int.Parse(row["fatherid"].ToString());
         }
     }
     return model;
 }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.userfun GetModel(int funid)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 funid,funno,funname,fatherid from userfun ");
            strSql.Append(" where funid=@funid ");
            SqlParameter[] parameters = {
                    new SqlParameter("@funid", SqlDbType.Int,4)			};
            parameters[0].Value = funid;

            Maticsoft.Model.userfun model=new Maticsoft.Model.userfun();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }