diff --git a/web/App_Code/DataAccess/StyleDataAccess.cs b/web/App_Code/DataAccess/StyleDataAccess.cs index bebe65a..2a158d8 100644 --- a/web/App_Code/DataAccess/StyleDataAccess.cs +++ b/web/App_Code/DataAccess/StyleDataAccess.cs @@ -1,4 +1,5 @@ -using DocumentFormat.OpenXml.Office2010.Excel; +using AjaxControlToolkit.HTMLEditor.Popups; +using DocumentFormat.OpenXml.Office2010.Excel; using DocumentFormat.OpenXml.Wordprocessing; using MINOM.COM.Utility; using Model; @@ -293,7 +294,7 @@ public class StyleDataAccess new SqlParameter("@UTime",""), }; - sb.Append("update TabletStyle set Descr=@Descr,PaperSize=@PaperSize,BackendImg=@BackendImg,PrintSize=@PrintSize,"); + sb.Append("update TabletStyle set Name=@Name,Descr=@Descr,PaperSize=@PaperSize,BackendImg=@BackendImg,PrintSize=@PrintSize,"); sb.Append("PrintMode=@PrintMode,Orientation=@Orientation,PrintPageCount=@PrintPageCount,RosterLimit=@RosterLimit,"); sb.Append("CUser=@CUser,CDate=@CDate,CTime=@CTime,UUser=@UUSer,UDate=@UDate,UTime=@UTime "); sb.Append("where StyleID=@StyleID "); @@ -348,4 +349,81 @@ public class StyleDataAccess } return obj; } + + public object[] DelTabletPaper(string paperID) + { + try + { + using (var context = new ezEntities()) + { + StringBuilder sb = new StringBuilder(); + SqlParameter[] sp = new SqlParameter[] { + new SqlParameter("@PaperID",paperID), + }; + sb.Clear(); + sb.Append("if not exists (select StyleID from TabletStyle where PaperSize=@paperID or PrintSize=@paperID)"); + sb.Append("begin "); + sb.Append("delete TabletPaperSize where paperID=@paperID "); + sb.Append("end;"); + sb.Append("select @@ROWCOUNT ;"); + int i = context.Database.ExecuteSqlCommand(sb.ToString(), sp.ToArray()); + if (i > 0) + { + obj[0] = "Y"; + obj[1] = "刪除成功"; + } + else + { + obj[0] = "N"; + obj[1] = "刪除失敗,已有活動使用"; + } + } + } + catch (Exception ex) + { + + obj[0] = "N"; + obj[1] = "刪除失敗:" + ex.Message; + } + return obj; + } + + public object[] DelTabletStyle(string styleID) + { + try + { + using (var context = new ezEntities()) + { + StringBuilder sb = new StringBuilder(); + SqlParameter[] sp = new SqlParameter[] { + new SqlParameter("@StyleID",styleID), + }; + sb.Clear(); + sb.Append("if not exists (select defaultStyle from actItem where defaultStyle=@styleID)"); + sb.Append("begin "); + sb.Append("delete TabletStyle where styleID=@styleID "); + sb.Append("delete TabletStyleDetail where StyleID=@StyleID "); + sb.Append("end;"); + sb.Append("select @@ROWCOUNT ;"); + int i = context.Database.ExecuteSqlCommand(sb.ToString(), sp.ToArray()); + if (i > 0) + { + obj[0] = "Y"; + obj[1] = "刪除成功"; + } + else + { + obj[0] = "N"; + obj[1] = "刪除失敗,已有活動使用"; + } + } + } + catch (Exception ex) + { + + obj[0] = "N"; + obj[1] = "刪除失敗:"+ex.Message; + } + return obj; + } } \ No newline at end of file diff --git a/web/App_Code/api/FollowerController.cs b/web/App_Code/api/FollowerController.cs index 1a95070..386502c 100644 --- a/web/App_Code/api/FollowerController.cs +++ b/web/App_Code/api/FollowerController.cs @@ -758,6 +758,7 @@ public class FollowerController : ApiController // ===== 新增 ===== autoEnroll = new Model.auto_enroll() { + num=0, f_num = item.f_num, start_date = item.start_date, end_date = item.end_date, diff --git a/web/App_Code/api/designerController.cs b/web/App_Code/api/designerController.cs index 7d503a7..a706e55 100644 --- a/web/App_Code/api/designerController.cs +++ b/web/App_Code/api/designerController.cs @@ -299,4 +299,32 @@ public class designerController : ApiController } } + + [HttpPost] + [Route("api/tablet/DelPaperSize")] + public IHttpActionResult DelPaperSize([FromBody] dynamic data) + { + LogUtility log = new LogUtility(); + var json = data; + log.writeLogPath((string)json.paperSize); + + string paperSize = (json == null || json.paperSize == null) ? "" : (string)json.paperSize; + //先檢查有沒有用過 + object[] obj = new StyleDataAccess().DelTabletPaper(paperSize); + return Ok(new { result = obj[0].ToString(), message = obj[1].ToString() }); + } + + [HttpPost] + [Route("api/tablet/DelTabletStyle")] + public IHttpActionResult DelTabletStyle([FromBody] dynamic data) + { + LogUtility log = new LogUtility(); + var json = data; + log.writeLogPath((string)json.styleID); + + string StyleID = (json == null || json.styleID == null) ? "" : (string)json.styleID; + //先檢查有沒有用過 + object[] obj = new StyleDataAccess().DelTabletStyle(StyleID); + return Ok(new { result = obj[0].ToString(), message = obj[1].ToString() }); + } } \ No newline at end of file diff --git a/web/admin/item/TabletDesigner.aspx b/web/admin/item/TabletDesigner.aspx index f7d3a14..3e29097 100644 --- a/web/admin/item/TabletDesigner.aspx +++ b/web/admin/item/TabletDesigner.aspx @@ -22,15 +22,43 @@ - + +
+
+
+ +
+
+
+ -
+
+
-
- - -
+ +
+
+ + +
+
+
+ + +
+
+ +
+ - + +
+
+ + -
+ <%--
-
+
--%>