コード例 #1
0
 /// <summary>
 /// submit a ticket to portal in background
 /// </summary>
 /// <param name="ticket"></param>
 public void Track(AssemblaTicket ticket)
 {
     if (!TrackEnabled)
     {
         return;
     }
     if (!_go)
     {
         Start();
     }
     if (DuplicateSafetyOn)
     {
         if ((ticket.Summary == _lastticketsum) && (ticket.Description == _lasttickdesc))
         {
             debug("Duplicate ticket content detected, ignoring ticket.");
             return;
         }
         else
         {
             _lasttickdesc  = ticket.Description;
             _lastticketsum = ticket.Summary;
         }
     }
     _tickets++;
     _untrackedqueue.Write(ticket);
 }
コード例 #2
0
        private void _create_Click(object sender, EventArgs e)
        {
            if (summ.Text.Length == 0)
            {
                status("missing subject.");
                return;
            }
            if (SucceedUrl == string.Empty)
            {
                SucceedUrl = AssemblaTicket.GetTicketUrl(space.Text);
            }
            if (FailUrl == string.Empty)
            {
                FailUrl = null;
            }

            int id = AssemblaTicket.Create(space.Text, user.Text, pass.Text, summ.Text, desc.Text, TicketStatus.New, Priority.Normal);

            if (id != 0)
            {
                if (attach)
                {
                    if (!AssemblaDocument.Create(space.Text, user.Text, pass.Text, path + SSFILE, id))
                    {
                        status("screenshot failed.");
                    }
                }
                if (_attachdataasfile)
                {
                    if (!AssemblaDocument.Create(space.Text, user.Text, pass.Text, path + DATAFILE, id))
                    {
                        status("data attach failed.");
                    }
                }
                if (SucceedUrl != null)
                {
                    System.Diagnostics.Process.Start(SucceedUrl);
                }
                if (TicketSucceed != null)
                {
                    TicketSucceed();
                }
            }
            else
            {
                status("login failed.");
                if (TicketFailed != null)
                {
                    TicketFailed();
                }
                if (FailUrl != null)
                {
                    System.Diagnostics.Process.Start(FailUrl);
                }
            }
        }
コード例 #3
0
ファイル: AssemblaTicket.cs プロジェクト: antonywu/tradelink
 public AssemblaTicket(AssemblaTicket copy)
 {
     _ticknum = copy._ticknum;
     _un = copy._un;
     _updated = copy._updated;
     _tickdocid = copy._tickdocid;
     _sum = copy._sum;
     _stat = copy._stat;
     _space = copy._space;
     _reporter = copy._reporter;
     _pw = copy._pw;
     _milestone = copy._milestone;
     _desc = copy._desc;
     _assign = copy._assign;
 }
コード例 #4
0
ファイル: AssemblaTicket.cs プロジェクト: zli69/tradelink
 public AssemblaTicket(AssemblaTicket copy)
 {
     _ticknum   = copy._ticknum;
     _un        = copy._un;
     _updated   = copy._updated;
     _tickdocid = copy._tickdocid;
     _sum       = copy._sum;
     _stat      = copy._stat;
     _space     = copy._space;
     _reporter  = copy._reporter;
     _pw        = copy._pw;
     _milestone = copy._milestone;
     _desc      = copy._desc;
     _assign    = copy._assign;
 }
コード例 #5
0
        private void _create_Click(object sender, EventArgs e)
        {
            if (_summ.Text.Length == 0)
            {
                status("missing subject.");
                return;
            }
            int id = AssemblaTicket.Create(_space.Text, _user.Text, _pass.Text, _summ.Text, _desc.Text, AssemblaStatus.New, AssemblaPriority.Normal);

            if (id != 0)
            {
                if (attach)
                {
                    if (!AssemblaDocument.Create(_space.Text, _user.Text, _pass.Text, path + SSFILE, id))
                    {
                        status("screenshot failed.");
                    }
                }
                if (_attachdataasfile)
                {
                    if (!AssemblaDocument.Create(_space.Text, _user.Text, _pass.Text, path + DATAFILE, id))
                    {
                        status("data attach failed.");
                    }
                }
                System.Diagnostics.Process.Start(AssemblaTicket.GetTicketsUrl(_space.Text));
                if (TicketSucceed != null)
                {
                    TicketSucceed();
                }
            }
            else
            {
                status("login failed.");
                if (TicketFailed != null)
                {
                    TicketFailed();
                }
            }
        }
コード例 #6
0
 void _bw_DoWork(object sender, DoWorkEventArgs e)
 {
     while (_go)
     {
         if (e.Cancel)
         {
             break;
         }
         System.Threading.Thread.Sleep(_SLEEP);
         while (!_untrackedqueue.isEmpty && TrackEnabled)
         {
             if (e.Cancel)
             {
                 break;
             }
             // get item
             AssemblaTicket t     = _untrackedqueue.Read();
             string         space = t.Space == string.Empty ? Space : t.Space;
             string         un    = t.Username == string.Empty ? _un : t.Username;
             string         pw    = t._pw == string.Empty ? _pw : t._pw;
             if ((space == string.Empty) || (un == string.Empty))
             {
                 debug(t.ToString() + " space or login information not provided, ignoring ticket.");
                 continue;
             }
             try
             {
                 int tid = AssemblaTicket.Create(space, un, pw, t.Summary, t.Description, t.Status, t.Priority);
                 debug("created ticket: " + tid);
             }
             catch (Exception ex)
             {
                 debug("error uploading: " + t.ToString() + " " + ex.Message + ex.StackTrace);
             }
             System.Threading.Thread.Sleep((int)((double)_SLEEP / 10));
         }
     }
 }
コード例 #7
0
ファイル: AssemblaTicket.cs プロジェクト: antonywu/tradelink
        /// <summary>
        /// get list of tickets on space (limited to first 1000)
        /// </summary>
        /// <param name="space"></param>
        /// <param name="user"></param>
        /// <param name="pw"></param>
        /// <returns></returns>
        public static List<AssemblaTicket> GetTickets(string space, string user, string pw, DebugDelegate deb)
        {
            List<AssemblaTicket> docs = new List<AssemblaTicket>();
            try
            {
                string url = AssemblaTicket.GetTicketsUrl(space);

                string result;
                if (!qc.goget(url, user, pw, string.Empty, SendDebug, out result))
                    return docs;


                XmlDocument xd = new XmlDocument();
                xd.LoadXml(result);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                                doc.Summary = m;
                            else if (dc.Name == "status")
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            else if (dc.Name == "description")
                                doc.Description = m;
                            else if (dc.Name == "priority")
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            else if (dc.Name == "number")
                                doc.Number = Convert.ToInt32(m);
                            else if (dc.Name == "assign-to-id")
                                doc.Owner = Convert.ToInt32(m);
                            else if (dc.Name == "milestone-id")
                                doc.Milestone = Convert.ToInt32(m);
                            else if (dc.Name == "updated-at")
                                doc.UpdatedAt = m;
                            else if (dc.Name == "id")
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            else if (dc.Name == "reporter-id")
                                doc.Reporter = m;
                            else if (dc.Name == "created-on")
                                doc.CreatedAt = m;
                        }
                        catch (Exception ex)
                        {

                        }

                    }
                    if (doc.isValid)
                        docs.Add(doc);
                }
            }
            catch (Exception ex)
            {
                if (deb != null)
                {
                    deb("error getting tickets for space: " + space + " error: " + ex.Message + ex.StackTrace);
                }
            }
            return docs;
        }
コード例 #8
0
ファイル: AssemblaTicket.cs プロジェクト: antonywu/tradelink
        public static AssemblaTicket GetTicket(string space, string user, string password, int ticketnum, DebugDelegate debs)
        {
            string url = GetTicketUrl(space)+"/"+ticketnum;
            string r= string.Empty;
            if (qc.goget(url, user, password, string.Empty, debs, out r))
            {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(r);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                                doc.Summary = m;
                            else if (dc.Name == "status")
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            else if (dc.Name == "description")
                                doc.Description = m;
                            else if (dc.Name == "priority")
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            else if (dc.Name == "number")
                                doc.Number = Convert.ToInt32(m);
                            else if (dc.Name == "assign-to-id")
                                doc.Owner = Convert.ToInt32(m);
                            else if (dc.Name == "milestone-id")
                                doc.Milestone = Convert.ToInt32(m);
                            else if (dc.Name == "updated-at")
                                doc.UpdatedAt = m;
                            else if (dc.Name == "id")
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            else if (dc.Name == "reporter-id")
                                doc.Reporter = m;
                            else if (dc.Name == "created-on")
                                doc.CreatedAt = m;
                        }
                        catch (Exception ex)
                        {

                        }

                    }
                    if (doc.isValid)
                        return doc;
                }
            }
            return new AssemblaTicket();

        }
コード例 #9
0
ファイル: AssemblaTicket.cs プロジェクト: antonywu/tradelink
 public static bool Update(string space, string user, string password, AssemblaTicket at)
 {
     return Update(space, user, password, at.TicketDocumentId, at.ToXml());
 }
コード例 #10
0
        /// <summary>
        /// get list of tickets on space (limited to first 1000)
        /// </summary>
        /// <param name="space"></param>
        /// <param name="user"></param>
        /// <param name="pw"></param>
        /// <returns></returns>
        public static List<AssemblaTicket> GetTickets(string space, string user, string pw, DebugDelegate deb)
        {
            List<AssemblaTicket> docs = new List<AssemblaTicket>();
            try
            {
                string url = AssemblaTicket.GetTicketsUrl(space);
                HttpWebRequest hr = WebRequest.Create(url) as HttpWebRequest;
                hr.Credentials = new System.Net.NetworkCredential(user, pw);
                hr.PreAuthenticate = true;
                hr.Method = "GET";
                hr.ContentType = "application/xml";
                HttpWebResponse wr = (HttpWebResponse)hr.GetResponse();
                StreamReader sr = new StreamReader(wr.GetResponseStream());

                string result = sr.ReadToEnd();

                XmlDocument xd = new XmlDocument();
                xd.LoadXml(result);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                                doc.Summary = m;
                            else if (dc.Name == "status")
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            else if (dc.Name == "description")
                                doc.Description = m;
                            else if (dc.Name == "priority")
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            else if (dc.Name == "number")
                                doc.Number = Convert.ToInt32(m);
                            else if (dc.Name == "assign-to-id")
                                doc.Owner = Convert.ToInt32(m);
                            else if (dc.Name == "milestone-id")
                                doc.Milestone = Convert.ToInt32(m);
                            else if (dc.Name == "updated-at")
                                doc.UpdatedAt = m;
                            else if (dc.Name == "id")
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            else if (dc.Name == "reporter-id")
                                doc.Reporter = m;
                            else if (dc.Name == "created-on")
                                doc.CreatedAt = m;
                        }
                        catch (Exception ex)
                        {

                        }

                    }
                    if (doc.isValid)
                        docs.Add(doc);
                }
            }
            catch (Exception ex)
            {
                if (deb != null)
                {
                    deb("error getting tickets for space: " + space + " error: " + ex.Message + ex.StackTrace);
                }
            }
            return docs;
        }
コード例 #11
0
ファイル: AssemblaTicket.cs プロジェクト: zli69/tradelink
        /// <summary>
        /// get list of tickets on space (limited to first 1000)
        /// </summary>
        /// <param name="space"></param>
        /// <param name="user"></param>
        /// <param name="pw"></param>
        /// <returns></returns>
        public static List <AssemblaTicket> GetTickets(string space, string user, string pw, DebugDelegate deb)
        {
            List <AssemblaTicket> docs = new List <AssemblaTicket>();

            try
            {
                string url = AssemblaTicket.GetTicketsUrl(space);

                string result;
                if (!qc.goget(url, user, pw, string.Empty, SendDebug, out result))
                {
                    return(docs);
                }


                XmlDocument xd = new XmlDocument();
                xd.LoadXml(result);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                            {
                                doc.Summary = m;
                            }
                            else if (dc.Name == "status")
                            {
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "description")
                            {
                                doc.Description = m;
                            }
                            else if (dc.Name == "priority")
                            {
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "number")
                            {
                                doc.Number = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "assign-to-id")
                            {
                                doc.Owner = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "milestone-id")
                            {
                                doc.Milestone = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "updated-at")
                            {
                                doc.UpdatedAt = m;
                            }
                            else if (dc.Name == "id")
                            {
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "reporter-id")
                            {
                                doc.Reporter = m;
                            }
                            else if (dc.Name == "created-on")
                            {
                                doc.CreatedAt = m;
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (doc.isValid)
                    {
                        docs.Add(doc);
                    }
                }
            }
            catch (Exception ex)
            {
                if (deb != null)
                {
                    deb("error getting tickets for space: " + space + " error: " + ex.Message + ex.StackTrace);
                }
            }
            return(docs);
        }
コード例 #12
0
ファイル: AssemblaTicket.cs プロジェクト: zli69/tradelink
        public static AssemblaTicket GetTicket(string space, string user, string password, int ticketnum, DebugDelegate debs)
        {
            string url = GetTicketUrl(space) + "/" + ticketnum;
            string r   = string.Empty;

            if (qc.goget(url, user, password, string.Empty, debs, out r))
            {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(r);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                            {
                                doc.Summary = m;
                            }
                            else if (dc.Name == "status")
                            {
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "description")
                            {
                                doc.Description = m;
                            }
                            else if (dc.Name == "priority")
                            {
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "number")
                            {
                                doc.Number = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "assign-to-id")
                            {
                                doc.Owner = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "milestone-id")
                            {
                                doc.Milestone = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "updated-at")
                            {
                                doc.UpdatedAt = m;
                            }
                            else if (dc.Name == "id")
                            {
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "reporter-id")
                            {
                                doc.Reporter = m;
                            }
                            else if (dc.Name == "created-on")
                            {
                                doc.CreatedAt = m;
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (doc.isValid)
                    {
                        return(doc);
                    }
                }
            }
            return(new AssemblaTicket());
        }
コード例 #13
0
ファイル: AssemblaTicket.cs プロジェクト: zli69/tradelink
 public static bool Update(string space, string user, string password, AssemblaTicket at)
 {
     return(Update(space, user, password, at.TicketDocumentId, at.ToXml()));
 }
コード例 #14
0
ファイル: TicketTracker.cs プロジェクト: bluejack2000/core
 /// <summary>
 /// submit a ticket to portal in background
 /// </summary>
 /// <param name="ticket"></param>
 public void Track(AssemblaTicket ticket)
 {
     if (!TrackEnabled) return;
     if (!_go) Start();
     if (DuplicateSafetyOn)
     {
         if ((ticket.Summary == _lastticketsum) && (ticket.Description == _lasttickdesc))
         {
             debug("Duplicate ticket content detected, ignoring ticket.");
             return;
         }
         else
         {
             _lasttickdesc = ticket.Description;
             _lastticketsum = ticket.Summary;
         }
     }
     _tickets++;
     _untrackedqueue.Write(ticket);
 }
コード例 #15
0
ファイル: AssemblaTicket.cs プロジェクト: larytet/JQuant
        /// <summary>
        /// get list of tickets on space (limited to first 1000)
        /// </summary>
        /// <param name="space"></param>
        /// <param name="user"></param>
        /// <param name="pw"></param>
        /// <returns></returns>
        public static List <AssemblaTicket> GetTickets(string space, string user, string pw, DebugDelegate deb)
        {
            List <AssemblaTicket> docs = new List <AssemblaTicket>();

            try
            {
                string         url = AssemblaTicket.GetTicketsUrl(space);
                HttpWebRequest hr  = WebRequest.Create(url) as HttpWebRequest;
                hr.Credentials     = new System.Net.NetworkCredential(user, pw);
                hr.PreAuthenticate = true;
                hr.Method          = "GET";
                hr.ContentType     = "application/xml";
                HttpWebResponse wr = (HttpWebResponse)hr.GetResponse();
                StreamReader    sr = new StreamReader(wr.GetResponseStream());

                string result = sr.ReadToEnd();

                XmlDocument xd = new XmlDocument();
                xd.LoadXml(result);

                XmlNodeList xnl = xd.GetElementsByTagName("ticket");
                foreach (XmlNode xn in xnl)
                {
                    AssemblaTicket doc = new AssemblaTicket();

                    doc.Space = space;
                    foreach (XmlNode dc in xn.ChildNodes)
                    {
                        try
                        {
                            string m = dc.InnerText;
                            if (dc.Name == "summary")
                            {
                                doc.Summary = m;
                            }
                            else if (dc.Name == "status")
                            {
                                doc.Status = (TradeLink.API.TicketStatus)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "description")
                            {
                                doc.Description = m;
                            }
                            else if (dc.Name == "priority")
                            {
                                doc.Priority = (TradeLink.API.Priority)Convert.ToInt32(m);
                            }
                            else if (dc.Name == "number")
                            {
                                doc.Number = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "assign-to-id")
                            {
                                doc.Owner = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "milestone-id")
                            {
                                doc.Milestone = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "updated-at")
                            {
                                doc.UpdatedAt = m;
                            }
                            else if (dc.Name == "id")
                            {
                                doc.TicketDocumentId = Convert.ToInt32(m);
                            }
                            else if (dc.Name == "reporter-id")
                            {
                                doc.Reporter = m;
                            }
                            else if (dc.Name == "created-on")
                            {
                                doc.CreatedAt = m;
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (doc.isValid)
                    {
                        docs.Add(doc);
                    }
                }
            }
            catch (Exception ex)
            {
                if (deb != null)
                {
                    deb("error getting tickets for space: " + space + " error: " + ex.Message + ex.StackTrace);
                }
            }
            return(docs);
        }