예제 #1
0
        private void GoNext()
        {
            Guid waitKey = Guid.Empty;

            if (_spellValues == null || !_spellValues.MoveNext())
            {
                if (!_spellEntities.MoveNext())
                {
                    _entity = null;
                    waitKey = FrmWaitScreen.ShowMessage("No spelling errors found in the selected context.", true);
                    this.Close();
                    return;
                }
                _spellValues = _spellEntities.Current.GetSpellValue().AsEnumerable().GetEnumerator();
                _spellValues.MoveNext();
            }

            _currentSpellIntermediate = new SpellCheckIntermediate(_spellEntities.Current, _spellValues.Current.Value, _spellValues.Current.Key);
            ApplyStoredChanges();
            _entity = _aryaSpellChecker.GetSpellCheckEntity(_currentSpellIntermediate);

            if (!_entity.Correct)
            {
                ShowCurrentItem();   //Show the current item and await user input
            }
            else
            {
                ApplyCurrentChanges();
            }
        }
예제 #2
0
        private void CheckDeletes()
        {
            var deletedGroupsIDs =
                (from row in
                 dgvGroups.Rows.Cast <DataGridViewRow>().Where(
                     p => p.Cells[0].Value != null && (Guid)p.Cells[0].Value != Guid.Empty)
                 let deleteCheckboxCell = row.Cells[1] as DataGridViewCheckBoxCell
                                          where deleteCheckboxCell != null && deleteCheckboxCell.Value != null && (bool)deleteCheckboxCell.Value
                                          select(Guid) row.Cells[0].Value).ToList();

            if (deletedGroupsIDs.Count == 0)
            {
                return;
            }

            if (deletedGroupsIDs.Count > 0 && MessageBox.Show("Group(s) will be deleted from all of its dependant Role(s) & Project(s)", "Warning - Group Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Cancel)
            {
                return;
            }

            var deletedGroups =
                dbContext.Groups.Where(p => deletedGroupsIDs.Contains(p.ID)).ToList();
            var currentDatabase = dbContext.Connection.Database;
            var otherDbs        =
                deletedGroups.SelectMany(p => p.UserProjects).Select(p => p.Project.DatabaseName).Where(p => p != currentDatabase).Distinct().ToList();

            dbContext.Groups.DeleteAllOnSubmit(deletedGroups);
            dbContext.SubmitChanges();
            //AryaTools.Instance.SaveChangesIfNecessary(false, true);

            if (otherDbs.Count == 0)
            {
                return;
            }

            var waitKey = FrmWaitScreen.ShowMessage("Cascading changes to Dependent Database(s) ...");

            foreach (var otherDb in otherDbs)
            {
                dbContext.Connection.ChangeDatabase(otherDb);
                dbContext.Groups.DeleteAllOnSubmit(dbContext.Groups.Where(p => deletedGroupsIDs.Contains(p.ID)));
            }

            AryaTools.Instance.InstanceData.Dc.Connection.ChangeDatabase(currentDatabase);

            FrmWaitScreen.HideMessage(waitKey);
        }
예제 #3
0
 private void lnkSave_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (saveFileDialogXml.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     try
     {
         var        serializer = new XmlSerializer(WorkingRules.GetType());
         TextWriter file       = new StreamWriter(saveFileDialogXml.FileName);
         serializer.Serialize(file, WorkingRules);
         file.Close();
     }
     catch (Exception ex)
     {
         FrmWaitScreen.ShowMessage("Unable to save: " + ex.Message, true);
     }
 }
예제 #4
0
 private void lnkMoveRuleUp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         var item         = (ColorRule)cdgv.CurrentCell.OwningRow.DataBoundItem;
         var currentIndex = WorkingRules.IndexOf(item);
         if (currentIndex > 0)
         {
             Point currentCellAddress = cdgv.CurrentCellAddress;
             WorkingRules.Remove(item);
             WorkingRules.Insert(currentIndex - 1, item);
             cdgv.CurrentCell = cdgv[currentCellAddress.X, currentCellAddress.Y - 1];
         }
     }
     catch (Exception ex)
     {
         FrmWaitScreen.ShowMessage("Please select a rule to Move: " + ex.Message, true);
     }
 }
예제 #5
0
        private void lnkLoad_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (openFileDialogXml.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try
            {
                var        deserializer = new XmlSerializer(WorkingRules.GetType());
                TextReader file         = new StreamReader(openFileDialogXml.FileName);

                var newRules = (BindingList <ColorRule>)deserializer.Deserialize(file);
                WorkingRules.Clear();
                newRules.ForEach(rule => WorkingRules.Add(rule));
            }
            catch (Exception ex)
            {
                FrmWaitScreen.ShowMessage("Unable to load from file: " + ex.Message, true);
            }
        }