Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.MenuBase GetModel(Guid m_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from MenuBase ");
            strSql.Append(" where m_ID=@m_ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@m_ID", SqlDbType.UniqueIdentifier,16)			};
            parameters[0].Value = m_ID;

            webs_YueyxShop.Model.MenuBase model = new webs_YueyxShop.Model.MenuBase();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.MenuBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.MenuBase model = new webs_YueyxShop.Model.MenuBase();
     if (row != null)
     {
         if (row["m_ID"] != null && row["m_ID"].ToString() != "")
         {
             model.m_ID = new Guid(row["m_ID"].ToString());
         }
         if (row["m_BianM"] != null)
         {
             model.m_BianM = row["m_BianM"].ToString();
         }
         if (row["m_MingCh"] != null)
         {
             model.m_MingCh = row["m_MingCh"].ToString();
         }
         if (row["m_CengJ"] != null && row["m_CengJ"].ToString() != "")
         {
             model.m_CengJ = int.Parse(row["m_CengJ"].ToString());
         }
         if (row["m_PaiX"] != null && row["m_PaiX"].ToString() != "")
         {
             model.m_PaiX = int.Parse(row["m_PaiX"].ToString());
         }
         if (row["m_ParentId"] != null && row["m_ParentId"].ToString() != "")
         {
             model.m_ParentId = new Guid(row["m_ParentId"].ToString());
         }
         if (row["m_CreatedOn"] != null && row["m_CreatedOn"].ToString() != "")
         {
             model.m_CreatedOn = DateTime.Parse(row["m_CreatedOn"].ToString());
         }
         if (row["m_CreatedBy"] != null && row["m_CreatedBy"].ToString() != "")
         {
             model.m_CreatedBy = new Guid(row["m_CreatedBy"].ToString());
         }
         if (row["m_StateCode"] != null && row["m_StateCode"].ToString() != "")
         {
             model.m_StateCode = int.Parse(row["m_StateCode"].ToString());
         }
         if (row["m_DeleteStateCode"] != null && row["m_DeleteStateCode"].ToString() != "")
         {
             model.m_DeleteStateCode = int.Parse(row["m_DeleteStateCode"].ToString());
         }
         if (row["m_Path"] != null)
         {
             model.m_Path = row["m_Path"].ToString();
         }
         if (row["m_Type"] != null && row["m_Type"].ToString() != "")
         {
             model.m_Type = int.Parse(row["m_Type"].ToString());
         }
         if (row["m_IsShow"] != null && row["m_IsShow"].ToString() != "")
         {
             if ((row["m_IsShow"].ToString() == "1") || (row["m_IsShow"].ToString().ToLower() == "true"))
             {
                 model.m_IsShow = true;
             }
             else
             {
                 model.m_IsShow = false;
             }
         }
         if (row["m_PageType"] != null)
         {
             model.m_PageType = row["m_PageType"].ToString();
         }
     }
     return model;
 }