ShowCxCtrl.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using DevExpress.XtraEditors;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Documents;
  11. using System.Windows.Forms;
  12. using DW5S.Entity;
  13. using DW5S.Repostory;
  14. using Serilog;
  15. using DW5S.Service;
  16. using DW5S.ViewModel;
  17. namespace DW5S.App.PopupControl
  18. {
  19. public partial class ShowCxCtrl : DevExpress.XtraEditors.XtraUserControl
  20. {
  21. PosResViewModel posItem;
  22. List<CxRes> list = new List<CxRes>();
  23. public ShowCxCtrl()
  24. {
  25. InitializeComponent();
  26. gridShowCx.UseDefault(list);
  27. }
  28. public ShowCxCtrl(PosResViewModel posItem)
  29. : this()
  30. {
  31. this.posItem = posItem;
  32. }
  33. private async void ShowCxCtrl_Load(object sender, EventArgs e)
  34. {
  35. var repsPos = IocContainer.UnitOfWork.OfLong<PosRes>();
  36. var pos = await repsPos.GetByIdAsync(this.posItem.Id);
  37. var unitOfWork = IocContainer.UnitOfWork;
  38. var repsCx = unitOfWork.OfLong<CxRes>();
  39. var items =await repsCx.FindAsync(p => p.Id == pos.CxResID);
  40. this.list.AddRange(items);
  41. gridView1.RefreshData();
  42. }
  43. }
  44. }