本文整理汇总了C#中System.Result.Join方法的典型用法代码示例。如果您正苦于以下问题:C# Result.Join方法的具体用法?C# Result.Join怎么用?C# Result.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Result
的用法示例。
在下文中一共展示了Result.Join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
public static Result Register(String username, String password,Boolean supper)
{
Result result = new Result();
if (string.IsNullOrEmpty(username))
{
result.Add("Sorry,管理员账号不能为空");
}
else if (string.IsNullOrEmpty(password))
{
result.Add("Sorry,管理员密码不能为空");
}
else
{
if (password.Length != 32)
{
password = Encryptor.Md5Encryptor32(Encryptor.Md5Encryptor32(password));
}
result.Join(System.IO.XMLHelper.AddData(PathHelper.Map("~/xcenter/data/wechat/manager.xml"), "Manager", System.IO.XMLHelper.CreateInsertParameter("Username", username), System.IO.XMLHelper.CreateInsertParameter("Password", password), System.IO.XMLHelper.CreateInsertParameter("Supper", supper ? "true" : "false")));
}
return result;
}
示例2: ElasticThreadPool_Multi_Staged_Fibonacci_Min_1_Max_30
public void ElasticThreadPool_Multi_Staged_Fibonacci_Min_1_Max_30()
{
const int test = 4;
// initialize data structures
ElasticThreadPool[] stp = new ElasticThreadPool[test];
Result<int>[] results = new Result<int>[test];
for(int i = 0; i < test; ++i) {
stp[i] = new ElasticThreadPool(1, 30);
results[i] = new Result<int>(TimeSpan.MaxValue, TaskEnv.New(stp[i]));
}
// start test
var sw = Stopwatch.StartNew();
for(int i = 0; i < results.Length; ++i) {
_log.DebugFormat("--- FIBONACCI KICK-OFF: {0}", i);
Fibonacci(stp[i], 30, TimeSpan.Zero, results[i]);
Thread.Sleep(TimeSpan.FromSeconds(1));
}
results.Join(new Result(TimeSpan.MaxValue)).Wait();
sw.Stop();
TimeSpan elapsed = sw.Elapsed;
// check results
for(int i = 0; i < test; ++i) {
Assert.AreEqual(832040, results[i].Value, "result {0} did not match", i);
}
_log.Debug("Time: " + elapsed);
_log.Debug("Work items processed: " + _counter);
for(int i = 0; i < test; ++i) {
stp[i].Dispose();
Assert.AreEqual(0, stp[i].WorkItemCount, "WorkQueue[{0}] items", i);
Assert.AreEqual(0, stp[i].ThreadCount, "WorkQueue[{0}] threads", i);
}
}
示例3: Register
public virtual User Register( User user, Result errors, ISiteConfig sconfig )
{
if (isNameReserved( user.Name, sconfig )) {
errors.Add( lang.get( "exNameFound" ) );
return null;
}
if (isUrlReserved( user.Url, sconfig )) {
errors.Add( lang.get( "exUrlFound" ) );
return null;
}
if (validateUnique( user, errors ) == false) return null;
setProfileAndTemplateAndHashPasswork( user, sconfig );
user.RoleId = sconfig.NormalRoleId;
Result result = db.insert( user );
if (result.HasErrors) {
db.delete( user.Profile );
errors.Join( result );
return null;
}
if (strUtil.IsNullOrEmpty( user.Url )) {
user.Url = "user" + user.Id;
db.update( user, "Url" );
}
sendMsg( user, sconfig );
userIncomeService.InitUserIncome( user );
if (isFirstUser()) {
user.RoleId = sconfig.AdministratorId;
db.update( user, "RoleId" );
}
return user;
}