コード例 #1
0
        void ValidaterAttributionProfil()
        {
            List <CsModuleDeFonction> lesModuleHabile = new List <CsModuleDeFonction>();
            List <CsModule>           lesModuleSelect = _ListeModuleObs.Where(t => t.IsSelect == true).ToList();
            CsFonction laFonctionSelect = (CsFonction)this.cbo_profile.SelectedItem;

            foreach (CsModule item in lesModuleSelect)
            {
                CsModuleDeFonction lesModuleDeLaFonction = new CsModuleDeFonction()
                {
                    FK_IDFONCTION = laFonctionSelect.PK_ID,
                    FK_IDMODULE   = item.PK_ID
                };
                lesModuleHabile.Add(lesModuleDeLaFonction);
            }

            //AdministrationServiceClient prgram = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
            AdministrationServiceClient insertHabil = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            insertHabil.InsertionModuleDeFonctionCompleted += (insers, resultins) =>
            {
                try
                {
                    if (resultins.Cancelled || resultins.Error != null)
                    {
                        string error = resultins.Error.Message;
                        Message.ShowInformation(error, Langue.errorTitle);
                        OKButton.IsEnabled = true;
                        return;
                    }

                    if (resultins.Result == false)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Administration.Langue.MsgSettingProfilFailed, Langue.informationTitle);
                        return;
                    }
                    else
                    if (resultins.Result == true)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Administration.Langue.MsgSettingProfilSuccess, Langue.informationTitle);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    OKButton.IsEnabled = true;
                    Message.ShowError(ex.Message, Langue.informationTitle);
                }
            };
            insertHabil.InsertionModuleDeFonctionAsync(lesModuleHabile);

            //prgram.InsertionModuleDeFonctionCompleted += (sprog, resprog) =>
            //{
            //    //InsertionModuleDeFonction(lesModuleHabile);
            //};
            //prgram.InsertionModuleDeFonctionAsync();
        }