Exemplo n.º 1
0
        internal MarksCalculator GetMarkCalculator()
        {
            var ret = new MarksCalculator();
            if (ret.Marks == null)
                ret.Marks = new List<MarkComponent>();
            var dt = GetDataTable("Select * from TB_Components");
            foreach (DataRow row in dt.Rows)
            {
                var m = new MarkComponent
                {
                    id = Convert.ToInt32(row["CPNT_Id"]),
                    percent = Convert.ToDouble(row["CPNT_Percent"])
                };
                ret.Marks.Add(m);
            }

            return ret;
        }
 private string Emailtext(IEnumerable<string> replacements, int iStudentId, MarksCalculator mcalc, out DataRow row)
 {
     var emailtext = txtEmailBody.Text;
     row = _config.GetStudentRow(iStudentId);
     foreach (var item in replacements)
     {
         var repvalue = "";
         switch (item)
         {
             case "MarkReport":
                 repvalue = _config.GetStudentReport(iStudentId, chkSendModerationNotice.Checked);
                 break;
             case "FinalMark":
                 repvalue = mcalc.GetFinalMark(row["SUB_NumericUserId"].ToString(), _config).ToString();
                 break;
             case "AllMarks":
             {
                 var p = new Programme(row["SUB_NumericUserId"].ToString());
                 repvalue = p.ShortMarksReport();
             }
                 break;
             default:
                 try
                 {
                     repvalue = row[item].ToString();
                 }
                 catch (Exception ex)
                 {
                 }
                 break;
         }
         emailtext = emailtext.Replace("{" + item + "}", repvalue);
     }
     return emailtext;
 }