private void Execute(object parameter) { int index = ProcessTypes.IndexOf(parameter as ProcessType); if (index > -1 && index < ProcessTypes.Count) { FAMA.AP.DataLayer.DbProcessType au = new FAMA.AP.DataLayer.DbProcessType(); au.DeleteData(ProcessTypes[index]); ProcessTypes.RemoveAt(index); } }
private void Add() { FAMA.AP.DataLayer.DbProcessType au = new FAMA.AP.DataLayer.DbProcessType(); au.InsertData(ProcessType); List <FAMA.AP.Model.ProcessType> ProcessTypesLst = au.Selectalldata(); ProcessTypes = new ObservableCollection <ProcessType>(); foreach (var item in ProcessTypesLst) { ProcessTypes.Add(item); } }
public ProcessTypeViewModel() { ProcessType = new ProcessType(); FAMA.AP.DataLayer.DbProcessType au = new FAMA.AP.DataLayer.DbProcessType(); List <FAMA.AP.Model.ProcessType> ProcessTypesLst = au.Selectalldata(); ProcessTypes = new ObservableCollection <ProcessType>(); foreach (var item in ProcessTypesLst) { ProcessTypes.Add(item); } ProcessTypes.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ProcessType_CollectionChanged); }
private void btn_save_Click(object sender, RoutedEventArgs e) { int idProcesType = 0; if (GridProcess.SelectedItems.Count > 0) { for (int i = 0; i < GridProcess.SelectedItems.Count; i++) { FAMA.AP.Model.ProcessType selectedid = (FAMA.AP.Model.ProcessType)GridProcess.SelectedItems[i]; idProcesType = (selectedid.IdProcessType); } } //int index = GridProcess.SelectedIndex; //int id = GridProcess.SelectedIndex; string Nombre = txtName.Text; string Descripcion = txtDescripcion.Text; ViewModel.ProcessTypeViewModel objnewpt = new ProcessTypeViewModel(); Model.ProcessType objprocess = new Model.ProcessType(); objprocess.IdProcessType = idProcesType; objprocess.Name = Nombre; objprocess.Description = Descripcion; objprocess.active = true; FAMA.AP.DataLayer.DbProcessType au = new FAMA.AP.DataLayer.DbProcessType(); if (idProcesType > 0) { au.UpdateData(objprocess); } else { au.InsertData(objprocess); } GridProcess.ItemsSource = au.Selectalldata(); GridProcess.Items.Refresh(); txtName.Text = ""; txtDescripcion.Text = ""; txtName.IsEnabled = false; txtDescripcion.IsEnabled = false; btn_cancel.Visibility = Visibility.Hidden; btn_save.Visibility = Visibility.Hidden; txtName.Visibility = Visibility.Hidden; txtDescripcion.Visibility = Visibility.Hidden; }
public CeisViewModel() { Ceis = new Ceis(); FAMA.AP.DataLayer.DbCeis Conexion = new FAMA.AP.DataLayer.DbCeis(); Ceis = Conexion.Selectalldata(); Ceiss = new ObservableCollection <Ceis>(); FAMA.AP.DataLayer.DbProcessType CxnProcessType = new FAMA.AP.DataLayer.DbProcessType(); processTypeList = CxnProcessType.Selectalldata(); qryProcessType = new CollectionView(processTypeList); qryProcessType.MoveCurrentTo(processTypeList[0]); qryProcessType.CurrentChanged += new EventHandler(queryProcessType_CurrentChanged); Ceiss.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Ceiss_CollectionChanged); }