我无法为jqgrid配置每页的项目.我的jqgrid是:
jQuery('#EmployeeTable').jqGrid({
url: '/Admin/IdeasJSON',
datatype: 'json',
postData: { page: page, pageIndex: pageIndex, Filter: Filter, DateStart: DateStart, DateEnd: DateEnd, TagID: TagID, StatusID: StatusID, CategoryID: CategoryID, IsDescription: IsDescription },
loadComplete: function () { pageIndex = null },
jsonReader: {
page: "page",
total: "total",
records: "records",
root: "rows",
repeatitems: false,
id: ""
},
Run Code Online (Sandbox Code Playgroud)
....
和MVC方法返回:
var result = new JsonResult()
{
Data = new { page = page, total = total, records = totalCount, rows = IdeaForJSONs }
};
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
public class UploadController : ApiController
{
DBRepository _repository = new DBRepository();
public Task<IEnumerable<FileDesc>> Post()
{
string folderName = "UploadedFiles";
string PATH = HttpContext.Current.Server.MapPath("~/" + folderName);
PATH = @"c:\www\qqq";
string rootUrl = Request.RequestUri.AbsoluteUri.Replace(Request.RequestUri.AbsolutePath, String.Empty);
if (Request.Content.IsMimeMultipartContent())
{
var streamProvider = new CustomMultipartFormDataStreamProvider(PATH);
var task = Request.Content.ReadAsMultipartAsync(streamProvider).ContinueWith<IEnumerable<FileDesc>>(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
throw new HttpResponseException(HttpStatusCode.InternalServerError);
}
return fileInfo;
});
return task;
}
else
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotAcceptable, "This request is not properly formatted"));
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误:
错误16'System.Net.Http.HttpContent'不包含'IsMimeMultipartContent'的定义,并且没有可以找到接受类型'System.Net.Http.HttpContent'的第一个参数的扩展方法'IsMimeMultipartContent'(你错过了吗?使用指令或程序集引用?)
错误17'System.Net.Http.HttpContent'不包含'ReadAsMultipartAsync'的定义,并且没有可以找到接受类型'System.Net.Http.HttpContent'的第一个参数的扩展方法'ReadAsMultipartAsync'(你错过了吗?使用指令或程序集引用?) …
我想搜索纽约的所有咖啡馆和餐馆.当然,我可以使用文本搜索,因为它在这里推荐 - Google Places API搜索关键字和城市
但是,如果我发出请求,例如 https://maps.googleapis.com/maps/api/place/textsearch/json?query=cafe+New+York+food&sensor=false&key=MY_KEY
我得到的第一个元素是
"formatted_address":"316 Victoria Avenue,Chatswood NSW,Australia",
真的没办法按城市过滤数据吗?这个数据存在于地址中,为什么没有好的方法按城市过滤,只能通过关键字?
我有一个 Azure 函数,它监听 azure 队列,例如,出现错误。它再次将消息重新添加到队列中。但 5 次后消息将被移至有害队列。
我想延迟重新将消息添加到队列中。例如,请在 1 小时内重试。因为我的 Azure Function 使用外部资源,目前可能不可用。我根本不想在10秒内重试5次,我想在1小时后重试。当然,我自己编写了它的实现,但这个功能可能已经存在。
我有 WebAPI (.NET Core) 并用于FluentValidator验证模型,包括更新。我使用 PATCH 动词并有以下方法:
public IActionResult Update(int id, [FromBody] JsonPatchDocument<TollUpdateAPI> jsonPatchDocument)
{
Run Code Online (Sandbox Code Playgroud)
另外,我有一validator堂课:
public class TollUpdateFluentValidator : AbstractValidator<TollUpdateAPI>
{
public TollUpdateFluentValidator ()
{
RuleFor(d => d.Date)
.NotNull().WithMessage("Date is required");
RuleFor(d => d.DriverId)
.GreaterThan(0).WithMessage("Invalid DriverId");
RuleFor(d => d.Amount)
.NotNull().WithMessage("Amount is required");
RuleFor(d => d.Amount)
.GreaterThanOrEqualTo(0).WithMessage("Invalid Amount");
}
}
Run Code Online (Sandbox Code Playgroud)
并将其映射到类validator中Startup:
services.AddTransient<IValidator<TollUpdateAPI>, TollUpdateFluentValidator>();
Run Code Online (Sandbox Code Playgroud)
但它不起作用。如何编写FluentValidator对我的任务有效的内容?
我使用 GraphServiceClient 从 Outlook 获取消息。
var messages = await _graphServiceClient.Me.MailFolders[folderId].Messages.Request()
.Header("Prefer", "outlook.body-content-type=\"text\"")
.Filter($"createdDateTime gt {greaterDate} and createdDateTime lt {lessDate}")
.Top(int.MaxValue).GetAsync();
Run Code Online (Sandbox Code Playgroud)
请求最多获取 1000 个项目。
我想获取其他消息并遵循文档。
我的代码:
var pageIterator = PageIterator<Message>
.CreatePageIterator(
_graphServiceClient,
messages,
// Callback executed for each item in
// the collection
(m) =>
{
return true;
},
// Used to configure subsequent page
// requests
(req) =>
{
// Re-add the header to subsequent requests
req.Header("Prefer", "outlook.body-content-type=\"text\"");
return req;
});
await pageIterator.IterateAsync();
Run Code Online (Sandbox Code Playgroud)
但是当我调用我的代码时什么也没有发生。看起来像是pageIterator.IterateAsync();无限循环之后。
怎么了?
c# asp.net-core microsoft-graph-sdks microsoft-graph-mail microsoft-graph-api
我有一个带有nvarchar字段的表(MS SQL Server 2008 R2).为了测试,这段代码工作正常:
Update [Screenshots] set name=N'????????' where id=230246
Run Code Online (Sandbox Code Playgroud)
现在我创建了Entity Framework模型,我将Unicode设置为True

然后我尝试更新我的记录:
public void Put(FormDataCollection formData)
{
string filename = formData.Get("filename");
var screenshot = c.Screenshots.Where(p => p.filename == filename).FirstOrDefault();
if (screenshot != null)
{
screenshot.name = formData.Get("description");
c.SaveChanges();
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到了"?????" 而不是unicode值.怎么做?我知道AsNonUnicode方法,但此方法仅适用于LINQ.
我有以下模型类:
public abstract class CompanyFormViewModelBase
{
public CompanyFormViewModelBase()
{
Role = new CompanyRoleListViewModel();
ContactPerson = new PersonListViewModel();
Sector = new SectorListViewModel();
}
[Required]
[Display(Name = "Company Name")]
public string CompanyName { get; set; }
public CompanyRoleListViewModel Role { get; set; }
[Display(Name = "Contact Name")]
public PersonListViewModel ContactPerson { get; set; }
public SectorListViewModel Sector { get; set; }
}
public class AddCompanyViewModel : CompanyFormViewModelBase, IValidatableObject
{
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
PlugandabandonEntities db = new PlugandabandonEntities();
CompanyName = CompanyName.Trim(); …Run Code Online (Sandbox Code Playgroud) 我想要一个表达式,找到值后的下一个符号不是“(”。
我有以下基本正则表达式:
(([_A-Za-z]([_\w])+)|([A-Za-z]))
Run Code Online (Sandbox Code Playgroud)
和文字,例如:
a3+red+42+_dv+Sy(w12+44)
Run Code Online (Sandbox Code Playgroud)
希望的正则表达式应返回:
a3, red, _dv, w12
Run Code Online (Sandbox Code Playgroud)
这个正则表达式返回
a3, red, _dv, Sy, w12
Run Code Online (Sandbox Code Playgroud)
但我需要排除“ Sy”,因为下一个符号是“(”。
我尝试以下方法:
(([_A-Za-z]([_\w])+)|([A-Za-z]))(\b)
Run Code Online (Sandbox Code Playgroud)
但它返回
a3+, red+, _dv+, w12)
Run Code Online (Sandbox Code Playgroud)
我不需要下一个符号,仅当下一个符号不是“(”时才需要包含。
我想通过内部消息搜索 Application Insights 日志。例如,我有以下日志:
我想搜索所有呼叫,当消息:'FunctionCallEfsApi no messages' 包含...我该怎么做?
azure ×2
asp.net-core ×1
asp.net-mvc ×1
asynchronous ×1
azure-queues ×1
c# ×1
google-maps ×1
jqgrid ×1
jquery ×1
json-patch ×1
patch ×1
regex ×1
system.net ×1
unicode ×1
validation ×1