예제 #1
0
        private void btExportGroupPrivileges_Click(object sender, EventArgs e)
        {
            MDSWrapper mdsWrapper = null;

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (this.cbModel.SelectedItem != null)
                {
                    if (this.folderBrowserDialog1.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    var modelId = this.cbModel.SelectedItem as Identifier;
                    var path    = this.folderBrowserDialog1.SelectedPath;

                    if (lstGroups.SelectedItem != null)
                    {
                        var fileName = String.Format(Constants.StringFormatGroupPrivileges, (lstGroups.SelectedItem as Group).Identifier.InternalId);
                        MDSWrapper.SecurityPrivilegesExport(modelId, path, fileName, lstGroups.SelectedItem as Group);
                    }

                    if (MessageBox.Show("Group principals successfully exported to " + path.Replace("\\\\", "\\") + "\r\nDo you want to open the destination folder ?", "Yes or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        Process.Start("explorer.exe", path);
                    }
                }
                else
                {
                    MessageBox.Show("Please select a model first");
                }
            }
            catch (Exception ex)
            {
                statusStrip1.Text = ex.Message;
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                if (mdsWrapper != null)
                {
                    mdsWrapper.Dispose();
                }
            }
        }