Ejemplo n.º 1
0
        private void Common_DeleteRecord(ListView listview, bool isMember = true)
        {
            if (listview.SelectedItem != null)
            {
                var item = listview.SelectedItem;

                try
                {
                    _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                    var sid = item.SubItems[2].Text;
                    var mbr = isMember ?
                              _Members.Where(x => x.SID.ToString() == sid).FirstOrDefault() :
                              _NonMembers.Where(x => x.SID.ToString() == sid).FirstOrDefault();

                    if (mbr != null)
                    {
                        _StoreGroup.GetStoreGroupMember(mbr.SID).Delete();
                    }

                    _Storage.CommitTransaction();
                }
                catch (Exception ex)
                {
                    _Storage.RollBackTransaction();
                    throw (ex);
                }
            }
        }
Ejemplo n.º 2
0
        private void SaveRecord()
        {
            try
            {
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                foreach (ListViewItem item in lvwStoreGroups.Items)
                {
                    #region update checked items only, not selected
                    if (item.Checked)
                    {
                        _SelectedItems.Add(item);

                        #region 立即 save
                        IAzManStoreGroup sg = _Store.GetStoreGroup(item.SubItems[0].Text);
                        _StoreGroup.CreateStoreGroupMember(sg.SID, WhereDefined.Store, _IsMember);
                        #endregion
                    }
                    #endregion
                }
                _Storage.CommitTransaction();
            }
            catch (Exception ex)
            {
                _Storage.RollBackTransaction();
                throw (ex);
            }
        }
Ejemplo n.º 3
0
        public DialogResult ShowDialog(IWin32Window owner, string fileName, object importIntoObject, bool chkUsersAndGroups, bool chkDBUsers, bool chkAuthorizations, SqlAzManMergeOptions mergeOptions)
        {
            this.DialogResult = DialogResult.None;
            this.TopMost      = true;
            this.Show(owner);
            /*Application.DoEvents();*/
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);
            XmlNode xmlStartNode;

            if (this.checkScopeNodePosition(doc, ref importIntoObject, out xmlStartNode))
            {
                IAzManStorage storage = this.getStorageReference(importIntoObject);
                try
                {
                    storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                    ((IAzManImport)importIntoObject).ImportChildren(xmlStartNode, chkUsersAndGroups, chkDBUsers, chkAuthorizations, mergeOptions);
                    storage.CommitTransaction();
                    this.Hide();
                    return(this.DialogResult = DialogResult.OK);
                }
                catch
                {
                    storage.RollBackTransaction();
                    this.DialogResult = DialogResult.Cancel;
                    this.Hide();
                    throw;
                }
            }
            else
            {
                return(this.DialogResult = DialogResult.Cancel);
            }
        }
Ejemplo n.º 4
0
        private void SaveRecord()
        {
            _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
            foreach (ListViewItem item in lvwStoreGroups.Items)
            {
                #region update checked items only, not selected
                if (item.Checked)
                {
                    _SelectedItems.Add(item);

                    #region 立即 save
                    IAzManStoreGroup    storeGroup = _Store.GetStoreGroup(item.SubItems[0].Text);
                    IAzManAuthorization auth       = _AuthItem.CreateAuthorization(
                        new SqlAzManSID(storeGroup.SID.ToString(), this._CurrentOwnerSidWhereDefined == WhereDefined.Store),
                        this._CurrentOwnerSidWhereDefined,
                        new SqlAzManSID(storeGroup.SID.ToString(), true),
                        WhereDefined.Store,
                        AuthorizationType.Neutral,
                        null,
                        null);
                    #endregion
                }
                #endregion
            }
            _Storage.CommitTransaction();
        }
Ejemplo n.º 5
0
        private void SaveRecord()
        {
            var key   = txtKey.Text.Trim();
            var value = txtValue.Text.Trim();

            if (key != String.Empty && value != String.Empty)
            {
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                switch (_Mode)
                {
                case Mode.Create:
                    _AzManItem.CreateAttribute(key, value);
                    break;

                case Mode.Delete:
                    break;

                case Mode.Update:
                    _AzManItem.GetAttribute(key).Update(key, value);
                    break;
                }

                _Storage.CommitTransaction();

                _Dirty = true;
            }
        }
Ejemplo n.º 6
0
        private void SaveRecord()
        {
            switch (_Mode)
            {
            case Mode.Create:
                //_Application = _Store.CreateApplication(txtName.Text.Trim(), txtDescription.Text);
                break;

            case Mode.Update:
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                //_Application.Rename(this.txtName.Text.Trim());
                //_Application.Update(this.txtDescription.Text.Trim());
                _Storage.CommitTransaction();
                break;
            }
        }
Ejemplo n.º 7
0
        private void SaveRecord()
        {
            var keypair  = (KeyValuePair <int, String>)cboAuthType.SelectedItem;
            var authType = (AuthorizationType)Enum.Parse(typeof(AuthorizationType), keypair.Value);

            DateTime?validFrom = null;

            if (datValidFrom.Checked)
            {
                validFrom = datValidFrom.Value;
            }
            DateTime?validTo = null;

            if (datValidFrom.Checked)
            {
                validTo = datValidTo.Value;
            }

            _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

            var item = _AuthItem.GetAuthorization(_AuthorizationID);

            item.Update(item.Owner, item.SID, item.SidWhereDefined,
                        authType,
                        validFrom,
                        validTo
                        );

            _Storage.CommitTransaction();

            _Dirty = true;
        }
Ejemplo n.º 8
0
        private void SaveRecord()
        {
            try
            {
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                switch (_Mode)
                {
                case Mode.Create:
                    _Application = _Store.CreateApplication(txtName.Text.Trim(), txtDescription.Text);
                    break;

                case Mode.Update:
                    _Application.Rename(this.txtName.Text.Trim());
                    _Application.Update(this.txtDescription.Text.Trim());
                    _Storage.CommitTransaction();
                    break;
                }
                _Storage.CommitTransaction();
            }
            catch (Exception ex)
            {
                _Storage.RollBackTransaction();
                throw ex;
            }
        }
Ejemplo n.º 9
0
        private void SaveRecord()
        {
            _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
            foreach (ListViewItem item in lvwItemList.Items)
            {
                #region update checked items only, not selected
                if (item.Checked)
                {
                    _SelectedItems.Add(item);

                    #region 立即 save
                    try
                    {
                        IAzManItem member = _Application.GetItem(item.SubItems[0].Text);

                        _AuthItem.AddMember(member);
                    }
                    catch (Exception ex)
                    {
                        //throw (ex);
                        MessageBox.Show(ex.Message, "Error Found", MessageBoxButtons.OK, MessageBoxIcon.Error, new EventHandler(ErrorPrompt));
                        //MessageBox.Show(ex.Message, "Error Found");
                    }
                    #endregion
                }
                #endregion
            }
            _Storage.CommitTransaction();
            MessageBox.Show("Error Found");
        }
Ejemplo n.º 10
0
        private void SaveRecord()
        {
            try
            {
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                foreach (ListViewItem item in lvwStoreGroups.Items)
                {
                    #region update checked items only, not selected
                    if (item.Checked)
                    {
                        _SelectedItems.Add(item);

                        if (_ApplicationGroup != null)
                        {
                            #region 立即 save
                            IAzManDBUser dbUser = _Storage.GetDBUser(item.SubItems[0].Text);
                            _ApplicationGroup.CreateApplicationGroupMember(dbUser.CustomSid, WhereDefined.Database, _IsMember);
                            #endregion
                        }
                    }
                    #endregion
                }
                _Storage.CommitTransaction();
            }
            catch (Exception ex)
            {
                _Storage.RollBackTransaction();
                throw (ex);
            }
        }
Ejemplo n.º 11
0
        private void Common_DeleteRecord(ListView listview)
        {
            if (listview.SelectedItem != null)
            {
                var item = listview.SelectedItem;

                try
                {
                    _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                    IAzManItem member = _Application.GetItem(item.SubItems[0].Text);
                    _Task.RemoveMember(member);

                    _Storage.CommitTransaction();
                }
                catch { }
            }
        }
Ejemplo n.º 12
0
 private void SaveRecord()
 {
     try
     {
         _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
         _Application.CreateItem(txtName.Text.Trim(), txtDescription.Text, ItemType.Operation);
         _Storage.CommitTransaction();
         _IsDirty = true;
     }
     catch (Exception ex)
     {
         _Storage.RollBackTransaction();
         throw ex;
     }
 }
        private void SaveRecord()
        {
            _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
            foreach (ListViewItem item in lvwStoreGroups.Items)
            {
                #region update checked items only, not selected
                if (item.Checked)
                {
                    _SelectedItems.Add(item);

                    #region 立即 save
                    IAzManApplicationGroup ag = _Application.GetApplicationGroup(item.SubItems[0].Text);
                    _ApplicationGroup.CreateApplicationGroupMember(ag.SID, WhereDefined.Application, _IsMember);
                    #endregion
                }
                #endregion
            }
            _Storage.CommitTransaction();
        }
Ejemplo n.º 14
0
        private void DeleteRecord()
        {
            if (listView.SelectedItem != null)
            {
                try
                {
                    var item = listView.SelectedItem;

                    _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                    var sg = _Storage[_Store.Name].GetStoreGroup(item.Text.Trim());
                    sg.Delete();

                    _Storage.CommitTransaction();

                    listView_Load();
                }
                catch { }
            }
        }
Ejemplo n.º 15
0
        private void DeleteRecord()
        {
            if (lvwAttributes.SelectedItem != null)
            {
                try
                {
                    var key   = lvwAttributes.SelectedItem.SubItems[0].Text;
                    var value = lvwAttributes.SelectedItem.SubItems[1].Text;
                    var index = int.Parse(lvwAttributes.SelectedItem.SubItems[2].Text);

                    _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                    _Authorization.GetAttribute(key).Delete();
                    _Store.Storage.CommitTransaction();

                    LoadList();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error found...Job aborted");
                }
            }
        }
Ejemplo n.º 16
0
        private void SaveRecord()
        {
            try
            {
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                IAzManStoreGroup storeGroup = _Store.CreateStoreGroup(
                    SqlAzManSID.NewSqlAzManSid(),
                    txtName.Text.Trim(),
                    txtDescription.Text.Trim(),
                    String.Empty,
                    (radBasic.Checked ? GroupType.Basic : GroupType.LDapQuery));

                _Storage.CommitTransaction();
                _IsDirty = true;
            }
            catch (Exception ex)
            {
                _Storage.RollBackTransaction();
                throw ex;
            }
        }
Ejemplo n.º 17
0
        public void doImport(object importIntoObject, bool chkUsersAndGroups, bool chkDBUsers, bool chkAuthorizations, SqlAzManMergeOptions mergeOptions)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(_UploadedFiles[0]);
            XmlNode xmlStartNode;

            if (this.checkScopeNodePosition(doc, ref importIntoObject, out xmlStartNode))
            {
                try
                {
                    _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);
                    ((IAzManImport)importIntoObject).ImportChildren(
                        xmlStartNode, chkUsersAndGroups, chkDBUsers, chkAuthorizations, mergeOptions);
                    _Storage.CommitTransaction();
                }
                catch
                {
                    _Storage.RollBackTransaction();
                    throw;
                }
            }
        }
Ejemplo n.º 18
0
        private void SaveRecord()
        {
            try
            {
                _Storage.OpenConnection();
                _Storage.BeginTransaction(AzManIsolationLevel.ReadUncommitted);

                #region  Managers
                KeyValuePair <string, bool>[] managers = _Store.GetManagers();
                foreach (CheckBox sqlLogin in flpManagers.Controls)
                {
                    if (sqlLogin.Checked)
                    {
                        if (!FindLogin(managers, sqlLogin.Text))
                        {
                            _Store.GrantAccessAsManager(sqlLogin.Text);
                        }
                    }
                    else
                    {
                        if (FindLogin(managers, sqlLogin.Text))
                        {
                            _Store.RevokeAccessAsManager(sqlLogin.Text);
                        }
                    }
                }
                #endregion

                #region Users
                KeyValuePair <string, bool>[] users = _Store.GetUsers();
                foreach (CheckBox sqlLogin in flpUsers.Controls)
                {
                    if (sqlLogin.Checked)
                    {
                        if (!FindLogin(users, sqlLogin.Text))
                        {
                            _Store.GrantAccessAsUser(sqlLogin.Text);
                        }
                    }
                    else
                    {
                        if (FindLogin(users, sqlLogin.Text))
                        {
                            _Store.RevokeAccessAsUser(sqlLogin.Text);
                        }
                    }
                }
                #endregion

                #region Readers
                KeyValuePair <string, bool>[] readers = _Store.GetReaders();
                foreach (CheckBox sqlLogin in flpReaders.Controls)
                {
                    if (sqlLogin.Checked)
                    {
                        if (!FindLogin(readers, sqlLogin.Text))
                        {
                            _Store.GrantAccessAsReader(sqlLogin.Text);
                        }
                    }
                    else
                    {
                        if (FindLogin(readers, sqlLogin.Text))
                        {
                            _Store.RevokeAccessAsReader(sqlLogin.Text);
                        }
                    }
                }
                #endregion

                _Storage.CommitTransaction();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                _Storage.CloseConnection();
            }
            _Dirty = true;
        }