예제 #1
0
        public void AddCrieria(dynamic id, dynamic name, dynamic maxScore)
        {
            Criteria c = new Criteria
            {
                Id = id,
                Name = name,
                MaxScore = maxScore
            };

            Criterion.Add(c);
        }
예제 #2
0
        public static Criteria ShowAndReturnObject()
        {
            var dlg = new FrmAddCriteria();

            // loop in case we need to validate later
            while (true)
            {
                DialogResult ans = dlg.ShowDialog();

                if ( ans == DialogResult.OK )
                {
                    if ( dlg.txtName.Text.Length <= 0 )
                    {
                        MessageBox.Show( "You must enter a name.", "Error" );
                        continue;
                    }

                    int score;
                    if (dlg.dudMaxScore.Text.Length <= 0 || !int.TryParse( dlg.dudMaxScore.Text, out score ) || score < 0)
                    {
                        MessageBox.Show("You must enter a valid score that is a number greater than or equal to 0.", "Error");
                        continue;
                    }

                    Criteria crit = new Criteria
                    {
                        Name = dlg.txtName.Text,
                        MaxScore = score,
                    };

                    return crit;
                }

                return null;
            }
        }
예제 #3
0
 public bool InsertCriteria(Criteria c)
 {
     try
     {
         return ExecuteQuery("AddCriteria", new { name = c.Name, maxScore = c.MaxScore });
     }
     catch (SqlException e)
     {
         throw e;
     }
 }