コード例 #1
0
ファイル: MainForm.cs プロジェクト: allenm84/ma-requests
        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);
                }
            }
        }
コード例 #2
0
 public RequestStateChanger(RequestItem request, string userID, IWin32Window owner)
 {
     Request         = request;
     UserID          = userID;
     Owner           = owner;
     IsDifferentUser = !string.Equals(request.EnteredByID, userID);
 }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: allenm84/ma-requests
 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;
 }
コード例 #4
0
        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();
        }
コード例 #5
0
ファイル: Importer.cs プロジェクト: allenm84/ma-requests
        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);
            }
        }
コード例 #6
0
 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);
 }
コード例 #7
0
ファイル: Extensions.cs プロジェクト: allenm84/ma-requests
 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(),
     });
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: allenm84/ma-requests
        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;
                }
            }
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: allenm84/ma-requests
        private void RefreshRequest(RequestItem request)
        {
            var index = requests.IndexOf(request);

            requests.ResetItem(index);
        }
コード例 #10
0
 public override bool IsRequestVisible(LocalData local, RequestItem item)
 {
     return(!local.KnownRequests.Contains(item.Number));
 }
コード例 #11
0
 public override bool IsRequestVisible(LocalData local, RequestItem item)
 {
     return(item.State == State);
 }
コード例 #12
0
ファイル: AllFilter.cs プロジェクト: allenm84/ma-requests
 public override bool IsRequestVisible(LocalData local, RequestItem item)
 {
     return(true);
 }
コード例 #13
0
 public static bool DoFixed(RequestItem request, string userID)
 {
     request.ChangeStateTo(RequestItemState.Fixed, "Verified as fixed", userID);
     return(true);
 }
コード例 #14
0
 public static bool GetCanApprove(RequestItem request, bool isDifferentUser)
 {
     return(request.State == RequestItemState.Open && isDifferentUser);
 }
コード例 #15
0
 public static bool GetCanReOpen(RequestItem request, bool isDifferentUser)
 {
     return(request.State == RequestItemState.Fixed);
 }
コード例 #16
0
 public static bool GetCanFixed(RequestItem request, bool isDifferentUser)
 {
     return(request.State == RequestItemState.Feedback && !isDifferentUser);
 }
コード例 #17
0
 public static bool GetCanResolve(RequestItem request, bool isDifferentUser)
 {
     return(request.State == RequestItemState.Scheduled && isDifferentUser);
 }
コード例 #18
0
 public static bool GetCanSchedule(RequestItem request, bool isDifferentUser)
 {
     return(request.State == RequestItemState.Approved && isDifferentUser);
 }
コード例 #19
0
 public static bool DoApprove(RequestItem request, string userID)
 {
     request.ChangeStateTo(RequestItemState.Approved, "Request has been seen", userID);
     return(true);
 }
コード例 #20
0
 public static bool DoSchedule(RequestItem request, string userID)
 {
     request.ChangeStateTo(RequestItemState.Scheduled, "Request has been scheduled", userID);
     return(true);
 }
コード例 #21
0
 public abstract bool IsRequestVisible(LocalData local, RequestItem item);
コード例 #22
0
 public override bool IsRequestVisible(LocalData local, RequestItem item)
 {
     return(item.State != RequestItemState.Fixed);
 }