using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Qcm.BLL; using Core.StlMes.Client.Qcm.model; using CoreFS.CA06; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm.Control { public partial class ComBasePurchaseProviderCtrl : UserControl { private ComBasePurchaseProviderBLL _purchaseProviderBLL; public ComBasePurchaseProviderCtrl(System.Windows.Forms.Control container, OpeBase ob) { InitializeComponent(); _purchaseProviderBLL = new ComBasePurchaseProviderBLL(ob); container.Controls.Add(this); this.Dock = DockStyle.Fill; EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } private string agreement = ""; public void Query(string agreement) { this.agreement = agreement; var rows = _purchaseProviderBLL.Query(agreement).AsQueryable(); rows = rows.OrderByDescending(a => a.Chk).ThenBy(a => a.SuppName); comBasePurchaseProviderEntityBindingSource.DataSource = rows.ToList(); foreach (var column in ultraGrid1.DisplayLayout.Bands[0].Columns) { column.SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Disabled; } } public void Clear() { this.comBasePurchaseProviderEntityBindingSource.Clear(); agreement = ""; } public List GetSaveParms() { ultraGrid1.UpdateData(); var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True"); var providers = rows.Select(a => (ComBasePurchaseProviderEntity)a.ListObject).ToList(); foreach (var provider in providers) { provider.AgreementCode = this.agreement; } return providers; } } }