您好我想在jqgrid的寻呼机中显示"export to excel"按钮.我尝试了很多方法,阅读了很多文章/帖子,但我没有看到这个按钮.文档也没有任何用处.我应该采取哪些措施才能看到此按钮
PS.我使用ASP.NET MVC
PSS.我的代码是
<link href="../../Scripts/jquery.UI/css/redmond/jquery-ui-1.8.1.custom.css" rel="Stylesheet"
type="text/css" />
<link href="../../Scripts/jquery.jqGrid/css/ui.jqgrid.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="../../Scripts/jquery.jqGrid/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.jqGrid/js/i18n/grid.locale-ru.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.jqGrid/js/jquery.jqGrid.min.js"></script>
<table id="EmployeeTable">
</table>
<div id="EmployeeTablePager">
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery('#EmployeeTable').jqGrid({
url: '/Employee/EmployeeData',
datatype: "json",
mtype: 'POST',
jsonReader: {
page: "page",
total: "total",
records: "records",
root: "rows",
repeatitems: false,
id: ""
},
colNames: ['Id', '???', '???????', 'Email', 'Date'],
colModel: [
{ name: 'Id', width: 20 },
{ name: 'FirstName', width: 105 },
{ name: …Run Code Online (Sandbox Code Playgroud) 我有DateTime字段,存储日期+时间.我只需要使用日期部分,所以我尝试:
query = query.Where(p => p.CreatedDateTime.Date == DateStart);
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
LINQ to Entities不支持指定的类型成员"Date".仅支持初始值设定项,实体成员和实体导航属性.
为什么以及如何解决它?
我有一个元素列表
List<int> StatusIDs
Run Code Online (Sandbox Code Playgroud)
我有一个查询
IQuerable<xxx> query
Run Code Online (Sandbox Code Playgroud)
我想创建如下语句:
query = query.Where(p=>p.StatusID == StatusID_1 || p.StatusID == StatusID_2 || ... p.StatusID == StatusID_n)
Run Code Online (Sandbox Code Playgroud)
其中StatusID_1,StatusID_2 ... StatusID_n - StatusID的元素.怎么做?
我有以下代码:
JToken hours = jToken["hours"];
Run Code Online (Sandbox Code Playgroud)
它返回以下 JSON:
{
"monday": [
["11:00", "21:30"]
],
"tuesday": [
["11:00", "21:30"]
],
"wednesday": [
["11:00", "21:30"]
],
"thursday": [
["11:00", "21:30"]
],
"friday": [
["11:00", "2:00"]
],
"saturday": [
["11:00", "2:00"]
],
"sunday": [
["11:00", "21:30"]
]
}
Run Code Online (Sandbox Code Playgroud)
我需要将其解析为类型化集合,例如
<string, string>
Run Code Online (Sandbox Code Playgroud)
或为任何一天选择一个值,例如
hours.Where(p=>p["monday"].Value<string>())
Run Code Online (Sandbox Code Playgroud)
我试过:
IList<JToken> a = hours.Children().ToList();
var a = JsonConvert.DeserializeObject<Pair<string, string>>(hours.Value<string>());
var a = hours["monday"];
hours.Where(p=>p["monday"].Value<string>())
Run Code Online (Sandbox Code Playgroud)
没有工作。
我想部署仅具有辅助角色的云服务(没有Web角色.Web角色部署为Azure WebSite).可能吗?
PS.为什么我会考虑这个解决方案 - 我需要一个能够发送电子邮件的网站.我将消息放入Web中排队,并以工作者角色获取这些消息,这些消息会发送电子邮件.我尝试在云服务中部署这两种服务,但是Web部署WebSite更加舒适(部署速度更快,能够为本地和远程设置连接字符串).所以,我想只使用worker角色部署服务
我对我的 WebApi 应用程序使用令牌身份验证。
我在 Startup 类中有以下 ConfigureAuth 方法:
// Configure the application for OAuth based flow
PublicClientId = "self";
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
// In production mode set AllowInsecureHttp = false
AllowInsecureHttp = true
};
// Enable the application to use bearer tokens to authenticate users
app.UseOAuthBearerTokens(OAuthOptions);
Run Code Online (Sandbox Code Playgroud)
和 ApplicationOAuthProvider:
public class ApplicationOAuthProvider : OAuthAuthorizationServerProvider
{
private readonly string _publicClientId;
public ApplicationOAuthProvider(string publicClientId)
{
if …Run Code Online (Sandbox Code Playgroud) authentication unit-testing oauth asp.net-web-api asp.net-web-api2
我想根据以下类解析 json:
public class DerModel
{
public string Name { get; set; }
public string Email { get; set; }
}
public class DriverPositiveResultModel
{
public int DriverId { get; set; }
public string DriverName { get; set; }
public string DriverSSN { get; set; }
public string CarrierName { get; set; }
public DerModel DER { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
以及以下架构:
{
"properties": {
"CarrierName": {
"type": "string"
},
"DER": {
"properties": {
"Email": {
"type": "string"
},
"Name": …Run Code Online (Sandbox Code Playgroud) 我有代码:
public async Task DeleteColorSchemeAsync(ColorScheme colorScheme)
{
if (colorScheme == null)
throw new ArgumentNullException(nameof(colorScheme));
if (colorScheme.IsDefault)
throw new SettingIsDefaultException();
_dbContext.ColorSchemes.Remove(colorScheme);
await _dbContext.SaveChangesAsync();
}
Run Code Online (Sandbox Code Playgroud)
一个代码分析器建议我将此方法分为两种方法:
将此方法分为两个部分,一个处理参数检查,另一个处理异步代码
我以下列方式拆分此代码时是否正确?
public async Task DeleteColorSchemeAsync(ColorScheme colorScheme)
{
if (colorScheme == null)
throw new ArgumentNullException(nameof(colorScheme));
if (colorScheme.IsDefault)
throw new SettingIsDefaultException();
await DeleteColorSchemeInternalAsync(colorScheme);
}
private async Task DeleteColorSchemeInternalAsync(ColorScheme colorScheme)
{
_dbContext.ColorSchemes.Remove(colorScheme);
await _dbContext.SaveChangesAsync();
}
Run Code Online (Sandbox Code Playgroud)
编译器有什么不同?它看到了两种异步方法,与我的第一种方法有什么不同?
二手编码工具分析仪:sonarqube
我有以下local.settings.json文件:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"SureMdmApiKey": "xxx",
"SureMdmApiUrl": "xxx",
"SureMdmUsername": "xxx",
"SureMdmPassword": "xxx"
},
"ConnectionStrings": {
"StorageConnectionString": "aaaa",
"DataContext": "aaaa"
}
}
Run Code Online (Sandbox Code Playgroud)
然后我在 Startup.cs 文件中有以下代码:
[assembly: FunctionsStartup(typeof(FunctionAppSureMdmSync.Startup))]
namespace FunctionAppSureMdmSync
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
var services = builder.Services;
services.AddTransient<ISureMdmService>(s => new SureMdmService(
url: System.Environment.GetEnvironmentVariable("SureMdmApiUrl"),
username: System.Environment.GetEnvironmentVariable("SureMdmUserName"),
password: System.Environment.GetEnvironmentVariable("SureMdmPassword"),
apiKey: System.Environment.GetEnvironmentVariable("SureMdmApiKey")
));
var connString = System.Environment.GetEnvironmentVariable("ConnectionStrings:DataContext");
services.AddDbContext<DataContext>(options => options
.UseSqlServer(connString, x => x.UseNetTopologySuite()));
services.AddTransient<ITabletGroupService, …Run Code Online (Sandbox Code Playgroud) 我有一个简单的任务:只需将一个类映射到另一个类。对于某些字段,我有复杂的逻辑,取决于 2 个或更多字段,因此,我尝试使用ConvertUsing(https://docs.automapper.org/en/stable/Custom-type-converters.html)
我使用 AutoMapper 10.0.0
我的代码是:
源码类:
public class DeviceStatusHistory
{
public DeviceStatusHistory()
{
DateChange = DateTime.UtcNow;
}
public int Id { get; set; }
public int DeviceId { get; set; }
public virtual Device Device { get; set; }
public int? RequestId { get; set; }
public virtual DeviceManagementRequest Request { get; set; }
public DeviceStatus OldStatus { get; set; }
public DeviceStatus NewStatus { get; set; }
public string Notes { get; set; …Run Code Online (Sandbox Code Playgroud) c# ×4
azure ×3
linq ×2
asp.net-mvc ×1
async-await ×1
automapper ×1
jqgrid ×1
json ×1
json.net ×1
oauth ×1
parsing ×1
sonarqube ×1
unit-testing ×1