Пример #1
0
 private void updateCaseDropdown(Case[] cases)
 {
     _cases = cases;
     dropCaseList.Items.Clear();
     RepopulateCaseDropdown();
     UpdateStateAccordingToTracking();
 }
Пример #2
0
        private XmlElement CreateMileStoneNode(Case c)
        {
            XmlElement mileStoneNode = NewElement();
            mileStoneNode.Attributes.Append(_doc.CreateAttribute("TEXT")).Value = string.Format("MileStone: {0}", c.ParentMileStone.Name);
            mileStoneNode.Attributes.Append(_doc.CreateAttribute("LINK")).Value = string.Format("{0}?pg=pgList&pre=preSaveFilterFixFor&ixFixFor={1}&ixStatus=-2", _fb.BaseURL, c.ParentMileStone.ID);

            return mileStoneNode;
        }
Пример #3
0
        public XmlElement CaseToNode(Case c)
        {
            XmlElement node = NewElement();
            node.Attributes.Append(_doc.CreateAttribute("TEXT")).Value = String.Format("{0} {1}: {2}", c.Category, c.ID, c.Name);
            node.Attributes.Append(_doc.CreateAttribute("LINK")).Value = _fb.BaseURL + "?" + c.ID.ToString();

            return node;
        }
Пример #4
0
        private ProjectNode CreateProjectNode(Case c)
        {
            ProjectNode ret = new ProjectNode();
            ret.Node = NewElement();
            ret.Node.Attributes.Append(_doc.CreateAttribute("TEXT")).Value = string.Format("Project: {0}", c.ParentProject.Name);
            ret.Node.Attributes.Append(_doc.CreateAttribute("LINK")).Value =
                string.Format("{0}?pre=preMultiSearch&pg=pgList&pgBack=pgSearch&search=2&searchFor=status:%22active%22+project:%22{1}%22+OrderBy:%22FixFor%22+View:%22Outline%22", _fb.BaseURL, c.ParentProject.Name);

            return ret;
        }
Пример #5
0
 private void UpdateStateAccordingToTracking()
 {
     // Handle also case where a case is being tracked on the server side, but not on the client
     if (ClientTrackingCase || _fb.CaseWorkedOnNow != 0)
     {
         if (!SelectWorkedOnCase())
         {
             TrackedCase = null;
             SetState(new StateLoggedIn(this));
         }
         else
             SetState(new StateTrackingCase(this));
     }
     else
         SetState(new StateLoggedIn(this));
 }
Пример #6
0
 public void SetParent(Case c, int parentID)
 {
     Utils.Log.InfoFormat("Setting paret of case {0} to be {1}", c.ID, parentID);
     fbCommand("edit", "ixBug=" + c.ID.ToString(), "ixBugParent=" + parentID.ToString());
 }
Пример #7
0
 public Search(string query, Case[] cases)
 {
     Cases = cases;
     Query = query;
 }
Пример #8
0
 private ProjectNode CaseProjectNode(Case c)
 {
     return _projectIdToNode[c.ParentProject.ID];
 }
Пример #9
0
        private void VerifyMileStoneExists(Case c)
        {
            ProjectNode pn = CaseProjectNode(c);

            if (!pn.MileStoneIdToNode.ContainsKey(c.ParentMileStone.ID))
                pn.MileStoneIdToNode.Add(c.ParentMileStone.ID, pn.Node.AppendChild(CreateMileStoneNode(c)));
        }
Пример #10
0
 private bool NoParentCaseAvailable(Case c)
 {
     return (c.ParentCaseID == 0 || !_caseToNode.ContainsKey(c.ParentCaseID));
 }
Пример #11
0
 private void MoveCaseToMileStone(Case c)
 {
     XmlNode ms = CaseProjectNode(c).MileStoneIdToNode[c.ParentMileStone.ID];
     ms.AppendChild(_caseToNode[c.ID]);
 }
Пример #12
0
 private void UpdateStateAccordingToTracking()
 {
     Utils.Log.Debug("Updating tracking state after update...");
     // Handle also case where a case is being tracked on the server side, but not on the client
     if (ClientTrackingCase || _fb.CaseWorkedOnNow != 0)
     {
         if (!SelectWorkedOnCase())
         {
             Utils.Log.Debug("Worked-on case not found in case list");
             TrackedCase = null;
             SetState(new StateLoggedIn(this));
         }
         else
             SetState(new StateTrackingCase(this));
     }
     else
         SetState(new StateLoggedIn(this));
 }
Пример #13
0
 private void SelectCase(int i)
 {
     dropCaseList.SelectedIndex = i;
     TrackedCase = ((Case)dropCaseList.Items[i]);
 }
Пример #14
0
        //added to stop work when workstation is locked
        private void SysEventsCheck(object sender, SessionSwitchEventArgs e)
        {
            MessageBox.Show(@"Locked");

            if (!(_autosleep))
            {
                _caseBeforePause = TrackedCase;
                TrackedCase = null;
                SetState(new StatePaused(this));
                switch (e.Reason)
                {
                    case SessionSwitchReason.SessionLock:
                        _caseBeforePause = TrackedCase;
                        TrackedCase = null;
                        SetState(new StatePaused(this));
                        break;
                    case SessionSwitchReason.SessionUnlock:
                        TrackedCase = _caseBeforePause;
                        SetState(new StateTrackingCase(this));
                        break;
                }
            }
        }
Пример #15
0
 private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e)
 {
     if (e.Mode != PowerModes.Suspend) return;
     _caseBeforePause = TrackedCase;
     TrackedCase = null;
     SetState(new StatePaused(this));
 }
Пример #16
0
 public void SetParent(Case c, int parentID)
 {
     fbCommand("edit", "ixBug=" + c.ID, "ixBugParent=" + parentID);
 }
Пример #17
0
        // Return all cases that match search (as in the web page search box)
        public Case[] GetCases(string search)
        {
            string res = fbCommand("search", "q=" + search,
                                   "cols=sTitle,sProject,ixProject,sPersonAssignedTo,sArea,hrsElapsed,hrsCurrEst,ixBugParent,ixFixFor,sFixFor,sCategory");
            XmlDocument doc = xmlDoc(res);
            XmlNodeList nodes = doc.SelectNodes("//case");

            var ret = new ArrayList();

            foreach (XmlNode node in nodes)
            {
                var c = new Case();
                c.Name = node.SelectSingleNode("sTitle").InnerText;
                c.ParentProject.Name = node.SelectSingleNode("sProject").InnerText;
                c.ParentProject.ID = int.Parse(node.SelectSingleNode("ixProject").InnerText);

                c.AssignedTo = node.SelectSingleNode("sPersonAssignedTo").InnerText;
                c.Area = node.SelectSingleNode("sArea").InnerText;
                c.ID = int.Parse(node.SelectSingleNode("@ixBug").Value);
                c.ParentCaseID = 0;
                if (node.SelectSingleNode("ixBugParent").InnerText != "")
                    c.ParentCaseID = int.Parse(node.SelectSingleNode("ixBugParent").InnerText);

                double hrsElapsed = double.Parse(node.SelectSingleNode("hrsElapsed").InnerText);
                c.Elapsed = new TimeSpan((long) (hrsElapsed*36000000000.0));

                double hrsEstimate = double.Parse(node.SelectSingleNode("hrsCurrEst").InnerText);
                c.Estimate = new TimeSpan((long) (hrsEstimate*36000000000.0));
                c.ParentMileStone.ID = int.Parse(node.SelectSingleNode("ixFixFor").InnerText);
                c.ParentMileStone.Name = node.SelectSingleNode("sFixFor").InnerText;
                c.Category = node.SelectSingleNode("sCategory").InnerText;

                ret.Add(c);
            }
            return (Case[]) ret.ToArray(typeof (Case));
        }
Пример #18
0
        private void StopWork()
        {
            Utils.Log.Debug("Stopping work...");
            TrackedCase = null;
            SelectNothing();

            SetState(new StateLoggedIn(this));
        }
Пример #19
0
        private bool ObtainUserEstimate(int caseid)
        {
            var dlg = new EstimateDialog();
            dlg.Left = ((Left + Width/2) - dlg.Width/2);
            dlg.Top = Bottom + 5;
            DialogResult res = dlg.ShowDialog(this);
            if (res == DialogResult.OK)
            {
                if (!_fb.SetEstimate(caseid, dlg.UserEstimate))
                {
                    Utils.ShowErrorMessage(
                        String.Format("Invalid estimate provided: '{0}'\nCurrent estimate was reset to 0 hours.",
                                      dlg.UserEstimate), "Invalid Estimate");
                    return false;
                }
                return true;
            }
            Process.Start(_fb.CaseEditURL(caseid));
            _trackedCase = null;

            // TODO: why is this tip not showing?
            trayIcon.ShowBalloonTip(3000, "FogBugz",
                                    "Sorry, I need a valid time estimate on that case.\nMeanwhile, you're working on \"nothing\"",
                                    ToolTipIcon.Info);
            return false;
        }
Пример #20
0
 private void UpdateTrackedItem()
 {
     try
     {
         // If the selected item is changed as part of the update process,
         // don't count it as the user changing selection
         if (_currentState.GetType() == typeof(StateUpdatingCases))
             return;
         TrackedCase = SelectedItemIsCase() ? (Case)dropCaseList.SelectedItem : null;
     }
     catch (System.InvalidCastException x)
     {
         Utils.Log.ErrorFormat(x.ToString() + "Selected item (index:{0}) is not a Case!", dropCaseList.SelectedIndex);
     }
 }
Пример #21
0
 public void SetParent(Case c, int parentID)
 {
     Utils.Log.InfoFormat("Setting paret of case {0} to be {1}", c.ID, parentID);
     fbCommand("edit", "ixBug=" + c.ID.ToString(), "ixBugParent=" + parentID.ToString());
 }
Пример #22
0
 private void MoveCaseToParent(Case c)
 {
     _caseToNode[c.ParentCaseID].AppendChild(_caseToNode[c.ID]);
 }
Пример #23
0
 private void MoveCaseToParent(Case c)
 {
     _caseToNode[c.ParentCaseID].AppendChild(_caseToNode[c.ID]);
 }
Пример #24
0
 private void RelocateCaseInDOM(Case c)
 {
     if (NoParentCaseAvailable(c))
         MoveCaseToMileStone(c);
     else
         MoveCaseToParent(c);
 }
Пример #25
0
        private void MoveCaseToMileStone(Case c)
        {
            XmlNode ms = CaseProjectNode(c).MileStoneIdToNode[c.ParentMileStone.ID];

            ms.AppendChild(_caseToNode[c.ID]);
        }
Пример #26
0
 private void VerifyProjectNodeExists(Case c)
 {
     if (!_projectIdToNode.ContainsKey(c.ParentProject.ID))
     {
         ProjectNode pn = CreateProjectNode(c);
         _rootNode.AppendChild(pn.Node);
         _projectIdToNode.Add(c.ParentProject.ID, pn);
     }
 }
Пример #27
0
 private bool NoParentCaseAvailable(Case c)
 {
     return(c.ParentCaseID == 0 || !_caseToNode.ContainsKey(c.ParentCaseID));
 }
Пример #28
0
        private Case ParseCaseNode(XmlNode node)
        {
            // Parse case link / title
            string text = node.Attributes["TEXT"].Value;
            Match m = Regex.Match(text, @"(\w+) (\d+): (.*)");
            if (!m.Success)
                return null;

            var c = new Case();
            c.Category = m.Groups[1].Value;
            c.ID = int.Parse(m.Groups[2].Value);
            c.Name = m.Groups[3].Value;
            return c;
        }
Пример #29
0
 private ProjectNode CaseProjectNode(Case c)
 {
     return(_projectIdToNode[c.ParentProject.ID]);
 }
Пример #30
0
 public string CasesToMindMap(Case[] cases)
 {
     throw new Exception("Not impl");
 }
Пример #31
0
 private void PauseWork()
 {
     Utils.Log.Debug("Pausing work...");
     _caseBeforePause = TrackedCase;
     TrackedCase = null;
     SetState(new StatePaused(this));
 }
Пример #32
0
        private Case ParseCaseNode(XmlNode node)
        {
            Case c = new Case();
            try
            {
                c.Name = node.SelectSingleNode("sTitle").InnerText;
                c.ParentProject.Name = node.SelectSingleNode("sProject").InnerText;
                c.ParentProject.ID = int.Parse(node.SelectSingleNode("ixProject").InnerText);

                c.AssignedTo = node.SelectSingleNode("sPersonAssignedTo").InnerText;
                c.Area = node.SelectSingleNode("sArea").InnerText;
                c.ID = int.Parse(node.SelectSingleNode("@ixBug").Value);
                c.ParentCaseID = 0;
                if (node.SelectSingleNode("ixBugParent").InnerText != "")
                    c.ParentCaseID = int.Parse(node.SelectSingleNode("ixBugParent").InnerText);

                double hrsElapsed = double.Parse(node.SelectSingleNode("hrsElapsed").InnerText);
                c.Elapsed = new TimeSpan((long)(hrsElapsed * 36000000000.0));

                double hrsEstimate = double.Parse(node.SelectSingleNode("hrsCurrEst").InnerText);
                c.Estimate = new TimeSpan((long)(hrsEstimate * 36000000000.0));
                c.ParentMileStone.ID = int.Parse(node.SelectSingleNode("ixFixFor").InnerText);
                c.ParentMileStone.Name = node.SelectSingleNode("sFixFor").InnerText;
                c.Category = node.SelectSingleNode("sCategory").InnerText;
            }
            catch (System.Exception e)
            {
                Utils.Log.ErrorFormat("Error parsing case XML: {0}\nError: {1}", node.InnerXml, e.ToString());
                throw;
            }
            return c;
        }
Пример #33
0
 private void ResumeWork()
 {
     Utils.Log.Debug("Resuming work...");
     TrackedCase = _caseBeforePause;
     SetState(new StateTrackingCase(this));
 }