48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using Org.BouncyCastle.Crypto.IO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.Sign
|
|
{
|
|
public partial class LC700 : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
BLL.Funs.usingMatId = Request.Params["keyId"];
|
|
}
|
|
|
|
[WebMethod]
|
|
public static string UploadData(string data)
|
|
{
|
|
byte[] imageBytes = Convert.FromBase64String(data);
|
|
string filePath = "/FileUpLoad/Sign/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpeg";
|
|
if (!Directory.Exists(BLL.Funs.RootPath + "/FileUpLoad/Sign/"))
|
|
{
|
|
Directory.CreateDirectory(BLL.Funs.RootPath + "/FileUpLoad/Sign/");
|
|
}
|
|
|
|
// 使用MemoryStream将字节数组转换为图片
|
|
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
|
|
{
|
|
System.Drawing.Image mImage = System.Drawing.Image.FromStream(ms);
|
|
|
|
// 使用Bitmap类从MemoryStream创建图片
|
|
using (Bitmap image = new Bitmap(mImage))
|
|
{
|
|
// 保存图片到文件
|
|
image.Save(BLL.Funs.RootPath + filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
}
|
|
}
|
|
var usingMat = BLL.UsingMatService.GetUsingMatById(BLL.Funs.usingMatId);
|
|
BLL.UsingMatService.WelderConfirm(BLL.Funs.usingMatId, true, filePath);
|
|
return filePath;
|
|
}
|
|
}
|
|
} |