Exemple #1
0
    public static Page Replace(string pageName, string param = null, Admission admision = null)
    {
        if (AdmissionManager.busing)
        {
            return(null);
        }
        Debug.Log("Replace to: " + pageName);
        var oldPage = PageStack.Find(pageName);

        if (oldPage != null)
        {
            throw new Exception("page: " + pageName + " already in stack, can't replace, try use Backto");
        }
        var fromPage = PageStack.Peek();
        var page     = TakeOrCreatePage(pageName);

        page.param = param;
        PageStack.RelpaceTop(page);
        RepositionMask();
        if (admision != null)
        {
            AdmissionManager.Play(admision, fromPage, page);
        }
        return(page);
    }
Exemple #2
0
    public static void Back(object result = null, Admission admision = null)
    {
        if (AdmissionManager.busing)
        {
            return;
        }
        var page = PageStack.Pop();

        if (page != null)
        {
            pagePool.Put(page.name, page);
        }
        if (PageStack.Count > 0)
        {
            var top = PageStack.Peek();
            Debug.Log("Back to: " + top.name);
            top.OnResult(result);
        }
        else
        {
            Debug.Log("All pages poped!");
        }
        if (admision != null)
        {
            AdmissionManager.Play(admision, page, PageStack.Peek());
        }
        RepositionMask();
    }
Exemple #3
0
    public static Page Forward(string pageName, object param = null, Admission admision = null)
    {
        if (AdmissionManager.busing)
        {
            return(null);
        }
        Debug.Log("Navigate to: " + pageName);
        var oldPage = PageStack.Find(pageName);

        if (oldPage != null)
        {
            throw new Exception("page: " + pageName + " already in stack, can't navigate, try use BackTo");
        }
        var fromPage = PageStack.Peek();
        var page     = TakeOrCreatePage(pageName);

        page.param = param;
        page.OnParamChanged();
        PageStack.Push(page);
        RepositionMask();
        if (admision != null)
        {
            AdmissionManager.Play(admision, fromPage, page);
        }
        return(page);
    }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(budgetFinanced.Text) || string.IsNullOrWhiteSpace(feePayer.Text))
            {
                MessageBox.Show("Field cannot be empty");
                return;
            }

            HtmlGenerator.WriteResultsToHTML(AdmissionManager.getSortedList(), Double.Parse(budgetFinanced.Text), Double.Parse(feePayer.Text));
            this.Hide();
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(budgetFinanced.Text) || string.IsNullOrWhiteSpace(feePayer.Text))
            {
                MessageBox.Show("Field cannot be empty");
                return;
            }

            Form3        fm = new Form3();
            DataGridView dg = new DataGridView();

            dg.Name                  = "dataResults";
            dg.ColumnCount           = 3;
            dg.Columns[0].HeaderText = "Name";
            dg.Columns[1].HeaderText = "Grade";
            dg.Columns[2].HeaderText = "Status";
            dg.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dg.AutoSizeRowsMode      = DataGridViewAutoSizeRowsMode.DisplayedCells;

            var listApplicantsSortedByGrade = AdmissionManager.getSortedList();

            foreach (Applicant applicant in listApplicantsSortedByGrade)
            {
                var    index = listApplicantsSortedByGrade.IndexOf(applicant);
                var    limitTotalAdmitted = Double.Parse(budgetFinanced.Text) + Double.Parse(feePayer.Text);
                var    limitBudget        = Double.Parse(budgetFinanced.Text);
                string typeCandidate      = "";
                if (index < limitBudget)
                {
                    typeCandidate = "budget-financed";
                }
                else if (index < limitTotalAdmitted)
                {
                    typeCandidate = "fee payer";
                }
                else
                {
                    typeCandidate = "rejected";
                }
                dg.Rows.Add(applicant.Name + " " + applicant.Surname, applicant.AdmissionGrade, typeCandidate);
            }

            fm.Controls.Add(dg);
            fm.Show();
            this.Hide();
        }
Exemple #6
0
        public void Should_Compute_Results()
        {
            Admission        admission        = new Admission();
            AdmissionManager admissionManager = new AdmissionManager();

            this.sortedStudents = this.sortedStudents.OrderBy(s => s.FinalGrade)
                                  .ThenBy(s => s.AdmissionExamGrade)
                                  .ThenBy(s => s.BaccalaureatAverageGrade)
                                  .ThenBy(s => s.BaccalaureatMaximumGrade)
                                  .Reverse()
                                  .ToList();

            this.Students = (List <Student>)admissionManager.ComputeResult(admission, this.Students);

            Assert.IsNotNull(this.Students);
            Assert.AreEqual(this.Students.First().Id, this.sortedStudents.First().Id);
            Assert.AreEqual(this.Students.Last().Id, this.sortedStudents.Last().Id);
        }
Exemple #7
0
        public void Should_Classiffy_Students()
        {
            Admission        admission        = new Admission();
            AdmissionManager admissionManager = new AdmissionManager();
            int    budget   = 2;
            int    tax      = 2;
            string Budget   = "Budget";
            string Fee      = "Fee";
            string Rejected = "Rejected";

            IList <Student> classiffiedStudents = admissionManager.ClassifyCandidates(this.Students, budget, tax);

            Assert.IsNotNull(this.Students);
            Assert.AreEqual(this.Students.ElementAt(0).Status, Budget);
            Assert.AreEqual(this.Students.ElementAt(1).Status, Budget);
            Assert.AreEqual(this.Students.ElementAt(2).Status, Fee);
            Assert.AreEqual(this.Students.ElementAt(3).Status, Fee);
            Assert.AreEqual(this.Students.ElementAt(4).Status, Rejected);
        }
Exemple #8
0
        public void DefaultCtrl_ShouldCreateNewInstance()
        {
            AdmissionManager admissionManager = new AdmissionManager();

            Assert.IsNotNull(admissionManager);
        }
Exemple #9
0
 public static void CleanAdmission()
 {
     AdmissionManager.Remove();
 }