Advertisement
Guest User

tes

a guest
May 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  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.Forms;
  7. using System.Drawing;
  8. namespace OOPCW2
  9. {
  10. class AssessmentDisplay
  11. {
  12. public Label assessName;
  13. public Label assessMark;
  14. public Label assessWeight;
  15. public Label assessStatus;
  16. public Button assessEdit;
  17. public Button assessDelete;
  18.  
  19. public Panel root;
  20. public Module module;
  21. public Assessment assessment;
  22.  
  23. public FormClosedEventHandler updateFCEH;
  24. public EventHandler updateEH;
  25.  
  26. public AssessmentDisplay(Module module, Assessment assessment, Panel root)
  27. {
  28.  
  29. this.root = root;
  30. this.module = module;
  31. this.assessment = assessment;
  32.  
  33.  
  34. assessName = new Label();
  35. assessMark = new Label();
  36. assessWeight = new Label();
  37. assessStatus = new Label();
  38. assessEdit = new Button();
  39. assessDelete = new Button();
  40. }
  41. public void addControls(Point point, out Point next)
  42. {
  43. Point curpoint = new Point(point.X, point.Y);
  44. assessName.Width += 40;
  45. assessName.Text = "Name: " + assessment.Name;
  46. assessName.Location = curpoint;
  47. curpoint = new Point(curpoint.X + assessName.Width + 5, curpoint.Y);
  48.  
  49. assessMark.Width -= 30;
  50. Console.WriteLine(assessment.Score(assessment.Marks, assessment.Weightages));
  51. assessMark.Text = "Mark: " + assessment.Score(assessment.Marks, assessment.Weightages) + "%";
  52. if (assessment.Score(assessment.Marks, assessment.Weightages) <= 30)
  53. {
  54. assessMark.ForeColor = System.Drawing.Color.Red;
  55. }
  56. else if (assessment.Score(assessment.Marks, assessment.Weightages) >= 30 && assessment.Score(assessment.Marks, assessment.Weightages) < 60)
  57. {
  58. assessMark.ForeColor = System.Drawing.Color.Green;
  59. }
  60. else if (assessment.Score(assessment.Marks, assessment.Weightages) >= 60)
  61. {
  62. assessMark.ForeColor = System.Drawing.Color.Blue;
  63. }
  64. assessMark.Location = curpoint;
  65. curpoint = new Point(curpoint.X + assessMark.Width + 5, curpoint.Y);
  66.  
  67. assessWeight.Width -= 20;
  68. assessWeight.Text = "Weight: " + assessment.Weightages + "%";
  69. assessWeight.Location = curpoint;
  70. curpoint = new Point(curpoint.X + assessWeight.Width + 5, curpoint.Y);
  71.  
  72. assessEdit.Text = "Edit";
  73. assessEdit.Location = curpoint;
  74. assessEdit.Click += new EventHandler(assessmentEditClick);
  75. curpoint = new Point(curpoint.X + assessEdit.Width + 5, curpoint.Y);
  76.  
  77. assessDelete.Text = "Delete";
  78. assessDelete.Location = curpoint;
  79. assessDelete.Click += new EventHandler(assessmentDelete_Click);
  80. // assessDelete.Click += updateEH;
  81. curpoint = new Point(curpoint.X + assessDelete.Width + 5, curpoint.Y);
  82.  
  83. assessStatus.Width -= 25;
  84. assessStatus.Text = "Status: " + (assessment.Marks >= 30 ? "pass" : "fail");
  85. assessStatus.Location = curpoint;
  86. curpoint = new Point(curpoint.X + assessStatus.Width + 5, curpoint.Y);
  87.  
  88. root.Controls.Add(assessName);
  89. root.Controls.Add(assessMark);
  90. root.Controls.Add(assessWeight);
  91. root.Controls.Add(assessEdit);
  92. root.Controls.Add(assessDelete);
  93. root.Controls.Add(assessStatus);
  94.  
  95. next = new Point(point.X, point.Y + assessEdit.Height);
  96. }
  97.  
  98. public void removeControls()
  99. {
  100. root.Controls.Remove(assessName);
  101. root.Controls.Remove(assessMark);
  102. root.Controls.Remove(assessWeight);
  103. root.Controls.Remove(assessEdit);
  104. root.Controls.Remove(assessDelete);
  105. root.Controls.Remove(assessStatus);
  106. }
  107.  
  108. public void assessmentEditClick(object sender, EventArgs args)
  109. {
  110. Console.Write("Hello");
  111. //Assessment ass = new Assessment(assName, mark, weightage);
  112. AddAssessment form = new AddAssessment(updateFCEH, module, assessment);
  113. form.Show();
  114. //UpdateAsslist();
  115. }
  116.  
  117. public void assessmentDelete_Click(object sender, EventArgs args)
  118. {
  119. //XmlNode AssnNode = xmlDoc.CreateElement("Assessment");
  120. XmlHandler hand = new XmlHandler();
  121. hand.DeleteAssessment(AssNode);
  122. //AssnNode.remove();
  123.  
  124.  
  125. // hand.getAllAssessments)
  126.  
  127. //var xc = hand.getAllAssessments();
  128. //xc.Remove();
  129. }
  130.  
  131. }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement