コード例 #1
0
 protected void insertBtn_Click(object sender, EventArgs e)
 {
     db = new StudentModel();
     bool boolValue = false;
     if (Active.SelectedItem.Text == "TRUE")
     {
         boolValue = true;
     }
     else
     {
         boolValue = false;
     }
     var InsertSubject = new Subject
       {
           SubjectName = SubjectName.Text.ToUpper(),
           SubjectCode = SubjectCode.Text.ToUpper(),
           SubjectUnit = SubjectUnit.SelectedItem.Text,
           SubjectValue = double.Parse(SubjectValue.SelectedItem.Text),
           Active = boolValue,
           Semester = Semester.SelectedItem.Text,
           SubjectLevel = SubjectLevel.SelectedItem.Text,
       };
     db.Subjects.Add(InsertSubject);
     db.SaveChanges();
     Response.Write("INSERTED");
     SubjectName.Text = "";
     SubjectCode.Text = "";
 }
コード例 #2
0
ファイル: Util.cs プロジェクト: PheemySamuel/School365Repo
 public static int GradeValue(double total)
 {
     StudentModel db = new StudentModel();
     Grade grade = (db.Grades
         .Where(g => total >=g.Minimum && total <= g.Maximum)
         .Count() > 0) ? db.Grades.First(g => total >= g.Minimum && total <= g.Maximum) : null;
     return (grade != null) ? grade.Value : 0;
 }
コード例 #3
0
 protected void InsertBtn_Click(object sender, EventArgs e)
 {
     db = new StudentModel();
     var InsertFaculty = new Model.Faculty
     {
         FacultyName = facultyName.Text.ToUpper(),
         FacultyCode = facultyCode.Text.ToUpper(),
     };
     db.Facultys.Add(InsertFaculty);
     db.SaveChanges();
     Response.Write("DATA INSERTED");
     facultyName.Text = "";
     facultyCode.Text = "";
 }