Exemplo n.º 1
0
        void SupprimerSecurite()
        {
            try
            {
                AdministrationServiceClient delete = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                delete.DeleteStrategieSecuriteCompleted += (senderdel, resultDel) =>
                {
                    try
                    {
                        if (resultDel.Cancelled || resultDel.Error != null)
                        {
                            string error = resultDel.Error.Message;
                            Message.Show(Galatee.Silverlight.Resources.Administration.Langue.MsgErrorInsertUser, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }

                        if (resultDel.Result == false)
                        {
                            Message.Show(Galatee.Silverlight.Resources.Administration.Langue.MsgErrorInsertUser, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }
                        else
                        {
                            Message.Show(Galatee.Silverlight.Resources.Langue.suppressionSuccess, Galatee.Silverlight.Resources.Langue.informationTitle);
                            List <CsStrategieSecurite> _securite = datagrid.ItemsSource as List <CsStrategieSecurite>;
                            _securite.Remove(security);
                            datagrid.ItemsSource = null;
                            datagrid.ItemsSource = _securite;
                            this.DialogResult    = true;
                        }
                    }
                    catch (Exception ew)
                    {
                        Message.Show(ew.Message, Langue.errorTitle);
                    }
                };
                delete.DeleteStrategieSecuriteAsync(security.PK_IDSTRATEGIESECURITE);
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Langue.errorTitle);
            }
        }