Commit 6c2ff73c authored by Dan Brydges's avatar Dan Brydges

A few updates

parent 8642b707
......@@ -39,7 +39,7 @@
</oracle.manageddataaccess.client>
<connectionStrings>
<add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=oracle_user;Password=oracle_user_password;Data Source=oracle" />
<add name="Entities" connectionString="metadata=res://*/EMPLOYEE_PER.csdl|res://*/EMPLOYEE_PER.ssdl|res://*/EMPLOYEE_PER.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=odatst;PASSWORD=yuckof;USER ID=STARHR&quot;" providerName="System.Data.EntityClient" />
<add name="Entities" connectionString="metadata=res://*/EMPLOYEE_PER.csdl|res://*/EMPLOYEE_PER.ssdl|res://*/EMPLOYEE_PER.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=odatst;PASSWORD=<PASSWORD></PASSWORD>;USER ID=STARHR&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<bindings>
......
......@@ -294,11 +294,12 @@ namespace UBWToStarHR
// select=personId
// filter=status eq 'N'
string id = "ITADMIN";
string pwd = "Hotpepperz9";
string pwd = "<PASSWORD>";
/*string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/query/employees?companyId=VU&select=personId&filter=status%20eq%20'N'&orderBy=personId"; */
string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/query/employees?companyId=VU&select=personId&filter=status%20eq%20'N'&orderBy=personId";
/*string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/query/employees?companyId=VU&select=personId&filter=status%20eq%20'N'&orderBy=personId"; */
/* string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/query/employees?companyId=VU&select=personId&filter=personId%20eq%20'357795'&orderBy=personId"; */
string url = "https://ubw.unit4cloud.com/ca_viu_prod_webapi/v1/query/employees?companyId=VU&select=personId&filter=status%20eq%20'N'&orderBy=personId";
var client = new RestClient(url);
client.Authenticator = new HttpBasicAuthenticator(id, pwd);
......@@ -313,9 +314,10 @@ namespace UBWToStarHR
public string GetEmployeeJSON(long pid)
{
string id = "ITADMIN";
string pwd = "Hotpepperz9";
string pwd = "<PASSWORD>";
//string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/employees/" + pid.ToString();
string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/objects/resources?companyId=VU&filter=personId%20eq%20'" + pid.ToString() + "'";
/* string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/objects/resources?companyId=VU&filter=personId%20eq%20'" + pid.ToString() + "'"; */
string url = "https://ubw.unit4cloud.com/ca_viu_prod_webapi/v1/objects/resources?companyId=VU&filter=personId%20eq%20'" + pid.ToString() + "'";
var client = new RestClient(url);
client.Authenticator = new HttpBasicAuthenticator(id, pwd);
var request = new RestRequest();
......@@ -328,8 +330,9 @@ namespace UBWToStarHR
public string GetEmployeeDetailJSON(long pid)
{
string id = "ITADMIN";
string pwd = "Hotpepperz9";
string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/employees/" + pid.ToString();
string pwd = "<PASSWORD>";
/* string url = "https://ubw-accept02.unit4cloud.com/ca_viu_acpt02_webapi/v1/employees/" + pid.ToString(); */
string url = "https://ubw.unit4cloud.com/ca_viu_prod_webapi/v1/employees/" + pid.ToString();
var client = new RestClient(url);
client.Authenticator = new HttpBasicAuthenticator(id, pwd);
......@@ -418,17 +421,18 @@ namespace UBWToStarHR
conn.Open();
OracleCommand cmd = conn.CreateCommand();
OracleCommand cmd2 = conn.CreateCommand();
cmd.CommandText = "select 'Y' from HR.UBW_SG_WRITE_LOG where resno = :res_no";
cmd.CommandText = "select 'Y' from HR.UBW_SG_WRITE_LOG where resno = :res_no and last_run_id = :runid";
cmd.Parameters.Add(new OracleParameter("res_no", resno));
cmd.Parameters.Add(new OracleParameter("runid", run_id));
using (OracleDataReader row = cmd.ExecuteReader())
{
if (row.Read())
{
cmd2.CommandText = "update HR.UBW_SG_WRITE_LOG set STATUS_IND=:status_ind, last_run_id=:last_run_id, date_run=sysdate, sg_empno=:sg_emp_no where resno=:res_no";
cmd2.CommandText = "update HR.UBW_SG_WRITE_LOG set STATUS_IND=:status_ind, date_run=sysdate, sg_empno=:sg_emp_no where resno=:res_no and last_run_id=:last_run_id";
cmd2.Parameters.Add(new OracleParameter("status_ind", status));
cmd2.Parameters.Add(new OracleParameter("last_run_id", run_id));
cmd2.Parameters.Add(new OracleParameter("sg_emp_no", sg_emp_no));
cmd2.Parameters.Add(new OracleParameter("res_no", resno));
cmd2.Parameters.Add(new OracleParameter("last_run_id", run_id));
cmd2.ExecuteNonQuery();
}
......@@ -446,6 +450,39 @@ namespace UBWToStarHR
}
public void SetUBWSGEmpStatus(string resno, string sg_emp_no, Int32 run_id, string status)
{
OracleConnection conn = GetHROracleConnection();
conn.Open();
OracleCommand cmd = conn.CreateCommand();
OracleCommand cmd2 = conn.CreateCommand();
cmd.CommandText = "select 'Y' from HR.UBW_SG_EMP_STATUS where UBW_RESNO = :res_no";
cmd.Parameters.Add(new OracleParameter("res_no", resno));
using (OracleDataReader row = cmd.ExecuteReader())
{
if (row.Read())
{
cmd2.CommandText = "update HR.UBW_SG_EMP_STATUS SET LAST_RUN_ID=:runid, LAST_RUN_STATUS=:stat, LAST_RUN_DATE=SYSDATE WHERE UBW_RESNO=:res_no";
cmd2.Parameters.Add(new OracleParameter("runid", run_id));
cmd2.Parameters.Add(new OracleParameter("stat", status));
cmd2.Parameters.Add(new OracleParameter("res_no", resno));
//cmd2.Parameters.Add(new OracleParameter("sg_emp_no", sg_emp_no));
cmd2.ExecuteNonQuery();
}
else
{
cmd2.CommandText = "insert into HR.UBW_SG_EMP_STATUS (UBW_RESNO, SG_EMPNO, FIRST_RUN_ID, FIRST_RUN_STATUS, FIRST_RUN_DATE) values (:res_no, :sg_emp_no, :runid, :stat, sysdate)";
cmd2.Parameters.Add(new OracleParameter("res_no", resno));
cmd2.Parameters.Add(new OracleParameter("sg_emp_no", sg_emp_no));
cmd2.Parameters.Add(new OracleParameter("runid", run_id));
cmd2.Parameters.Add(new OracleParameter("stat", status));
cmd2.ExecuteNonQuery();
}
}
}
public void EMP_COMP_ACCT_COPY()
{
OracleConnection conn = GetOracleConnection();
......@@ -896,20 +933,31 @@ namespace UBWToStarHR
public string GetEmailFromAD(string userName)
{
string rtn;
using (var pc = new PrincipalContext(ContextType.Domain, "viu.int.viu.ca"))
string rtn = " ";
if (userName != null)
{
var usr = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, "viu.int.viu.ca\\" + userName);
if (usr != null)
{
rtn = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, "viu.int.viu.ca\\" + userName).EmailAddress;
}
else
using (var pc = new PrincipalContext(ContextType.Domain, "viu.int.viu.ca"))
{
rtn = " ";
var usr = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, "viu.int.viu.ca\\" + userName);
if (usr != null)
{
rtn = UserPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, "viu.int.viu.ca\\" + userName).EmailAddress;
}
else
{
rtn = " ";
}
}
}
return rtn;
if (rtn != null)
{
return rtn;
} else
{
return " ";
}
}
public string GetMailLocFromAD(string userName)
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment