/// <summary>
        /// Update one record
        /// </summary>
        public void Update(MDLSTopMainMenu model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("UPDATE [STopMainMenu] SET ");
            strSql.Append("[TopMenuId]=" + model.TopMenuId + ",");
			strSql.Append("[MenuCategoryId]=" + model.MenuCategoryId + "");
			strSql.Append(" WHERE [);
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
		/// <summary>
        /// Method to get one recoder by primary key
        /// </summary>    	 
        public MDLSTopMainMenu GetModel(int )
        {
			//Set up a return value
            MDLSTopMainMenu model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [TopMenuId], [MenuCategoryId] ");
            strSql.Append(" FROM [STopMainMenu] ");
            strSql.Append(" WHERE []=" + .ToString());
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                if (sdr.Read())
                    model = new MDLSTopMainMenu(sdr.GetInt32(0), sdr.GetInt32(1));
				else
                    model = new MDLSTopMainMenu();                
            }
            return model;
        }
		/// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<MDLSTopMainMenu> GetList()
        {
            IList<MDLSTopMainMenu> list = new List<MDLSTopMainMenu>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [TopMenuId], [MenuCategoryId] ");
            strSql.Append(" FROM [STopMainMenu] ");            

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    MDLSTopMainMenu item = new MDLSTopMainMenu(sdr.GetInt32(0), sdr.GetInt32(1));
                    list.Add(item);
                }
            }
            return list;
        }
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(MDLSTopMainMenu model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("INSERT INTO [STopMainMenu](");
            strSql.Append("[TopMenuId],[MenuCategoryId]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("" + model.TopMenuId + ",");
			strSql.Append("" + model.MenuCategoryId + "");
			strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(MDLSTopMainMenu model)
 {
     dal.Update(model);
 }
Esempio n. 6
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(MDLSTopMainMenu model)
 {
     return(dal.Add(model));
 }