diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 0000000..e3cadb9
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-ef": {
+ "version": "8.0.0",
+ "commands": [
+ "dotnet-ef"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs
index b6cf7ed..96bb22e 100644
--- a/Controllers/HomeController.cs
+++ b/Controllers/HomeController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
+using static DbTableClass;
namespace Journeys_WantHome.Controllers
{
@@ -20,6 +21,11 @@ namespace Journeys_WantHome.Controllers
this._httpContextAccessor = httpContextAccessor;
this._objToken = new authToken(this._httpContextAccessor);
+
+ kol myKol = new kol();
+ myKol.kol_name = "123";
+
+ kolDetial kolD = new kolDetial(myKol);
}
public IActionResult OptionList()
diff --git a/Journeys_WantHome.csproj b/Journeys_WantHome.csproj
index ae73dfa..608672f 100644
--- a/Journeys_WantHome.csproj
+++ b/Journeys_WantHome.csproj
@@ -43,13 +43,13 @@
-
+
-
+
diff --git a/Models/DbTableClass.cs b/Models/DbTableClass.cs
index 052df29..904d3c1 100644
--- a/Models/DbTableClass.cs
+++ b/Models/DbTableClass.cs
@@ -8,6 +8,140 @@ using Newtonsoft.Json.Linq;
public class DbTableClass
{
+ [Table("kol")]
+ public class kol
+ {
+ [JsonIgnore]
+ [Key]
+ public int kol_sn { get; set; }
+
+ public string kol_uid { get; set; } = "";
+
+ public string kol_name { get; set; } = "";
+
+ public string kol_descript { get; set; } = "";
+
+ public string kol_men_ratio { get; set; } = "";
+
+ public string kol_women_ratio { get; set; } = "";
+
+ public double kol_13_17 { get; set; }
+
+ public double kol_18_24 { get; set; }
+
+ public double kol_25_34 { get; set; }
+
+ public double kol_35_44 { get; set; }
+
+ public double kol_45_54 { get; set; }
+
+ public double kol_55_64 { get; set; }
+
+ public double kol_65 { get; set; }
+
+ public DateTime kol_createdate { get; set; }
+
+ public DateTime kol_modifydate { get; set; }
+
+ public string kol_create_userId { get; set; } = "";
+
+ public string kol_modify_userId { get; set; } = "";
+
+ }
+
+
+ [Table("kolCooperateType")]
+ public class kolCooperateType
+ {
+ [JsonIgnore]
+ [Key]
+ public int kolCooperateType_sn { get; set; }
+
+ public string kolCooperateType_uid { get; set; } = "";
+
+ public string kol_uid { get; set; } = "";
+
+ public string option_uid { get; set; } = "";
+
+ public string optionItem_uid { get; set; } = "";
+
+ }
+
+ [Table("kolFansType")]
+ public class kolFansType
+ {
+ [JsonIgnore]
+ [Key]
+ public int kolFansType_sn { get; set; }
+
+ public string kolFansType_uid { get; set; } = "";
+
+ public string kol_uid { get; set; } = "";
+
+ public string option_uid { get; set; } = "";
+
+ public string optionItem_uid { get; set; } = "";
+
+ }
+
+
+ [Table("kolMakeup")]
+ public class kolMakeup
+ {
+ [JsonIgnore]
+ [Key]
+ public int kolMakeup_sn { get; set; }
+
+ public string kolMakeup_uid { get; set; } = "";
+
+ public string kol_uid { get; set; } = "";
+
+ public string option_uid { get; set; } = "";
+
+ public string optionItem_uid { get; set; } = "";
+
+ }
+
+ [Table("kolMedia")]
+ public class kolMedia
+ {
+ [JsonIgnore]
+ [Key]
+ public int kolMedia_sn { get; set; }
+
+ public string kolMedia_uid { get; set; } = "";
+
+ public string kol_uid { get; set; } = "";
+
+ public string option_uid { get; set; } = "";
+
+ public string optionItem_uid { get; set; } = "";
+
+ public string kolMedia_displayName { get; set; } = "";
+
+ public string kolMedia_accountName { get; set; } = "";
+
+ public int kolMedia_fansNum { get; set; } = 0;
+
+ }
+
+ [Table("kolStyle")]
+ public class kolStyle
+ {
+ [JsonIgnore]
+ [Key]
+ public int kolStyle_sn { get; set; }
+
+ public string kolStyle_uid { get; set; } = "";
+
+ public string kol_uid { get; set; } = "";
+
+ public string option_uid { get; set; } = "";
+
+ public string optionItem_uid { get; set; } = "";
+
+ }
+
[Table("optionItem")]
public class optionItem
{
diff --git a/Models/kolCooperateTypeDetail.cs b/Models/kolCooperateTypeDetail.cs
new file mode 100644
index 0000000..b05d563
--- /dev/null
+++ b/Models/kolCooperateTypeDetail.cs
@@ -0,0 +1,117 @@
+using Dapper;
+using Dapper.Contrib.Extensions;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+
+public class kolCooperateTypeDetail : kolCooperateType {
+
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public string option_name { get; set; } = "";
+ public string optionItem_name { get; set; } = "";
+
+ public string updateResult { get; set; } = "";
+
+ private kolCooperateType _kolCooperateType;
+
+ public kolCooperateTypeDetail() {
+ _kolCooperateType = new kolCooperateType();
+ }
+
+ public kolCooperateTypeDetail(string kolCooperateType_uid) {
+ _kolCooperateType = conn.QueryFirstOrDefault("select * from kolCooperateType where kolCooperateType_uid = @kolCooperateType_uid", new { kolCooperateType_uid = kolCooperateType_uid});
+
+ if (_kolCooperateType != null)
+ {
+ Type dataType = _kolCooperateType.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolCooperateType, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+ else {
+ _kolCooperateType = new kolCooperateType();
+ }
+ }
+
+ public kolCooperateTypeDetail(kolCooperateType cooperateType)
+ {
+ this._kolCooperateType = cooperateType;
+
+ Type dataType = _kolCooperateType.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolCooperateType, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+
+ public bool dataUpdate() {
+ if (this._kolCooperateType != null)
+ {
+ if (this._kolCooperateType.kolCooperateType_uid == "")
+ {
+ this._kolCooperateType.kolCooperateType_uid = "KCT_" + GlobalClass.CreateRandomCode(16);
+
+ try
+ {
+ conn.Insert(this._kolCooperateType);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex){
+ updateResult = ex.Message;
+ return false;
+ }
+
+ }
+ else {
+ try
+ {
+ conn.Update(this._kolCooperateType);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+ }
+ }
+ else {
+ updateResult = "null 物件無法更新";
+ return false;
+ }
+ }
+
+
+}
diff --git a/Models/kolDetial.cs b/Models/kolDetial.cs
new file mode 100644
index 0000000..12c5056
--- /dev/null
+++ b/Models/kolDetial.cs
@@ -0,0 +1,51 @@
+using Dapper;
+using NPOI.SS.Formula.Functions;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+public class kolDetial : kol
+{
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public List cooperateTypes = new List();
+ public List fansTypes = new List();
+ public List makeups = new List();
+ public List medias = new List();
+ public List styles = new List();
+
+ public kolDetial() {
+
+ }
+
+ public kolDetial(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);
+ }
+
+
+ }
+
+ private void loadList() {
+ if (this.kol_uid != "") {
+ this.cooperateTypes.Clear();
+ this.fansTypes.Clear();
+ this.makeups.Clear();
+ this.medias.Clear();
+ this.styles.Clear();
+
+ this.cooperateTypes = conn.Query("select * from ").ToList();
+
+
+ }
+ }
+
+}
diff --git a/Models/kolFansTypeDetail.cs b/Models/kolFansTypeDetail.cs
new file mode 100644
index 0000000..b1789b9
--- /dev/null
+++ b/Models/kolFansTypeDetail.cs
@@ -0,0 +1,119 @@
+using Dapper;
+using Dapper.Contrib.Extensions;
+using System.ComponentModel.DataAnnotations;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+public class kolFansTypeDetail : kolFansType
+{
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public string option_name { get; set; } = "";
+ public string optionItem_name { get; set; } = "";
+
+ public string updateResult { get; set; } = "";
+
+ private kolFansType _kolFansType;
+
+ public kolFansTypeDetail() {
+ _kolFansType = new kolFansType();
+ }
+
+ public kolFansTypeDetail(string kolFansType_uid)
+ {
+ _kolFansType = conn.QueryFirstOrDefault("select * from kolFansType where kolFansType_uid = @kolFansType_uid", new { kolFansType_uid = kolFansType_uid });
+
+ if (_kolFansType != null)
+ {
+ Type dataType = _kolFansType.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolFansType, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+ else
+ {
+ _kolFansType = new kolFansType();
+ }
+ }
+
+ public kolFansTypeDetail(kolFansType fansType)
+ {
+ this._kolFansType = fansType;
+
+ Type dataType = _kolFansType.GetType();
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolFansType, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+
+ public bool dataUpdate()
+ {
+ if (this._kolFansType != null)
+ {
+ if (this._kolFansType.kolFansType_uid == "")
+ {
+ this._kolFansType.kolFansType_uid = "KFT_" + GlobalClass.CreateRandomCode(16);
+
+ try
+ {
+ conn.Insert(this._kolFansType);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+
+ }
+ else
+ {
+ try
+ {
+ conn.Update(this._kolFansType);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+ }
+ }
+ else
+ {
+ updateResult = "null 物件無法更新";
+ return false;
+ }
+ }
+}
diff --git a/Models/kolMakeupDetail.cs b/Models/kolMakeupDetail.cs
new file mode 100644
index 0000000..380f546
--- /dev/null
+++ b/Models/kolMakeupDetail.cs
@@ -0,0 +1,120 @@
+using Dapper;
+using Dapper.Contrib.Extensions;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+public class kolMakeupDetail : kolMakeup
+{
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public string option_name { get; set; } = "";
+ public string optionItem_name { get; set; } = "";
+
+ public string updateResult { get; set; } = "";
+
+ private kolMakeup _kolMakeup;
+
+ public kolMakeupDetail() {
+ _kolMakeup = new kolMakeup();
+ }
+
+ public kolMakeupDetail(string kolMakeup_uid)
+ {
+ _kolMakeup = conn.QueryFirstOrDefault("select * from kolMakeup where kolMakeup_uid = @kolMakeup_uid", new { kolMakeup_uid = kolMakeup_uid });
+
+ if (_kolMakeup != null)
+ {
+ Type dataType = _kolMakeup.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolMakeup, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+ else
+ {
+ _kolMakeup = new kolMakeup();
+ }
+ }
+
+ public kolMakeupDetail(kolMakeup kolMakeup)
+ {
+ this._kolMakeup = kolMakeup;
+
+ Type dataType = _kolMakeup.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolMakeup, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+
+ }
+
+ public bool dataUpdate()
+ {
+ if (this._kolMakeup != null)
+ {
+ if (this._kolMakeup.kolMakeup_uid == "")
+ {
+ this._kolMakeup.kolMakeup_uid = "KMK_" + GlobalClass.CreateRandomCode(16);
+
+ try
+ {
+ conn.Insert(this._kolMakeup);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+
+ }
+ else
+ {
+ try
+ {
+ conn.Update(this._kolMakeup);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+ }
+ }
+ else
+ {
+ updateResult = "null 物件無法更新";
+ return false;
+ }
+ }
+}
diff --git a/Models/kolMediaDetail.cs b/Models/kolMediaDetail.cs
new file mode 100644
index 0000000..f544662
--- /dev/null
+++ b/Models/kolMediaDetail.cs
@@ -0,0 +1,120 @@
+using Dapper;
+using Dapper.Contrib.Extensions;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+public class kolMediaDetail : kolMedia
+{
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public string option_name { get; set; } = "";
+ public string optionItem_name { get; set; } = "";
+
+ public string updateResult { get; set; } = "";
+
+ private kolMedia _kolMedia;
+
+ public kolMediaDetail()
+ {
+ _kolMedia = new kolMedia();
+ }
+
+ public kolMediaDetail(string kolMakeup_uid)
+ {
+ _kolMedia = conn.QueryFirstOrDefault("select * from kolMedia where kolMedia_uid = @kolMedia_uid", new { kolMedia_uid = kolMedia_uid });
+
+ if (_kolMedia != null)
+ {
+ Type dataType = _kolMedia.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolMedia, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+ else
+ {
+ _kolMedia = new kolMedia();
+ }
+ }
+
+ public kolMediaDetail(kolMedia kolMedia)
+ {
+ this._kolMedia = kolMedia;
+
+ Type dataType = _kolMedia.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolMedia, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+
+ public bool dataUpdate()
+ {
+ if (this._kolMedia != null)
+ {
+ if (this._kolMedia.kolMedia_uid == "")
+ {
+ this._kolMedia.kolMedia_uid = "KME_" + GlobalClass.CreateRandomCode(16);
+
+ try
+ {
+ conn.Insert(this._kolMedia);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+
+ }
+ else
+ {
+ try
+ {
+ conn.Update(this._kolMedia);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+ }
+ }
+ else
+ {
+ updateResult = "null 物件無法更新";
+ return false;
+ }
+ }
+}
diff --git a/Models/kolStyleDetail.cs b/Models/kolStyleDetail.cs
new file mode 100644
index 0000000..eb77269
--- /dev/null
+++ b/Models/kolStyleDetail.cs
@@ -0,0 +1,120 @@
+using Dapper;
+using Dapper.Contrib.Extensions;
+using System.Data.SqlClient;
+using static DbTableClass;
+
+public class kolStyleDetail : kolStyle
+{
+ DbConn dbConn = new DbConn();
+ SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
+
+ public string option_name { get; set; } = "";
+ public string optionItem_name { get; set; } = "";
+
+ public string updateResult { get; set; } = "";
+
+ private kolStyle _kolStyle;
+
+ public kolStyleDetail()
+ {
+ _kolStyle = new kolStyle();
+ }
+
+ public kolStyleDetail(string kolMakeup_uid)
+ {
+ _kolStyle = conn.QueryFirstOrDefault("select * from kolStyle where kolStyle_uid = @kolStyle_uid", new { kolStyle_uid = kolStyle_uid });
+
+ if (_kolStyle != null)
+ {
+ Type dataType = _kolStyle.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolStyle, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+ else
+ {
+ _kolStyle = new kolStyle();
+ }
+ }
+
+ public kolStyleDetail(kolStyle kolStyle)
+ {
+ this._kolStyle = kolStyle;
+
+ Type dataType = _kolStyle.GetType();
+
+ foreach (var prop in dataType.GetProperties())
+ {
+ string propName = prop.Name;
+ var valueProperty = dataType.GetProperty(propName);
+ object propValue = valueProperty.GetValue(_kolStyle, null);
+
+ this.GetType().GetProperty(propName).SetValue(this, propValue);
+ }
+
+ var result = conn.QueryFirstOrDefault("select A.option_name, B.optionItem_name from from option A, optionItem B where A.option_uid = B.option_uid and B.option_uid = @option_uid and B.optionItem_uid = @optionItem_uid ", new { option_uid = this.option_uid, optionItem_uid = this.optionItem_uid });
+
+ if (result != null)
+ {
+ this.option_name = result.option_name;
+ this.optionItem_name = result.optionItem_name;
+ }
+ }
+
+ public bool dataUpdate()
+ {
+ if (this._kolStyle != null)
+ {
+ if (this._kolStyle.kolStyle_uid == "")
+ {
+ this._kolStyle.kolStyle_uid = "KST_" + GlobalClass.CreateRandomCode(16);
+
+ try
+ {
+ conn.Insert(this._kolStyle);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+
+ }
+ else
+ {
+ try
+ {
+ conn.Update(this._kolStyle);
+ updateResult = "success";
+ return true;
+ }
+ catch (Exception ex)
+ {
+ updateResult = ex.Message;
+ return false;
+ }
+ }
+ }
+ else
+ {
+ updateResult = "null 物件無法更新";
+ return false;
+ }
+ }
+}
diff --git a/Views/Home/Dashboard.cshtml b/Views/Home/Dashboard.cshtml
index 121caea..b70b877 100644
--- a/Views/Home/Dashboard.cshtml
+++ b/Views/Home/Dashboard.cshtml
@@ -11,4 +11,13 @@
@section Script {
-}
\ No newline at end of file
+
+}
+