Example #1
0
 public Model.Sys_Menu DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.Sys_Menu model = new TDTK.PlatForm.MVC4.Model.Sys_Menu();
     if (row != null)
     {
         if (row["MenuID"] != null)
         {
             model.MenuID = row["MenuID"].ToString();
         }
         if (row["MenuName"] != null)
         {
             model.MenuName = row["MenuName"].ToString();
         }
         if (row["MenuUrl"] != null)
         {
             model.MenuUrl = row["MenuUrl"].ToString();
         }
         if (row["FunctionID"] != null)
         {
             model.FunctionID = row["FunctionID"].ToString();
         }
         if (row["IsLeaf"] != null)
         {
             model.IsLeaf = row["IsLeaf"].ToString();
         }
         if (row["MenuLevel"] != null)
         {
             model.MenuLevel = row["MenuLevel"].ToString();
         }
         if (row["RootID"] != null)
         {
             model.RootID = row["RootID"].ToString();
         }
         if (row["ParentsID"] != null)
         {
             model.ParentsID = row["ParentsID"].ToString();
         }
         if (row["DisplayOrder"] != null && row["DisplayOrder"].ToString() != "")
         {
             model.DisplayOrder = decimal.Parse(row["DisplayOrder"].ToString());
         }
         if (row["IcValue"] != null)
         {
             model.IcValue = row["IcValue"].ToString();
         }
         if (row["IsPop"] != null)
         {
             model.IsPop = row["IsPop"].ToString();
         }
         if (row["MenuSeq"] != null)
         {
             model.MenuSeq = row["MenuSeq"].ToString();
         }
     }
     return model;
 }
Example #2
0
        public Model.Sys_Menu GetModel(Model.Sys_Menu t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 MenuID,MenuName,MenuUrl,FunctionID,IsLeaf,MenuLevel,RootID,ParentsID,DisplayOrder,IcValue,IsPop,MenuSeq from Sys_Menu ");
            strSql.Append(" where MenuID=@MenuID ");
            SqlParameter[] parameters = {
					new SqlParameter("@MenuID", SqlDbType.NVarChar,20)			};
            parameters[0].Value = t.MenuID;

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