附件内容打印.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. using UAS_LabelMachine.PublicMethod;
  11. namespace UAS_LabelMachine
  12. {
  13. public partial class 附件内容打印 : Form
  14. {
  15. DataHelper dh = SystemInf.dh;
  16. string custcode;
  17. public 附件内容打印(string CustCode)
  18. {
  19. custcode = CustCode;
  20. InitializeComponent();
  21. }
  22. private void 附件内容打印_Load(object sender, EventArgs e)
  23. {
  24. DataTable dt = (DataTable)dh.ExecuteSql("select * from LabelAttachPARAMETER where lap_custcode='" + custcode + "' and lap_inman='" + User.UserCode + "'", "select");
  25. for (int i = 0; i < dt.Rows.Count; i++)
  26. {
  27. Controls["lap_id" + (i + 1)].Text = dt.Rows[i]["lap_id"].ToString();
  28. Controls["lap_param" + (i + 1)].Text = dt.Rows[i]["lap_param"].ToString();
  29. Controls["lap_value" + (i + 1)].Text = dt.Rows[i]["lap_value"].ToString();
  30. }
  31. }
  32. private void Confirm_Click(object sender, EventArgs e)
  33. {
  34. string SQL = "";
  35. for (int i = 1; i < 6; i++)
  36. {
  37. if (Controls["lap_id" + i].Text == "")
  38. {
  39. SQL = "insert into LabelAttachPARAMETER(lap_id,lap_custcode,lap_param,lap_value,lap_inman)values(LabelAttachPARAMETER_seq.nextval,'" + custcode + "','" + Controls["lap_param" + i].Text + "','" + Controls["lap_value" + i].Text + "','" + User.UserCode + "')";
  40. }
  41. else
  42. {
  43. 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 + "'";
  44. }
  45. dh.ExecuteSql(SQL, "insert");
  46. }
  47. LogManager.DoCommandLog(custcode, User.UserCode, "保存附加参数", "成功");
  48. MessageBox.Show("保存成功");
  49. Close();
  50. }
  51. }
  52. }