附件内容打印.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_LabelMachine.Entity;
  10. namespace UAS_LabelMachine
  11. {
  12. public partial class 附件内容打印 : Form
  13. {
  14. DataHelper dh = SystemInf.dh;
  15. string custcode;
  16. public 附件内容打印(string CustCode)
  17. {
  18. custcode = CustCode;
  19. InitializeComponent();
  20. }
  21. private void 附件内容打印_Load(object sender, EventArgs e)
  22. {
  23. DataTable dt = (DataTable)dh.ExecuteSql("select * from LabelAttachPARAMETER where lap_custcode='" + custcode + "'", "select");
  24. for (int i = 0; i < dt.Rows.Count; i++)
  25. {
  26. Controls["lap_id" + (i + 1)].Text = dt.Rows[i]["lap_id"].ToString();
  27. Controls["lap_param" + (i + 1)].Text = dt.Rows[i]["lap_param"].ToString();
  28. Controls["lap_value" + (i + 1)].Text = dt.Rows[i]["lap_value"].ToString();
  29. }
  30. }
  31. private void Confirm_Click(object sender, EventArgs e)
  32. {
  33. string SQL = "";
  34. for (int i = 1; i < 6; i++)
  35. {
  36. if (Controls["lap_id" + i].Text == "")
  37. {
  38. SQL = "insert into LabelAttachPARAMETER(lap_id,lap_custcode,lap_param,lap_value)values(LabelAttachPARAMETER_seq.nextval,'" + custcode + "','" + Controls["lap_param" + i].Text + "','" + Controls["lap_value" + i].Text + "')";
  39. }
  40. else
  41. {
  42. SQL = "update LabelAttachPARAMETER set lap_custcode='" + custcode + "',lap_param='" + Controls["lap_param" + i].Text + "',lap_value='" + Controls["lap_value" + i].Text + "' where lap_id='" + Controls["lap_id" + i].Text + "'";
  43. }
  44. dh.ExecuteSql(SQL, "insert");
  45. }
  46. MessageBox.Show("保存成功");
  47. Close();
  48. }
  49. }
  50. }