当前位置: 首页>>代码示例>>C#>>正文


C# BindingList.Count方法代码示例

本文整理汇总了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();
        }
开发者ID:RodrigoDotNet,项目名称:gerador-de-camadas,代码行数:31,代码来源:frmPesquisaManual.cs

示例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));
        }
开发者ID:rootah,项目名称:gebase-alpha-0.2.1,代码行数:10,代码来源:stdcode.cs

示例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();
        }
开发者ID:AleksMorozova,项目名称:prizm,代码行数:18,代码来源:PartSearchCommand.cs

示例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);
            //}
        }
开发者ID:rootah,项目名称:GIT.GEBASE,代码行数:18,代码来源:stdcode.cs

示例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;
            //    }
            //}
        }
开发者ID:hksarwar,项目名称:JobSystem,代码行数:49,代码来源:MainForm.cs

示例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";
        }
开发者ID:rootah,项目名称:gebase-alpha-0.2.1,代码行数:11,代码来源:groupcode.cs

示例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});

//.........这里部分代码省略.........
开发者ID:LexaGal,项目名称:Plants,代码行数:101,代码来源:FrameworkElementFactoriesBuilder.cs

示例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;
        }
开发者ID:LexaGal,项目名称:Plants,代码行数:45,代码来源:FrameworkElementFactoriesBuilder.cs

示例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!";
     }
 }
开发者ID:abonSerg,项目名称:Clinic,代码行数:18,代码来源:NewOrderModel.cs

示例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!";
     }
 }
开发者ID:abonSerg,项目名称:Clinic,代码行数:11,代码来源:InterpretationModel.cs

示例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;
        }
开发者ID:mkoscak,项目名称:active-mizu,代码行数:26,代码来源:MainWindow.cs


注:本文中的BindingList.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。