牌位版型設計,增加刪除版型跟紙張尺寸
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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() });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user