当前位置: 首页>>代码示例>>C#>>正文


C# Body.Get方法代码示例

本文整理汇总了C#中Body.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Body.Get方法的具体用法?C# Body.Get怎么用?C# Body.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Body的用法示例。


在下文中一共展示了Body.Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public override string Get()
        {
            StringBuilder grid = new StringBuilder();

            using (DataTable table = this.GetTable())
            {
                if (table.Rows.Count.Equals(0))
                {
                    return "<div class='ui message'>No record found</div>";
                }

                TagBuilder.Begin(grid, "table");
                TagBuilder.AddId(grid, "FormGridView");
                TagBuilder.AddClass(grid, ConfigBuilder.GetGridViewCssClass(this.Config));
                TagBuilder.AddStyle(grid, ConfigBuilder.GetGridViewWidth(this.Config) + ";white-space: nowrap;");
                TagBuilder.Close(grid);

                List<Column> columns = GetColumns(table).ToList();

                HeaderRow header = new HeaderRow(this.Config, columns);
                grid.Append(header.Get());

                using (Body body = new Body(this.Config, table, columns))
                {
                    grid.Append(body.Get());
                }

                TagBuilder.EndTag(grid, "table");
            }

            return grid.ToString();
        }
开发者ID:JonathanValle,项目名称:mixerp,代码行数:32,代码来源:GridView.cs

示例2: ManageReplicationSession

        /// <summary>
        /// Request, configure, or stop, a replication operation.
        /// </summary>
        /// <returns>The response state for further HTTP processing</returns>
        /// <param name="context">The context of the Couchbase Lite HTTP request</param>
        /// <remarks>
        /// http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate
        /// <remarks>
        public static ICouchbaseResponseState ManageReplicationSession(ICouchbaseListenerContext context)
        {
            byte[] buffer = new byte[context.ContentLength];
            context.BodyStream.Read(buffer, 0, buffer.Length);
            var body = new Body(buffer).GetProperties() ?? new Dictionary<string, object>();

            Replication rep =  context.DbManager.ReplicationWithProperties(body);
            var response = context.CreateResponse();
            bool cancel = body.Get("cancel") is bool && (bool)body.Get("cancel");
            if (cancel) {
                if (!rep.IsRunning) {
                    response.InternalStatus = StatusCode.NotFound;
                } else {
                    rep.Stop();
                }
            } else {
                rep.Start();
                if (rep.Continuous || body.GetCast<bool>("async", false)) {
                    response.JsonBody = new Body(new Dictionary<string, object> {
                        { "session_id", rep.sessionID }
                    });
                } else {
                    return new OneShotCouchbaseResponseState(rep) { 
                        Response = response
                    };
                }
            }

            return response.AsDefaultState();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:38,代码来源:ServerMethods.cs


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