public string Save(CourseAssign courseAssign)
        {
            if (courseAssignGateway.IsSubjectExsists(courseAssign))
            {
                return("The Course is already Assigned");
            }
            else
            {
                float Credit          = Convert.ToSingle(courseAssignGateway.GetCourseId(courseAssign.CourseCode).Credit);
                float AvailableCredit = Convert.ToSingle(courseAssignGateway.GetAvailableCreditByTeacherId(courseAssign.TeacherId).ReminingCredit);
                float RemainingCredit = (AvailableCredit - Credit);


                int rowAffect = courseAssignGateway.UpdateTeacher(courseAssign.TeacherId, RemainingCredit);
                if (rowAffect > 0)
                {
                    int affect = courseAssignGateway.Save(courseAssign);
                    if (affect > 0)
                    {
                        return("Save Successfully");
                    }
                    else
                    {
                        return("Failed");
                    }
                }

                else
                {
                    return("Failed");
                }
            }
        }
        public string Save(AssignCourse assignCourse)
        {
            if (assignGateway.IsCourseAssignExists(assignCourse))
            {
                return("Already Assigned");
            }

            else
            {
                int rowAffected = assignGateway.Save(assignCourse);
                if (rowAffected > 0)
                {
                    return("Course Assigned successfully");
                }
                return("Failed");
            }
        }
Example #3
0
 public String Save(int did, int tid, int cid)
 {
     if (!courseAssignGateway.OverlapCourse(tid, cid))
     {
         if (!courseAssignGateway.AssignCourse(cid))
         {
             if (courseAssignGateway.Save(did, tid, cid) > 0)
             {
                 return("Save Successfully");
             }
             else
             {
                 return("Sory! Save Fail");
             }
         }
         return("Course Alrady Assing");
     }
     return("Overlape Course");
 }
Example #4
0
        public string Save(CourseAssign aCourseAssign)
        {
            bool check = aCourseAssignGateway.IsCourseAssigned(aCourseAssign.CourseId);

            if (check != true)
            {
                aCourseAssign.RemainingCredit = aCourseAssign.RemainingCredit - aCourseAssign.CourseCredit;
                int rowAffected = aCourseAssignGateway.Save(aCourseAssign);
                if (rowAffected > 0)
                {
                    return("Successfully Saved");
                }
                else
                {
                    return("Saving failed");
                }
            }
            return("Course Already Assigned");
        }
Example #5
0
 public String Save(int did, int tid, int cid, decimal remainingCredit)
 {
     if (!courseAssignGateway.OverlapCourse(tid, cid))
     {
         if (!courseAssignGateway.AssignCourse(cid))
         {
             if (courseAssignGateway.Save(did, tid, cid, remainingCredit) > 0)
             {
                 return("Save Successfully");
             }
             else
             {
                 return("Sorry! Save Failed");
             }
         }
         return("Course Already Assing");
     }
     return("Overlape Course");
 }