• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Result的典型用法代码示例。如果您正苦于以下问题:C# Result类的具体用法?C# Result怎么用?C# Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Result类属于System命名空间,在下文中一共展示了Result类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MigrateDB

        public static void MigrateDB()
        {
            SQLSvrDbi.DbConnectionString = Configuration.Configurator.GetDBConnString(SourceDBConnName);
            GemFireXDDbi.DbConnectionString = Configuration.Configurator.GetDBConnString(DestDBConnName);

            try
            {
                if (MigrateTables)
                    MigrateDbTables();
                if (MigrateViews)
                    MigrateDbViews();
                if (MigrateIndexes)
                    MigrateDbIndexes();
                if (MigrateProcedures)
                    MigrateDbStoredProcedures();
                if (MigrateFunctions)
                    MigrateDbFunctions();
                if (MigrateTriggers)
                    MigrateDbTriggers();
            }
            catch (ThreadAbortException e)
            {
                Result = Result.Aborted;
                OnMigrateEvent(new MigrateEventArgs(Result.Aborted, "Operation aborted!"));
            }
            catch (Exception e)
            {
                Helper.Log(e);
            }
            finally
            {
                dbTableList.Clear();
            }
        }
开发者ID:leloulight,项目名称:gemfirexd-oss,代码行数:34,代码来源:Migrator.cs


示例2: GetTags

        public Yield GetTags(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
            string type = DreamContext.Current.GetParam("type", "");
            string fromStr = DreamContext.Current.GetParam("from", "");
            string toStr = DreamContext.Current.GetParam("to", "");
            bool showPages = DreamContext.Current.GetParam("pages", false);
            string partialName = DreamContext.Current.GetParam("q", "");

            // parse type
            TagType tagType = TagType.ALL;
            if(!string.IsNullOrEmpty(type) && !SysUtil.TryParseEnum(type, out tagType)) {
                throw new DreamBadRequestException("Invalid type parameter");
            }

            // check and validate from date
            DateTime from = (tagType == TagType.DATE) ? DateTime.Now : DateTime.MinValue;
            if(!string.IsNullOrEmpty(fromStr) && !DateTime.TryParse(fromStr, out from)) {
                throw new DreamBadRequestException("Invalid from date parameter");
            }

            // check and validate to date
            DateTime to = (tagType == TagType.DATE) ? from.AddDays(30) : DateTime.MaxValue;
            if(!string.IsNullOrEmpty(toStr) && !DateTime.TryParse(toStr, out to)) {
                throw new DreamBadRequestException("Invalid to date parameter");
            }

            // execute query
            var tags = TagBL.GetTags(partialName, tagType, from, to);
            XDoc doc = TagBL.GetTagListXml(tags, "tags", null, showPages);
            response.Return(DreamMessage.Ok(doc));
            yield break;
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:31,代码来源:DekiWiki-Tags.cs


示例3: Validate

        public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result )
        {
            Object obj = target.get( info.Name );

            Boolean isNull = false;
            if (info.Type == typeof( String )) {
                if (obj == null) {
                    isNull = true;
                }
                else if (strUtil.IsNullOrEmpty( obj.ToString() )) {
                    isNull = true;
                }
            }
            else if (obj == null) {
                isNull = true;
            }

            if (isNull) {
                if (strUtil.HasText( this.Message )) {
                    result.Add( this.Message );
                }
                else {
                    EntityInfo ei = Entity.GetInfo( target );
                    String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
                    result.Add( str + "can not be null" );
                }
            }
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:28,代码来源:NotNullAttribute.cs


示例4: Search

        public Result Search(N2.Persistence.Search.Query query)
        {
            if (!query.IsValid())
                return Result.Empty;

            var s = accessor.GetSearcher();
            try
            {
                var q = CreateQuery(query);
                var hits = s.Search(q, query.SkipHits + query.TakeHits);

                var result = new Result();
                result.Total = hits.totalHits;
                var resultHits = hits.scoreDocs.Skip(query.SkipHits).Take(query.TakeHits).Select(hit =>
                {
                    var doc = s.Doc(hit.doc);
                    int id = int.Parse(doc.Get("ID"));
                    ContentItem item = persister.Get(id);
                    return new Hit { Content = item, Score = hit.score };
                }).Where(h => h.Content != null).ToList();
                result.Hits = resultHits;
                result.Count = resultHits.Count;
                return result;
            }
            finally
            {
                //s.Close();
            }
        }
开发者ID:wrohrbach,项目名称:n2cms,代码行数:29,代码来源:LuceneSearcher.cs


示例5: Buy

        public virtual Result Buy( int buyerId, int creatorId, ForumTopic topic )
        {
            Result result = new Result();
            if (userIncomeService.HasEnoughKeyIncome( buyerId, topic.Price ) == false) {
                result.Add( String.Format( alang.get( typeof( ForumApp ), "exIncome" ), KeyCurrency.Instance.Name ) );
                return result;
            }

            // 日志:买方减少收入
            UserIncomeLog log = new UserIncomeLog();
            log.UserId = buyerId;
            log.CurrencyId = KeyCurrency.Instance.Id;
            log.Income = -topic.Price;
            log.DataId = topic.Id;
            log.ActionId = actionId;
            db.insert( log );

            // 日志:卖方增加收入
            UserIncomeLog log2 = new UserIncomeLog();
            log2.UserId = creatorId;
            log2.CurrencyId = KeyCurrency.Instance.Id;
            log2.Income = topic.Price;
            log2.DataId = topic.Id;
            log2.ActionId = actionId;
            db.insert( log2 );

            userIncomeService.AddKeyIncome( buyerId, -topic.Price );
            userIncomeService.AddKeyIncome( creatorId, topic.Price );

            return result;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:31,代码来源:ForumBuyLogService.cs


示例6: GetServiceById

        public Yield GetServiceById(DreamContext context, DreamMessage request, Result<DreamMessage> response) {

            bool privateDetails = PermissionsBL.IsUserAllowed(DekiContext.Current.User, Permissions.ADMIN);

            //Private feature requires api-key
            var identifier = context.GetParam("id");
            uint serviceId = 0;
            if(identifier.StartsWith("=")) {
                var serviceInfo = DekiContext.Current.Instance.RunningServices[XUri.Decode(identifier.Substring(1))];
                if(serviceInfo != null) {
                    serviceId = serviceInfo.ServiceId;
                }
            } else {
                if(!uint.TryParse(identifier, out serviceId)) {
                    throw new DreamBadRequestException(string.Format("Invalid id '{0}'", identifier));
                }
            }
            ServiceBE service = ServiceBL.GetServiceById(serviceId);
            DreamMessage responseMsg = null;
            if(service == null) {
                responseMsg = DreamMessage.NotFound(string.Format(DekiResources.SERVICE_NOT_FOUND, identifier));
            } else {
                responseMsg = DreamMessage.Ok(ServiceBL.GetServiceXmlVerbose(DekiContext.Current.Instance, service, null, privateDetails));
            }
            response.Return(responseMsg);
            yield break;
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:27,代码来源:DekiWiki-Services.cs


示例7: GetHistoryCmds

        private List<Result> GetHistoryCmds(string cmd, Result result)
        {
            IEnumerable<Result> history = CMDStorage.Instance.CMDHistory.Where(o => o.Key.Contains(cmd))
                .OrderByDescending(o => o.Value)
                .Select(m =>
                {
                    if (m.Key == cmd)
                    {
                        result.SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value);
                        return null;
                    }

                    var ret = new Result
                    {
                        Title = m.Key,
                        SubTitle =  string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value),
                        IcoPath = "Images/cmd.png",
                        Action = (c) =>
                        {
                            ExecuteCmd(m.Key);
                            return true;
                        }
                    };
                    return ret;
                }).Where(o => o != null).Take(4);
            return history.ToList();
        }
开发者ID:gotatsu,项目名称:Wox,代码行数:27,代码来源:CMD.cs


示例8: Process

        public override Result Process(Result result)
        {
            if(result.Line.StartsWith("#"))
            {

                if(result.Line.StartsWith(Constants.HeaderField))
                {
                    LogContext.Storage.Insert(GetStorageKey(result), new FieldParser().ParseFields(result.Line));
                }

                result.Canceled = true;
                return result;
            }

            try
            {
                var parsedLine = ParseLine(result);
                result.EventTimeStamp = parsedLine.TimeStamp;

                foreach(var field in parsedLine.Fields)
                {
                    var token = FieldToJToken.Parse(field);
                    result.Json.Add(field.Key, token);
                }

                return result;
            }
            catch(Exception ex)
            {
                Log.ErrorException("Line: " + result.Line + " could not be parsed.", ex);
                result.Canceled = true;
                return result;
            }
        }
开发者ID:fatbwif,项目名称:LogFlow,代码行数:34,代码来源:IISLogProcessor.cs


示例9: GetUserAllOrder

 //获取用户的所有有效订单数据
 public Result<List<OrderViewModel>> GetUserAllOrder(int userId,List<int> orderStatus)
 {
     var result = new Result<List<OrderViewModel>>();
     result.Data= orderDataAccess.GetUserAllOrder(userId, orderStatus);
     result.Status = new Status() {Code = "1"};
     return result;
 }
开发者ID:BHfeimao,项目名称:DotNetStudio,代码行数:8,代码来源:OrderService.cs


示例10: Query

 public override List<Result> Query(Query query)
 {
     if (query.RawQuery == "h mem")
     {
         var rl = new List<Result>();
         var r = new Result();
         r.Title = GetTotalPhysicalMemory();
         r.SubTitle = "Copy this number to the clipboard";
         r.IcoPath = "[Res]:sys";
         r.Score = 100;
         r.Action = e =>
         {
             context_.Api.HideAndClear();
             try
             {
                 Clipboard.SetText(r.Title);
                 return true;
             }
             catch (System.Runtime.InteropServices.ExternalException)
             {
                 return false;
             }
         };
         rl.Add(r);
         return rl;
     }
     return null;
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:28,代码来源:Main.cs


示例11: Optimize

 static Result Optimize(Result current, Func<double[],double> evaluator)
 {
     bool[,] tried = new bool[current.vector.Length, 2];
     int coordinate = 0;
     int direction = 0;
     bool cont = false;
     Result newResult = null;
     while(true)
     {
         if (tried.Cast<bool>().All(z => z)) break;
         coordinate = rnd.Next(current.vector.Length);
         direction = rnd.Next(2);
         if (tried[coordinate, direction]) continue;
         tried[coordinate, direction] = true;
         newResult = Shift(current, coordinate, direction, evaluator);
         if (newResult.value > current.value)
         {
             cont = true;
             break;
         }
     }
     if (!cont) return null;
     for (int i=0;i<10;i++)
     {
         var veryNew = Shift(newResult, coordinate, direction, evaluator);
         if (veryNew.value <= newResult.value) return newResult;
         newResult = veryNew;
     }
     return newResult;
 }
开发者ID:xoposhiy,项目名称:icfpc2015,代码行数:30,代码来源:GradientOptimizer.cs


示例12: Main

        public static void Main()
        {
            maps = mapIndices
               .Select(z => Problems.LoadProblems()[z].ToMap(Seed))
               .ToArray();

            var vector = new double[WeightedMetric.KnownFunctions.Count()];
            for (int i=0;i<WeightedMetric.KnownFunctions.Count();i++)
            {
                var test = WeightedMetric.Test.Where(z => z.Function == WeightedMetric.KnownFunctions.ElementAt(i)).FirstOrDefault();
                if (test == null) continue;
                vector[i] = test.Weight;
            }

            Console.Write(Print(vector)+"\t BASELINE");
            baseline = Run(vector);
            var current = new Result { vector = vector, value = 1 };
            Console.WriteLine("  OK");
            while (true)
            {
                var newCurrent = Optimize(current, Evaluate);
                if (newCurrent != null)
                {
                    current = newCurrent;
                    Console.WriteLine(Print(current.vector) + "\t OPT\t" + current.value);
                    continue;
                }
                else
                {
                    Console.WriteLine(Print(current.vector) + "\t END\t" + current.value);
                    Console.ReadKey();
                    break;
                }
            }
        }
开发者ID:xoposhiy,项目名称:icfpc2015,代码行数:35,代码来源:GradientOptimizer.cs


示例13: Delete

		public Result<bool> Delete(string aSourceId, string rev, Result<bool> aResult)
		{
			ArgCheck.NotNullNorEmpty("aSourceId", aSourceId);

			Coroutine.Invoke(DeleteHelper, aSourceId, rev, aResult);
			return aResult;
		}
开发者ID:willemda,项目名称:FoireMuses,代码行数:7,代码来源:SourceController.cs


示例14: GetArchiveFiles

 public Yield GetArchiveFiles(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.ADMIN);
     IList<AttachmentBE> removedFiles = AttachmentBL.Instance.GetResources(DeletionFilter.DELETEDONLY, null, null);
     XDoc responseXml = AttachmentBL.Instance.GetFileXml(removedFiles, true, "archive", null, null);            
     response.Return(DreamMessage.Ok(responseXml));
     yield break;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:7,代码来源:DekiWiki-RecycleBin.cs


示例15: GetSiteStatus

 public Yield GetSiteStatus(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     PermissionsBL.CheckUserAllowed(DekiContext.Current.User, Permissions.UPDATE);
     var status = new XDoc("status")
         .Elem("state", DekiContext.Current.Instance.Status);
     response.Return(DreamMessage.Ok(status));
     yield break;
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:7,代码来源:DekiWiki-Site.cs


示例16: OnSpecificationEnd

 public void OnSpecificationEnd(SpecificationInfo specification, Result result)
 {
   switch (result.Status)
   {
     case Status.Passing:
       _writer.WriteTestFinished(GetSpecificationName(specification), TimeSpan.Zero);
       break;
     case Status.NotImplemented:
       _writer.WriteTestIgnored(GetSpecificationName(specification), "(Not Implemented)");
       break;
     case Status.Ignored:
       _writer.WriteTestIgnored(GetSpecificationName(specification), "(Ignored)");
       break;
     default:
       if (result.Exception != null)
       {
         _writer.WriteTestFailed(GetSpecificationName(specification), 
           result.Exception.Message, result.Exception.StackTrace);
       }
       else
       {
         _writer.WriteTestFailed(GetSpecificationName(specification), "FAIL", "");
       }
       _failureOccured = true;
       break;
   }
 }
开发者ID:benlovell,项目名称:machine.specifications,代码行数:27,代码来源:TeamCityReporter.cs


示例17: parse

		public static AddressBookParsedResult parse(Result result)
		{
			string text = result.Text;
			if (text == null || !text.StartsWith("MECARD:"))
			{
				return null;
			}
			string[] array = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("N:", text, true);
			if (array == null)
			{
				return null;
			}
			string value_Renamed = AddressBookDoCoMoResultParser.parseName(array[0]);
			string pronunciation = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("SOUND:", text, true);
			string[] phoneNumbers = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("TEL:", text, true);
			string[] emails = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("EMAIL:", text, true);
			string note = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("NOTE:", text, false);
			string[] addresses = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("ADR:", text, true);
			string text2 = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("BDAY:", text, true);
			if (text2 != null && !ResultParser.isStringOfDigits(text2, 8))
			{
				text2 = null;
			}
			string url = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("URL:", text, true);
			string org = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("ORG:", text, true);
			return new AddressBookParsedResult(ResultParser.maybeWrap(value_Renamed), pronunciation, phoneNumbers, emails, note, addresses, org, text2, null, url);
		}
开发者ID:Natsuwind,项目名称:DeepInSummer,代码行数:27,代码来源:AddressBookDoCoMoResultParser.cs


示例18: FireOnResult

 private void FireOnResult(Result newResult)
 {
     if (OnResult != null)
     {
         OnResult(newResult);
     }
 }
开发者ID:xkenia,项目名称:liveresults,代码行数:7,代码来源:Jwoc2014Parser.cs


示例19: checkUploadPic

        /// <summary>
        /// 检查上传的图片是否合法
        /// </summary>
        /// <param name="postedFile"></param>
        /// <param name="errors"></param>
        public static void checkUploadPic( HttpFile postedFile, Result errors )
        {
            if (postedFile == null) {
                errors.Add( lang.get( "exPlsUpload" ) );
                return;
            }

            // 检查文件大小
            if (postedFile.ContentLength <= 1) {
                errors.Add( lang.get( "exPlsUpload" ) );
                return;
            }

            int uploadMax = 1024 * 1024 * config.Instance.Site.UploadPicMaxMB;
            if (postedFile.ContentLength > uploadMax) {
                errors.Add( lang.get( "exUploadMax" ) + " " + config.Instance.Site.UploadPicMaxMB + " MB" );
                return;
            }

            // TODO: (flash upload) application/octet-stream
            //if (postedFile.ContentType.ToLower().IndexOf( "image" ) < 0) {
            //    errors.Add( lang.get( "exPhotoFormatTip" ) );
            //    return;
            //}

            // 检查文件格式
            if (Uploader.isAllowedPic( postedFile ) == false) {
                errors.Add( lang.get( "exUploadType" ) + ":" + postedFile.FileName + "(" + postedFile.ContentType + ")" );
            }
        }
开发者ID:robin88,项目名称:wojilu,代码行数:35,代码来源:Uploader.cs


示例20: OnSpecificationEnd

    public void OnSpecificationEnd(SpecificationInfo specification, Result result)
    {
      switch (result.Status)
      {
        case Status.Passing:
          break;
        case Status.NotImplemented:
          _writer.WriteTestIgnored(GetSpecificationName(specification), "(Not Implemented)");
          break;
        case Status.Ignored:
          _writer.WriteTestIgnored(GetSpecificationName(specification), "(Ignored)");
          break;
        default:
          if (result.Exception != null)
          {
            _writer.WriteTestFailed(GetSpecificationName(specification),
                                    result.Exception.Message,
                                    result.Exception.ToString());
          }
          else
          {
            _writer.WriteTestFailed(GetSpecificationName(specification), "FAIL", "");
          }
          _failureOccurred = true;
          break;
      }
      var duration = TimeSpan.FromMilliseconds(_timingListener.GetSpecificationTime(specification));

      _writer.WriteTestFinished(GetSpecificationName(specification), duration);
    }
开发者ID:agross,项目名称:machine.specifications,代码行数:30,代码来源:TeamCityReporter.cs



注:本文中的System.Result类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.RuntimeFieldHandle类代码示例发布时间:2022-05-26
下一篇:
C# System.Resolver类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap