CameraControlNotesSuperSmallForm.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. namespace LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm
  10. {
  11. public partial class CameraControlNotesSuperSmallForm : LYFZ.Software.UI.CameraControlBook.SuperSmallForm.CameraControlNotesSuperSmallForm
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpOrderRemarkRecord orrbll = new BLL.BLL_ErpOrderRemarkRecord();
  15. public CameraControlNotesSuperSmallForm()
  16. {
  17. this.Shown += CameraControlNotesSuperSmallForm_Shown;
  18. this.FormClosing += CameraControlNotesSuperSmallForm_FormClosing;
  19. }
  20. /// <summary>
  21. /// 每月的日期,如果2016-11-09
  22. /// </summary>
  23. public string StrDateValue = "";
  24. /// <summary>
  25. /// 分店编号
  26. /// </summary>
  27. public string StrStoreName = "";
  28. /// <summary>
  29. /// 是否保存
  30. /// </summary>
  31. public bool IsSaveed = false;
  32. /// <summary>
  33. /// 保存后是否有内容
  34. /// </summary>
  35. public int intCurrentLength = 0;
  36. /// <summary>
  37. /// 员工编号
  38. /// </summary>
  39. string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  40. LYFZ.Model.Model_ErpOrderRemarkRecord model = null;
  41. /// <summary>
  42. /// 窗体加载事件
  43. /// </summary>
  44. /// <param name="sender"></param>
  45. /// <param name="e"></param>
  46. void CameraControlNotesSuperSmallForm_Shown(object sender, EventArgs e)
  47. {
  48. string StrWhere = "Ordrr_OrdNumber = '" + this.StrStoreName + "' And Ordrr_ModuleName = '每日便签' " + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Ordrr_CreateDatetime", StrDateValue, StrDateValue);
  49. DataTable dt = orbll.GetView_Custom("tb_ErpOrderRemarkRecord", StrWhere: StrWhere, ShowColumnName: "*").Tables[0];
  50. if (dt.Rows.Count > 0)
  51. {
  52. this.txtTextNotes.Text = dt.Rows[0]["Ordrr_Remark"].ToString().Trim();
  53. model = orrbll.DataRowToModel(dt.Rows[0]);
  54. }
  55. else
  56. { model = new Model.Model_ErpOrderRemarkRecord(); }
  57. }
  58. /// <summary>
  59. /// 关闭窗体之前
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. void CameraControlNotesSuperSmallForm_FormClosing(object sender, FormClosingEventArgs e)
  64. {
  65. if (model.Ordrr_Remark == null || !model.Ordrr_Remark.Trim().Equals(this.txtTextNotes.Text.Trim()))
  66. {
  67. model.Ordrr_Remark = this.txtTextNotes.Text.Trim();
  68. model.Ordrr_ViceNumber = "";
  69. if (model.ID <= 0)
  70. {
  71. model.Ordrr_Number = "ORR" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  72. model.Ordrr_OrdNumber = StrStoreName;
  73. model.Ordrr_ModuleName = "每日便签";
  74. model.Ordrr_CreateDatetime = Convert.ToDateTime(this.StrDateValue);
  75. model.Ordrr_CreateName = StrUserID;
  76. orrbll.Add(model);
  77. }
  78. else
  79. {
  80. model.Ordrr_CreateName = StrUserID;
  81. orrbll.Update(model);
  82. }
  83. intCurrentLength = model.Ordrr_Remark.Trim().Length;
  84. this.IsSaveed = true;
  85. }
  86. }
  87. }
  88. }