pgLRP.xaml.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace RedmineOracle
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для pgLRP.xaml
  19. /// </summary>
  20. public partial class pgLRP : Page
  21. {
  22. OracleWork ow;
  23. int id;
  24. int check;
  25. string currSt;
  26. ListIstIssues li;
  27. List<OracleWork.StatusInfo> statuses;
  28. public pgLRP(int id)
  29. {
  30. InitializeComponent();
  31. check = 0;
  32. this.id = id;
  33. ow = new OracleWork();
  34. li = new ListIstIssues();
  35. DataContext = ow.CurrentLRP(id);
  36. statuses = ow.getAllStatus(ow.CurrentLRP(id).Status);
  37. cbStatus.ItemsSource = ow.getAllStatus(ow.CurrentLRP(id).Status);
  38. cbStatus.SelectedValuePath = "idStatus";
  39. cbStatus.DisplayMemberPath = "statusName";
  40. cbStatus.SelectedIndex = 0;
  41. currSt = cbStatus.SelectedValue.ToString();
  42. lbComm.ItemsSource = ow.CreateListComm(id);
  43. tbIdIss.Text = ow.FindRmIssue(id.ToString());
  44. if (tbIdIss.Text != "Н/З")
  45. LoadPages.rmFrame.Navigate(new pgIssue(Convert.ToInt32(tbIdIss.Text), true));
  46. ListInfo.lbForum = lbComm;
  47. }
  48. private void Button_Click(object sender, RoutedEventArgs e)
  49. {
  50. ow.insertComm(Convert.ToInt32(tbId.Text), tbSComm.Text, tbComm.Text);
  51. lbComm.ItemsSource = ow.CreateListComm(id);
  52. tbIdIss.Text = ow.FindRmIssue(id.ToString());
  53. if (tbIdIss.Text != "Н/З")
  54. LoadPages.rmFrame.Navigate(new pgIssue(Convert.ToInt32(tbIdIss.Text), true));
  55. }
  56. private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
  57. {
  58. TextBlock tb = sender as TextBlock;
  59. string id = tb.Uid;
  60. new windDrpFile(id).ShowDialog();
  61. }
  62. private void AddCommToRM(object sender, MouseButtonEventArgs e)
  63. {
  64. }
  65. private void btnCreateIss_Click(object sender, RoutedEventArgs e)
  66. {
  67. new windCreateIssLRP(tbId.Text, tbMiniInf.Text, tbFullInf.Text, tbModule.Text).ShowDialog();
  68. tbIdIss.Text = ow.FindRmIssue(id.ToString());
  69. if (tbIdIss.Text != "Н/З")
  70. LoadPages.rmFrame.Navigate(new pgIssue(Convert.ToInt32(tbIdIss.Text), true));
  71. }
  72. private void btnInsert_Click(object sender, RoutedEventArgs e)
  73. {
  74. Button btn = sender as Button;
  75. int idDRP = Convert.ToInt32(btn.Uid);
  76. MessageBoxResult result = MessageBox.Show("Внести изменнения?", "Внесение изменений", MessageBoxButton.YesNo, MessageBoxImage.Information);
  77. if (result == MessageBoxResult.Yes)
  78. {
  79. if (tbIdIss.Text != "Н/З")
  80. {
  81. ListIstIssues li = new ListIstIssues();
  82. li.AddNewComm(Convert.ToInt32(tbIdIss.Text), ow.InserCommToRB(idDRP));
  83. ListInfo.lbRedmine.ItemsSource = li.listNotes(Convert.ToInt32(tbIdIss.Text));
  84. }
  85. else
  86. MessageBox.Show("Для данной проблемы нет связной задачи !");
  87. }
  88. }
  89. private void tbDonFile_MouseDown(object sender, MouseButtonEventArgs e)
  90. {
  91. TextBlock tb = sender as TextBlock;
  92. string id = tb.Uid;
  93. new windLRPFile(id).ShowDialog();
  94. }
  95. private void btnRefreshComm_Click(object sender, RoutedEventArgs e)
  96. {
  97. ow = new OracleWork();
  98. lbComm.ItemsSource = ow.CreateListComm(id);
  99. }
  100. private void cbStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
  101. {
  102. if (check > 0)
  103. {
  104. MessageBoxResult result = MessageBox.Show("Внести изменнения?", "Внесение изменений", MessageBoxButton.YesNo, MessageBoxImage.Information);
  105. if (result == MessageBoxResult.Yes)
  106. {
  107. OracleWork.StatusInfo curr = statuses.FirstOrDefault(x => x.idStatus == currSt);
  108. OracleWork.StatusInfo newS = statuses.FirstOrDefault(x => x.idStatus == cbStatus.SelectedValue.ToString());
  109. string currS = curr.statusName;
  110. string newSt = newS.statusName;
  111. ow.updateStatus(tbId.Text, currS, newSt, cbStatus.SelectedValue.ToString());
  112. currSt = cbStatus.SelectedValue.ToString();
  113. }
  114. else
  115. {
  116. check = 0;
  117. cbStatus.SelectedIndex = 0;
  118. }
  119. check++;
  120. }
  121. check++;
  122. }
  123. }
  124. }