如何使用TypeScript定义我的控制器.现在它是在角度js但我想改变这种类型脚本.所以可以快速检索数据.
function CustomerCtrl($scope, $http, $templateCache){
$scope.search = function(search)
{
debugger;
var Search = {
AccountId: search.AccountId,
checkActiveOnly: search.checkActiveOnly,
checkParentsOnly: search.checkParentsOnly,
listCustomerType: search.listCustomerType
};
$scope.customer = [];
$scope.ticket = [];
$scope.services = [];
$http.put('<%=ResolveUrl("API/Search/PutDoSearch")%>', Search).
success(function(data, status, headers, config) {
debugger;
$scope.cust_File = data[0].customers;
$scope.ticket_file = data[0].tickets;
$scope.service_file = data[0].services;
}).
error(function(data, status)
{
console.log("Request Failed");
});
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Type Script.I已将我的角度js控制器转换为类型脚本但是我面临着ng-repeater中的问题.(我在下面附上了我的控制器代码: -
class CustomCtrl{
public customer;
public ticket;
public services;
public cust_File;
public ticket_file;
public service_file;
static $inject = ['$scope', '$http', '$templateCache'];
constructor (
private $http,
private $templateCache
){}
Run Code Online (Sandbox Code Playgroud) 我是打字稿和angular的新手.我使用typescript和angular js实现了一个模块.我需要在其中创建一个动态表,它将获取演示文稿的类型并相应地附加到我以前在C#中完成的视图.我在下面给出了c#代码:
private void ShowCustomFields()
{
Customer.CustomerController control = new Customer.CustomerController();
DataTable fields = control.GetCustomFields();
TableRow row = new TableRow();
Int16 count = 0;
foreach (DataRow dr in fields.Rows)
{
count++;
string id = dr["Id"].ToString();
string name = dr["Name"].ToString();
string type = dr["Type"].ToString();
string val = "";
//Determine if the user can view/edit this custom field
bool canEdit = false;
if (Permissions.PermissionController.HasPermission(this.UserInfo.Username, "Custom Fields - Customer",
dr["Name"].ToString(),
Permissions.PermissionLevels.Edit))
{
canEdit = true;
}
TableCell cellId = new TableCell();
cellId.Visible = …Run Code Online (Sandbox Code Playgroud) angularjs typescript angularjs-scope typescript1.4 typescript1.5
我已经实现了一个脚本,我试图将服务器A上的一些文件复制到服务器B.让我向您解释一下这个过程.
我启动了一个循环,它将运行两次,在第一次执行时,我停止应用程序池并启动应用程序池,而不是创建备份,而不是尝试复制文件但是它给了我一个错误,访问被拒绝但是我编辑该文件夹的所有权限,但通过脚本,它不允许我从服务器A复制和替换服务器2上的文件.
# Embedding the password in the script.
"Setting Variables"
$MyDomain = "ranbi" ;
$MyClearTextUsername = "shian" ;
$MyClearTextPassword = "sham@01" ;
$MyUsernameDomain = $MyDomain + '\' + $MyClearTextUsername;
$SecurePassword = ConvertTo-SecureString -String $MyClearTextPassword -AsPlainText -Force ;
$MyCreds = New-Object System.Management.Automation.PSCredential $MyUsernameDomain,$SecurePassword ;
#System Variable for backup Procedure
$date = Get-Date -Format d-MMMM-yyyy-h-m-s #Variable is used to get the date and time
for ($i=1; $i -le 2; $i++) {
$servername = "server" + $i
$backupsrc = "\\$servername\C$\Program Files (x86)\service\healthService\v1_0" …Run Code Online (Sandbox Code Playgroud) powershell powershell-2.0 powershell-remoting powershell-3.0 powershell-4.0
我试图在提供凭据后让 PowerShell 在远程计算机上停止并启动 AppPool。
启动应用程序池的函数:
Function fnStartApplicationPool([string]$appPoolName)
{
import-module WebAdministration
if((Get-WebAppPoolState $appPoolName).Value -ne 'Started')
{
Start-WebAppPool -Name $appPoolName
}
}
Run Code Online (Sandbox Code Playgroud)
停止应用程序池的函数:
Function fnStopApplicationPool([string]$appPoolName)
{
import-module WebAdministration
if((Get-WebAppPoolState $appPoolName).Value -ne 'Stopped')
{
Stop-WebAppPool -Name $appPoolName
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码不起作用:
if ($pathback -eq $false)
{
#Copying Data from Source to Destination
copy-Item -Recurse $backupsrc -Destination $backupdes
write-host "Backup Successful"
#Validating the apppool value
import-module WebAdministration
if((Get-WebAppPoolState $appPoolName).Value -ne 'Stopped')
{
#Stop apppool
Stop-WebAppPool -Name $appPoolName
write-host "AppPool Stopped Successfully"
}
#Copying Data from …Run Code Online (Sandbox Code Playgroud) 我已经实现了一个模块,我将其分为两部分:
这是我的路由器映射器类: -
using DotNetNuke.Web.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
namespace NewController
{
public class RouteMapper : IServiceRouteMapper
{
public void RegisterRoutes(IMapRoute mapRouteManager)
{
mapRouteManager.MapHttpRoute("NewController", "default", "{controller}/{action}",
new[] { "NewController" });
}
}
}
Run Code Online (Sandbox Code Playgroud)
我已多次检查我的命名空间和文件夹名称,但没有发现任何错误.
My Controller namespace is like below:-
using DotNetNuke.Common.Utilities;
using DotNetNuke.Web.Api;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace NewController
{
public class NewInfoController : …Run Code Online (Sandbox Code Playgroud)