ShowCxCtrl.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using DevExpress.XtraEditors;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Data.Entity;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Documents;
  12. using System.Windows.Forms;
  13. using XdCxRhDW.App.Model;
  14. using XdCxRhDW.Repostory.EFContext;
  15. using XdCxRhDW.Repostory.Model;
  16. namespace XdCxRhDW.App.PopupControl
  17. {
  18. public partial class ShowCxCtrl : DevExpress.XtraEditors.XtraUserControl
  19. {
  20. PosRes posItem;
  21. List<CxRes> list = new List<CxRes>();
  22. public ShowCxCtrl()
  23. {
  24. InitializeComponent();
  25. gridShowCx.Init<CxRes>().DataSource = list;
  26. }
  27. public ShowCxCtrl(PosRes posItem)
  28. :this()
  29. {
  30. this.posItem = posItem;
  31. }
  32. private async void ShowCxCtrl_Load(object sender, EventArgs e)
  33. {
  34. using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
  35. {
  36. var items =await db.CxRes.Where(p => p.ID == posItem.CxResID).ToListAsync();
  37. this.list.AddRange(items);
  38. }
  39. gridView1.RefreshData();
  40. }
  41. }
  42. }