Exemplo n.º 1
0
        public string SaveResult(Resultsrb aResultsrb)
        {
            EnrollCourseGAtewaysrb aenrollAtewaysrb = new EnrollCourseGAtewaysrb();
            EnrollCourse           aEnrollCourse    = new EnrollCourse();

            aEnrollCourse.StudentId = aResultsrb.StudentId;
            aEnrollCourse.CourseId  = aResultsrb.CourseId;
            bool isenrolled = aenrollAtewaysrb.IsExist(aEnrollCourse);

            if (isenrolled)
            {
                ResultGatewaysrb aGatewaysrb = new ResultGatewaysrb();
                bool             Isexist     = aGatewaysrb.isexist(aResultsrb);
                if (Isexist)
                {
                    return("Sorry This Course is Graded Before.Try a new One");
                }
                else
                {
                    int rowaffected = aGatewaysrb.SaveResult(aResultsrb);
                    if (rowaffected > 0)
                    {
                        return("Result has been Saved");
                    }
                    else
                    {
                        return("Save Failed");
                    }
                }
            }
            else
            {
                return("This Course is not Enrolled by this Student");
            }
        }
Exemplo n.º 2
0
        public int SaveResult(Resultsrb aResultsrb)
        {
            Query   = "INSERT INTO StudentResult VALUES('" + aResultsrb.StudentId + "','" + aResultsrb.CourseId + "','" + aResultsrb.Grade + "')";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            int rowaffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowaffected);
        }
Exemplo n.º 3
0
 public bool isexist(Resultsrb aResultsrb)
 {
     Query   = "SELECT* FROM StudentResult WHERE StudentId='" + aResultsrb.StudentId + "' AND CourseId='" + aResultsrb.CourseId + "'";
     Command = new SqlCommand(Query, Connection);
     Connection.Open();
     Reader = Command.ExecuteReader();
     if (Reader.HasRows)
     {
         Connection.Close();
         Reader.Close();
         return(true);
     }
     else
     {
         Connection.Close();
         Reader.Close();
         return(false);
     }
 }
Exemplo n.º 4
0
        public ActionResult GenerateResult(Resultsrb aResultsrb)
        {
            aStudentGom.StudentId = aResultsrb.StudentId;
            StudentsManagersrb aManagersrb = new StudentsManagersrb();

            ViewBag.students = aManagersrb.GetallStudent();
            ResultManagersrb aResultManagersrb = new ResultManagersrb();
            string           result            = aResultManagersrb.SaveResult(aResultsrb);

            if (result == "Sorry This Course is Graded Before.Try a new One" || result == "This Course is not Enrolled by this Student")
            {
                ViewBag.failed = result;
            }
            else if (result == "Result has been Saved")
            {
                ViewBag.success = result;
            }

            return(View());
        }