using Procurement.Enums;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
using Procurement.EntityFrameworkCore.SqlRepositories;
using Procurement.ViewModel;
using Procurement.Helpers;
using System.Data.SqlClient;
using System.Data;
namespace Procurement.Controllers
{
[Produces("application/json")]
[Route("api/[controller]")]
public class PurOrdRctMasterController : AbpController
{
private readonly ISqlRepository _repository;
public PurOrdRctMasterController(ISqlRepository sqlRepository)
{
_repository = sqlRepository;
}
///
/// ΅₯ΊΕΡ‘ΤρΑΠ±ν
///
///
///
[Route("receiverselectlist")]
[HttpGet]
public async Task Get(string domain, string type = "")
{
ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
string subMsg = "";
dynamic items = null;
try
{
SqlParameter[] parameters = {
new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar}
};
items = await _repository.GetSingleListByProcAsync("pr_WMS_GetPurOrdRctList", parameters);
}
catch (Exception ex)
{
subMsg = ex.Message;
code = ResultCode.Fail;
subCode = ResultCode.Fail;
}
ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
return Ok(result);
}
[Route("purordrctdetails")]
[HttpGet]
public async Task GetPurOrdRctDetails(string domain, string receiver, string type)
{
ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
string subMsg = "";
dynamic items = null;
try
{
SqlParameter[] parameters = {
new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Receiver", Value = receiver,SqlDbType=SqlDbType.VarChar},
new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar}
};
items = await _repository.GetListByProcAsync("pr_WMS_GetPurOrdRctDetails", parameters);
}
catch (Exception ex)
{
subMsg = ex.Message;
code = ResultCode.Fail;
subCode = ResultCode.Fail;
}
ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
return Ok(result);
}
}
}