Hi aaron This is my sample Code
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.Domain.Repositories;
using KWANP.Dbmtab.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KWANP.Dbmtab
{
public interface IDbmtabStorePAppService : IApplicationService
{
Task<string> GetUserNames();
}
}
using Abp.Data;
using System.Data.Common;
using Microsoft.EntityFrameworkCore;
using System.Data;
using System.Data.SqlClient;
using Abp.Application.Services.Dto;
using KWANP.Dbmtab.Dto;
using AutoMapper;
namespace KWANP.Dbmtab
{
public class DbmtabStorePAppService : KWANPRepositoryBase<Dbmtab00>, IDbmtabStorePAppService
{
private readonly IActiveTransactionProvider _transactionProvider;
public DbmtabStorePAppService(IDbContextProvider<KWANPDbContext> dbContextProvider, IActiveTransactionProvider transactionProvider) : base(dbContextProvider)
{
_transactionProvider = transactionProvider;
}
public async Task<string> GetUserNames()
{
EnsureConnectionOpen();
using (var command = CreateCommand("SELECT dbo.GetUsernameById(@tabtb1)", CommandType.Text, new SqlParameter("@tabtb1", "BUDGETTYPE")))
{
var username = (await command.ExecuteScalarAsync()).ToString();
return username;
}
}
private DbCommand CreateCommand(string commandText, CommandType commandType, params SqlParameter[] parameters)
{
var command = Context.Database.GetDbConnection().CreateCommand();
command.CommandText = commandText;
command.CommandType = commandType;
command.Transaction = GetActiveTransaction();
foreach (var parameter in parameters)
{
command.Parameters.Add(parameter);
}
return command;
}
private void EnsureConnectionOpen()
{
var connection = Context.Database.GetDbConnection();
if (connection.State != ConnectionState.Open)
{
connection.Open();
}
}
private DbTransaction GetActiveTransaction()
{
return (DbTransaction)_transactionProvider.GetActiveTransaction(new ActiveTransactionProviderArgs
{
{"ContextType", typeof(KWANPDbContext) },
{"MultiTenancySide", MultiTenancySide }
});
}
}
}
after start the service error show: 500 : <a class="postlink" href="http://localhost:22742/swagger/v1/swagger.json">http://localhost:22742/swagger/v1/swagger.json</a>
Thank you
Hi aaron after i follow on this sample link: <a class="postlink" href="https://www.codeproject.com/Articles/1199648/Using-Stored-Procedure-User-Defined-Function-and-V">https://www.codeproject.com/Articles/11 ... tion-and-V</a>
The service to call store procedure that i just create not show on swagger
how can i fix this problem
my version for my project: ASP.NET Core & Angular
Thank you
My version is: ASP.NET CORE + ANGULAR 4.X i already check my connection string is the same because i try to create new table and its work
can you please give me the sample on how to extend OrganizationUnit class to be able to Read,Insert, Update , and delete
i just to add one more filed public string DisplayCode { get; set; }
Thank you
This is my we.config that i use
?<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
After i copy and paste this code i just know that error on code from the beginning with ? and after i remove i got it to work now Thank you
How can i extend
public class OrganizationUnit : FullAuditedEntity<long>, IMayHaveTenant
{
public OrganizationUnit(int? tenantId, string displayName, long? parentId = default(long?));
}
constructor to include my DisplayCode filed to be able to call , insert and update to the database
and i also add this to the code but noting happen
[AutoMapFrom(typeof(OrganizationUnit), typeof(OrgChartExtendCode))]
public class OrganizationUnitDto : AuditedEntityDto<long>
{
public long? ParentId { get; set; }
public string Code { get; set; }
public string DisplayName { get; set; }
public int MemberCount { get; set; }
public string DisplayCode { get; set; }
}
Thank you
i publish my project separate angular run on port 80 and asp.net core run on port 2000
i will try to install IIS url rewrite module
Thank you
Ok it clear to me now
Thank you
Hi can you please give me the sample how to implement Process.start() i already try put in .ts file but when i click the error show
ERROR TypeError: Cannot read property 'Process' of undefined
at PhoneBookComponent.webpackJsonp.2170.PhoneBookComponent.callExe (phonebook.component.ts:40)
at Object.eval [as handleEvent] (PhoneBookComponent.html:35)
at handleEvent (core.es5.js:11914)
at callWithDebugContext (core.es5.js:13206)
at Object.debugHandleEvent [as handleEvent] (core.es5.js:12794)
at dispatchEvent (core.es5.js:8814)
at core.es5.js:9406
at HTMLButtonElement.<anonymous> (platform-browser.es5.js:2687)
at ZoneDelegate.webpackJsonp.666.ZoneDelegate.invokeTask (zone.js:398)
at Object.onInvokeTask (core.es5.js:4140)
at ZoneDelegate.webpackJsonp.666.ZoneDelegate.invokeTask (zone.js:397)
at Zone.webpackJsonp.666.Zone.runTask (zone.js:165)
at HTMLButtonElement.ZoneTask.invoke (zone.js:460)
and this is the code that i try on .ts file
callExe(): void{
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = "notepad.exe";
p.StartInfo.Arguments = "Test";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardOutput.ReadToEnd().Dump();
}
and this the button that i try to call
<button (click)="callExe()" class="btn default" type="submit"><i class="icon-magnifier"></i></button>
Thank you