1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using DevExpress.XtraEditors;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Documents;
- using System.Windows.Forms;
- using DW5S.App.Model;
- using DW5S.Entity;
- using DW5S.Repostory;
- namespace DW5S.App.PopupControl
- {
- public partial class ShowCheckCtrl : DevExpress.XtraEditors.XtraUserControl
- {
- PosRes posItem;
- List<CheckRes> list = new List<CheckRes>();
- public ShowCheckCtrl()
- {
- InitializeComponent();
- gridShowCheck.UseDefault(list);
- }
- public ShowCheckCtrl(PosRes posItem)
- : this()
- {
- this.posItem = posItem;
- }
- private async void ShowCxCtrl_Load(object sender, EventArgs e)
- {
- if (posItem.CheckResID == null)//没有检测结果
- return;
- using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
- {
- if (db == null) return;
- var items = await db.CheckRes.Where(p => p.ID == posItem.CheckResID).ToListAsync();
- this.list.AddRange(items);
- }
- gridView1.RefreshData();
- }
- private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
- {
- if (gridView1.RowCount == 0)
- {
- string txt = "没有检测结果信息";
- var s = e.Appearance.CalcTextSize(e.Cache, txt, e.Bounds.Width).ToSize();
- var x = (e.Bounds.Width - s.Width) / 2;
- var y = (e.Bounds.Height - s.Height) / 2;
- e.Appearance.ForeColor = Color.Gray;
- e.Appearance.DrawString(e.Cache, txt, new Rectangle(x, y, s.Width, s.Height));
- }
- }
- private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
- {
- if (e.Value == null)
- e.DisplayText = "--";
- }
- }
- }
|