First Initial
This commit is contained in:
22
Models/external_competency/Iexternal_competencyService.cs
Normal file
22
Models/external_competency/Iexternal_competencyService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public interface Iexternal_competencyService
|
||||
{
|
||||
List<external_com_competencysViewModel> Getcom_competencys();
|
||||
List<external_com_competency_levelsViewModel> Getcom_competency_levels();
|
||||
List<external_com_competency_levelsViewModel> Getcom_competency_levelsBycompetency_id(int? competency_id);
|
||||
List<external_competencyViewModel> GetTotalItemInLevel(int? competency_level_id);
|
||||
List<external_com_competency_descriptionsViewModel> Getcom_competency_descriptions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_com_competency_descriptionsViewModel
|
||||
{
|
||||
public int? competency_level_description_id { get; set; }
|
||||
|
||||
public string description { get; set; }
|
||||
|
||||
public int? list_no { get; set; }
|
||||
|
||||
public int? competency_level_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_com_competency_levelsViewModel
|
||||
{
|
||||
public int? competency_level_id { get; set; }
|
||||
|
||||
public string competency_level_detail { get; set; }
|
||||
|
||||
public int? competency_id { get; set; }
|
||||
|
||||
public int? level { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_com_competencysViewModel
|
||||
{
|
||||
public int? competency_id { get; set; }
|
||||
|
||||
public string competency_code { get; set; }
|
||||
|
||||
public string competency_topic { get; set; }
|
||||
}
|
||||
}
|
||||
34
Models/external_competency/external_competencyInputModel.cs
Normal file
34
Models/external_competency/external_competencyInputModel.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_competencyInputModel
|
||||
{
|
||||
|
||||
public Guid? id { get; set; }
|
||||
|
||||
public int? competency_id { get; set; }
|
||||
|
||||
public string competency_code { get; set; }
|
||||
|
||||
public string competency_topic { get; set; }
|
||||
|
||||
public int? competency_level_id { get; set; }
|
||||
|
||||
public string competency_level_detail { get; set; }
|
||||
|
||||
public int? tot { get; set; }
|
||||
|
||||
public string active_mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
152
Models/external_competency/external_competencyService.cs
Normal file
152
Models/external_competency/external_competencyService.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
using TodoAPI2.Models;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using TTSW.Configure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Data;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_competencyService : Iexternal_competencyService
|
||||
{
|
||||
private IMyDatabase db;
|
||||
|
||||
public external_competencyService(IMyDatabase mydb)
|
||||
{
|
||||
db = mydb;
|
||||
}
|
||||
|
||||
public List<external_com_competencysViewModel> Getcom_competencys()
|
||||
{
|
||||
var sql = @"
|
||||
select * from com_competencys where competency_type = 'Core' and deleted_at is null;
|
||||
";
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_com_competencysViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_com_competencysViewModel();
|
||||
i.competency_id = Convert.ToInt32(dr["competency_id"]);
|
||||
i.competency_code = Convert.ToString(dr["competency_code"]);
|
||||
i.competency_topic = Convert.ToString(dr["competency_topic"]);
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<external_com_competency_levelsViewModel> Getcom_competency_levels()
|
||||
{
|
||||
var sql = $@"
|
||||
select * from com_competency_levels where deleted_at is null order by competency_id,level;
|
||||
";
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_com_competency_levelsViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_com_competency_levelsViewModel();
|
||||
i.competency_level_id = Convert.ToInt16(dr["competency_level_id"]);
|
||||
i.competency_level_detail = Convert.ToString(dr["level"])+" "+Convert.ToString(dr["competency_level_detail"]);
|
||||
i.competency_id = Convert.ToInt16(dr["competency_id"]);
|
||||
i.level = Convert.ToInt16(dr["level"]);
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<external_com_competency_levelsViewModel> Getcom_competency_levelsBycompetency_id(int? competency_id)
|
||||
{
|
||||
if (competency_id.HasValue)
|
||||
{
|
||||
var sql = $@"
|
||||
select * from com_competency_levels where competency_id={competency_id.ToString()} and deleted_at is null order by level;
|
||||
";
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_com_competency_levelsViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_com_competency_levelsViewModel();
|
||||
i.competency_level_id = Convert.ToInt16(dr["competency_level_id"]);
|
||||
i.competency_level_detail = Convert.ToString(dr["level"]) + " " + Convert.ToString(dr["competency_level_detail"]);
|
||||
i.competency_id = Convert.ToInt16(dr["competency_id"]);
|
||||
i.level = Convert.ToInt16(dr["level"]);
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<external_competencyViewModel> GetTotalItemInLevel(int? competency_level_id)
|
||||
{
|
||||
if (competency_level_id.HasValue)
|
||||
{
|
||||
var sql = $@"
|
||||
select c.competency_id,c.competency_code,c.competency_topic,l.competency_level_id,
|
||||
l.competency_level_detail,count(d.competency_level_description_id) tot from public.com_competencys c
|
||||
left join public.com_competency_levels l on c.competency_id=l.competency_id
|
||||
left join public.com_competency_level_descriptions d on d.competency_level_id = l.competency_level_id
|
||||
where competency_type = 'Core' and l.competency_level_id={competency_level_id.ToString()}
|
||||
and c.deleted_at is null and l.deleted_at is null and d.deleted_at is null
|
||||
group by c.competency_id,c.competency_code,c.competency_topic,l.competency_level_id,
|
||||
l.competency_level_detail
|
||||
";
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_competencyViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_competencyViewModel();
|
||||
i.competency_id = Convert.ToInt32(dr["competency_id"]);
|
||||
i.competency_code = Convert.ToString(dr["competency_code"]);
|
||||
i.competency_topic = Convert.ToString(dr["competency_topic"]);
|
||||
i.competency_level_id = Convert.ToInt16(dr["competency_level_id"]);
|
||||
i.competency_level_detail = Convert.ToString(dr["competency_level_detail"]);
|
||||
i.tot = Convert.ToInt16(dr["tot"]);
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<external_com_competency_descriptionsViewModel> Getcom_competency_descriptions()
|
||||
{
|
||||
var sql = $@"
|
||||
select * from com_competency_level_descriptions where deleted_at is null order by competency_level_description_id, competency_level_id, list_no;
|
||||
";
|
||||
var para = db.GetParameterListNpgsql();
|
||||
DataTable dt = db.ExecuteDataTableNpgsql(sql, para);
|
||||
var result = new List<external_com_competency_descriptionsViewModel>();
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
var i = new external_com_competency_descriptionsViewModel();
|
||||
i.competency_level_description_id = Convert.ToInt16(dr["competency_level_description_id"]);
|
||||
i.description = Convert.ToString(dr["description"]);
|
||||
i.list_no = Convert.ToInt16(dr["list_no"]);
|
||||
i.competency_level_id = Convert.ToInt16(dr["competency_level_id"]);
|
||||
|
||||
result.Add(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
Models/external_competency/external_competencyViewModel.cs
Normal file
28
Models/external_competency/external_competencyViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TTSW.EF;
|
||||
using TTSW.Utils;
|
||||
using TTSW.Constant;
|
||||
using TTSW.Common;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_competencyViewModel
|
||||
{
|
||||
public int? competency_id { get; set; }
|
||||
|
||||
public string competency_code { get; set; }
|
||||
|
||||
public string competency_topic { get; set; }
|
||||
|
||||
public int? competency_level_id { get; set; }
|
||||
|
||||
public string competency_level_detail { get; set; }
|
||||
|
||||
public int? tot { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TodoAPI2.Models
|
||||
{
|
||||
public class external_competencyWithSelectionViewModel: external_competencyViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user