|
|
@@ -340,7 +340,7 @@ namespace ResfullApi.Models
|
|
|
return ds;
|
|
|
}
|
|
|
|
|
|
- public static DataSet SYS_FUNCTION_WEB_CMS_GET_LIST(string v_users, string v_id, string v_role, string v_name, string v_link, string v_order, string v_rowsOnPage, string v_seqPage)
|
|
|
+ public static DataSet SYS_FUNCTION_WEB_CMS_GET_LIST(string v_users, string v_id, string v_role, string v_name, string v_link, string v_order, string v_rowsOnPage, string v_seqPage, string v_status)
|
|
|
{
|
|
|
DataSet ds = new DataSet();
|
|
|
OracleConnection dbConnection = DataAccess.getPoolingConnection();
|
|
|
@@ -354,7 +354,7 @@ namespace ResfullApi.Models
|
|
|
|
|
|
// Build base query for counting total records
|
|
|
string countSql = "SELECT COUNT(*) FROM USER_WEB_CMS_FUNCTION WHERE 1=1";
|
|
|
- string dataSql = @"SELECT ID, ROLE, NAME, LINK, NOTE
|
|
|
+ string dataSql = @"SELECT ID, ROLE, NAME, LINK, NOTE, STATUS AS FUNCTION_STATUS
|
|
|
FROM USER_WEB_CMS_FUNCTION WHERE 1=1";
|
|
|
|
|
|
// Add filters
|
|
|
@@ -382,6 +382,12 @@ namespace ResfullApi.Models
|
|
|
dataSql += " AND UPPER(LINK) LIKE UPPER(:v_link)";
|
|
|
}
|
|
|
|
|
|
+ if (v_status != null && v_status != "-1")
|
|
|
+ {
|
|
|
+ countSql += " AND STATUS = :v_status";
|
|
|
+ dataSql += " AND STATUS = :v_status";
|
|
|
+ }
|
|
|
+
|
|
|
// Add ordering
|
|
|
dataSql += " ORDER BY ID " + (v_order == "desc" ? "DESC" : "ASC");
|
|
|
|
|
|
@@ -409,6 +415,11 @@ namespace ResfullApi.Models
|
|
|
countCmd.Parameters.Add(":v_link", OracleDbType.NVarchar2).Value = "%" + v_link + "%";
|
|
|
}
|
|
|
|
|
|
+ if (v_status != null && v_status != "-1")
|
|
|
+ {
|
|
|
+ countCmd.Parameters.Add(":v_status", OracleDbType.Int32).Value = int.Parse(v_status);
|
|
|
+ }
|
|
|
+
|
|
|
int totalRows = Convert.ToInt32(countCmd.ExecuteScalar());
|
|
|
int totalPage = (int)Math.Ceiling((double)totalRows / rowsOnPage);
|
|
|
|
|
|
@@ -441,6 +452,11 @@ namespace ResfullApi.Models
|
|
|
dataCmd.Parameters.Add(":v_link", OracleDbType.NVarchar2).Value = "%" + v_link + "%";
|
|
|
}
|
|
|
|
|
|
+ if (v_status != null && v_status != "-1")
|
|
|
+ {
|
|
|
+ dataCmd.Parameters.Add(":v_status", OracleDbType.Int32).Value = int.Parse(v_status);
|
|
|
+ }
|
|
|
+
|
|
|
OracleDataAdapter dataAdapter = new OracleDataAdapter(dataCmd);
|
|
|
dataAdapter.Fill(ds);
|
|
|
|
|
|
@@ -492,7 +508,7 @@ namespace ResfullApi.Models
|
|
|
return ds;
|
|
|
}
|
|
|
|
|
|
- public static DataSet SYS_FUNCTION_WEB_CMS_INSERT(string V_ROLE, string V_NAME, string V_LINK, string V_NOTE, string V_USERS)
|
|
|
+ public static DataSet SYS_FUNCTION_WEB_CMS_INSERT(string V_ROLE, string V_NAME, string V_LINK, string V_NOTE, string V_STATUS, string V_USERS)
|
|
|
{
|
|
|
DataSet ds = new DataSet();
|
|
|
DataTable tb = new DataTable();
|
|
|
@@ -502,8 +518,8 @@ namespace ResfullApi.Models
|
|
|
try
|
|
|
{
|
|
|
dbConnection.Open();
|
|
|
- string sql = @"INSERT INTO USER_WEB_CMS_FUNCTION(ID, ROLE, NAME, LINK, NOTE)
|
|
|
- VALUES(USER_WEB_CMS_FUNCTION_SEQ.NEXTVAL, :role, :name, :link, :note)";
|
|
|
+ string sql = @"INSERT INTO USER_WEB_CMS_FUNCTION(ID, ROLE, NAME, LINK, NOTE, STATUS)
|
|
|
+ VALUES(USER_WEB_CMS_FUNCTION_SEQ.NEXTVAL, :role, :name, :link, :note, :status)";
|
|
|
using (OracleCommand cmd = new OracleCommand(sql, dbConnection))
|
|
|
{
|
|
|
cmd.CommandType = CommandType.Text;
|
|
|
@@ -511,6 +527,7 @@ namespace ResfullApi.Models
|
|
|
cmd.Parameters.Add(":name", OracleDbType.NVarchar2).Value = V_NAME ?? "";
|
|
|
cmd.Parameters.Add(":link", OracleDbType.NVarchar2).Value = V_LINK ?? "";
|
|
|
cmd.Parameters.Add(":note", OracleDbType.NVarchar2).Value = V_NOTE ?? "";
|
|
|
+ cmd.Parameters.Add(":status", OracleDbType.Int32).Value = string.IsNullOrEmpty(V_STATUS) ? 1 : int.Parse(V_STATUS);
|
|
|
int affected = cmd.ExecuteNonQuery();
|
|
|
|
|
|
// get generated id in this session
|
|
|
@@ -546,7 +563,7 @@ namespace ResfullApi.Models
|
|
|
return ds;
|
|
|
}
|
|
|
|
|
|
- public static DataSet SYS_FUNCTION_WEB_CMS_UPDATE(string V_ID, string V_ROLE, string V_NAME, string V_LINK, string V_NOTE, string V_USERS)
|
|
|
+ public static DataSet SYS_FUNCTION_WEB_CMS_UPDATE(string V_ID, string V_ROLE, string V_NAME, string V_LINK, string V_NOTE, string V_STATUS, string V_USERS)
|
|
|
{
|
|
|
DataSet ds = new DataSet();
|
|
|
DataTable tb = new DataTable();
|
|
|
@@ -560,7 +577,8 @@ namespace ResfullApi.Models
|
|
|
SET ROLE = :role,
|
|
|
NAME = :name,
|
|
|
LINK = :link,
|
|
|
- NOTE = :note
|
|
|
+ NOTE = :note,
|
|
|
+ STATUS = :status
|
|
|
WHERE ID = :id";
|
|
|
using (OracleCommand cmd = new OracleCommand(sql, dbConnection))
|
|
|
{
|
|
|
@@ -569,6 +587,7 @@ namespace ResfullApi.Models
|
|
|
cmd.Parameters.Add(":name", OracleDbType.NVarchar2).Value = V_NAME ?? "";
|
|
|
cmd.Parameters.Add(":link", OracleDbType.NVarchar2).Value = V_LINK ?? "";
|
|
|
cmd.Parameters.Add(":note", OracleDbType.NVarchar2).Value = V_NOTE ?? "";
|
|
|
+ cmd.Parameters.Add(":status", OracleDbType.Int32).Value = string.IsNullOrEmpty(V_STATUS) ? 1 : int.Parse(V_STATUS);
|
|
|
cmd.Parameters.Add(":id", OracleDbType.NVarchar2).Value = V_ID ?? "";
|
|
|
int affected = cmd.ExecuteNonQuery();
|
|
|
|