This commit is contained in:
chikyun.kim
2018-12-08 15:12:15 +09:00
parent 3f68c3c5e8
commit 43841e6c52
43 changed files with 6312 additions and 1015 deletions

View File

@@ -31,6 +31,58 @@ namespace FCOMMON
public int qty;
}
public static Boolean setImageData(System.Drawing.Image img, string table, string field, int idx)
{
var cn = getCn();
cn.Open();
Boolean retval = false;
string sql = "update " + table + " set " + field + " = @data" + " where idx = @idx";
var cmd = new SqlCommand(sql, cn);
System.IO.MemoryStream sm = new System.IO.MemoryStream();
img.Save(sm, System.Drawing.Imaging.ImageFormat.Jpeg);
var buffer = sm.GetBuffer();
sm.Dispose();
cmd.Parameters.Add(new SqlParameter("idx", idx));
cmd.Parameters.Add(new SqlParameter("data", buffer));
try
{
cmd.ExecuteNonQuery();
retval = true;
}catch (Exception ex)
{
}
cn.Close();
cn.Dispose();
return retval;
}
public static System.Drawing.Image GetImageData(string table,string field,int idx)
{
var cn = getCn();
cn.Open();
string sql = "select " + field + " from "+table+" where idx = " + idx.ToString();
var cmd = new SqlCommand(sql, cn);
var data = cmd.ExecuteScalar() as byte[];
System.Drawing.Bitmap bmp = null;
if(data != null)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
bmp = new System.Drawing.Bitmap(ms, true);
ms.Dispose();
}
cn.Close();
cn.Dispose();
return bmp;
}
public static sItemInfo getLastPurchaseInfo(int idx)
{
var cn = getCn();