Example #1
0
        async private void btnTest_Click(object sender, EventArgs e)
        {
            TMSTaskSynchronizer tmsTaskSynchronizer = TMSTaskSynchronizer.GetInstance("MACBI", this);

            tmsTaskSynchronizer.GetActionsForTMS("02866");


            //PrintCurrentTime();
            //WriteLine(DateTime.Now.ToString("HH:mm"));

            /*
             * var cookieJar = new CookieContainer();
             * var client = new RestClient("http://pcredmine:3000");
             * client.AddDefaultQueryParameter("key", "0533a992d0c093b3b1592e57e10281156ea6afde");
             * var request = new RestRequest("issues/7979.xml", Method.PUT);
             * request.AddParameter("Content-Type", "application/xml");
             * request.RequestFormat = DataFormat.Xml;
             *
             * string xml = "<?xml version=\"1.0\"?><issue><notes>The subject was changed 111</notes></issue>";
             */
            //request.Add

            //request.AddBody(xml);

            //client.Authenticator = new SimpleAuthenticator();
            //var response = client.Put(request);

            //var postUrl = "issues/7979.xml";
            //string rawXml = "<?xml version=\"1.0\"?><issue><notes>The subject was changed 111</notes></issue>";

            //var client = new RestClient("http://pcredmine:3000");
            //client.AddDefaultQueryParameter("key", "0533a992d0c093b3b1592e57e10281156ea6afde");
            //IRestRequest request = new RestRequest
            //{
            //    Resource = postUrl
            //};

            //request.AddHeader("Content-Type", "text/xml");
            //request.AddHeader("Accept", "text/xml");
            //request.AddParameter("text/xml", rawXml, ParameterType.RequestBody);


            //IRestResponse response = client.Put(request);
            //IRestResponse response = client.Execu//te(request);

            //  Assert.IsNotNull(response.Data);

            /*
             * Dictionary<string, string> valuesToUpdate = new Dictionary<string, string>();
             * valuesToUpdate.Add("notes", "some sample note");
             * valuesToUpdate.Add("assigned_to_id", "549");
             * UpdateRMTicket("8356", valuesToUpdate);
             */
        }
Example #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            DataGridViewButtonCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell;

            if (cell != null)
            {
                if (e.ColumnIndex == 2)/*TMS*/
                {
                    string tms = Convert.ToString(cell.Value);

                    if (!string.IsNullOrEmpty(tms))
                    {
                        string[] tmsTab = tms.Split('-');
                        if (tmsTab.Length == 2)
                        {
                            string client = tmsTab[0];
                            string numb   = tmsTab[1];

                            string finalLnk = string.Format(TMS_LINK, client, numb);

                            Process.Start("chrome.exe", finalLnk);
                        }
                    }
                }
                else
                if (e.ColumnIndex == 3) /* TMS ACTION HIST */
                {
                    DataGridViewButtonCell tmsTaskCell = dataGridView1.Rows[e.RowIndex].Cells[2] as DataGridViewButtonCell;
                    string tms = Convert.ToString(tmsTaskCell.Value);

                    if (!string.IsNullOrEmpty(tms))
                    {
                        string[] tmsTab = tms.Split('-');
                        if (tmsTab.Length == 2)
                        {
                            string client = tmsTab[0];
                            string numb   = tmsTab[1];

                            TMSTaskSynchronizer tmsTaskSynchronizer = TMSTaskSynchronizer.GetInstance(client, this);
                            DataTable           tmsActions          = tmsTaskSynchronizer.GetActionsForTMS(numb);

                            TMSActionsForm form = new TMSActionsForm();
                            form.WriteToGrid(tmsActions);
                            form.ShowDialog();
                        }
                    }
                }
                else
                if (e.ColumnIndex == 4)     /* RM LINK*/
                {
                    string rmId = Convert.ToString(cell.Value);

                    if (!string.IsNullOrEmpty(rmId))
                    {
                        string finalLnk = string.Format(RM_LINK, rmId);

                        Process.Start("chrome.exe", finalLnk);
                    }
                }
                else
                if (e.ColumnIndex == 5) /* RM ACTION HIST */
                {
                }

                else
                if (e.ColumnIndex == 8)
                {
                    DataGridViewTextBoxCell assignedToCell = dataGridView1.Rows[e.RowIndex].Cells[4] as DataGridViewTextBoxCell;
                    DataGridViewButtonCell  rmIssueNum     = dataGridView1.Rows[e.RowIndex].Cells[3] as DataGridViewButtonCell;

                    if (assignedToCell != null && rmIssueNum != null)
                    {
                        string assignedInTMS = Convert.ToString(assignedToCell.Value);
                        string rmId          = Convert.ToString(rmIssueNum.Value);

                        if (!string.IsNullOrEmpty(assignedInTMS) && !string.IsNullOrEmpty(rmId))
                        {
                            NameValueCollection parameters = new NameValueCollection {
                                { RedmineKeys.INCLUDE, $"{RedmineKeys.CHANGE_SETS},{RedmineKeys.JOURNALS},{RedmineKeys.NOTES}" }
                            };
                            Issue rmIssue = RMManegerService.RMManager.GetObject <Issue>(rmId, parameters);


                            if (rmIssue != null)
                            {
                            }
                            //var newIssue = new Issue { Subject = subject, Project = p, Description = details };
                            //MManegerService.RMManager.CreateObject(newIssue);


                            // fixture.RedmineManager.UpdateObject(UPDATED_ISSUE_ID, issue);

                            switch (assignedInTMS)
                            {
                            case "N/GENEBUG":
                                break;
                            }
                        }
                    }
                    //string assignedInTMS = dataGridView1.Rows[e.RowIndex].Cells[4];
                }
            }
        }