public object Communicate(TeacherRatingParam obj)
        {
            SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password);

            var Info = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault();

            if (db == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            if (Info == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            var AcademicYear = db.View_GETACADEMICYEAR.FirstOrDefault();

            if (AcademicYear == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Academic Year Not Found"
                });
            }

            var EmployeeCode      = Convert.ToInt16(Info.EmpCode);
            var StudentDetails    = db.TBLTRANSFERSTUDENTs.Where(r => r.ACADEMICYEAR == AcademicYear.ACADEMICYEAR && r.STUDENTID == EmployeeCode).FirstOrDefault();
            int StandardId        = Convert.ToInt32(StudentDetails.STANDARDID);
            int DivisionId        = Convert.ToInt32(StudentDetails.DIVISIONID);
            var GetTeacherDetails = db.View_Communiation.Where(r => r.STANDARDID == StandardId && r.DIVISIONID == DivisionId).FirstOrDefault();

            if (GetTeacherDetails == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Teacher Not Found"
                });
            }
            else
            {
                return(new TeacherData()
                {
                    IsSuccess = true, TeacherInformation = GetTeacherDetails
                });
            }
        }
 public object CommunicationToParents(TeacherRatingParam obj)
 {
     try
     {
         CommunicationBusiness objp = new CommunicationBusiness();
         var Rate = objp.CommunicateWithParents(obj);
         return(Rate);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
 public object DisplayRating(TeacherRatingParam obj)
 {
     try
     {
         RatingBusiness objp = new RatingBusiness();
         var            Rate = objp.DisplayMark(obj);
         return(Rate);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
        public object CommunicateWithParents(TeacherRatingParam obj)
        {
            SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password);

            var Info = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault();

            if (db == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            if (Info == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            var AcademicYear = db.View_GETACADEMICYEAR.FirstOrDefault();

            if (AcademicYear == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Academic Year Not Found"
                });
            }

            var EmployeeCode      = Convert.ToInt16(Info.EmpCode);
            var GetTeacherDeatils = db.TBLASSIGNCLASSTEACHERs.Where(r => r.EMPLOYEEID == EmployeeCode).FirstOrDefault();
            var StandardId        = GetTeacherDeatils.STANDARDID.ToString();
            int DivisionId        = Convert.ToInt16(GetTeacherDeatils.DIVISIONID);
            var GetStudents       = //db.TBLTRANSFERSTUDENTs.Where(r => r.STANDARDID == StandardId && r.DIVISIONID == DivisionId).ToList();
                                    from c in db.View_DisplayStudentDetails.Where(r => r.STANDARDID == StandardId && r.DIVISIONID == DivisionId)
                                    select new { c.STUDENTNAME, c.GENDER, c.DOB, c.GMOBILE, c.IMAGEPATH, c.STUDENTID };

            return(GetStudents);
        }
Ejemplo n.º 5
0
        public object DisplayMark(TeacherRatingParam obj)
        {
            SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password);

            var Info = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault();

            if (db == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            if (Info == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            var AcademicYear = db.View_GETACADEMICYEAR.FirstOrDefault();

            if (AcademicYear == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Academic Year Not Found"
                });
            }

            var EmployeeCode  = Convert.ToInt16(Info.EmpCode);
            var AssignTeacher = db.TBLASSIGNSTAFFs.Where(r => r.EMPLOYEEID == EmployeeCode).FirstOrDefault();

            if (AssignTeacher == null)
            {
                return(new Results()
                {
                    IsSuccess = false, Message = "Teacher Not Assign"
                });
            }
            List <string> Parameter     = db.TBLRATINGMASTERs.OrderBy(r => r.RatingMasterId).Select(r => r.Parameter).ToList();
            var           PramerterList = db.TBLRATINGMASTERs.Where(r => r.Display == 1).Distinct().ToList();
            List <Rate>   lt            = new List <Rate>();

            foreach (var item in Parameter)
            {
                item.ToList();
                double        totalcount   = 0;
                double        Counts       = 0;
                double        GetStars     = 0;
                double        GettingStars = 0;
                double        GetAvrage    = 0;
                string        Stars        = "";
                TIMETABLELIST ddl          = new TIMETABLELIST();
                // var data = db.View_Timetable.Where(r => r.EMPLOYEEID == EmployeeCode && r.WORKINGDAYS == item && r.DISPLAY == 1 && r.EDUYEAR == AcademicYear.ACADEMICYEAR).ToList();
                var data_d = db.View_DisplayRate.Where(r => r.TeacherId == EmployeeCode).ToList();
                for (int i = 0; i < data_d.Count(); i++)
                {
                    if (item == data_d[i].Parameter)
                    {
                        Counts++;
                        totalcount  += Convert.ToDouble(data_d[i].Mark);
                        GetStars     = (totalcount / Counts * 10);
                        GettingStars = (GetStars * 5) / 100;
                        GetAvrage    = Math.Round(GettingStars);
                        if (GetAvrage == 1)
                        {
                            Stars = "One Star";
                        }
                        else if (GetAvrage == 2)
                        {
                            Stars = "Two Star";
                        }
                        else if (GetAvrage == 3)
                        {
                            Stars = "Three Star";
                        }
                        else if (GetAvrage == 4)
                        {
                            Stars = "Four Star";
                        }
                        else
                        {
                            Stars = "Five Star";
                        }
                        if (Counts <= 1)
                        {
                            lt.Add(new Rate
                            {
                                PramerterName = item,
                                Stars         = Stars
                            });
                        }
                        else
                        {
                            lt.RemoveAll(r => r.PramerterName == item);
                            lt.Add(new Rate
                            {
                                PramerterName = item,
                                Stars         = Stars
                            });
                        }
                    }
                    //else
                    //{
                    //        lt.RemoveAll(r => r.Stars =="" && r.PramerterName==item);
                    //        lt.Add(new Rate
                    //        {
                    //            PramerterName = item,
                    //            Stars = Stars
                    //        });
                    //}
                }
                if (data_d.Count() == 0)
                {
                    lt.Add(new Rate
                    {
                        PramerterName = item,
                        Stars         = Stars
                    });
                }
                if (data_d.Count() <= 1)
                {
                    lt.RemoveAll(r => r.PramerterName == item);
                    lt.Add(new Rate
                    {
                        PramerterName = item,
                        Stars         = Stars
                    });
                }
            }
            return(new RateParameterList()
            {
                IsSuccess = true, GetStars = lt.ToArray()
            });
        }