本文整理汇总了C#中BindingList.Count方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Count方法的具体用法?C# BindingList.Count怎么用?C# BindingList.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Count方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: txtConsulta_TextChanged
private void txtConsulta_TextChanged(object sender, EventArgs e)
{
if (txtConsulta.Text.Contains(":"))
{
txtConsulta.Text = txtConsulta.Text.Replace(":", "@");
}
if (txtConsulta.Text.Contains("@"))
{
var consulta = txtConsulta.Text.Trim();
var possicoes = txtConsulta.Text.AllIndexesOf("@");
_parametros = new BindingList<DadosStoredProceduresParameters>();
foreach (var posicao in possicoes)
{
var nomeParametro = consulta.Substring(posicao, RetornaPosicaoFinalNomeParametro((posicao + 1), consulta));
if (_parametros.Count(p => p.ParameterName == nomeParametro)==0)
{
_parametros.Add(new DadosStoredProceduresParameters
{
ParameterName = nomeParametro,
DefineNull = true
});
}
}
}
CarregaGridViewParametros();
}
示例2: StdGridRefresh
public static void StdGridRefresh(MainAppForm mainapp)
{
var query = Query.EQ("status", Properties.Settings.Default.StdFilterFlag);
var stdresult = new BindingList<stdcolls>(stdcollection.Find(query).ToList());
mainapp.gridStudents.DataSource = stdresult;
var count = Convert.ToInt16(stdresult.Count());
mainapp.ItemsCountStatusText.Caption = String.Format("{0} students count: {1}", Convert.ToString(Properties.Settings.Default.StdFilterFlag), Convert.ToString(count));
}
示例3: Execute
public void Execute()
{
BindingList<Part> parts = new BindingList<Part>();
var query = session.CreateSQLQuery(PartQuery.BuildSql(viewModel.Types, viewModel.Number, viewModel.Activity))
.SetResultTransformer(PartQuery.Transformer);
var qparts = query.List<Part>();
foreach(var item in qparts)
{
parts.Add(item);
}
viewModel.Parts = parts;
viewModel.Amount = parts.Count();
RefreshVisualStateEvent();
}
示例4: StdGridRefresh
public static void StdGridRefresh(MainAppForm mainapp)
{
//if (mainapp.bandedStudentsGridView.RowCount > 0)
//{
var query = Query.EQ("status", Properties.Settings.Default.StdFilterFlag);
BindingList<stdcolls> stdresult = new BindingList<stdcolls>(stdcollection.Find(query).ToList());
mainapp.gridStudents.DataSource = stdresult;
int count = Convert.ToInt16(stdresult.Count());
mainapp.ItemsCountStatusText.Caption = Convert.ToString(Properties.Settings.Default.StdFilterFlag) + " students count: " + Convert.ToString(count);
//}
//else
//{
// int count = 0;
// mainapp.ItemsCountStatusText.Caption = Convert.ToString(Properties.Settings.Default.StdFilterFlag) + " students count: " + Convert.ToString(count);
//}
}
示例5: GetUsers
public void GetUsers()
{
if (users.Count > 0)
{
users.Clear();
}
string stream = searchStreamBX.SelectedItem.ToString();
string status = searchStatusBX.SelectedItem.ToString();
List<string> searchSkills = new List<string>();
//noConsultantsFoundTBX.Text = status;
for (int k = 0; k < searchSelectedSkills.Count(); k++)
{
searchSkills.Add(searchSelectedSkills[k].ToString());
}
//noConsultantsFoundTBX.Text = success.Count().ToString();
users = service.SearchForConsultants(stream, status, searchSkills);
//noConsultantsFoundTBX.Text = users.Count().ToString();
BindingList<string> searchUsers = new BindingList<string>();
for (int i = 0; i < users.Count(); i++)
{
searchUsers.Add(users[i].Name);
}
searchUsersLBX.DataSource = searchUsers;
noConsultantsFoundTBX.Text = searchUsers.Count().ToString() + " consultant(s) found";
searchUsersLBX.Visible = true;
//// Display profile of selected user
//for (int j = 0; j < users.Count(); j++)
//{
// if (searchUsersLBX.SelectedItem.ToString() == users[j].Name)
// {
// service.GetProfile(users[j].UserId);
// nameTBX.Text = users[j].Name;
// degreeTBX.Text = users[j].Degree;
// modulesTBX.Text = users[j].Modules;
// locationTBX.Text = users[j].Location;
// statusTBX.Text = users[j].TStatus;
// streamTBX.Text = users[j].Stream;
// emailTBX.Text = users[j].Email;
// searchConsultantSkillsLBX.DataSource = users[j].Skills;
// profileGBX.Visible = true;
// }
//}
}
示例6: GroupGridRefresh
public static void GroupGridRefresh(MainAppForm mainapp)
{
var query = Query.EQ("status", Properties.Settings.Default.GroupFilterFlag);
var groupresult = new BindingList<groupcolls>(gebase.GetCollection<groupcolls>("groups").Find(query).ToList());
mainapp.gridGroup.DataSource = groupresult;
var count = Convert.ToInt16(groupresult.Count());
mainapp.ItemsCountStatusText.Caption = String.Format("{0} groups count: {1}", Convert.ToString(Properties.Settings.Default.GroupFilterFlag), Convert.ToString(count));
mainapp.bandedGroupGridView.GroupPanelText = Convert.ToString(Properties.Settings.Default.GroupFilterFlag) + " groups list";
}
示例7: CreateSensorSaveButtonTemplate
public FrameworkElementFactory CreateSensorSaveButtonTemplate(PlantsArea area,
BindingList<DataGridSensorView> dataGridSensorViews,
BindingList<DataGridServiceScheduleView> dataGridServiceScheduleViews,
Func<PlantsArea, Sensor, ServiceSchedule, bool> saveSensor)
{
FrameworkElementFactory buttonTemplate = new FrameworkElementFactory(typeof (Button));
buttonTemplate.SetValue(ContentControl.ContentProperty, "Save");
buttonTemplate.AddHandler(
ButtonBase.ClickEvent,
new RoutedEventHandler((o, e) =>
{
DataGridSensorView dataGridSensorView = ((FrameworkElement) o).DataContext as DataGridSensorView;
if (dataGridSensorView != null)
{
try
{
ServiceState serviceState;
ServiceSchedule serviceSchedule;
if (dataGridSensorView.Sensor != null)
{
if (!dataGridSensorView.Sensor.MeasurableParameter.HasValidParameters())
{
throw new Exception();
}
if (dataGridSensorView.MeasurableIsModified)
{
string oldMeasurable = dataGridSensorView.Sensor.MeasurableType;
dataGridSensorView.Sensor.MeasurableParameter.MeasurableType =
dataGridSensorView.Measurable;
serviceState = dataGridSensorView.Sensor.PlantsArea
.PlantServicesStates.GetServiceState(state => state.IsFor(oldMeasurable));
if (serviceState != null)
{
serviceSchedule = dataGridSensorView.Sensor.PlantsArea
.ServicesSchedulesStates.GetServiceSchedule(
schedule => schedule.IsFor(serviceState.ServiceName));
serviceState.ServiceName = dataGridSensorView.Measurable;
if (serviceSchedule != null)
{
serviceSchedule.ServiceName = serviceState.ServiceName;
}
saveSensor(area, dataGridSensorView.Sensor, serviceSchedule);
dataGridSensorView.MeasurableIsModified = false;
dataGridSensorView.IsModified = false.ToString();
MessageBox.Show(
$"Sensor with measurable '{dataGridSensorView.Measurable}' updated");
OnRefreshControls();
return;
}
}
saveSensor(area, dataGridSensorView.Sensor, null);
dataGridSensorView.IsModified = false.ToString();
MessageBox.Show($"'{dataGridSensorView.Measurable}': sensor data saved");
return;
}
if (dataGridSensorViews.Count(s => s.Measurable == dataGridSensorView.Measurable) != 1)
{
MessageBox.Show(
$"Sensor with measurable '{dataGridSensorView.Measurable}' already exists");
return;
}
CustomParameter customParameter =
new CustomParameter(Guid.NewGuid(), Convert.ToInt32(dataGridSensorView.Optimal),
Convert.ToInt32(dataGridSensorView.Min),
Convert.ToInt32(dataGridSensorView.Max),
dataGridSensorView.Measurable);
CustomSensor sensor =
new CustomSensor(Guid.NewGuid(), area,
TimeSpan.Parse(dataGridSensorView.Timeout), customParameter);
dataGridSensorView.Sensor = sensor;
serviceState = new ServiceState(sensor.MeasurableType, true);
area.PlantServicesStates.AddServiceState(serviceState);
serviceSchedule = new ServiceSchedule(Guid.NewGuid(), area.Id,
serviceState.ServiceName, new TimeSpan(0, 0, 10), new TimeSpan(0, 1, 0),
new List<MeasurableParameter> {sensor.MeasurableParameter});
//.........这里部分代码省略.........
示例8: CreateRemoveSensorButtonTemplate
public FrameworkElementFactory CreateRemoveSensorButtonTemplate(PlantsArea area,
BindingList<DataGridSensorView> dataGridSensorViews,
BindingList<DataGridServiceScheduleView> dataGridServiceScheduleViews,
Func<PlantsArea, Sensor, ServiceSchedule, bool> removeSensor)
{
FrameworkElementFactory buttonTemplate = new FrameworkElementFactory(typeof (Button));
buttonTemplate.SetValue(ContentControl.ContentProperty, "X");
buttonTemplate.AddHandler(
ButtonBase.ClickEvent,
new RoutedEventHandler((o, e) =>
{
DataGridSensorView dataGridSensorView = ((FrameworkElement) o).DataContext as DataGridSensorView;
if (dataGridSensorView != null)
{
if (dataGridSensorViews.Count(s => s.Measurable == dataGridSensorView.Measurable) == 0)
{
MessageBox.Show(
$"'{dataGridSensorView.Measurable}': sensor with such measurable does not exist");
return;
}
ServiceState serviceState = area.PlantServicesStates.ServicesStates.SingleOrDefault(
state => state.IsFor(dataGridSensorView.Measurable));
if (serviceState != null)
{
DataGridServiceScheduleView dataGridServiceScheduleView =
dataGridServiceScheduleViews.SingleOrDefault(
s => s.ServiceName == serviceState.ServiceName);
ServiceSchedule serviceSchedule =
area.ServicesSchedulesStates.ServicesSchedules.SingleOrDefault(
schedule => schedule.ServiceName == serviceState.ServiceName);
removeSensor(area, dataGridSensorView.Sensor, serviceSchedule);
dataGridSensorViews.Remove(dataGridSensorView);
dataGridServiceScheduleViews.Remove(dataGridServiceScheduleView);
}
}
OnRefreshControls();
})
);
return buttonTemplate;
}
示例9: LoadDefaultEntities
public string LoadDefaultEntities(string code, BindingList<TestForGrid> testGrids, BindingList<SpecimenForGrid> specimenGrids, BindingList<TubeForGrid> tubeGrids)
{
if (testGrids.Count<TestForGrid>(test => test.Code == code) < 2)
{
var test = new TestServiceClient().GetTestByCode(code);
var specimenForGrid = new SpecimenForGrid()
{
Code = test.DefaultSpecimen.Code
};
specimenGrids.Add(specimenForGrid);
LoadDefaultTube(test.DefaultSpecimen.Code, tubeGrids);
return string.Empty;
}
else
{
return "Test is exist already!";
}
}
示例10: LoadDiagnosis
public string LoadDiagnosis(string code, BindingList<DiagnosisForGrid> diagnosisGrids)
{
if (diagnosisGrids.Count<DiagnosisForGrid>(diagnosis => diagnosis.Code == code) < 2)
{
return string.Empty;
}
else
{
return "Diagnosis is exist already!";
}
}
示例11: UniqueStocks
private BindingList<StockItem> UniqueStocks()
{
var ds = GetProductsDS();
if (ds == null)
return null;
BindingList<StockItem> newDs = new BindingList<StockItem>();
foreach (var item in ds)
{
var c = ds.Count(s => s.ProductCode == item.ProductCode);
if (c == 1)
{
newDs.Add(item);
continue;
}
if (newDs.Count(s => s.ProductCode == item.ProductCode) > 0) // uz existuje
continue;
item.Disp_Qty = c; // nastavime celkovy pocet
item.Ord_Qty = c; // nastavime celkovy pocet
newDs.Add(item);
}
return newDs;
}