Beispiel #1
0
        private void dtClickDate_EditValueChanged(object sender, System.EventArgs e)
        {
            if (BranchParam1.Length == 0 || BranchParam2.Length == 0)
            {
                return;
            }
            else
            {
                DataBind(dtClickDate.DateTime);
                gridMaster.DataSource = "";
                gridMaster.RefreshDataSource();

                Load_Childview();
            }
        }
        private void btn_View_Click(object sender, System.EventArgs e)
        {
            if (DateTime.Compare(dtClickDate.SelectionStart, dtClickDateTill.SelectionStart) > 0)
            {
                MessageBox.Show("Invalid Dates.");
                return;
            }

            if (BranchParam1.Length == 0 || BranchParam2.Length == 0)
            {
                return;
            }
            else
            {
                gridMaster.DataSource = "";
                DataBind();
                gridMaster.RefreshDataSource();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 刷新已经绑定的网格数据。
        /// </summary>
        /// <param name="xtraGrid"></param>
        /// <param name="dataSource"></param>
        public void RefreshDataGrid(DevExpress.XtraGrid.GridControl xtraGrid, object dataSource)
        {
            if (xtraGrid.DataSource == null)
            {
                throw new MB.Util.APPException("当前网格绑定的数据源为空,不能使用方法 RefreshDataGrid", MB.Util.APPMessageType.SysErrInfo);
            }

            IList oldList = xtraGrid.DataSource as IList;

            if (oldList != null)
            {
                IList lstData = dataSource as IList;
                oldList.Clear();
                foreach (object newItem in lstData)
                {
                    oldList.Add(newItem);
                }

                xtraGrid.RefreshDataSource();
                return;
            }
            DataView dv = xtraGrid.DataSource as DataView;

            if (dv != null)
            {
                DataTable dtData = MB.Util.MyConvert.Instance.ToDataTable(dataSource, "");
                if (dtData != null)
                {
                    DataView newDv = dtData.DefaultView;
                    newDv.RowFilter     = dv.RowFilter;
                    xtraGrid.DataSource = newDv;
                }
                return;
            }

            throw new MB.Util.APPException(string.Format("当前网格绑定的数据源不支持 类型{0} ", xtraGrid.DataSource.GetType().FullName), MB.Util.APPMessageType.SysErrInfo);
        }
Beispiel #4
0
 public void LoadData(List <LineInfo> list)
 {
     gridControl.DataSource = list;
     gridControl.RefreshDataSource();
 }