updates
parent
c39e4049a4
commit
26e7543bde
|
|
@ -870,11 +870,21 @@ namespace Journeys_WantHome.Controllers
|
|||
if (project_year == "")
|
||||
{
|
||||
List<project> projects = conn.Query<project>("select * from project order by project_modifydate desc ").ToList();
|
||||
ret.projectList = projects;
|
||||
|
||||
foreach (project item in projects) {
|
||||
ret.projectList.Add(new projectDetail(item));
|
||||
}
|
||||
|
||||
//ret.projectList = projects;
|
||||
}
|
||||
else {
|
||||
List<project> projects = conn.Query<project>("select * from project where project_year = @project_year and project_month = @project_month order by project_modifydate desc ", new { project_year = project_year, project_month = project_month }).ToList();
|
||||
ret.projectList = projects;
|
||||
|
||||
foreach (project item in projects)
|
||||
{
|
||||
ret.projectList.Add(new projectDetail(item));
|
||||
}
|
||||
//ret.projectList = projects;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1678,7 +1688,7 @@ namespace Journeys_WantHome.Controllers
|
|||
public string err_code { get; set; } = "0000";
|
||||
public string message { get; set; } = "";
|
||||
|
||||
public List<project> projectList { get; set; } = new List<project>();
|
||||
public List<projectDetail> projectList { get; set; } = new List<projectDetail>();
|
||||
}
|
||||
|
||||
public class kolListResult {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
using Dapper;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Data.SqlClient;
|
||||
using static DbTableClass;
|
||||
|
||||
public class kolWithTag : kol
|
||||
{
|
||||
DbConn dbConn = new DbConn();
|
||||
SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
|
||||
|
||||
|
||||
public List<kolTagDetail> tags = new List<kolTagDetail>();
|
||||
|
||||
private kol _kol;
|
||||
|
||||
public kolWithTag()
|
||||
{
|
||||
_kol = new kol();
|
||||
}
|
||||
|
||||
public kolWithTag(kol kolObj)
|
||||
{
|
||||
Type kolType = kolObj.GetType();
|
||||
|
||||
foreach (var prop in kolType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = kolType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(kolObj, null);
|
||||
|
||||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
_kol = kolObj;
|
||||
loadList();
|
||||
}
|
||||
|
||||
public kolWithTag(string kol_uid)
|
||||
{
|
||||
_kol = conn.QueryFirstOrDefault<kol>("select * from kol where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||||
|
||||
if (_kol != null)
|
||||
{
|
||||
Type dataType = _kol.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(_kol, null);
|
||||
|
||||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
loadList();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadList()
|
||||
{
|
||||
if (this.kol_uid != "")
|
||||
{
|
||||
|
||||
tags.Clear();
|
||||
|
||||
List<kolTag> kolTags = conn.Query<kolTag>("select A.* from kolTag A, tags B where A.tag_uid = B.tag_uid and A.kol_uid = @kol_uid", new { kol_uid = kol_uid }).ToList();
|
||||
|
||||
|
||||
foreach (kolTag objItem in kolTags)
|
||||
{
|
||||
kolTagDetail objDetail = new kolTagDetail(objItem);
|
||||
tags.Add(objDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
using Dapper;
|
||||
using Dapper.Contrib.Extensions;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Data.SqlClient;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using static DbTableClass;
|
||||
|
||||
|
||||
public class projectDetail : project
|
||||
{
|
||||
DbConn dbConn = new DbConn();
|
||||
SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
|
||||
|
||||
public List<kolData> kolList = new List<kolData>();
|
||||
|
||||
private project _project;
|
||||
|
||||
public projectDetail()
|
||||
{
|
||||
_project = new project();
|
||||
}
|
||||
|
||||
public projectDetail(project projectObj)
|
||||
{
|
||||
Type projectType = projectObj.GetType();
|
||||
|
||||
foreach (var prop in projectType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = projectType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(projectObj, null);
|
||||
|
||||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
_project = projectObj;
|
||||
loadList();
|
||||
}
|
||||
|
||||
public projectDetail(string project_uid)
|
||||
{
|
||||
_project = conn.QueryFirstOrDefault<project>("select * from project where project_uid = @project_uid", new { project_uid = project_uid });
|
||||
|
||||
if (_project != null)
|
||||
{
|
||||
Type dataType = _project.GetType();
|
||||
|
||||
foreach (var prop in dataType.GetProperties())
|
||||
{
|
||||
string propName = prop.Name;
|
||||
var valueProperty = dataType.GetProperty(propName);
|
||||
object propValue = valueProperty.GetValue(_project, null);
|
||||
|
||||
this.GetType().GetProperty(propName).SetValue(this, propValue);
|
||||
}
|
||||
|
||||
loadList();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadList() {
|
||||
kolList = conn.Query<kolData>("select A.kol_uid, A.kol_name, A.kol_photo, A.kol_descript, B.kolProject_isExec, B.kolProject_noExecReason, B.kolProject_memo, B.kolProject_modifydate from kol A, kolProject B where A.kol_uid = B.kol_uid and B.project_uid = @project_uid order by B.kolProject_modifydate desc", new { project_uid = _project.project_uid }).ToList();
|
||||
}
|
||||
|
||||
public class kolData
|
||||
{
|
||||
public string kol_uid { get; set; } = "";
|
||||
|
||||
public string kol_name { get; set; } = "";
|
||||
|
||||
public string kol_photo { get; set; } = "";
|
||||
|
||||
public string kol_descript { get; set; } = "";
|
||||
|
||||
public string kolProject_isExec { get; set; } = "N";
|
||||
public string kolProject_noExecReason { get; set; } = "";
|
||||
public string kolProject_memo { get; set; } = "";
|
||||
|
||||
|
||||
public DateTime kolProject_modifydate { get; set; } = DateTime.Now;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<th> 名稱 </th>
|
||||
<th> 組成類型 </th>
|
||||
<th> 聯絡方式1 </th>
|
||||
<th> 聯絡方式2 </th>
|
||||
<th> 合作過類型 </th>
|
||||
<th> 最後修改時間 </th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
|
||||
var mediaTr;
|
||||
var delMedia;
|
||||
var mainTable;
|
||||
|
|
@ -82,7 +83,7 @@ $(document).ready(function () {
|
|||
kolMedia_url: $(this).find('td').eq(1).text().trim(),
|
||||
kolMedia_displayName: $(this).find('td').eq(3).text().trim(),
|
||||
kolMedia_accountName: $(this).find('td').eq(2).text().trim(),
|
||||
kolMedia_fansNum: $(this).find('td').eq(4).text().trim()
|
||||
kolMedia_fansNum: RemoveComma($(this).find('td').eq(4).text().trim())
|
||||
}
|
||||
|
||||
mediaArray.push(item);
|
||||
|
|
@ -198,7 +199,7 @@ $(document).ready(function () {
|
|||
err_msg += "請填入正確的社群平台網址!\n";
|
||||
}
|
||||
|
||||
if (kolMedia_fansNum.isNumber() == false) {
|
||||
if (RemoveComma(kolMedia_fansNum).isNumber() == false) {
|
||||
kolMedia_fansNum = 0;
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +215,7 @@ $(document).ready(function () {
|
|||
trHtml += ' <td class="align-middle"> ' + kolMedia_url + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + kolMedia_accountName + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + kolMedia_displayName + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + kolMedia_fansNum + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + AppendComma(kolMedia_fansNum) + ' </td>';
|
||||
trHtml += ' <td class="align-middle text-right">';
|
||||
trHtml += ' <button type="button" data-uid="" media-uid="' + optionItem_uid + '" data-method="edit" onclick="buttonClick(this);" class="btn btn-sm btn-icon btn-secondary" data-toggle="modal" data-target="#clientContactEditModal"><i class="fa fa-pencil-alt"></i> <span class="sr-only">Edit</span></button>';
|
||||
trHtml += ' <button type="button" data-uid="" media-uid="' + optionItem_uid + '" data-method="del" onclick="buttonClick(this);" class="btn btn-sm btn-icon btn-secondary"><i class="far fa-trash-alt"></i> <span class="sr-only">Remove</span></button>';
|
||||
|
|
@ -231,7 +232,7 @@ $(document).ready(function () {
|
|||
mediaTr.find('td').eq(1).text(kolMedia_url);
|
||||
mediaTr.find('td').eq(2).text(kolMedia_accountName);
|
||||
mediaTr.find('td').eq(3).text(kolMedia_displayName);
|
||||
mediaTr.find('td').eq(4).text(kolMedia_fansNum);
|
||||
mediaTr.find('td').eq(4).text(AppendComma(kolMedia_fansNum));
|
||||
var method1 = mediaTr.find('td').eq(5).children('button').eq(0).attr('media-uid', optionItem_uid);
|
||||
var mehtod2 = mediaTr.find('td').eq(5).children('button').eq(1).attr('media-uid', optionItem_uid);
|
||||
|
||||
|
|
@ -919,6 +920,20 @@ $(document).ready(function () {
|
|||
//return '<a href="javascript: void(0); " data-method="edit" data-uid="' + row.company_uid + '">' + row.company_name + '</a>';
|
||||
}
|
||||
}
|
||||
, {
|
||||
targets: 4,
|
||||
orderable: false,
|
||||
searchable: true,
|
||||
render: function render(data, type, row, meta) {
|
||||
var ret = '';
|
||||
|
||||
$.each(row.tags, function (key, value) {
|
||||
ret += '<span class="badge badge-pill badge-info">#' + value.tag_text + '</span> ';
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
, {
|
||||
targets: 5,
|
||||
orderable: false,
|
||||
|
|
@ -1765,7 +1780,7 @@ function buttonClick2(obj) {
|
|||
trHtml += ' <td class="align-middle"> ' + value.kolMedia_url + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + value.kolMedia_accountName + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + value.kolMedia_displayName + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + value.kolMedia_fansNum + ' </td>';
|
||||
trHtml += ' <td class="align-middle"> ' + AppendComma(value.kolMedia_fansNum) + ' </td>';
|
||||
trHtml += ' <td class="align-middle text-right">';
|
||||
trHtml += ' <button type="button" data-uid="' + value.kolMedia_uid + '" media-uid="' + value.optionItem_uid + '" data-method="edit" onclick="buttonClick(this);" class="btn btn-sm btn-icon btn-secondary" data-toggle="modal" data-target="#clientContactEditModal"><i class="fa fa-pencil-alt"></i> <span class="sr-only">Edit</span></button>';
|
||||
trHtml += ' <button type="button" data-uid="' + value.kolMedia_uid + '" media-uid="' + value.optionItem_uid + '" data-method="del" onclick="buttonClick(this);" class="btn btn-sm btn-icon btn-secondary"><i class="far fa-trash-alt"></i> <span class="sr-only">Remove</span></button>';
|
||||
|
|
@ -1821,7 +1836,7 @@ function buttonClick(obj) {
|
|||
var kolMedia_url = mediaTr.find('td').eq(1).text().trim();
|
||||
var kolMedia_accountName = mediaTr.find('td').eq(2).text().trim();
|
||||
var kolMedia_displayName = mediaTr.find('td').eq(3).text().trim();
|
||||
var kolMedia_fansNum = mediaTr.find('td').eq(4).text().trim();
|
||||
var kolMedia_fansNum = RemoveComma(mediaTr.find('td').eq(4).text().trim());
|
||||
|
||||
if (dataMethod == 'edit') {
|
||||
$('#media_method').val('edit');
|
||||
|
|
|
|||
|
|
@ -251,13 +251,13 @@ $(document).ready(function () {
|
|||
info: true,
|
||||
search: "搜尋:",
|
||||
searching: true,
|
||||
columns: [{ data: 'project_year', className: 'align-middle', orderable: false, searchable: false },
|
||||
{ data: 'project_prmSerial', className: 'align-middle text-left', orderable: true, searchable: true },
|
||||
{ data: 'project_name', className: 'align-middle text-left', orderable: true, searchable: true },
|
||||
{ data: 'project_isExec', className: 'align-middle text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_uid', className: 'align-middle text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_modifydate', className: 'align-middle text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_uid', className: 'align-middle text-center', orderable: false, searchable: false }],
|
||||
columns: [{ data: 'project_year', className: 'align-top', orderable: false, searchable: false },
|
||||
{ data: 'project_prmSerial', className: 'align-top text-left', orderable: true, searchable: true },
|
||||
{ data: 'project_name', className: 'align-top text-left', orderable: true, searchable: true },
|
||||
{ data: 'project_isExec', className: 'align-top text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_uid', className: 'align-top text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_modifydate', className: 'align-top text-left', orderable: false, searchable: true },
|
||||
{ data: 'project_uid', className: 'align-top text-center', orderable: false, searchable: false }],
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 3,
|
||||
|
|
@ -270,9 +270,13 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
if (row.project_isExec == 'N') {
|
||||
|
||||
if (row.project_reason == '') {
|
||||
return "未執行";
|
||||
} else {
|
||||
return "未執行,原因:" + row.project_reason;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
//return row.gift_city + row.gift_area + row.gift_address;
|
||||
|
|
@ -289,7 +293,31 @@ $(document).ready(function () {
|
|||
orderable: false,
|
||||
searchable: false,
|
||||
render: function render(data, type, row, meta) {
|
||||
ret = '尚在開發中';
|
||||
|
||||
var ret = '';
|
||||
|
||||
$.each(row.kolList, function (key, value) {
|
||||
var isExec = '未執行';
|
||||
|
||||
if (value.kolProject_isExec == 'Y') {
|
||||
isExec = '執行';
|
||||
|
||||
ret += '<span class="badge badge-pill badge-info">' + value.kol_name + ' (' + isExec + ')</span><br/>';
|
||||
} else {
|
||||
isExec = '未執行';
|
||||
|
||||
if (value.kolProject_noExecReason != '') {
|
||||
isExec += ':' + value.kolProject_noExecReason;
|
||||
}
|
||||
|
||||
ret += '<span class="badge badge-pill badge-warning">' + value.kol_name + ' (' + isExec + ')</span><br/>';
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
//ret = ret.replace(/^\/+|\/+$/g, '');
|
||||
//ret = '尚在開發中';
|
||||
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue