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); } } }
public RequestStateChanger(RequestItem request, string userID, IWin32Window owner) { Request = request; UserID = userID; Owner = owner; IsDifferentUser = !string.Equals(request.EnteredByID, userID); }
public static void ChangeStateTo(this RequestItem request, RequestItemState state, string notes, string userID) { request.History.Add(new RequestItemStateChange { Current = state, Date = DateTime.Now, Notes = notes, Previous = request.State, UserID = userID, }); request.State = state; }
public EditRequestItemDialog(LocalData local, RequestItem request, IList <ProgramItem> programs) { this.local = local; this.request = request; this.programs = programs; changer = new RequestStateChanger(request, local.CurrentUserID, this); InitializeComponent(); ReadOnly = false; UpdateToolbar(); ReadRequest(); }
public static void Import() { Database.Reset(); string path = @"C:\Users\mallen\Dropbox\Downloads\Archive\[bin]\RequestTracker\saved.xml"; var doc = XDocument.Parse(File.ReadAllText(path)); var ns = XNamespace.Get("http://www.mapa.com/apps/RequestTracker"); var products = doc.Descendants(ns + "Product"); foreach (var p in products) { Database.Programs.Add(new ProgramItem { ID = p.Element(ns + "ID").Value, Name = p.Element(ns + "Name").Value, }); } var users = doc.Descendants(ns + "User"); foreach (var u in users) { Database.Users.Add(new UserItem { ID = u.Element(ns + "ID").Value, Name = u.Element(ns + "Username").Value, }); } var requests = doc.Descendants(ns + "Request"); foreach (var r in requests) { var request = new RequestItem { Description = r.Element(ns + "Description").Value, Entered = (DateTime)r.Element(ns + "DateEntered"), EnteredByID = r.Element(ns + "CreatedByID").Value, History = new List <RequestItemStateChange>(), Number = Database.Next, ProgramID = r.Element(ns + "ProductID").Value, Reproduce = new List <ReproduceStep>(), State = RequestItemState.None, Summary = r.Element(ns + "Summary").Value, }; request.ChangeStateTo(RequestItemState.Open, "Imported from previous program", request.EnteredByID); Database.Requests.Add(request); } }
public static bool DoResolve(RequestItem request, string userID, IWin32Window owner) { using (var dlg = new MultilineInputBox()) { dlg.Text = "Resolve..."; dlg.Prompt = "Notes:"; if (dlg.ShowDialog(owner) == DialogResult.OK) { request.ChangeStateTo(RequestItemState.Feedback, dlg.Input, userID); return(true); } } return(false); }
public static RequestItem Duplicate(this RequestItem request) { return(new RequestItem { Description = request.Description.Duplicate(), Entered = request.Entered, EnteredByID = request.EnteredByID.Duplicate(), History = request.History.Select(h => h.Duplicate()).ToList(), Number = request.Number, ProgramID = request.ProgramID.Duplicate(), Reproduce = request.Reproduce.Select(r => r.Duplicate()).ToList(), State = request.State, Summary = request.Summary.Duplicate(), }); }
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; } } }
private void RefreshRequest(RequestItem request) { var index = requests.IndexOf(request); requests.ResetItem(index); }
public override bool IsRequestVisible(LocalData local, RequestItem item) { return(!local.KnownRequests.Contains(item.Number)); }
public override bool IsRequestVisible(LocalData local, RequestItem item) { return(item.State == State); }
public override bool IsRequestVisible(LocalData local, RequestItem item) { return(true); }
public static bool DoFixed(RequestItem request, string userID) { request.ChangeStateTo(RequestItemState.Fixed, "Verified as fixed", userID); return(true); }
public static bool GetCanApprove(RequestItem request, bool isDifferentUser) { return(request.State == RequestItemState.Open && isDifferentUser); }
public static bool GetCanReOpen(RequestItem request, bool isDifferentUser) { return(request.State == RequestItemState.Fixed); }
public static bool GetCanFixed(RequestItem request, bool isDifferentUser) { return(request.State == RequestItemState.Feedback && !isDifferentUser); }
public static bool GetCanResolve(RequestItem request, bool isDifferentUser) { return(request.State == RequestItemState.Scheduled && isDifferentUser); }
public static bool GetCanSchedule(RequestItem request, bool isDifferentUser) { return(request.State == RequestItemState.Approved && isDifferentUser); }
public static bool DoApprove(RequestItem request, string userID) { request.ChangeStateTo(RequestItemState.Approved, "Request has been seen", userID); return(true); }
public static bool DoSchedule(RequestItem request, string userID) { request.ChangeStateTo(RequestItemState.Scheduled, "Request has been scheduled", userID); return(true); }
public abstract bool IsRequestVisible(LocalData local, RequestItem item);
public override bool IsRequestVisible(LocalData local, RequestItem item) { return(item.State != RequestItemState.Fixed); }