Exemplo n.º 1
0
        public UcWKF(CsWorkflow wkf, SessionObject.ExecMode execMode)
        {
            try
            {
                InitializeComponent();
                Translate();
                //Chargement des données par défaut pour la création
                GetDefaultData();
                Workflow         = wkf;
                ObjetSelectionne = wkf;
                _execMode        = execMode;

                ShowDetailsWKF();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.FenetreOperation);
            }
        }
Exemplo n.º 2
0
        public UcWKF(CsWorkflow wkf, SessionObject.ExecMode execMode, DataGrid pGrid)
        {
            dataGrid = pGrid;
            try
            {
                if (dataGrid != null)
                {
                    donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsWorkflow>;
                }
                InitializeComponent();
                Translate();
                //Chargement des données par défaut pour la création
                GetDefaultData();
                Workflow         = wkf;
                ObjetSelectionne = wkf;
                _execMode        = execMode;

                ShowDetailsWKF();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.FenetreOperation);
            }
        }
Exemplo n.º 3
0
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
         if (_execMode == SessionObject.ExecMode.Creation)
         {
             ObjetSelectionne = new CsWorkflow()
             {
                 PK_ID              = Guid.NewGuid(),
                 CODE               = txtCode.Text,
                 DESCRIPTION        = txtDescription.Text,
                 WORKFLOWNAME       = txtNom.Text,
                 FK_IDTABLE_TRAVAIL = (int.Parse(cmbTable.SelectedValue.ToString()) != 0) ?
                                      int.Parse(cmbTable.SelectedValue.ToString()) : 0
             };
             List <CsWorkflow> toInsert = new List <CsWorkflow>()
             {
                 ObjetSelectionne
             };
             client.InsertWorkflowCompleted += (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;
                 }
                 DialogResult = true;
                 UpdateParentList(toInsert);
             };
             client.InsertWorkflowAsync(toInsert);
         }
         else if (_execMode == SessionObject.ExecMode.Modification)
         {
             ObjetSelectionne.CODE               = txtCode.Text;
             ObjetSelectionne.DESCRIPTION        = txtDescription.Text;
             ObjetSelectionne.WORKFLOWNAME       = txtNom.Text;
             ObjetSelectionne.FK_IDTABLE_TRAVAIL = (int.Parse(cmbTable.SelectedValue.ToString()) != 0) ?
                                                   int.Parse(cmbTable.SelectedValue.ToString()) : 0;
             List <CsWorkflow> toUpdate = new List <CsWorkflow>()
             {
                 ObjetSelectionne
             };
             client.UpdateWorkflowCompleted += (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;
                 }
                 DialogResult = true;
                 UpdateParentList(toUpdate);
             };
             client.UpdateWorkflowAsync(toUpdate);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }