109 lines
3.4 KiB
C#
109 lines
3.4 KiB
C#
using ExcelHelper;
|
|
using LoggingHelper;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using VECV_WebApi.Models.Ticket;
|
|
|
|
namespace VECV_WebApi.Controllers.Ticket
|
|
{
|
|
public class PartDetailsController : ApiController
|
|
{
|
|
#region Global Variable
|
|
|
|
/// <summary>
|
|
/// making object of LoggingUtility class available to this class
|
|
/// </summary>
|
|
LoggingUtility objLog = new LoggingUtility();
|
|
|
|
/// <summary>
|
|
/// making the data-log file path available to this class
|
|
/// </summary>
|
|
string path = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["PathLog"]);
|
|
|
|
/// <summary>
|
|
/// making data log file path available to this class
|
|
/// </summary>
|
|
string logtf = (ConfigurationManager.AppSettings["Log"]);
|
|
|
|
/// <summary>
|
|
/// making error log file path available to this class
|
|
/// </summary>
|
|
string errorlogtf = (ConfigurationManager.AppSettings["ErrorLog"]);
|
|
|
|
/// <summary>
|
|
/// making Ticket Repository object available to this class
|
|
/// </summary>
|
|
TicketRepository objTicketRepository;
|
|
|
|
/// <summary>
|
|
/// making the Database connection string available to this class
|
|
/// </summary>
|
|
private string _connStr = ConfigurationManager.ConnectionStrings["Vecv_GoData"].ToString();
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region APIs
|
|
|
|
public string Post([FromBody] ParttDetailsModel model)
|
|
{
|
|
|
|
try
|
|
{
|
|
string strsuccess = "";
|
|
List<TicketOpenModel> objList = new List<TicketOpenModel>();
|
|
objTicketRepository = new TicketRepository(_connStr);
|
|
|
|
// string strid = objTicketRepository.GetTicketdetailsByTicketId(model.TicketId);
|
|
// model.TicketId_Alias = strid;
|
|
strsuccess = objTicketRepository.insertPartDetails(model);
|
|
return strsuccess;
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("GetTicketDetailOnDeviceAlias_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
}
|
|
|
|
public List<ParttDetailsModel> Post([FromUri] string getDetails, [FromBody] ParttDetailsModel model)
|
|
{
|
|
List<ParttDetailsModel> objListfullDetails = new List<ParttDetailsModel>();
|
|
try
|
|
{
|
|
|
|
// TicketOpenModel objModel = new TicketOpenModel();
|
|
objTicketRepository = new TicketRepository(_connStr);
|
|
objListfullDetails = objTicketRepository.GetPartDetailsHistory(model);
|
|
|
|
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
// write error log into file
|
|
objLog.ErrorLogFile("TicketAcceptOrDecliend_Controller", Ex.Message, path, errorlogtf);
|
|
throw Ex;
|
|
}
|
|
|
|
return objListfullDetails;
|
|
}
|
|
|
|
public string Get(string partstatus, string ticketId)
|
|
{
|
|
string status = "";
|
|
objTicketRepository = new TicketRepository(_connStr);
|
|
status = objTicketRepository.GetPartStatusByTicketId(ticketId);
|
|
return status;
|
|
}
|
|
#endregion
|
|
}
|
|
} |