示例#1
0
 private void deleteBtn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete the selected Hint?", "Delete Hint", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         modelService.DeleteDomainObject((Hint)hintListView.SelectedItems[0].Tag);
         hintCollection.Hints.Remove((Hint)hintListView.SelectedItems[0].Tag);
         hintListView.Items.Remove(hintListView.SelectedItems[0]);
         fullTextTbx.Text = "";
     }
 }
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (UXComponent is UXRadioGroup)
            {
                UXRadioGroup radioGroup = UXComponent as UXRadioGroup;

                if (radioGroup.KeyValues.Count == 0)
                {
                    MessageBox.Show("You need to specify atleast one radio group option.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (componentMap != null && !(UXComponent is UXServiceComponent))
            {
                modelService.DeleteDomainObject(componentMap);
            }

            DialogResult = DialogResult.OK;
        }
示例#3
0
        private void DoDeleteCustomDialog()
        {
            if (SelectedDialog != null)
            {
                DataAccess.IVersionControlled domainObject = SelectedDialog;

                domainObject = (DataAccess.IVersionControlled)modelService.GetInitializedDomainObject(domainObject.Id, modelService.GetDomainObjectType(domainObject));

                if (domainObject.IsLocked && domainObject.LockedBy == Environment.UserName)
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        modelService.DeleteDomainObject(domainObject);
                        ReadFromDBAndShowList();
                        Cursor.Current = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        string mess = ex.Message;

                        if (ex is ModelAggregatedException)
                        {
                            string ids = string.Empty;
                            foreach (string id in ((ModelAggregatedException)ex).Ids)
                            {
                                ids += id + "\r\n";
                            }

                            Clipboard.SetText(ids);
                            mess += "\r\n\r\nThe Ids has been copied to the clipboard";
                        }

                        MessageBox.Show(mess);
                    }
                }
            }
        }