Example #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                InitWorkStationIds = new List <int>();

                using (GeelyPtlEntities dbContext = new GeelyPtlEntities())
                {
                    workStationSelModels = new List <WorkStationSelModel>();

                    List <CFG_WorkStation> cfgWorkStations = dbContext.CFG_WorkStations.OrderBy(t => t.Code).ToList();

                    foreach (CFG_WorkStation cfgWorkStation in cfgWorkStations)
                    {
                        WorkStationSelModel workStationSelModel = new WorkStationSelModel();
                        workStationSelModel.Id        = cfgWorkStation.Id;
                        workStationSelModel.Code      = cfgWorkStation.Code;
                        workStationSelModel.Name      = cfgWorkStation.Name;
                        workStationSelModel.IsChecked = false;

                        workStationSelModels.Add(workStationSelModel);
                    }

                    this.dataGrid.ItemsSource = workStationSelModels;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                this.Close();
            }
        }
Example #2
0
        private void cb_Click(object sender, RoutedEventArgs e)
        {
            CheckBox            chk = (CheckBox)sender;
            WorkStationSelModel vd  = chk.Tag as WorkStationSelModel;

            vd.IsChecked = chk.IsChecked.Value;
        }