예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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;
        }
예제 #5
0
        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);
        }