using System; using System.Data; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; namespace UAS_LabelMachine { public partial class BartenderPreview : Form { [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); public const int WM_SYSCOMMAND = 0x0112; public const int SC_MOVE = 0xF010; public const int HTCAPTION = 0x0002; DataHelper dh; string pl_id; public BartenderPreview() { InitializeComponent(); } public BartenderPreview(string ID, Image image) { InitializeComponent(); LabelPreViewPic.Image = image; pl_id = ID; } private void 标签预览_Load(object sender, EventArgs e) { dh = new DataHelper(); //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 + "'"); //SQL.Text = dt.Rows[0]["la_sql"].ToString(); } private void headBar1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } //存在Label则直接更新,不存在的插入一条记录 private void Save_Click(object sender, EventArgs e) { //if (dt.Rows[0]["la_id"].ToString() == "") //{ // 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()); //} //else { // dh.ExecuteSql("update label set la_sql=:sql where la_id=" + dt.Rows[0]["la_id"].ToString(), "update", SQL.Text); //} MessageBox.Show("保存成功"); } private void Cancel_Click(object sender, EventArgs e) { this.Close(); } } }