如何在以下代码中修改来实现菜单加载界面只显示100条数据using System;using SystemCollectionsGeneric;using SystemComponentModel;using SystemDrawing;using SystemData;using SystemLinq;using SystemText;using SystemWindowsForms;using
在Query()和QueryByItemName()方法中,将foreach循环中的计数器count改为循环100次即可实现只显示100条数据。
修改后的代码如下:
public int Query() { ArrayList alItem = null; Neusoft.HISFC.BizLogic.Fee.Item item = new Neusoft.HISFC.BizLogic.Fee.Item(); alItem = item.getItemNumType(); int count = 0;
foreach (Neusoft.HISFC.Models.Fee.Item.Undrug Item in alItem)
{
if(count >= 100) break; // 只显示前100条数据
this.neuSpread_sheet1.Rows.Add(count, 1);
this.neuSpread_sheet1.Cells[count, 0].Text = Item.ID;
this.neuSpread_sheet1.Cells[count, 1].Text = Item.Name;
if (Item.NumType == "1")
{
this.neuSpread_sheet1.Cells[count, 2].Text = "出院校验时提醒";
}
else if (Item.NumType == "2")
{
this.neuSpread_sheet1.Cells[count, 2].Text = "出院校验时拦截";
}
else
{
this.neuSpread_sheet1.Cells[count, 2].Text = "无校验";
}
this.neuSpread_sheet1.Cells[count, 3].Text = Item.NumTimes.ToString();
this.neuSpread_sheet1.Cells[count, 4].Tag = Item.FeeCheckGroup.ToString();
this.neuSpread_sheet1.Cells[count, 4].Text = Item.FeeCheckGroupName.ToString();
count++;
}
this.neuSpread_sheet1.Columns[0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[2].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[3].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[4].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[0].Locked = true;
this.neuSpread_sheet1.Columns[1].Locked = true;
this.neuSpread_sheet1.Columns[2].Locked = true;
this.neuSpread_sheet1.Columns[3].Locked = true;
this.neuSpread_sheet1.Columns[4].Locked = true;
return 1;
}
public int QueryByItemName() { ArrayList alItem = null; Neusoft.HISFC.BizLogic.Fee.Item item = new Neusoft.HISFC.BizLogic.Fee.Item(); string itemName = this.txtItemName.Text; alItem = item.getItemNumType(itemName); int count = 0;
foreach (Neusoft.HISFC.Models.Fee.Item.Undrug Item in alItem)
{
if(count >= 100) break; // 只显示前100条数据
this.neuSpread_sheet1.Rows.Add(count, 1);
this.neuSpread_sheet1.Cells[count, 0].Text = Item.ID;
this.neuSpread_sheet1.Cells[count, 1].Text = Item.Name;
if (Item.NumType == "1")
{
this.neuSpread_sheet1.Cells[count, 2].Text = "出院校验时提醒";
}
else if (Item.NumType == "2")
{
this.neuSpread_sheet1.Cells[count, 2].Text = "出院校验时拦截";
}
else
{
this.neuSpread_sheet1.Cells[count, 2].Text = "无校验";
}
this.neuSpread_sheet1.Cells[count, 3].Text = Item.NumTimes.ToString();
this.neuSpread_sheet1.Cells[count, 4].Tag = Item.FeeCheckGroup.ToString();
this.neuSpread_sheet1.Cells[count, 4].Text = Item.FeeCheckGroupName.ToString();
count++;
}
this.neuSpread_sheet1.Columns[0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[1].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[2].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[3].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[4].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;
this.neuSpread_sheet1.Columns[0].Locked = true;
this.neuSpread_sheet1.Columns[1].Locked = true;
this.neuSpread_sheet1.Columns[2].Locked = true;
this.neuSpread_sheet1.Columns[3].Locked = true;
this.neuSpread_sheet1.Columns[4].Locked = true;
return 1;
}
原文地址: https://www.cveoy.top/t/topic/bEt3 著作权归作者所有。请勿转载和采集!