BartenderPreview.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Runtime.InteropServices;
  5. using System.Windows.Forms;
  6. namespace UAS_LabelMachine
  7. {
  8. public partial class BartenderPreview : Form
  9. {
  10. [DllImport("user32.dll")]
  11. public static extern bool ReleaseCapture();
  12. [DllImport("user32.dll")]
  13. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  14. public const int WM_SYSCOMMAND = 0x0112;
  15. public const int SC_MOVE = 0xF010;
  16. public const int HTCAPTION = 0x0002;
  17. DataHelper dh;
  18. string pl_id;
  19. public BartenderPreview()
  20. {
  21. InitializeComponent();
  22. }
  23. public BartenderPreview(string ID, Image image)
  24. {
  25. InitializeComponent();
  26. LabelPreViewPic.Image = image;
  27. pl_id = ID;
  28. }
  29. private void 标签预览_Load(object sender, EventArgs e)
  30. {
  31. dh = new DataHelper();
  32. //dt = (DataTable)dh.getFieldsDataByCondition("productlabel left join LABEL on la_code = pl_labelcode left join labelparameter on lp_laid = la_id", new string[] { "la_sql", "la_id", "pl_labelcode" }, "pl_id='" + pl_id + "'");
  33. //SQL.Text = dt.Rows[0]["la_sql"].ToString();
  34. }
  35. private void headBar1_MouseDown(object sender, MouseEventArgs e)
  36. {
  37. ReleaseCapture();
  38. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  39. }
  40. //存在Label则直接更新,不存在的插入一条记录
  41. private void Save_Click(object sender, EventArgs e)
  42. {
  43. //if (dt.Rows[0]["la_id"].ToString() == "")
  44. //{
  45. // dh.ExecuteSql("insert into label(la_id,la_inman,la_indate,la_sql,la_code) values (label_seq.nextval,'',sysdate,:sql,:la_code) ", "insert", SQL.Text, dt.Rows[0]["pl_labelcode"].ToString());
  46. //}
  47. //else {
  48. // dh.ExecuteSql("update label set la_sql=:sql where la_id=" + dt.Rows[0]["la_id"].ToString(), "update", SQL.Text);
  49. //}
  50. MessageBox.Show("保存成功");
  51. }
  52. private void Cancel_Click(object sender, EventArgs e)
  53. {
  54. this.Close();
  55. }
  56. }
  57. }