Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KSOA.Model.Admin_SysMenu DataRowToModel(DataRow row)
 {
     KSOA.Model.Admin_SysMenu model=new KSOA.Model.Admin_SysMenu();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=int.Parse(row["ID"].ToString());
         }
         if(row["ParentID"]!=null && row["ParentID"].ToString()!="")
         {
             model.ParentID=int.Parse(row["ParentID"].ToString());
         }
         if(row["MenuName"]!=null)
         {
             model.MenuName=row["MenuName"].ToString();
         }
         if(row["MenuUrl"]!=null)
         {
             model.MenuUrl=row["MenuUrl"].ToString();
         }
         if(row["OrderIndex"]!=null && row["OrderIndex"].ToString()!="")
         {
             model.OrderIndex=int.Parse(row["OrderIndex"].ToString());
         }
         if(row["AdminRoleID"]!=null && row["AdminRoleID"].ToString()!="")
         {
             model.AdminRoleID=int.Parse(row["AdminRoleID"].ToString());
         }
         if(row["IsEnable"]!=null && row["IsEnable"].ToString()!="")
         {
             if((row["IsEnable"].ToString()=="1")||(row["IsEnable"].ToString().ToLower()=="true"))
             {
                 model.IsEnable=true;
             }
             else
             {
                 model.IsEnable=false;
             }
         }
         if(row["IsDelete"]!=null && row["IsDelete"].ToString()!="")
         {
             if((row["IsDelete"].ToString()=="1")||(row["IsDelete"].ToString().ToLower()=="true"))
             {
                 model.IsDelete=true;
             }
             else
             {
                 model.IsDelete=false;
             }
         }
         if(row["AddTime"]!=null && row["AddTime"].ToString()!="")
         {
             model.AddTime=DateTime.Parse(row["AddTime"].ToString());
         }
     }
     return model;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KSOA.Model.Admin_SysMenu GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ID,ParentID,MenuName,MenuUrl,OrderIndex,AdminRoleID,IsEnable,IsDelete,AddTime from Admin_SysMenu ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

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