Exemplo n.º 1
0
        public UcWKFSelectEtape(List <CsEtape> lsEtapes, CsEtape BeforeStep, List <CsEtape> EtapeDejaChoisie, DataGrid pdtGrid, CsTableDeTravail theWorkingTable,
                                List <CsGroupeValidation> grpValidations)
        {
            try
            {
                InitializeComponent();

                dataGrid = pdtGrid;
                if (dataGrid != null)
                {
                    donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsRAffectationEtapeWorkflow>;
                }

                _ttsLesEtapes           = lsEtapes;
                _workingTable           = theWorkingTable;
                _LesGroupesValidation   = grpValidations;
                _lesEtapesANePasChoisir = EtapeDejaChoisie;
                _EtapePrecedente        = BeforeStep;
                SetData();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Configuration Etape");
            }
        }
Exemplo n.º 2
0
        public UcWKFSelectEtape(List <CsEtape> lsEtapes, CsEtape BeforeStep, List <CsEtape> EtapeDejaChoisie, DataGrid pdtGrid, CsTableDeTravail theWorkingTable, List <CsGroupeValidation> grpValidations,
                                KeyValuePair <CsRAffectationEtapeWorkflow, CsConditionBranchement> lEtapeEtCondition, SessionObject.ExecMode execMode,
                                bool CanAddCondition)
        {
            try
            {
                InitializeComponent();

                dataGrid = pdtGrid;
                if (dataGrid != null)
                {
                    donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsRAffectationEtapeWorkflow>;
                }
                _ttsLesEtapes         = lsEtapes;
                _workingTable         = theWorkingTable;
                _LesGroupesValidation = grpValidations;
                _StepAndCondition     = lEtapeEtCondition;
                _EtapePrecedente      = BeforeStep;
                Step = _StepAndCondition;
                _lesEtapesANePasChoisir = EtapeDejaChoisie;
                _execMode    = execMode;
                UseCondition = CanAddCondition;

                SetData();
                ShowDetailEtape();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Configuration Etape");
            }
        }
Exemplo n.º 3
0
        private void MenuContextuelCreerEtape_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //On prend la dernière étape du datagrid
                IOrderedEnumerable <CsRAffectationEtapeWorkflow> dtGridRAff = dtgrdParametre.ItemsSource as IOrderedEnumerable <CsRAffectationEtapeWorkflow>;
                CsRAffectationEtapeWorkflow lastStep = null;

                if (null != dtGridRAff)
                {
                    lastStep = dtGridRAff.LastOrDefault();
                }
                CsEtape beforeStep = null;
                if (null != lastStep)
                {
                    beforeStep = _ttsLesEtapes.Where(st => st.PK_ID == lastStep.FK_IDETAPE)
                                 .FirstOrDefault();
                }

                //Appel récursive de cette même fenêtre pour configurer le circuit de détournement
                //causé par la condition sur l'étape courante d'origine
                //Mais pour le moment, pas de condition à un deuxième niveau
                UcWKFSelectEtape uctl = new UcWKFSelectEtape(_ttsLesEtapes, beforeStep, StepAllReadyChoosed, dtgrdParametre, _workingTable,
                                                             _LesGroupesValidation, false);
                uctl.Closing += uctl_Closing;
                uctl.Show();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
 private void BtnAjouterRejet_Click(object sender, RoutedEventArgs e)
 {
     if (null != cmbEtape.SelectedValue)
     {
         CsEtape __Etape = cmbEtape.SelectedItem as CsEtape;
         UcWKFSelectRenvoiRejet ucRenvoi = new UcWKFSelectRenvoiRejet(__Etape, _lesEtapesANePasChoisir);
         ucRenvoi.Closed += ucRenvoi_Closed;
         ucRenvoi.Show();
     }
 }
        public UcWKFSelectRenvoiRejet(CsEtape _etape, List <CsEtape> _lsEtape)
        {
            InitializeComponent();

            OrigineEtape = _etape;
            _lsEtapes    = _lsEtape;

            cmbEtapeConditionVrai.DisplayMemberPath = "NOM";
            cmbEtapeConditionVrai.SelectedValuePath = "PK_ID";
            cmbEtapeConditionVrai.ItemsSource       = _lsEtapes;
        }
Exemplo n.º 6
0
        private void Modifier_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgrdParametre.SelectedItem != null)
                {
                    //Appel récursif de la même fenêtre
                    var objetselectionne = (CsRAffectationEtapeWorkflow)dtgrdParametre.SelectedItem;
                    if (null != objetselectionne)
                    {
                        IOrderedEnumerable <CsRAffectationEtapeWorkflow> dtGridRAff = dtgrdParametre.ItemsSource as IOrderedEnumerable <CsRAffectationEtapeWorkflow>;
                        CsRAffectationEtapeWorkflow lastStep = null;

                        if (null != dtGridRAff)
                        {
                            lastStep = dtGridRAff.Where(aff => aff.ORDRE < objetselectionne.ORDRE)
                                       .OrderBy(a => a.ORDRE)
                                       .LastOrDefault();
                        }
                        CsEtape beforeStep = null;
                        if (null != lastStep)
                        {
                            beforeStep = _ttsLesEtapes.Where(st => st.PK_ID == lastStep.FK_IDETAPE)
                                         .FirstOrDefault();
                        }
                        List <CsEtape> IlFautQuandMemeAjouterLaMemeEtapePourQuellePuisseEtreSelecionneeDansLaFenetreDeConfiguration = new List <CsEtape>();
                        StepAllReadyChoosed.ForEach((CsEtape etap) =>
                        {
                            if (etap.PK_ID != objetselectionne.FK_IDETAPE)
                            {
                                IlFautQuandMemeAjouterLaMemeEtapePourQuellePuisseEtreSelecionneeDansLaFenetreDeConfiguration.Add(etap);
                            }
                        });

                        KeyValuePair <CsRAffectationEtapeWorkflow, CsConditionBranchement> leAffChoosed = new KeyValuePair <CsRAffectationEtapeWorkflow, CsConditionBranchement>(
                            objetselectionne, _RelationAffectationEtapeCondition[objetselectionne.PK_ID]);

                        //pour le moment, pas de condition à un deuxième niveau
                        UcWKFSelectEtape form = new UcWKFSelectEtape(_ttsLesEtapes, beforeStep, IlFautQuandMemeAjouterLaMemeEtapePourQuellePuisseEtreSelecionneeDansLaFenetreDeConfiguration,
                                                                     dtgrdParametre, _workingTable, _LesGroupesValidation,
                                                                     leAffChoosed, SessionObject.ExecMode.Modification, false);

                        form.Closing += uctl_Closing;
                        form.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Languages.FenetreOperation);
            }
        }
 public UcWKFCondition(CsEtape _theStep, CsTableDeTravail _table, List <CsGroupeValidation> grpValidation, bool ForAction)
 {
     try
     {
         InitializeComponent();
         TableTravailConcernée = _table;
         OrigineEtape          = _theStep;
         GroupeValidation      = grpValidation;
         _conditionAction      = ForAction;
         SetData();
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, "Définition Condition Etape");
     }
 }
Exemplo n.º 8
0
 public UcWKFListeDemandeTravaux(Guid Operation, int IDEtape, int NbreEtape)
 {
     try
     {
         InitializeComponent();
         FKEtape            = IDEtape;
         _OperationID       = Operation;
         nombreEtapeCircuit = NbreEtape;
         SessionObject.IsChargerDashbord = false;
         _LEtape = null != SessionObject._ToutesLesEtapesWorkflows ? SessionObject._ToutesLesEtapesWorkflows.FirstOrDefault(e => e.PK_ID == IDEtape):null;
         ChargerListDesSite(null);
         Translate();
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, "Tableau de bord, Fenetre demande Liste");
     }
 }
Exemplo n.º 9
0
 public UcWKFEtape(CsEtape objEtape, SessionObject.ExecMode execMode, Guid OpGUID)
 {
     try
     {
         InitializeComponent();
         ObjetSelectionne = objEtape;
         _execMode        = execMode;
         OperationGUID    = OpGUID;
         Translate();
         if (_execMode == SessionObject.ExecMode.Modification || _execMode == SessionObject.ExecMode.Consultation)
         {
             GetDefaultData();
         }
         ShowDetailsOperation();
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, Languages.FenetreOperation);
     }
 }
        public UcWKFCondition(CsEtape _theStep, List <CsEtape> lsStep, CsTableDeTravail _table, List <CsGroupeValidation> grpValidation,
                              CsConditionBranchement lCondition, SessionObject.ExecMode execMode, CsRAffectationEtapeWorkflow DirectEtapeBranchement)
        {
            try
            {
                InitializeComponent();
                _lsEtapes                = lsStep;
                TableTravailConcernée    = _table;
                OrigineEtape             = _theStep;
                GroupeValidation         = grpValidation;
                _theCondition            = lCondition;
                _rAffDirectementBranchee = DirectEtapeBranchement;
                _execMode                = execMode;

                SetData();
                ShowDetail();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Définition Condition Etape");
            }
        }
Exemplo n.º 11
0
        public UcWKFListeDemandeTravaux(Guid Operation, List <Guid> lstIdDemande, bool _IstraitementLot, string _NomOperation, int IDEtape)
        {
            try
            {
                InitializeComponent();
                Translate();
                NomOperation       = _NomOperation;
                _OperationID       = Operation;
                FKEtape            = IDEtape;
                IsTraitementParLot = _IstraitementLot;
                SessionObject.IsChargerDashbord = false;
                ChargeEquipe(UserConnecte.Centre);
                ChargerListDesSite(lstIdDemande);
                _LEtape = null != SessionObject._ToutesLesEtapesWorkflows ? SessionObject._ToutesLesEtapesWorkflows.FirstOrDefault(e => e.PK_ID == IDEtape) : null;

                //On cache dabord le bouton
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Tableau de bord, Fenetre demande Liste");
            }
        }
Exemplo n.º 12
0
        public UcWKFListeDemandeTravaux(Guid Operation, int IDEtape, int NbreEtape, string _NomOperation)
        {
            try
            {
                InitializeComponent();
                FKEtape            = IDEtape;
                _OperationID       = Operation;
                NomOperation       = _NomOperation;
                prgBar.Visibility  = System.Windows.Visibility.Collapsed;
                nombreEtapeCircuit = NbreEtape;
                SessionObject.IsChargerDashbord = false;

                _LEtape = null != SessionObject._ToutesLesEtapesWorkflows ? SessionObject._ToutesLesEtapesWorkflows.FirstOrDefault(e => e.PK_ID == IDEtape) : null;
                ChargerListDesSite(null);
                Translate();
                EditerButton.IsEnabled = false;
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Tableau de bord");
            }
        }
Exemplo n.º 13
0
        private void btnSpecifierCondition_Click(object sender, RoutedEventArgs e)
        {
            int     PKIDStep = int.Parse(cmbEtape.SelectedValue.ToString());
            CsEtape step     = _ttsLesEtapes.Where(et => et.PK_ID == PKIDStep)
                               .FirstOrDefault();

            if (null != step)
            {
                if (null != _StepAndCondition.Key && null != _StepAndCondition.Value)
                {
                    UcWKFCondition formC = new UcWKFCondition(step, _ttsLesEtapes, _workingTable, _LesGroupesValidation,
                                                              _StepAndCondition.Value, SessionObject.ExecMode.Modification, _detournement);
                    formC.Closing += formC_Closing;
                    formC.Show();
                }
                else
                {
                    UcWKFCondition formC = new UcWKFCondition(step, _ttsLesEtapes, _workingTable, _LesGroupesValidation);
                    formC.Closing += formC_Closing;
                    formC.Show();
                }
            }
        }
Exemplo n.º 14
0
        public UcWKFListeDemandeTravaux(bool IsConsultation, Guid Operation, List <Guid> lstIdDemande, bool _IstraitementLot, string _NomOperation, int IDEtape, string _CodeEtape)
        {
            try
            {
                InitializeComponent();
                Translate();
                NomOperation       = _NomOperation;
                _OperationID       = Operation;
                FKEtape            = IDEtape;
                CodeEtape          = _CodeEtape;
                IsTraitementParLot = _IstraitementLot;
                ChargeEquipe(UserConnecte.Centre);
                SessionObject.IsChargerDashbord = false;
                IsConsultationSeul = IsConsultation;
                _LEtape            = null != SessionObject._ToutesLesEtapesWorkflows ? SessionObject._ToutesLesEtapesWorkflows.FirstOrDefault(e => e.PK_ID == IDEtape) : null;
                if (IsConsultation)
                {
                    EditerButton.Visibility = System.Windows.Visibility.Collapsed;
                }
                prgBar.Visibility = System.Windows.Visibility.Collapsed;
                if (CodeEtape == "SCOMP")
                {
                    IsSortieCompteur = true;
                }
                else if (CodeEtape == "SMAT")
                {
                    IsSortieCompteur = false;
                }
                ChargerListDesSite(lstIdDemande);

                //On cache dabord le bouton
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Tableau de bord, Fenetre demande Liste");
            }
        }
Exemplo n.º 15
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (null != cmbFormulaire.SelectedValue)
            {
                try
                {
                    ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                    int  idFrm            = int.Parse(cmbFormulaire.SelectedValue.ToString());
                    bool?checkboxSelected = chkboxConsultationSeulement.IsChecked;
                    int  back             = LoadingManager.BeginLoading("Enregistrement ...");
                    if (_execMode == SessionObject.ExecMode.Creation)
                    {
                        ObjetSelectionne = new CsEtape()
                        {
                            PK_ID            = 0,
                            CODE             = txtCode.Text,
                            DESCRIPTIONETAPE = txtDescription.Text,
                            NOM             = txtNom.Text,
                            FK_IDOPERATION  = OperationGUID,
                            FK_IDFORMULAIRE = idFrm,
                            MODIFICATION    = !checkboxSelected,
                            CONTROLEETAPE   = (0 != idFrm) ? _lsFormulaires.Where(f => f.PK_ID == idFrm)
                                              .First().FULLNAMECONTROLE : string.Empty,
                            IS_TRAITEMENT_LOT = chkTraitementParLot.IsChecked.Value
                        };
                        List <CsEtape> toInsert = new List <CsEtape>()
                        {
                            ObjetSelectionne
                        };
                        client.InsertEtapeCompleted += (ssender, insertR) =>
                        {
                            if (insertR.Cancelled ||
                                insertR.Error != null)
                            {
                                Message.ShowError(insertR.Error.Message, Languages.FenetreOperation);
                                return;
                            }
                            if (!insertR.Result)
                            {
                                Message.ShowError(Languages.ErreurInsertionDonnees, Languages.FenetreOperation);
                                return;
                            }
                            Etape        = ObjetSelectionne;
                            DialogResult = true;
                            UpdateParentList(toInsert);

                            LoadingManager.EndLoading(back);
                        };
                        client.InsertEtapeAsync(toInsert);
                    }
                    else if (_execMode == SessionObject.ExecMode.Modification)
                    {
                        ObjetSelectionne.CODE             = txtCode.Text;
                        ObjetSelectionne.DESCRIPTIONETAPE = txtDescription.Text;
                        ObjetSelectionne.NOM             = txtNom.Text;
                        ObjetSelectionne.FK_IDOPERATION  = OperationGUID;
                        ObjetSelectionne.FK_IDFORMULAIRE = idFrm;
                        ObjetSelectionne.CONTROLEETAPE   = (idFrm != 0) ? _lsFormulaires.Where(f => f.PK_ID == idFrm).First()
                                                           .FULLNAMECONTROLE : string.Empty;
                        ObjetSelectionne.IS_TRAITEMENT_LOT = chkTraitementParLot.IsChecked.Value;
                        List <CsEtape> toUpdate = new List <CsEtape>()
                        {
                            ObjetSelectionne
                        };
                        client.UpdateEtapeCompleted += (ssender, insertR) =>
                        {
                            if (insertR.Cancelled ||
                                insertR.Error != null)
                            {
                                Message.ShowError(insertR.Error.Message, Languages.FenetreOperation);
                                return;
                            }
                            if (!insertR.Result)
                            {
                                Message.ShowError(Languages.ErreurInsertionDonnees, Languages.FenetreOperation);
                                return;
                            }
                            Etape        = ObjetSelectionne;
                            DialogResult = true;
                            UpdateParentList(toUpdate);

                            LoadingManager.EndLoading(back);
                        };
                        client.UpdateEtapeAsync(toUpdate);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Message.ShowError(new Exception("Veuillez selectionner un formulaire"), "Configuration Etape");
            }
        }
        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override RESULTACTION Execute(CodeActivityContext context)
        {
            RESULTACTION _resultAction = RESULTACTION.ERREURINCONNUE;

            string _codeDemande     = context.GetValue <string>(CodeDemande);
            string _matricule       = context.GetValue <string>(MatriculeUser);
            string _actionOnDemande = string.Empty;

            //On va mettre transmettre la demande à l'étape suivante
            try
            {
                DB_WORKFLOW dbWKF = new DB_WORKFLOW();

                //On récupère toutes les infos de la demande
                CsDemandeWorkflow dmdWorkflow = dbWKF.SelectLaDemande(_codeDemande);
                if (null != dmdWorkflow)
                {
                    //Infos sur la table de travail
                    CsTableDeTravail table = dbWKF.SelectAllTableDeTravail().Where(t => t.PK_ID == dmdWorkflow.FK_IDTABLETRAVAIL)
                                             .FirstOrDefault();

                    //La demande doit être forcement liée à une table de travail
                    //if (null != table)        --> Une opération peut ne peut avoir une table de travail
                    //{
                    //Avant de transmettre  la demande on cherche les infos de l'étape actuelle
                    KeyValuePair <CsCopieDmdCircuit, CsCopieDmdConditionBranchement> CurrentStep = dbWKF.RecupererEtapeCourante(_codeDemande);
                    if (null != CurrentStep.Key)
                    {
                        //On verifie la condition actuelle de l'étape
                        bool IlYaUneCondition = (null != CurrentStep.Value &&
                                                 (null != CurrentStep.Key.CONDITION && string.Empty != CurrentStep.Key.CONDITION));

                        bool transmissionOk = true;
                        bool LastStep       = false;

                        string msgErr = string.Empty;
                        if (IlYaUneCondition)
                        {
                            //On utilise la condition pour transmettre
                            bool onABienTeste      = true;
                            bool conditionRespecte = ConditionChecker.CheckIfConditionIsRespected(CurrentStep.Key.CONDITION,
                                                                                                  table.TABLE_NAME, ref msgErr, dmdWorkflow.FK_IDLIGNETABLETRAVAIL, ref onABienTeste);
                            if (onABienTeste)
                            {
                                transmissionOk = dbWKF.TransmettreDemande(_codeDemande, dmdWorkflow.FK_IDETAPEACTUELLE, ref msgErr, ref LastStep,
                                                                          ref dmdWorkflow, conditionRespecte);
                            }
                            else
                            {
                                transmissionOk = false;
                            }
                        }
                        else
                        {
                            //On transmet sans condition
                            transmissionOk = dbWKF.TransmettreDemande(_codeDemande, dmdWorkflow.FK_IDETAPEACTUELLE, ref msgErr, ref LastStep,
                                                                      ref dmdWorkflow, false);
                        }
                        if (transmissionOk)
                        {
                            //On a bien transmis,
                            dmdWorkflow.FK_IDSTATUS = (int)STATUSDEMANDE.EnAttenteValidation;       //Pour la prochaine étape
                            dmdWorkflow.DATEDERNIEREMODIFICATION = DateTime.Now;
                            _resultAction = RESULTACTION.TRANSMISE;


                            /** ZEG 29/08/2017 **/
                            //_actionOnDemande = "Validation à l'étape " + CurrentStep.Key.LIBELLEETAPE;
                            CsEtape _etape = dbWKF.SelectAllEtapes().Find(e => e.PK_ID == dmdWorkflow.FK_IDETAPEPRECEDENTE);
                            _actionOnDemande = "Etape " + _etape.NOM + " traitée";
                            /****/



                            MessageErreur.Set(context, "");

                            #region Mise à jour de la demande et insertion des journaux
                            //On met à jour la demande
                            bool update = dbWKF.UpdateDemande(new List <CsDemandeWorkflow>()
                            {
                                dmdWorkflow
                            });
                            if (update)
                            {
                                //maintenant on écrit dans le journal de la demande
                                CsJournalDemandeWorkflow jrnal = new CsJournalDemandeWorkflow();
                                jrnal.PK_ID               = Guid.NewGuid();
                                jrnal.CODE_DEMANDE        = dmdWorkflow.CODE;
                                jrnal.FK_IDDEMANDE        = dmdWorkflow.PK_ID;
                                jrnal.LIBELLEACTION       = _actionOnDemande;
                                jrnal.DATEACTION          = DateTime.Today.Date;
                                jrnal.OBSERVATIONS        = string.Empty;
                                jrnal.MATRICULEUSERACTION = _matricule;

                                dbWKF.InsertJournalDemande(new List <CsJournalDemandeWorkflow>()
                                {
                                    jrnal
                                });

                                //Suppresion de la demande dans la table des affectations user
                                dbWKF.SupprimerAffectationDemande(dmdWorkflow.CODE);
                            }
                            else
                            {
                                MessageErreur.Set(context, "Une erreur interne est survenue");
                                _resultAction = RESULTACTION.ERREURINCONNUE;
                            }

                            #endregion
                        }
                        else
                        {
                            //On na pas bien transmis, donc on check si on est déjà à la dernière étape
                            if (LastStep)
                            {
                                //Bon la, la demande est terminée oh, donc après on va parser la table pour la purger
                                //si le paramètre SUPPRIMER_DEMANDE_TERMINE est à OUI
                                dmdWorkflow.FK_IDSTATUS = (int)STATUSDEMANDE.Terminee;
                                dmdWorkflow.DATEDERNIEREMODIFICATION = DateTime.Now;
                                _resultAction = RESULTACTION.FINDECIRCUIT;

                                //Si on est à la fin du circuit, on n'a plus de journaux à insérer,
                                //car aucune action n'a été faite en principe, mais on va juste insérer
                                //demande terminée par ... le ... à l'étape ...
                                bool update = dbWKF.UpdateDemande(new List <CsDemandeWorkflow>()
                                {
                                    dmdWorkflow
                                });
                                if (update)
                                {
                                    /** ZEG 29/08/2017 **/
                                    CsEtape _etape2 = dbWKF.SelectAllEtapes().Find(e => e.PK_ID == dmdWorkflow.FK_IDETAPEPRECEDENTE);

                                    //Insertion du journal
                                    CsJournalDemandeWorkflow jrnal = new CsJournalDemandeWorkflow()
                                    {
                                        CODE_DEMANDE = dmdWorkflow.CODE,
                                        DATEACTION   = DateTime.Today.Date,
                                        FK_IDDEMANDE = dmdWorkflow.PK_ID,
                                        PK_ID        = Guid.NewGuid(),

                                        /** ZEG 29/08/2017 **/
                                        //LIBELLEACTION = "Dernière validation à l'étape " + CurrentStep.Key.LIBELLEETAPE,
                                        LIBELLEACTION = "Dernière étape " + _etape2.NOM + " validée",


                                        MATRICULEUSERACTION = _matricule,
                                        OBSERVATIONS        = string.Empty
                                    };

                                    dbWKF.InsertJournalDemande(new List <CsJournalDemandeWorkflow>()
                                    {
                                        jrnal
                                    });

                                    //Suppresion de la demande dans la table des affectations user
                                    dbWKF.SupprimerAffectationDemande(dmdWorkflow.CODE);
                                }
                                MessageErreur.Set(context, "");
                            }
                            else
                            {
                                //La la, ya vraiment une erreur qui s'est produite
                                _resultAction = RESULTACTION.ERREURINCONNUE;
                                MessageErreur.Set(context, msgErr);
                            }
                        }


                        return(_resultAction);
                    }
                    else
                    {
                        MessageErreur.Set(context, "Impossible d'avancer une demande n'étant à aucune étape");
                        return(RESULTACTION.ERREURINCONNUE);
                    }
                    //}
                    //else
                    //{
                    //    MessageErreur.Set(context, "Impossible de transmettre une demande n'étant pas liée à une table de travail");
                    //    return RESULTACTION.ERREURINCONNUE;
                    //}
                }
                else
                {
                    MessageErreur.Set(context, "Impossible de transmettre une demande qui n'existe pas");
                    return(RESULTACTION.ERREURINCONNUE);
                }
            }
            catch (Exception ex)
            {
                MessageErreur.Set(context, ex.Message);
                return(RESULTACTION.ERREURINCONNUE);
            }
        }
Exemplo n.º 17
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //On crée laffectation
            if (null != cmbEtape.SelectedValue && null != cmbGroupeValidation.SelectedValue)
            {
                if (!VerifierChampDelai())
                {
                    Message.ShowError(new Exception("Veuillez donner une durée d'exécution de l'étape"), "Affectation Etape");
                    return;
                }

                int     PKIDStep = int.Parse(cmbEtape.SelectedValue.ToString());
                CsEtape LEtapeOh = _ttsLesEtapes.Where(et => et.PK_ID == PKIDStep)
                                   .FirstOrDefault();

                Guid GrpPKID = Guid.Parse(cmbGroupeValidation.SelectedValue.ToString());

                if (null != LEtapeOh && Guid.Empty != GrpPKID)
                {
                    if (null == Step.Key)
                    {
                        CsRAffectationEtapeWorkflow affEtape = new CsRAffectationEtapeWorkflow()
                        {
                            PK_ID                  = Guid.NewGuid(),
                            CODEETAPE              = LEtapeOh.CODE,
                            FK_IDETAPE             = PKIDStep,
                            FK_IDGROUPEVALIDATIOIN = GrpPKID,
                            LIBELLEETAPE           = LEtapeOh.NOM,
                            GROUPEVALIDATION       = _LesGroupesValidation.Where(g => g.PK_ID == GrpPKID).FirstOrDefault().GROUPENAME,
                            DUREE                  = int.Parse(txtDelai.Text)
                        };
                        if (null != TheCondition)
                        {
                            affEtape.CONDITION = TheCondition.NOM;
                            TheCondition.FK_IDRAFFECTATIONWKF = affEtape.PK_ID;
                        }

                        Step = new KeyValuePair <CsRAffectationEtapeWorkflow, CsConditionBranchement>(affEtape, TheCondition);
                    }
                    else
                    {
                        CsRAffectationEtapeWorkflow affEtape = new CsRAffectationEtapeWorkflow()
                        {
                            PK_ID                  = Step.Key.PK_ID,
                            CODEETAPE              = LEtapeOh.CODE,
                            FK_IDETAPE             = PKIDStep,
                            FK_IDGROUPEVALIDATIOIN = GrpPKID,
                            LIBELLEETAPE           = LEtapeOh.NOM,
                            ORDRE                  = Step.Key.ORDRE,
                            DUREE                  = int.Parse(txtDelai.Text)
                        };
                        if (null != TheCondition)
                        {
                            affEtape.CONDITION = TheCondition.NOM;
                            TheCondition.FK_IDRAFFECTATIONWKF = affEtape.PK_ID;
                        }

                        Step = new KeyValuePair <CsRAffectationEtapeWorkflow, CsConditionBranchement>(affEtape, TheCondition);
                    }

                    //On va maintenant récupérer les étapes du circuits de détournement
                    LeCircuitDetourne = new List <CsRAffectationEtapeWorkflow>();
                    if (null != SecondedonnesDatagrid)
                    {
                        foreach (CsRAffectationEtapeWorkflow aff in SecondedonnesDatagrid)
                        {
                            aff.FK_IDRETAPEWORKFLOWORIGINE = Step.Key.PK_ID;
                            LeCircuitDetourne.Add(aff);
                        }
                    }
                    this.DialogResult = true;
                }
                else
                {
                    this.DialogResult = false;
                }
            }
            else
            {
                Message.ShowError(new Exception("Veuillez sélectionner une étape et un groupe de validation"),
                                  "Affectation Etape");
            }
        }