コード例 #1
0
        public void TestGetPrimaryMetadataForEveryone()
        {
            // Blow away excessive nychanis data.
            FastDAO <NycDatum> dataDao = new FastDAO <NycDatum>("PDP.Data", "NYCHANIS");
            DaoCriteria        crit    = new DaoCriteria();

            crit.Expressions.Add(new EqualExpression("IndicatorId", 201, false));
            crit.Expressions.Add(new GreaterExpression("IndicatorId", 10));
            dataDao.Delete(crit);

            // And also excessive PDB data.
            PdbTwoTableHelper helper = new PdbTwoTableHelper(Config.GetConfig("PDP.Data"), "Properties",
                                                             PdbEntityType.Properties);
            DictionaryDao primaryPdbDao = new DictionaryDao(
                dataDao.ConnDesc, helper.GetClassMapForPrimaryTable(new SecurityRole[] { SecurityRole.@public }));
            FastDAO <PdbSecondaryTableProperty> secondaryPdbDao = new FastDAO <PdbSecondaryTableProperty>(
                dataDao.ConnDesc, helper.GetClassMapForSecondaryTable());

            crit.Expressions.Clear();
            crit.Expressions.Add(new GreaterExpression("UID", 100630));
            primaryPdbDao.Delete(crit);
            crit.Expressions.Clear();
            crit.Expressions.Add(new GreaterExpression("ForeignKey", 100630));
            secondaryPdbDao.Delete(crit);
        }
コード例 #2
0
ファイル: UserHelper.cs プロジェクト: FurmanCenter/SHIP
 /// <summary>
 /// Deletes the record of the given user.
 /// </summary>
 /// <param name="userName">The user to be deleted.</param>
 /// <returns>The number of records deleted. Should be 1 when successful.</returns>
 public static int DeleteUser(string userName)
 {
     // If there is a user, return the record
     if (StringHelper.IsNonBlank(userName))
     {
         DaoCriteria crit = new DaoCriteria();
         crit.Expressions.Add(new EqualExpression("UserName", userName));
         return(_userDao.Delete(crit));
     }
     return(0);
 }
コード例 #3
0
 /// <summary>
 /// Removes a comment from
 /// </summary>
 /// <param name="user"></param>
 public void Delete(User user)
 {
     AssertModifyAuthorization(user);
     _dao.Delete(this);
 }