Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Drawing;
- namespace OOPCW2
- {
- class AssessmentDisplay
- {
- public Label assessName;
- public Label assessMark;
- public Label assessWeight;
- public Label assessStatus;
- public Button assessEdit;
- public Button assessDelete;
- public Panel root;
- public Module module;
- public Assessment assessment;
- public FormClosedEventHandler updateFCEH;
- public EventHandler updateEH;
- public AssessmentDisplay(Module module, Assessment assessment, Panel root)
- {
- this.root = root;
- this.module = module;
- this.assessment = assessment;
- assessName = new Label();
- assessMark = new Label();
- assessWeight = new Label();
- assessStatus = new Label();
- assessEdit = new Button();
- assessDelete = new Button();
- }
- public void addControls(Point point, out Point next)
- {
- Point curpoint = new Point(point.X, point.Y);
- assessName.Width += 40;
- assessName.Text = "Name: " + assessment.Name;
- assessName.Location = curpoint;
- curpoint = new Point(curpoint.X + assessName.Width + 5, curpoint.Y);
- assessMark.Width -= 30;
- Console.WriteLine(assessment.Score(assessment.Marks, assessment.Weightages));
- assessMark.Text = "Mark: " + assessment.Score(assessment.Marks, assessment.Weightages) + "%";
- if (assessment.Score(assessment.Marks, assessment.Weightages) <= 30)
- {
- assessMark.ForeColor = System.Drawing.Color.Red;
- }
- else if (assessment.Score(assessment.Marks, assessment.Weightages) >= 30 && assessment.Score(assessment.Marks, assessment.Weightages) < 60)
- {
- assessMark.ForeColor = System.Drawing.Color.Green;
- }
- else if (assessment.Score(assessment.Marks, assessment.Weightages) >= 60)
- {
- assessMark.ForeColor = System.Drawing.Color.Blue;
- }
- assessMark.Location = curpoint;
- curpoint = new Point(curpoint.X + assessMark.Width + 5, curpoint.Y);
- assessWeight.Width -= 20;
- assessWeight.Text = "Weight: " + assessment.Weightages + "%";
- assessWeight.Location = curpoint;
- curpoint = new Point(curpoint.X + assessWeight.Width + 5, curpoint.Y);
- assessEdit.Text = "Edit";
- assessEdit.Location = curpoint;
- assessEdit.Click += new EventHandler(assessmentEditClick);
- curpoint = new Point(curpoint.X + assessEdit.Width + 5, curpoint.Y);
- assessDelete.Text = "Delete";
- assessDelete.Location = curpoint;
- assessDelete.Click += new EventHandler(assessmentDelete_Click);
- // assessDelete.Click += updateEH;
- curpoint = new Point(curpoint.X + assessDelete.Width + 5, curpoint.Y);
- assessStatus.Width -= 25;
- assessStatus.Text = "Status: " + (assessment.Marks >= 30 ? "pass" : "fail");
- assessStatus.Location = curpoint;
- curpoint = new Point(curpoint.X + assessStatus.Width + 5, curpoint.Y);
- root.Controls.Add(assessName);
- root.Controls.Add(assessMark);
- root.Controls.Add(assessWeight);
- root.Controls.Add(assessEdit);
- root.Controls.Add(assessDelete);
- root.Controls.Add(assessStatus);
- next = new Point(point.X, point.Y + assessEdit.Height);
- }
- public void removeControls()
- {
- root.Controls.Remove(assessName);
- root.Controls.Remove(assessMark);
- root.Controls.Remove(assessWeight);
- root.Controls.Remove(assessEdit);
- root.Controls.Remove(assessDelete);
- root.Controls.Remove(assessStatus);
- }
- public void assessmentEditClick(object sender, EventArgs args)
- {
- Console.Write("Hello");
- //Assessment ass = new Assessment(assName, mark, weightage);
- AddAssessment form = new AddAssessment(updateFCEH, module, assessment);
- form.Show();
- //UpdateAsslist();
- }
- public void assessmentDelete_Click(object sender, EventArgs args)
- {
- //XmlNode AssnNode = xmlDoc.CreateElement("Assessment");
- XmlHandler hand = new XmlHandler();
- hand.DeleteAssessment(AssNode);
- //AssnNode.remove();
- // hand.getAllAssessments)
- //var xc = hand.getAllAssessments();
- //xc.Remove();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement