Beispiel #1
0
        private void tbbNewRequest_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(localData.CurrentUserID) && !AskUserToSignIn(false))
            {
                XtraMessageBox.Show(this,
                                    "You must be signed in to create a request. Please sign in",
                                    "Sign In Needed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var request = new RequestItem
            {
                Description = string.Empty,
                Entered     = DateTime.Now,
                EnteredByID = localData.CurrentUserID,
                History     = new List <RequestItemStateChange>(),
                Number      = Database.Next,
                ProgramID   = null,
                Reproduce   = new List <ReproduceStep>(),
                State       = RequestItemState.None,
                Summary     = string.Empty,
            };

            request.ChangeStateTo(RequestItemState.Open, "New Request", localData.CurrentUserID);

            using (var dlg = new EditRequestItemDialog(localData, request, programs))
            {
                dlg.Text     = "Add Request";
                dlg.ReadOnly = false;
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    requests.Add(request);
                }
            }
        }
Beispiel #2
0
        private void EditRequestByItem(RequestItem item)
        {
            if (item == null)
            {
                return;
            }

            var copy = item.Duplicate();

            using (var dlg = new EditRequestItemDialog(localData, copy, programs))
            {
                dlg.Text     = string.Format("Edit Request {0}", copy.Number);
                dlg.ReadOnly = true;
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    var index = requests.IndexOf(item);
                    requests[index] = copy;
                }
            }
        }