小编Dan*_*y G的帖子

角度2 NgbModal NgbActiveModal关闭事件模态

我正在使用Angular 2,我正在使用表单模式,我有两个组件,从一个组件我以这种方式打开表单模式:

import { Component, OnInit, Output} from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { MyFormComponent } from '......./....';


@Component({
    moduleId: module.id,
    selector: 'my-component',
    templateUrl: 'my-component.html'
})
export class MyComponent implements OnInit {

    private anyData: any;
    private anyDataForm: any;


    constructor(
        private modalService: NgbModal
    ) { }

    ngOnInit(): void {
    }

    open() {
        const modalRef = this.modalService.open(MyFormComponent, { size: 'lg' });
        modalRef.componentInstance.anyDataForm = this.anyData;
    }

    possibleOnCloseEvet() { 
        //Do some actions....
    }

}
Run Code Online (Sandbox Code Playgroud)

open()方法从my-component.html上的按钮触发

在Form组件(模态组件)上,我使用它来关闭实际模态(从它本身)

import { Component, …
Run Code Online (Sandbox Code Playgroud)

ng-bootstrap angular

8
推荐指数
2
解决办法
2万
查看次数

C#Azure将文件上载到"文件存储服务" - 而不是Blob存储

我有一个要求上传文件到Azure文件存储服务C#,(不是Blob存储),我搜索了很多,但我没有找到如何,只找到如何为Blob存储做的信息,似乎它不支持或者我在寻找坏消息.

我能够到达这里,但是没有UploadFromStream()像blob 这样的方法

FileInfo file = new FileInfo(@"C:\...\file.txt");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
CloudFileShare share = fileClient.GetShareReference(ConfigurationManager.AppSettings["ShareReference"]);
CloudFileDirectory root = share.GetRootDirectoryReference();
CloudFileDirectory dir = root.GetDirectoryReference("TESTDIR");

using (FileStream fs = file.OpenRead())
{
    // what should I do here
}
Run Code Online (Sandbox Code Playgroud)

是否可以像这样上传文件?
在哪种情况下,我错过了什么?

c# azure

3
推荐指数
1
解决办法
3395
查看次数

两个或多个值冲突时的SQL Server存储过程顺序

我正在构建一个SQL Server存储过程(在Sql Azure上)我能够为需求生成数据,但我无法下订单,我不知道该怎么做.

以下是此时的查询结果(这是带有必要列的随机数据)

File    | Description   | DateOfFile | OrderOfLoad | BatchID
--------+---------------+------------+-------------+---------    
ABC.DOC | a description | 2016-07-12 |      2      | 10
DEF.PDF | a description | 2016-07-10 |      4      |  6
GHI.DOC | a description | 2016-07-12 |      2      |  3
XYZ.PDF | a description | 2016-07-10 |      1      |  7
WWW.XLS | a description | 2016-05-01 |      5      | 15
Run Code Online (Sandbox Code Playgroud)

首先,我必须从最近的first(order by DateOfFile DESC)按日期排序,但是如果有两个或更多具有相同日期的文件(AAAAMMDD),则顺序决定如下:最后一个BatchId数字和第一个OrderOfLoad数字(如果存在冲突)对于两个或多个文件的日期),因此,对于此处的示例,订单将是

  1. ABC.DOC ......(记录的另一部分)
  2. GHI.DOC ......
  3. XYZ.PDF ...... …

sql sql-server stored-procedures azure-sql-database

2
推荐指数
1
解决办法
104
查看次数

Azure活动目录注销或清除本机应用程序的令牌缓存

我有一个C#web API REST服务后端,我提供CMS,网页和Angular2应用程序的服务(这是相关的).Angular应用程序需要通过后端发送用户名和密码(原始凭据)进行身份验证,后端使用这些来请求访问Azure Active Directory(带UserCredentials)的access_token,并将access_token发送回Angular应用程序,用于授权在它的请求(Authorization: Bearer).这是我正在验证的方式:

UserCredential uc = new UserPasswordCredential(user, password);
AuthenticationContext authContext = new AuthenticationContext(Constants.authority, false);
AuthenticationResult result = authContext.AcquireTokenAsync(Constants.audience, Constants.clientIdNative, uc).Result;
Run Code Online (Sandbox Code Playgroud)

问题是它为该令牌生成一小时缓存,如果用户注销并再次使用用户或用户+错误密码再次进入,则身份验证只会查找该用户的缓存并忽略或不验证密码.在一小时的窗口中,任何人都可以使用用户名进入.

我在这里和许多其他网站上找到了注销或清除令牌的方法,但这些不适用于我的后端,因为它是无状态的.我不管理这些之间的会话或HTTP上下文.如果有人可以指导解决这个问题,我正在使用Microsoft.IdentityModel.Clients.ActiveDirectory版本3.13.1.846 的最后一个程序集,我知道该方法AcquireTokenByAuthorizationCodeAsync不会查找缓存,但是没有用于原始凭据的实现.

谢谢你们,希望你能帮助我.

c# azure azure-active-directory adal

2
推荐指数
1
解决办法
5567
查看次数