1049 lines
46 KiB
C#
1049 lines
46 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Configuration;
|
|||
|
using System.Data;
|
|||
|
using System.Globalization;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Net.Http.Headers;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using AutoMapper.Configuration;
|
|||
|
using Ease.Core;
|
|||
|
using HRM.BO;
|
|||
|
using HRM.DA;
|
|||
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
using Microsoft.AspNetCore.Http;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using Microsoft.AspNetCore.StaticFiles;
|
|||
|
using Microsoft.Extensions.Configuration;
|
|||
|
using Payroll.BO;
|
|||
|
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
|
|||
|
|
|||
|
namespace HRM.UI.Controllers
|
|||
|
{
|
|||
|
[ApiController]
|
|||
|
[Route("api/survey")]
|
|||
|
[Authorize]
|
|||
|
public class SurveyController : Controller
|
|||
|
{
|
|||
|
#region Declerations
|
|||
|
|
|||
|
private readonly IQuestionCategoryService _questionCategoryService;
|
|||
|
private readonly IQuestionService _questionService;
|
|||
|
private readonly IConfiguration _config;
|
|||
|
private readonly IEmployeeService _employeeService;
|
|||
|
private readonly IQuestionAnswerService _questionAnswerService;
|
|||
|
private readonly ISurveyCategoryService _surveyCategoryService;
|
|||
|
private readonly ISurveyService _surveyService;
|
|||
|
private readonly ISurveyQuestionService _surveyQuestionService;
|
|||
|
private readonly ISurveyResultService _surveyResultService;
|
|||
|
private readonly ISurveyEmployeeService _surveyEmployeeService;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public SurveyController(IConfiguration config,
|
|||
|
IQuestionCategoryService questionCategoryService,
|
|||
|
IQuestionService questionService,
|
|||
|
IQuestionAnswerService questionAnswerService,
|
|||
|
ISurveyCategoryService surveyCategoryService,
|
|||
|
ISurveyService surveyService,
|
|||
|
ISurveyQuestionService surveyQuestionService,
|
|||
|
ISurveyResultService surveyResultService,
|
|||
|
ISurveyEmployeeService surveyEmployeeService
|
|||
|
)
|
|||
|
{
|
|||
|
_config = config;
|
|||
|
_questionCategoryService = questionCategoryService;
|
|||
|
_questionService = questionService;
|
|||
|
_questionAnswerService = questionAnswerService;
|
|||
|
_surveyCategoryService = surveyCategoryService;
|
|||
|
_surveyService = surveyService;
|
|||
|
_surveyQuestionService = surveyQuestionService;
|
|||
|
_surveyResultService = surveyResultService;
|
|||
|
_surveyEmployeeService = surveyEmployeeService;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
[HttpPost]
|
|||
|
[Route("savequestion")]
|
|||
|
public ActionResult SaveQuestion(Question item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
var isNew = item.ID <= 0;
|
|||
|
string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|||
|
item.ConnectionString = connectionString;
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
if (isNew)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
item.UserID= currentUser.UserID;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
try
|
|||
|
{
|
|||
|
ans = _questionService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getQuestionCategories")]
|
|||
|
public ActionResult GetQuestionCategories()
|
|||
|
{
|
|||
|
List<QuestionCategory> obs = new List<QuestionCategory>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
try
|
|||
|
{
|
|||
|
obs = _questionCategoryService.Get(EnumStatus.Active);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(obs);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("GetByCategory/{categoryId}")]
|
|||
|
public ActionResult GetByCategory(int categoryId)
|
|||
|
{
|
|||
|
List<Question> items = new List<Question>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _questionService.GetByCategory(categoryId);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("GetQuestionsByCategory/{categoryId}")]
|
|||
|
public ActionResult GetQuestionsByCategory(int categoryId)
|
|||
|
{
|
|||
|
List<Survey> items = new List<Survey>();
|
|||
|
try
|
|||
|
{
|
|||
|
items = _surveyService.GetQuestionSetByCategoryID(categoryId);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(items);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getQuestionById/{questionId}")]
|
|||
|
public ActionResult getQuestionById(int questionId)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
Question question = new Question();
|
|||
|
try
|
|||
|
{
|
|||
|
question = _questionService.Get(questionId);
|
|||
|
question.QuestionAnswers = _questionAnswerService.GetByQuestionID(questionId);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(question);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getSurveyById/{surveyId}")]
|
|||
|
public ActionResult getSurveyById(int surveyId)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
Survey survey = new Survey();
|
|||
|
try
|
|||
|
{
|
|||
|
survey = _surveyService.Get(surveyId);
|
|||
|
survey.SurveyQuestions = _surveyQuestionService.GetSurveyQuestion(surveyId);
|
|||
|
foreach(var item in survey.SurveyQuestions)
|
|||
|
{
|
|||
|
item.Question = _questionService.Get(item.QuestionID);
|
|||
|
item.Question.QuestionAnswers = _questionAnswerService.GetByQuestionID(item.QuestionID);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(survey);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getAllFilesById/{questionId}")]
|
|||
|
public ActionResult GetAllFilesById(int questionId)
|
|||
|
{
|
|||
|
List<QuestionAnswerAttachment> files = new List<QuestionAnswerAttachment>();
|
|||
|
try
|
|||
|
{
|
|||
|
files = _questionAnswerService.GetQuestionFileAttachments(questionId);
|
|||
|
|
|||
|
if (files != null && files.Count > 0)
|
|||
|
{
|
|||
|
foreach (var item in files)
|
|||
|
{
|
|||
|
item.PreviousFileTobase64 = item.FileTobase64;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(files);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getSurveyCategories")]
|
|||
|
public ActionResult GetSurveyCategories()
|
|||
|
{
|
|||
|
List<SurveyCategory> obs = new List<SurveyCategory>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
try
|
|||
|
{
|
|||
|
obs = _surveyCategoryService.Get(EnumStatus.Active);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(obs);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("savesurvey")]
|
|||
|
public ActionResult SaveSurvey(Survey item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
var isNew = item.ID <= 0;
|
|||
|
//string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|||
|
//item.ConnectionString = connectionString;
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
if (isNew)
|
|||
|
{
|
|||
|
item.CreatedBy = currentUser.UserID;
|
|||
|
item.CreatedDate = DateTime.Today;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
item.ModifiedBy = currentUser.UserID;
|
|||
|
item.ModifiedDate = DateTime.Today;
|
|||
|
}
|
|||
|
try
|
|||
|
{
|
|||
|
item.FromDate = DateTime.Today;
|
|||
|
item.ToDate = DateTime.Today;
|
|||
|
ans = _surveyService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getQuestionSet")]
|
|||
|
public ActionResult GetQuestionSet()
|
|||
|
{
|
|||
|
List<Survey> obs = new List<Survey>();
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
try
|
|||
|
{
|
|||
|
obs = _surveyService.Get();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(obs);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("deleteQuestion")]
|
|||
|
public ActionResult DeleteQuestion(Question item)
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
_questionService.Delete(item.ID);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(true);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("getQuestionsBySurveyId/{jobId}")]
|
|||
|
public ActionResult GetQuestionsBySurveyId(int jobId)
|
|||
|
{
|
|||
|
Survey survey = new Survey();
|
|||
|
List<QuestionAnswerAttachment> files = new List<QuestionAnswerAttachment>();
|
|||
|
try
|
|||
|
{
|
|||
|
//List<ErCircularSurvey> erCircularSurveys = null;
|
|||
|
//erCircularSurveys = _erCircularSurveyService.GetByCircularID(jobId);
|
|||
|
//var erCircularSurvey = erCircularSurveys[0];
|
|||
|
survey = _surveyService.Get(jobId); // need to pass survey id
|
|||
|
survey.EstimatedTime = 0;
|
|||
|
survey.SurveyQuestions = _surveyQuestionService.GetSurveyQuestion(jobId);
|
|||
|
|
|||
|
if (survey.SurveyQuestions != null && survey.SurveyQuestions.Count > 0)
|
|||
|
{
|
|||
|
foreach (var item in survey.SurveyQuestions)
|
|||
|
{
|
|||
|
item.Question = _questionService.GetWithChild(item.QuestionID);
|
|||
|
if (item.Question != null && item.Question.QuestionAnswers != null && item.Question.QuestionAnswers.Count > 0)
|
|||
|
{
|
|||
|
foreach (var temp in item.Question.QuestionAnswers)
|
|||
|
{
|
|||
|
var tempAttachment = _questionService.GetAnswerByAttchmentId(item.Question.ID, temp.ID);
|
|||
|
if (tempAttachment != null)
|
|||
|
{
|
|||
|
temp.QuestionAnswerAttachments = new List<QuestionAnswerAttachment>();
|
|||
|
temp.QuestionAnswerAttachments.Add(tempAttachment);
|
|||
|
}
|
|||
|
}
|
|||
|
survey.EstimatedTime += item.Question.EstimatedTime;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(survey);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveSurveyResult")]
|
|||
|
public ActionResult SaveSurveyResult(SurveyResult item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
var isNew = item.ID <= 0;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
item.CandidateID = (int)currentUser.UserID;
|
|||
|
item.EmployeeID = null;
|
|||
|
var prevResult = _surveyResultService.GetSurveyResultByCandidateID(item.SurveyID, item.CandidateID, item.QuestionID);
|
|||
|
if (prevResult != null)
|
|||
|
{
|
|||
|
_surveyResultService.DeleteByCandidateID(item.SurveyID, item.CandidateID, item.QuestionID);
|
|||
|
}
|
|||
|
|
|||
|
ans = _surveyResultService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
[Route("saveSurveyEmployee")]
|
|||
|
public ActionResult saveSurveyEmployee(SurveyEmployee item)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
var isNew = item.ID <= 0;
|
|||
|
List<SurveyEmployee> surveyEmployees = new List<SurveyEmployee>();
|
|||
|
SurveyEmployee prevItem = null;
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
item.CandidateID = currentUser.UserID;
|
|||
|
item.EmployeeID = null;
|
|||
|
item.CurrentTime = (double)(DateTime.Now - (DateTime)item.StartTime).Minutes;
|
|||
|
surveyEmployees = _surveyEmployeeService.GetSurveyEmployeeByCandidateId(item.SurveyID, item.CandidateID, item.ErCircularID);
|
|||
|
if (surveyEmployees != null && surveyEmployees.Count > 0)
|
|||
|
{
|
|||
|
prevItem = new SurveyEmployee();
|
|||
|
prevItem = surveyEmployees[0];
|
|||
|
item.SurveyMark = prevItem.SurveyMark;
|
|||
|
item.SurveyParticipantDate = prevItem.SurveyParticipantDate;
|
|||
|
item.SurveyTime = prevItem.SurveyTime;
|
|||
|
if (prevItem.IsCompleted == false && (prevItem.SurveyTime > prevItem.CurrentTime) && prevItem.IsDisconnected == true)
|
|||
|
{
|
|||
|
item.CurrentTime = (double)(DateTime.Now - (DateTime)item.StartTime).Minutes + prevItem.CurrentTime;
|
|||
|
|
|||
|
}
|
|||
|
if (item.IsCompleted == true)
|
|||
|
{
|
|||
|
item.CompleteTime = DateTime.Now;
|
|||
|
}
|
|||
|
}
|
|||
|
if (prevItem != null)
|
|||
|
{
|
|||
|
_surveyEmployeeService.DeleteByCandidateID(prevItem.SurveyID, prevItem.CandidateID, prevItem.ErCircularID);
|
|||
|
}
|
|||
|
|
|||
|
ans = _surveyEmployeeService.Save(item);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(ans);
|
|||
|
}
|
|||
|
|
|||
|
[HttpGet]
|
|||
|
[Route("checkDisconncetedSurveyEmployee/{erCircularID}/{surveyId}")]
|
|||
|
public ActionResult CheckDisconncetedSurveyEmployee(int erCircularID, int surveyId)
|
|||
|
{
|
|||
|
int ans;
|
|||
|
List<SurveyEmployee> surveyEmployees = new List<SurveyEmployee>();
|
|||
|
SurveyEmployee prevItem = null;
|
|||
|
try
|
|||
|
{
|
|||
|
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
int candidateID = currentUser.UserID;
|
|||
|
surveyEmployees = _surveyEmployeeService.GetSurveyEmployeeByCandidateId(surveyId, candidateID, erCircularID);
|
|||
|
if (surveyEmployees != null && surveyEmployees.Count > 0)
|
|||
|
{
|
|||
|
prevItem = new SurveyEmployee();
|
|||
|
prevItem = surveyEmployees[0];
|
|||
|
}
|
|||
|
if (prevItem != null)
|
|||
|
{
|
|||
|
if (prevItem.IsCompleted == false && prevItem.SurveyTime > prevItem.CurrentTime)
|
|||
|
{
|
|||
|
prevItem.IsDisconnected = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
prevItem = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
return Ok(prevItem);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetClaimBasic/{calimBasicID}")]
|
|||
|
//public ActionResult GetClaimBasic(int calimBasicID)
|
|||
|
//{
|
|||
|
// ClaimBasic item = new ClaimBasic();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// item = _claimBasicService.Get(calimBasicID);
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(item);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("getDesignationsForClaim")]
|
|||
|
//public ActionResult GetDesignationsForClaim()
|
|||
|
//{
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// List<Designation> tempDesignations = new List<Designation>();
|
|||
|
// List<Designation> designations = new List<Designation>();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// tempDesignations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|||
|
// if (tempDesignations != null && tempDesignations.Count > 0)
|
|||
|
// {
|
|||
|
// designations = tempDesignations
|
|||
|
// .Where(x => x.Code == "014" || x.Code == "040" || x.Code == "075" || x.Code == "011" || x.Code == "016" || x.Code == "013" || x.Code == "029" || x.Code == "015" || x.Code == "066" || x.Code == "100" || x.Code == "110" || x.Code == "104" || x.Code == "107" || x.Code == "061").ToList();
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception e)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(designations);
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetClaimBasicItems/{calimBasicID}")]
|
|||
|
//public ActionResult GetClaimBasicItems(int calimBasicID)
|
|||
|
//{
|
|||
|
// List<ClaimBasicItem> claimBasicItems = new List<ClaimBasicItem>();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// claimBasicItems = _claimBasicItemService.GetByClaimBasicID(calimBasicID);
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(claimBasicItems);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpPost]
|
|||
|
//[Route("saveclaimrule")]
|
|||
|
//public ActionResult SaveClaimRule(ClaimRule item)
|
|||
|
//{
|
|||
|
// int ans;
|
|||
|
// var isNew = item.ID <= 0;
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// if (isNew)
|
|||
|
// {
|
|||
|
// item.CreatedBy = currentUser.UserID;
|
|||
|
// item.CreatedDate = DateTime.Today;
|
|||
|
// // item.PayrollTypeID = (int)currentUser.PayrollTypeID;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.ModifiedBy = currentUser.UserID;
|
|||
|
// item.ModifiedDate = DateTime.Today;
|
|||
|
// }
|
|||
|
|
|||
|
// try
|
|||
|
// {
|
|||
|
// ans = _claimRuleService.Save(item);
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(ans);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet("getClaimRules")]
|
|||
|
//public ActionResult GetClaimRules()
|
|||
|
//{
|
|||
|
// List<ClaimRule> obs = new List<ClaimRule>();
|
|||
|
// //CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// try
|
|||
|
// {
|
|||
|
// obs = _claimRuleService.Get();
|
|||
|
// if (obs.Count > 0)
|
|||
|
// {
|
|||
|
// foreach (ClaimRule item in obs)
|
|||
|
// {
|
|||
|
// if (item.IsAnnualBalance == true)
|
|||
|
// {
|
|||
|
// item.AnnualBalance = "Yes";
|
|||
|
// }
|
|||
|
// else if (item.IsAnnualBalance == false)
|
|||
|
// {
|
|||
|
// item.AnnualBalance = "No";
|
|||
|
// }
|
|||
|
|
|||
|
// if (item.IsAtActualPayment == true)
|
|||
|
// {
|
|||
|
// item.AtActualPayment = "Yes";
|
|||
|
// }
|
|||
|
// else if (item.IsAtActualPayment == false)
|
|||
|
// {
|
|||
|
// item.AtActualPayment = "No";
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(obs);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetClaimRule/{claimRuleId}")]
|
|||
|
//public ActionResult GetClaimRule(int claimRuleId)
|
|||
|
//{
|
|||
|
// ClaimRule item = new ClaimRule();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// item = _claimRuleService.Get(claimRuleId);
|
|||
|
// if (item != null)
|
|||
|
// {
|
|||
|
// item.ClaimRuleDesignations = _claimRuleService.GetClaimRuleGradesByClaimRuleID(item.ID);
|
|||
|
// item.ClaimBasicItems = _claimBasicItemService.GetByClaimBasicID(item.ClaimBasicID);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(item);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetWithDesignation")]
|
|||
|
//public ActionResult GetWithDesignation()
|
|||
|
//{
|
|||
|
// List<ClaimBasic> items = new List<ClaimBasic>();
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// Employee employee = new Employee();
|
|||
|
// employee = _employeeService.Get((int)currentUser.EmployeeID);
|
|||
|
// DataSet ds = new DataSet();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// ds = _claimBasicService.GetWithDesignation((int)employee.DesignationID, (int)currentUser.PayrollTypeID);
|
|||
|
// foreach (var row in ds.Tables[0].AsEnumerable())
|
|||
|
// {
|
|||
|
// ClaimBasic temp = new ClaimBasic();
|
|||
|
// temp.ID = row["ClaimBasicID"] == null ? 0 : row.Field<Int32>("ClaimBasicID");
|
|||
|
// temp.ItemName = row["ItemName"] == null ? "" : row.Field<string>("ItemName");
|
|||
|
// items.Add(temp);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(items);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetClaimRuleAmount/{claimBasicItemID}")]
|
|||
|
//public ActionResult GetClaimRuleAmount(int claimBasicItemID)
|
|||
|
//{
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// ClaimRuleDesignations claimRuleDesignation = new ClaimRuleDesignations();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// ClaimBasicItem claimitem = _claimBasicItemService.Get(claimBasicItemID);
|
|||
|
// Employee employee = new Employee();
|
|||
|
// employee = _employeeService.Get((int)currentUser.EmployeeID);
|
|||
|
// List<ClaimRule> claimRules = _claimRuleService.GetByClaimBasicID(claimitem.ClaimBasicID);
|
|||
|
// if (claimRules != null)
|
|||
|
// {
|
|||
|
// foreach (var item in claimRules)
|
|||
|
// {
|
|||
|
// item.ClaimRuleDesignations = _claimRuleService.GetClaimRuleGradesByClaimRuleID(item.ID);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// ClaimRule claimRule = (claimRules != null && claimRules.Count > 0) ? claimRules.First() : new ClaimRule();
|
|||
|
// //claimRuleDesignation = claimRule.ClaimRuleDesignations.Where(x => x.ClaimBasicItemId == claimBasicItemID &&
|
|||
|
// // x.DesignationID == employee.DesignationID
|
|||
|
// // ).FirstOrDefault();
|
|||
|
// claimRuleDesignation = claimRule.ClaimRuleDesignations.Where(x => x.ClaimBasicItemId == claimBasicItemID).FirstOrDefault();
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(claimRuleDesignation);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpPost]
|
|||
|
//[Route("saveClaimRequisition")]
|
|||
|
//public ActionResult SaveClaimRequisition(ClaimRequisition item)
|
|||
|
//{
|
|||
|
// string connectionString = _config.GetSection("dbSettings").GetSection("SqlCommandConnection").Value;
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// item.ConnectionString = connectionString;
|
|||
|
// int startIndex = 0;
|
|||
|
// if (item.IsNew)
|
|||
|
// {
|
|||
|
// item.CreatedBy = currentUser.UserID;
|
|||
|
// item.CreatedDate = DateTime.Today;
|
|||
|
// item.PayrollTypeID = currentUser.PayrollTypeID;
|
|||
|
// item.EmployeeID = (int)currentUser.EmployeeID;
|
|||
|
// item.SalaryMonth = (DateTime)currentUser.NextPayProcessDate;
|
|||
|
// item.ClaimProcessDate = null;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.ModifiedBy = currentUser.UserID;
|
|||
|
// item.ModifiedDate = DateTime.Today;
|
|||
|
// }
|
|||
|
|
|||
|
// try
|
|||
|
// {
|
|||
|
|
|||
|
// if (item.ClaimRequisitionItems != null && item.ClaimRequisitionItems.Count > 0)
|
|||
|
// {
|
|||
|
// foreach (var tempItem in item.ClaimRequisitionItems)
|
|||
|
// {
|
|||
|
// if (tempItem.claimRequisitionFileAttacment != null)
|
|||
|
// {
|
|||
|
// if (tempItem.claimRequisitionFileAttacment.ID <= 0 && tempItem.claimRequisitionFileAttacment.PreviousFileTobase64 != null)
|
|||
|
// {
|
|||
|
// string[] items = tempItem.claimRequisitionFileAttacment.PreviousFileTobase64.Split(new char[] { ',', ' ' }, StringSplitOptions.None);
|
|||
|
// byte[] newBytes = Convert.FromBase64String(items[1]);
|
|||
|
// tempItem.claimRequisitionFileAttacment.FileAsByteArray = newBytes;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// _claimRequisitionService.Save(item);
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(item.ID);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetDraftedClaimItems")]
|
|||
|
//public ActionResult GetDraftedClaimItems()
|
|||
|
//{
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// ClaimRequisition draftedClaimRequisition = new ClaimRequisition();
|
|||
|
// List<ClaimBasic> obs = new List<ClaimBasic>();
|
|||
|
// // List<ClaimBasicItem> obsi = new List<ClaimBasicItem>();
|
|||
|
// ClaimBasicItem obsi = new ClaimBasicItem();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// obs = _claimBasicService.Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|||
|
|
|||
|
// draftedClaimRequisition = _claimRequisitionService.GetClaimByprocessDate(EnumwfStatus.Initiate, (int)currentUser.EmployeeID);
|
|||
|
// if (draftedClaimRequisition != null)
|
|||
|
// {
|
|||
|
// draftedClaimRequisition.ClaimRequisitionItems = _claimRequisitionService.GetClaimRequisitionItem(draftedClaimRequisition.ID.ToString());
|
|||
|
// if (draftedClaimRequisition.ClaimRequisitionItems != null && draftedClaimRequisition.ClaimRequisitionItems.Count > 0)
|
|||
|
// {
|
|||
|
// draftedClaimRequisition.IRFileAttacments = new List<FileAttachment>();
|
|||
|
// draftedClaimRequisition.IRFileAttacments = _claimRequisitionService.GetIRFileAttachments(draftedClaimRequisition.ID);
|
|||
|
// }
|
|||
|
// foreach (var item in draftedClaimRequisition.ClaimRequisitionItems)
|
|||
|
// {
|
|||
|
// obsi = _claimBasicItemService.Get(item.ClaimBasicItemID);
|
|||
|
// item.ClaimBasicName = obs?.Where(x => x.ID == item.ClaimBasicID)?.FirstOrDefault().ItemName;
|
|||
|
// item.ClaimBasicItemName = obsi.Name;
|
|||
|
// item.claimRequisitionFileAttacment = new FileAttachment();
|
|||
|
// item.claimRequisitionFileAttacment = draftedClaimRequisition.IRFileAttacments?.Where(x => x.RefchildID == item.ID)?.FirstOrDefault();
|
|||
|
// // item.claimRequisitionFileAttacment.PreviousFileTobase64 = item.claimRequisitionFileAttacment.FileTobase64;
|
|||
|
// if (item.claimRequisitionFileAttacment != null)
|
|||
|
// item.claimRequisitionFileAttacment.PreviousFileTobase64 = item.claimRequisitionFileAttacment == null ? null : item.claimRequisitionFileAttacment.FileTobase64;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(draftedClaimRequisition);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("getClaim/{claimId}")]
|
|||
|
//public ActionResult GetClaim(int claimId)
|
|||
|
//{
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// ClaimRequisition prevClaimRequisition = new ClaimRequisition();
|
|||
|
// List<ClaimBasic> obs = new List<ClaimBasic>();
|
|||
|
// // List<ClaimBasicItem> obsi = new List<ClaimBasicItem>();
|
|||
|
// ClaimBasicItem obsi = new ClaimBasicItem();
|
|||
|
// try
|
|||
|
// {
|
|||
|
// prevClaimRequisition = _claimRequisitionService.Get(claimId);
|
|||
|
// obs = _claimBasicService.Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
|
|||
|
// //field fillup
|
|||
|
// //if (prevClaimRequisition != null)
|
|||
|
// //{
|
|||
|
// // if (prevClaimRequisition.ClaimBasicID != null && prevClaimRequisition.ClaimBasicID > 0)
|
|||
|
// // {
|
|||
|
// // var selecetedClaimBasic = obs.Find(x => x.ID == prevClaimRequisition.ClaimBasicID);
|
|||
|
// // if (selecetedClaimBasic != null)
|
|||
|
// // {
|
|||
|
// // if (selecetedClaimBasic.IsField1 == true && selecetedClaimBasic.Field1Type == EnumFieldTypeStatus.Date)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field1 = Convert.ToDateTime(prevClaimRequisition.Field1);
|
|||
|
// // }
|
|||
|
// // else if (selecetedClaimBasic.IsField1 == true && selecetedClaimBasic.Field1Type == EnumFieldTypeStatus.Number)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field1 = Convert.ToDouble(prevClaimRequisition.Field1, CultureInfo.InvariantCulture); ;
|
|||
|
// // }
|
|||
|
|
|||
|
// // if (selecetedClaimBasic.IsField2 == true && selecetedClaimBasic.Field2Type == EnumFieldTypeStatus.Date)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field2 = Convert.ToDateTime(prevClaimRequisition.Field2);
|
|||
|
// // }
|
|||
|
// // else if (selecetedClaimBasic.IsField2 == true && selecetedClaimBasic.Field2Type == EnumFieldTypeStatus.Number)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field2 = Convert.ToDouble(prevClaimRequisition.Field2, CultureInfo.InvariantCulture); ;
|
|||
|
// // }
|
|||
|
|
|||
|
// // if (selecetedClaimBasic.IsField3 == true && selecetedClaimBasic.Field3Type == EnumFieldTypeStatus.Date)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field3 = Convert.ToDateTime(prevClaimRequisition.Field3);
|
|||
|
// // }
|
|||
|
// // else if (selecetedClaimBasic.IsField3 == true && selecetedClaimBasic.Field3Type == EnumFieldTypeStatus.Number)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field3 = Convert.ToDouble(prevClaimRequisition.Field3, CultureInfo.InvariantCulture); ;
|
|||
|
// // }
|
|||
|
|
|||
|
|
|||
|
// // if (selecetedClaimBasic.IsField4 == true && selecetedClaimBasic.Field4Type == EnumFieldTypeStatus.Date)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field4 = Convert.ToDateTime(prevClaimRequisition.Field4);
|
|||
|
// // }
|
|||
|
// // else if (selecetedClaimBasic.IsField4 == true && selecetedClaimBasic.Field4Type == EnumFieldTypeStatus.Number)
|
|||
|
// // {
|
|||
|
// // prevClaimRequisition.Field4 = Convert.ToDouble(prevClaimRequisition.Field4, CultureInfo.InvariantCulture); ;
|
|||
|
// // }
|
|||
|
// // }
|
|||
|
// // }
|
|||
|
// //}
|
|||
|
|
|||
|
// if (prevClaimRequisition != null)
|
|||
|
// {
|
|||
|
// prevClaimRequisition.ClaimRequisitionItems = _claimRequisitionService.GetClaimRequisitionItem(prevClaimRequisition.ID.ToString());
|
|||
|
// if (prevClaimRequisition.ClaimRequisitionItems != null && prevClaimRequisition.ClaimRequisitionItems.Count > 0)
|
|||
|
// {
|
|||
|
// foreach (var item in prevClaimRequisition.ClaimRequisitionItems)
|
|||
|
// {
|
|||
|
// if (item != null)
|
|||
|
// {
|
|||
|
// if (item.ClaimBasicID > 0)
|
|||
|
// {
|
|||
|
// var selecetedClaimBasic = obs.Find(x => x.ID == item.ClaimBasicID);
|
|||
|
// if (selecetedClaimBasic != null)
|
|||
|
// {
|
|||
|
// if (selecetedClaimBasic.IsField1 == true)
|
|||
|
// {
|
|||
|
// item.Description += " " + selecetedClaimBasic.Field1 +" :";
|
|||
|
// if (selecetedClaimBasic.Field1Type == EnumFieldTypeStatus.Date)
|
|||
|
// {
|
|||
|
// var Field1 = Convert.ToDateTime(item.Field1) == DateTime.MinValue ? null : Convert.ToDateTime(item.Field1);
|
|||
|
// item.VisitingDate= Convert.ToDateTime(item.Field1) == DateTime.MinValue ? null : Convert.ToDateTime(item.Field1);
|
|||
|
// item.Description += " " + Field1 + " ";
|
|||
|
// }
|
|||
|
// else if (selecetedClaimBasic.Field1Type == EnumFieldTypeStatus.Number)
|
|||
|
// {
|
|||
|
// var Field1 = Convert.ToDouble(item.Field1, CultureInfo.InvariantCulture);
|
|||
|
// item.Description += " " + Field1 + " ";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.Description += " " + item.Field1 + " ";
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// if (selecetedClaimBasic.IsField2 == true)
|
|||
|
// item.Description += selecetedClaimBasic.Field2 + " :";
|
|||
|
|
|||
|
// if (selecetedClaimBasic.IsField2 == true && selecetedClaimBasic.Field2Type == EnumFieldTypeStatus.Date)
|
|||
|
// {
|
|||
|
// var Field2 = Convert.ToDateTime(item.Field2);
|
|||
|
// if (Field2 == DateTime.MinValue)
|
|||
|
// {
|
|||
|
// Field2 = null;
|
|||
|
// }
|
|||
|
// item.VisitingDate = Field2;
|
|||
|
// item.Description += " " + Field2 + " " + " ";
|
|||
|
// }
|
|||
|
// else if (selecetedClaimBasic.IsField2 == true && selecetedClaimBasic.Field2Type == EnumFieldTypeStatus.Number)
|
|||
|
// {
|
|||
|
// var Field2 = Convert.ToDouble(item.Field2, CultureInfo.InvariantCulture);
|
|||
|
// item.Description += " " + Field2 + " " + " ";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.Description += " " + item.Field2 + " " + " ";
|
|||
|
// }
|
|||
|
|
|||
|
// if (selecetedClaimBasic.IsField3 == true)
|
|||
|
// item.Description += selecetedClaimBasic.Field3 + " :";
|
|||
|
|
|||
|
// //if (selecetedClaimBasic.IsField3 == true && selecetedClaimBasic.Field3Type == EnumFieldTypeStatus.Date)
|
|||
|
// //{
|
|||
|
// // var Field3 = Convert.ToDateTime(item.Field3);
|
|||
|
// // if (Field3 == DateTime.MinValue)
|
|||
|
// // {
|
|||
|
// // Field3 = null;
|
|||
|
// // }
|
|||
|
// // item.Description += " " + Field3 + " ";
|
|||
|
// // item.VisitingDate = Field3;
|
|||
|
// //}
|
|||
|
// //else if (selecetedClaimBasic.IsField3 == true && selecetedClaimBasic.Field3Type == EnumFieldTypeStatus.Number)
|
|||
|
// //{
|
|||
|
// // var Field3 = Convert.ToDouble(item.Field3, CultureInfo.InvariantCulture);
|
|||
|
// // item.Description += " " + Field3 + " ";
|
|||
|
// //}
|
|||
|
// //else
|
|||
|
// //{
|
|||
|
// // item.Description += " " + item.Field3 + " ";
|
|||
|
// //}
|
|||
|
|
|||
|
// //if (selecetedClaimBasic.IsField4 == true)
|
|||
|
// // item.Description += selecetedClaimBasic.Field4 + " :";
|
|||
|
|
|||
|
// //if (selecetedClaimBasic.IsField4 == true && selecetedClaimBasic.Field4Type == EnumFieldTypeStatus.Date)
|
|||
|
// //{
|
|||
|
// // var Field4 = Convert.ToDateTime(item.Field4);
|
|||
|
// // if (Field4 == DateTime.MinValue)
|
|||
|
// // {
|
|||
|
// // Field4 = null;
|
|||
|
// // }
|
|||
|
// // item.VisitingDate = Field4;
|
|||
|
// // item.Description += " " + Field4 + " ";
|
|||
|
// //}
|
|||
|
// //else if (selecetedClaimBasic.IsField4 == true && selecetedClaimBasic.Field4Type == EnumFieldTypeStatus.Number)
|
|||
|
// //{
|
|||
|
// // var Field4 = Convert.ToDouble(item.Field4, CultureInfo.InvariantCulture);
|
|||
|
// // item.Description += " " + Field4 + " ";
|
|||
|
// //}
|
|||
|
// //else
|
|||
|
// //{
|
|||
|
// // item.Description += " " + item.Field4 + " ";
|
|||
|
// //}
|
|||
|
// if (selecetedClaimBasic.IsField5 == true)
|
|||
|
// item.Description += selecetedClaimBasic.Field5 + " :";
|
|||
|
|
|||
|
// if (selecetedClaimBasic.IsField5 == true && selecetedClaimBasic.Field5Type == EnumFieldTypeStatus.Date)
|
|||
|
// {
|
|||
|
// var Field5 = Convert.ToDateTime(item.Field5);
|
|||
|
// if (Field5 == DateTime.MinValue)
|
|||
|
// {
|
|||
|
// Field5 = null;
|
|||
|
// }
|
|||
|
// item.VisitingDate = Field5;
|
|||
|
// item.Description += " " + Field5 + " ";
|
|||
|
// }
|
|||
|
// else if (selecetedClaimBasic.IsField5 == true && selecetedClaimBasic.Field5Type == EnumFieldTypeStatus.Number)
|
|||
|
// {
|
|||
|
// var Field5 = Convert.ToDouble(item.Field5, CultureInfo.InvariantCulture);
|
|||
|
// item.Description += " " + Field5 + " ";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.Description += " " + item.Field5 + " ";
|
|||
|
// }
|
|||
|
// if (selecetedClaimBasic.IsField6 == true && selecetedClaimBasic.Field6Type == EnumFieldTypeStatus.Date)
|
|||
|
// {
|
|||
|
// var Field6 = Convert.ToDateTime(item.Field5);
|
|||
|
// if (Field6 == DateTime.MinValue)
|
|||
|
// {
|
|||
|
// Field6 = null;
|
|||
|
// }
|
|||
|
// item.VisitingDate = Field6;
|
|||
|
// item.Description += " " + Field6 + " ";
|
|||
|
// }
|
|||
|
// else if (selecetedClaimBasic.IsField6 == true && selecetedClaimBasic.Field6Type == EnumFieldTypeStatus.Number)
|
|||
|
// {
|
|||
|
// var Field6 = Convert.ToDouble(item.Field6, CultureInfo.InvariantCulture);
|
|||
|
// item.Description += " " + Field6 + " ";
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// item.Description += " " + item.Field6 + " ";
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// //prevClaimRequisition.IRFileAttacments = new List<FileAttachment>();
|
|||
|
// //prevClaimRequisition.IRFileAttacments = _claimRequisitionService.GetIRFileAttachments(prevClaimRequisition.ID);
|
|||
|
// }
|
|||
|
// foreach (var item in prevClaimRequisition.ClaimRequisitionItems)
|
|||
|
// {
|
|||
|
// obsi = _claimBasicItemService.Get(item.ClaimBasicItemID);
|
|||
|
// item.ClaimBasicName = obs?.Where(x => x.ID == item.ClaimBasicID)?.FirstOrDefault().ItemName;
|
|||
|
// item.ClaimBasicItemName = obsi.Name;
|
|||
|
|
|||
|
// //File Retrieve
|
|||
|
|
|||
|
// // item.claimRequisitionFileAttacment = new FileAttachment();
|
|||
|
// //item.claimRequisitionFileAttacment = prevClaimRequisition.IRFileAttacments?.Where(x => x.RefchildID == item.ID)?.FirstOrDefault();
|
|||
|
// item.claimRequisitionFileAttacment = _claimRequisitionService.GetByRefChildId(prevClaimRequisition.ID, item.ID);
|
|||
|
// if (item.claimRequisitionFileAttacment != null)
|
|||
|
// {
|
|||
|
// item.claimRequisitionFileAttacment.PreviousFileTobase64 = item.claimRequisitionFileAttacment == null ? null : item.claimRequisitionFileAttacment.FileTobase64;
|
|||
|
// item.IsFileExist = item.claimRequisitionFileAttacment.PreviousFileTobase64 != null ? true : false;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(prevClaimRequisition);
|
|||
|
//}
|
|||
|
|
|||
|
//[HttpGet]
|
|||
|
//[Route("GetMyPendingList/{ids}/{fromDate}/{toDate}/")]
|
|||
|
//public ActionResult GetMyPendingList(string ids, DateTime fromDate, DateTime toDate)
|
|||
|
//{
|
|||
|
// DataTable odata = null;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// ids = (ids == "null" || ids == "undefined") ? null : ids;
|
|||
|
// CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
|
|||
|
// odata = this._claimRequisitionService.GetPendingList((int)currentUser.EmployeeID, ids, fromDate, toDate);
|
|||
|
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
|
|||
|
// }
|
|||
|
|
|||
|
// return Ok(odata);
|
|||
|
//}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|