增加紙張尺寸設定
This commit is contained in:
@@ -24,6 +24,72 @@ public class StyleDataAccess
|
||||
//
|
||||
}
|
||||
|
||||
public object[] AddTabletPaper(TabletPaperSize tps)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = new ezEntities())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sp = new List<SqlParameter>();
|
||||
sb.Append("insert into TabletPaperSize (PaperID,PaperName,Width,Height,CUser,CDate,CTime,UUser,UDate,UTime )");
|
||||
sb.Append("values (@PaperID,@PaperName,@Width,@Height,@CUser,@CDate,@CTime,@UUser,@UDate,@UTime )");
|
||||
sp.Add(new SqlParameter("@PaperID",tps.PaperID));
|
||||
sp.Add(new SqlParameter("@PaperName", tps.PaperName));
|
||||
sp.Add(new SqlParameter("@Width", tps.Width));
|
||||
sp.Add(new SqlParameter("@Height", tps.Height));
|
||||
sp.Add(new SqlParameter("@CUser", tps.CUser));
|
||||
sp.Add(new SqlParameter("@CDate", tps.CDate));
|
||||
sp.Add(new SqlParameter("@CTime", tps.CTime));
|
||||
sp.Add(new SqlParameter("@UUser", tps.UUser));
|
||||
sp.Add(new SqlParameter("@UDate", tps.UDate));
|
||||
sp.Add(new SqlParameter("@UTime", tps.UTime));
|
||||
context.Database.ExecuteSqlCommand(sb.ToString(),sp);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.writeErrorPath("AddTabletPaper:" + ex.Message + ex.StackTrace);
|
||||
obj[0] = "N";
|
||||
obj[1] = ex.Message;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
public object[] GetTabletPaper(string paperID, string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var context = new ezEntities())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sp = new List<SqlParameter>();
|
||||
|
||||
sb.Append("select * from TabletPaperSize where 1=1 ");
|
||||
if (!string.IsNullOrEmpty(paperID))
|
||||
{
|
||||
sb.Append("and PaperID=@PaperID ");
|
||||
sp.Add(new SqlParameter("@PaperID", paperID));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
sb.Append("and Name=@Name ");
|
||||
sp.Add(new SqlParameter("@Name", name));
|
||||
}
|
||||
var data = context.Database.SqlQuery<TabletPaperSize>(sb.ToString(), sp.ToArray()).ToList();
|
||||
obj[2] = data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.writeErrorPath("GetTabletElement:" + ex.Message + ex.StackTrace);
|
||||
obj[0] = "N";
|
||||
obj[1] = ex.Message;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
public object[] GetTabletElement(string elementID ,string name)
|
||||
{
|
||||
try
|
||||
@@ -31,20 +97,20 @@ public class StyleDataAccess
|
||||
using (var context = new ezEntities())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SqlParameter[] sp = new SqlParameter[] { };
|
||||
var sp = new List<SqlParameter>();
|
||||
|
||||
sb.Append("select * from TabletElement where 1=1 ");
|
||||
if (!string.IsNullOrEmpty(elementID))
|
||||
{
|
||||
sb.Append("and ElementID=@ElementID ");
|
||||
sp.Append(new SqlParameter("ElementID", elementID));
|
||||
sp.Add(new SqlParameter("@ElementID", elementID));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
sb.Append("and Name=@Name ");
|
||||
sp.Append(new SqlParameter("Name", name));
|
||||
sp.Add(new SqlParameter("@Name", name));
|
||||
}
|
||||
var data = context.Database.SqlQuery<TabletElement>(sb.ToString(), sp).ToList();
|
||||
var data = context.Database.SqlQuery<TabletElement>(sb.ToString(), sp.ToArray()).ToList();
|
||||
obj[2] = data;
|
||||
}
|
||||
}
|
||||
@@ -65,20 +131,20 @@ public class StyleDataAccess
|
||||
using (var context = new ezEntities())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SqlParameter[] sp = new SqlParameter[] { };
|
||||
var sp = new List<SqlParameter>();
|
||||
|
||||
sb.Append("select * from TabletStyleDetail where 1=1 ");
|
||||
if (!string.IsNullOrEmpty(styleID))
|
||||
{
|
||||
sb.Append("and StyleID=@StyleID ");
|
||||
sp.Append(new SqlParameter("StyleID", styleID));
|
||||
sp.Add(new SqlParameter("@StyleID", styleID));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(elementID))
|
||||
{
|
||||
sb.Append("and ElementID=@ElementID ");
|
||||
sp.Append(new SqlParameter("ElementID", elementID));
|
||||
sp.Add(new SqlParameter("@ElementID", elementID));
|
||||
}
|
||||
var data = context.Database.SqlQuery<TabletStyleDetail>(sb.ToString(), sp).ToList();
|
||||
var data = context.Database.SqlQuery<TabletStyleDetail>(sb.ToString(), sp.ToArray()).ToList();
|
||||
obj[2] = data;
|
||||
}
|
||||
}
|
||||
@@ -98,20 +164,20 @@ public class StyleDataAccess
|
||||
using (var context = new ezEntities())
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SqlParameter[] sp = new SqlParameter[] { };
|
||||
var sp = new List<SqlParameter>();
|
||||
|
||||
sb.Append("select * from TabletStyle where 1=1 ");
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
sb.Append("and StyleID=@StyleID ");
|
||||
sp.Append(new SqlParameter( "StyleID",id));
|
||||
sp.Add(new SqlParameter( "@StyleID",id));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
sb.Append("and Name=@Name ");
|
||||
sp.Append(new SqlParameter("Name", name));
|
||||
sp.Add(new SqlParameter("@Name", name));
|
||||
}
|
||||
var data= context.Database.SqlQuery<TabletStyle>(sb.ToString(), sp).ToList();
|
||||
var data= context.Database.SqlQuery<TabletStyle>(sb.ToString(), sp.ToArray()).ToList();
|
||||
obj[2]= data;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +291,7 @@ public class StyleDataAccess
|
||||
new SqlParameter("@UTime",""),
|
||||
};
|
||||
|
||||
sb.Append("update TableStyle set Descr=@Descr,PaperSize=@PaperSize,BackendImg=@BackendImg,PrintSize=@PrintSize,");
|
||||
sb.Append("update TabletStyle set Descr=@Descr,PaperSize=@PaperSize,BackendImg=@BackendImg,PrintSize=@PrintSize,");
|
||||
sb.Append("PrintMode=@PrintMode,Orientation=@Orientation,PrintPageCount=@PrintPageCount,");
|
||||
sb.Append("CUser=@CUser,CDate=@CDate,CTime=@CTime,UUser=@UUSer,UDate=@UDate,UTime=@UTime ");
|
||||
sb.Append("where StyleID=@StyleID ");
|
||||
@@ -234,7 +300,7 @@ public class StyleDataAccess
|
||||
|
||||
sb.Clear();
|
||||
sb.Append("update TabletStyleDetail set Descr=@Descr,StartX=@StartX,StartY=@StartY,FontSize=@FontSize,BreakLen=@BreakLen,");
|
||||
sb.Append("FontFamily=@FontFamily,TwoOffset=@TwoOffset,ThreeOffset=@ThreeOffset,FourOffsert=@FourOffset,IsActive=@IsActive,");
|
||||
sb.Append("FontFamily=@FontFamily,TwoOffset=@TwoOffset,ThreeOffset=@ThreeOffset,FourOffset=@FourOffset,IsActive=@IsActive,");
|
||||
sb.Append("Width=@Width,Height=@Height,TextWidth=@TextWidth,TextHeight=@TextHeight,UUser=@UUser,UDate=@UDate,UTime=@UTime ");
|
||||
sb.Append("where StyleID=@StyleID and ElementID=@ElementID ");
|
||||
//sb.Append("insert into TabletStyleDetail(StyleID,Name,Descr,ElementID,StartX,StartY,FontSize,BreakLen,FontFamily,TwoOffset,");
|
||||
|
||||
@@ -73,4 +73,19 @@ public class TabletElement
|
||||
public string UUser { get; set; }
|
||||
public string UDate { get; set; }
|
||||
public string UTime { get; set; }
|
||||
}
|
||||
|
||||
public class TabletPaperSize
|
||||
{
|
||||
public TabletPaperSize() { }
|
||||
public string PaperID { get; set; }
|
||||
public string PaperName { get; set; }
|
||||
public string Width { get; set; }
|
||||
public string Height { get; set; }
|
||||
public string CUser { get; set; }
|
||||
public string CDate { get; set; }
|
||||
public string CTime { get; set; }
|
||||
public string UUser { get; set; }
|
||||
public string UDate { get; set; }
|
||||
public string UTime { get; set; }
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using System.Web.Http;
|
||||
/// <summary>
|
||||
/// designerController 的摘要描述
|
||||
/// </summary>
|
||||
public class designerController:ApiController
|
||||
public class designerController : ApiController
|
||||
{
|
||||
public designerController()
|
||||
{
|
||||
@@ -67,8 +67,8 @@ public class designerController:ApiController
|
||||
{
|
||||
LogUtility log = new LogUtility();
|
||||
|
||||
object[] obj=new StyleDataAccess().GetStyle("","");
|
||||
if (obj[0].ToString()=="Y")
|
||||
object[] obj = new StyleDataAccess().GetStyle("", "");
|
||||
if (obj[0].ToString() == "Y")
|
||||
{
|
||||
return Ok(new { result = "Y", data = obj[2] });
|
||||
}
|
||||
@@ -84,13 +84,13 @@ public class designerController:ApiController
|
||||
[Route("api/tablet/SavDegignerData")]
|
||||
public IHttpActionResult SavDegignerData([FromBody] dynamic data)
|
||||
{
|
||||
LogUtility log=new LogUtility();
|
||||
LogUtility log = new LogUtility();
|
||||
var json = data;
|
||||
//json.detail.Children<JObject>()
|
||||
log.writeLogPath((string)json.styleName);
|
||||
TabletStyle ts=new TabletStyle();
|
||||
List<TabletStyleDetail> list=new List<TabletStyleDetail>();
|
||||
ts.StyleID = (json == null || json.styleID == null) ? "" : (string) json.styleID;
|
||||
TabletStyle ts = new TabletStyle();
|
||||
List<TabletStyleDetail> list = new List<TabletStyleDetail>();
|
||||
ts.StyleID = (json == null || json.styleID == null) ? "" : (string)json.styleID;
|
||||
string mode = "edit";
|
||||
if (string.IsNullOrEmpty(ts.StyleID))
|
||||
{
|
||||
@@ -108,8 +108,8 @@ public class designerController:ApiController
|
||||
foreach (var item in json.detail.Children<JObject>())
|
||||
{
|
||||
TabletStyleDetail tsd = new TabletStyleDetail();
|
||||
tsd.StyleID=ts.StyleID;
|
||||
tsd.Name=item.name==null?"":(string)item.name;
|
||||
tsd.StyleID = ts.StyleID;
|
||||
tsd.Name = item.name == null ? "" : (string)item.name;
|
||||
tsd.Descr = item.descr == null ? "" : (string)item.descr;
|
||||
tsd.ElementID = item.elementID == null ? "" : (string)item.elementID;
|
||||
tsd.StartX = item.startX == null ? "" : (string)item.startX;
|
||||
@@ -126,8 +126,111 @@ public class designerController:ApiController
|
||||
}
|
||||
if (mode == "add")
|
||||
{
|
||||
object[] obj= new StyleDataAccess().AddStyle(ts,list);
|
||||
object[] obj = new StyleDataAccess().AddStyle(ts, list);
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/tablet/UpdateDegignerData")]
|
||||
public IHttpActionResult UpdateDegignerData([FromBody] dynamic data)
|
||||
{
|
||||
LogUtility log = new LogUtility();
|
||||
var json = data;
|
||||
//json.detail.Children<JObject>()
|
||||
log.writeLogPath((string)json.styleName);
|
||||
TabletStyle ts = new TabletStyle();
|
||||
List<TabletStyleDetail> list = new List<TabletStyleDetail>();
|
||||
ts.StyleID = (json == null || json.styleID == null) ? "" : (string)json.styleID;
|
||||
string mode = "edit";
|
||||
if (string.IsNullOrEmpty(ts.StyleID))
|
||||
{
|
||||
ts.StyleID = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
mode = "add";
|
||||
}
|
||||
ts.Name = (json == null || json.styleName == null) ? "" : (string)json.styleName;
|
||||
ts.Descr = (json == null || json.descr == null) ? "" : (string)json.descr;
|
||||
ts.PaperSize = (json == null || json.paperSize == null) ? "" : (string)json.paperSize;
|
||||
ts.BackendImg = (json == null || json.backendImg == null) ? "" : (string)json.backendImg;
|
||||
ts.PrintSize = (json == null || json.printSize == null) ? "" : (string)json.printSize;
|
||||
ts.Orientation = (json == null || json.orientation == null) ? "" : (string)json.orientation;
|
||||
ts.PrintPageCount = (json == null || json.printPageCount == null) ? "" : (string)json.printPageCount;
|
||||
ts.PrintMode = (json == null || json.printMode == null) ? "" : (string)json.printMode;
|
||||
foreach (var item in json.detail.Children<JObject>())
|
||||
{
|
||||
TabletStyleDetail tsd = new TabletStyleDetail();
|
||||
tsd.StyleID = ts.StyleID;
|
||||
tsd.Name = item.name == null ? "" : (string)item.name;
|
||||
tsd.Descr = item.descr == null ? "" : (string)item.descr;
|
||||
tsd.ElementID = item.elementID == null ? "" : (string)item.elementID;
|
||||
tsd.StartX = item.startX == null ? "" : (string)item.startX;
|
||||
tsd.StartY = item.startY == null ? "" : (string)item.startY;
|
||||
tsd.FontSize = item.fontSize == null ? "" : (string)item.fontSize;
|
||||
tsd.FontFamily = item.fontFamily == null ? "" : (string)item.fontFamily;
|
||||
tsd.BreakLen = item.breakLen == null ? "" : (string)item.breakLen;
|
||||
tsd.Width = item.width == null ? "" : (string)item.width;
|
||||
tsd.TwoOffset = item.twoOffset == null ? "" : (string)item.twoOffset;
|
||||
tsd.ThreeOffset = item.threeOffset == null ? "" : (string)item.threeOffset;
|
||||
tsd.FourOffset = item.fourOffset == null ? "" : (string)item.fourOffset;
|
||||
tsd.IsActive = item.isActive == null ? "" : (string)item.isActive;
|
||||
tsd.Width = item.width == null ? "" : (string)item.width;
|
||||
tsd.Height = item.height == null ? "" : (string)item.height;
|
||||
tsd.TextWidth = item.textWidth == null ? "" : (string)item.textWidth;
|
||||
tsd.TextHeight = item.textHeight == null ? "" : (string)item.textHeight;
|
||||
list.Add(tsd);
|
||||
}
|
||||
|
||||
object[] obj = new StyleDataAccess().UpdateStyle(ts, list);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/tablet/GetPaperSize")]
|
||||
public IHttpActionResult GetPaperSize([FromBody] dynamic data)
|
||||
{
|
||||
LogUtility log = new LogUtility();
|
||||
|
||||
object[] obj = new StyleDataAccess().GetTabletPaper("", "");
|
||||
if (obj[0].ToString() == "Y")
|
||||
{
|
||||
return Ok(new { result = "Y", data = obj[2] });
|
||||
}
|
||||
else
|
||||
{
|
||||
return Ok(new { result = "N", message = obj[1] });
|
||||
//throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
//return Ok(data);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/tablet/SavePaperSize")]
|
||||
public IHttpActionResult SavePaperSize([FromBody] dynamic data)
|
||||
{
|
||||
LogUtility log = new LogUtility();
|
||||
var json = data;
|
||||
//json.detail.Children<JObject>()
|
||||
log.writeLogPath((string)json.styleName);
|
||||
TabletPaperSize tps = new TabletPaperSize();
|
||||
tps.PaperID = (json == null || json.PaperID == null) ? "" : (string)json.PaperID;
|
||||
if (string.IsNullOrEmpty(tps.PaperID))
|
||||
{
|
||||
tps.PaperID = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
}
|
||||
tps.PaperName = (json == null || json.PaperName == null) ? "" : (string)json.PaperName;
|
||||
tps.Width = (json == null || json.Width == null) ? "" : (string)json.Width;
|
||||
tps.Height = (json == null || json.Height == null) ? "" : (string)json.Height;
|
||||
|
||||
|
||||
|
||||
object[] obj = new StyleDataAccess().AddTabletPaper(tps);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user