コード例 #1
0
		/// <summary>
        /// Method to get one recoder by primary key
        /// </summary>    	 
        public MDLAccountsRolePermissions GetModel(int )
        {
			//Set up a return value
            MDLAccountsRolePermissions model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [RoleId], [PermissionId] ");
            strSql.Append(" FROM [AccountsRolePermissions] ");
            strSql.Append(" WHERE []=" + .ToString());
            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                if (sdr.Read())
                    model = new MDLAccountsRolePermissions(sdr.GetInt32(0), sdr.GetInt32(1));
				else
                    model = new MDLAccountsRolePermissions();                
            }
            return model;
        }
コード例 #2
0
		/// <summary>
        /// Method to get recoders with condition
        /// </summary>    	 
        public IList<MDLAccountsRolePermissions> GetList()
        {
            IList<MDLAccountsRolePermissions> list = new List<MDLAccountsRolePermissions>();

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT [RoleId], [PermissionId] ");
            strSql.Append(" FROM [AccountsRolePermissions] ");            

            using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (sdr.Read())
                {
                    MDLAccountsRolePermissions item = new MDLAccountsRolePermissions(sdr.GetInt32(0), sdr.GetInt32(1));
                    list.Add(item);
                }
            }
            return list;
        }
コード例 #3
0
        /// <summary>
        /// Add one record
        /// </summary>
        public int Add(MDLAccountsRolePermissions model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("INSERT INTO [AccountsRolePermissions](");
            strSql.Append("[RoleId],[PermissionId]");
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append("" + model.RoleId + ",");
			strSql.Append("" + model.PermissionId + "");
			strSql.Append(")");
            strSql.Append(";SELECT @@IDENTITY");
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
コード例 #4
0
        /// <summary>
        /// Update one record
        /// </summary>
        public void Update(MDLAccountsRolePermissions model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("UPDATE [AccountsRolePermissions] SET ");
            strSql.Append("[RoleId]=" + model.RoleId + ",");
			strSql.Append("[PermissionId]=" + model.PermissionId + "");
			strSql.Append(" WHERE [);
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
コード例 #5
0
 /// <summary>
 /// Update one record
 /// </summary>
 public void Update(MDLAccountsRolePermissions model)
 {
 	dal.Update(model);
 }
コード例 #6
0
 /// <summary>
 /// Add one record
 /// </summary>
 public int Add(MDLAccountsRolePermissions model)
 {
     return dal.Add(model);
 }