107 lines
4.4 KiB
C#
107 lines
4.4 KiB
C#
|
|
using cel.hrm.mobile.api.Models;
|
|||
|
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|
|||
|
|
namespace cel.hrm.mobile.api.Controllers
|
|||
|
|
{
|
|||
|
|
[ApiController]
|
|||
|
|
[Route("api/Mobile/User")]
|
|||
|
|
[Authorize]
|
|||
|
|
public class UserController : ControllerBase
|
|||
|
|
{
|
|||
|
|
[HttpPost]
|
|||
|
|
[Route("GetApiLink")]
|
|||
|
|
[AllowAnonymous]
|
|||
|
|
public ActionResult GetApiLink(MobileApiDetails oMobileApiDetails)
|
|||
|
|
{
|
|||
|
|
string address = "";
|
|||
|
|
string companyName = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string domain = string.Empty;
|
|||
|
|
string[] parts = oMobileApiDetails.EmailAddress!.Split('@');
|
|||
|
|
|
|||
|
|
if (parts.Length >= 2)
|
|||
|
|
{
|
|||
|
|
domain = parts[1].ToLower();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
switch (domain)
|
|||
|
|
{
|
|||
|
|
case "celimited.com":
|
|||
|
|
address = "https://celbd.com/celhrmmobiletest/api/Mobile/";
|
|||
|
|
companyName = "CEL";
|
|||
|
|
//address = "http://100.100.100.15:45456/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "shvenergybd.com":
|
|||
|
|
//address = "https://celclouds.com/petromax/api/Mobile/";
|
|||
|
|
companyName = "Petromax";
|
|||
|
|
address = "http://100.100.100.19:45456/api/Mobile/";
|
|||
|
|
//address = "https://celbd.com/petromaxHRUAT/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "lifung.com":
|
|||
|
|
case "lfsourcing.com":
|
|||
|
|
case "neotangent.com":
|
|||
|
|
case "lfmilesgroup.com":
|
|||
|
|
//address = "https://celclouds.com/lifungbd/api/Mobile/";
|
|||
|
|
companyName = "LF";
|
|||
|
|
address = "http://100.100.100.15:45457/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "hm.com":
|
|||
|
|
case "HM.COM":
|
|||
|
|
case "arket.com":
|
|||
|
|
case "weekday.com":
|
|||
|
|
address = "https://bdpohr01.azurewebsites.net/api/Mobile/";
|
|||
|
|
companyName = "H&M";
|
|||
|
|
//address = "http://100.100.100.19:45455/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "wartsila.com":
|
|||
|
|
address = "https://celclouds.com/WartsilaHR/api/Mobile/";
|
|||
|
|
companyName = "Wartsila";
|
|||
|
|
//address = "http://100.100.100.19:45456/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "texebo-bd.com":
|
|||
|
|
//temporary
|
|||
|
|
if (DateTime.UtcNow > new DateTime(2026, 3, 11, 16, 0, 0))
|
|||
|
|
address = "https://hris.texebo-bd.net/texebohrms/api/Mobile/";
|
|||
|
|
else
|
|||
|
|
address = "https://celclouds.com/texebohrms/api/Mobile/";
|
|||
|
|
companyName = "Tex-Ebo";
|
|||
|
|
//address = "http://100.100.100.19:45457/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "duncanbd.com":
|
|||
|
|
address = "https://hrm.duncanbd.net/api/Mobile/";
|
|||
|
|
//address = "https://celclouds.com/texebohrms/api/Mobile/";
|
|||
|
|
companyName = "Duncan BD";
|
|||
|
|
//address = "http://100.100.100.19:45457/api/Mobile/";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "customdomain.com":
|
|||
|
|
Console.WriteLine("This is a Custom Domain address.");
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
default:
|
|||
|
|
//address = "https://celbd.com/celhrmmobiletest/api/Mobile/";
|
|||
|
|
//companyName = "CEL";
|
|||
|
|
//address = "http://100.100.100.15:45456/api/Mobile/";
|
|||
|
|
//return StatusCode(StatusCodes.Status500InternalServerError, "Invalid Email Address " + oMobileApiDetails.EmailAddress);
|
|||
|
|
//throw new CustomException(Error, "Employee does not exists in the system");
|
|||
|
|
//break;
|
|||
|
|
return Ok("Invalid Email Address");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
|||
|
|
}
|
|||
|
|
return Ok("companyname#" + companyName + "#" + "address#" + address + "#");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|