예제 #1
0
        public bool Put(int AdmissionId, AdmissionForm student)
        {
            ClassController _class = new ClassController();

            if (!ModelState.IsValid)
            {
                return(false);
            }
            if (AdmissionId != student.AdmissionId)
            {
                return(false);
            }

            try
            {
                Convert.ToInt32(student.Class);
            }
            catch (Exception ex)
            {
                student.Class = _class.GetClassID(student.Class).ToString();
            }

            SchoolDB.Entry(student).State = EntityState.Modified;
            try
            {
                SchoolDB.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public bool UpdateFeeHead(int FID, NewFeeHeading newFeeHeading)
        {
            ClassController _class = new ClassController();

            if (!ModelState.IsValid)
            {
                return(false);
            }
            if (FID != newFeeHeading.FID)
            {
                return(false);
            }

            newFeeHeading.Class = Convert.ToString(_class.GetClassID(newFeeHeading.Class));
            SchoolDB.Entry(newFeeHeading).State = EntityState.Modified;
            try
            {
                SchoolDB.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(false);
            }
            return(true);
        }
예제 #3
0
        public IEnumerable <MonthAttendanceReport> GetMonthlyAttendance(string ClassVal)
        {
            var ReturnVal = from bs in SchoolDB.StAttendances.Where(x => x.Session == SchoolSession).ToList()
                            where Convert.ToDateTime(bs.Date).Month == DateTime.Now.Month
                            group bs by new
            {
                bs.StAdmNo,
                bs.StName,
                bs.StClass
            }
            into g
                select new MonthAttendanceReport
            {
                AdmissionNo = g.Key.StAdmNo,
                Name        = g.Key.StName,
                Class       = g.Key.StClass,
                Present     = g.Sum(x => x.Attendance.ToUpper() == "PRESENT" ? 1 : 0),
                Absent      = g.Sum(x => x.Attendance.ToUpper() == "ABSENT" ? 1 : 0),
                Leave       = g.Sum(x => x.Attendance.ToUpper() == "LEAVE" ? 1 : 0),
                TotalDays   = DateTime.Now.Day
            };
            ClassController _class = new ClassController();
            List <MonthAttendanceReport> ReportList = new List <MonthAttendanceReport>();

            foreach (var item in ReturnVal)
            {
                item.Class = _class.GetClassName(item.Class);
                ReportList.Add(item);
            }
            return(ReportList);
        }
예제 #4
0
        // GET api/school/5
        public List <AdmissionForm> GetStudentDetails()
        {
            ClassController _class         = new ClassController();
            var             studentDetails = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession)).OrderBy(x => x.Class).ThenBy(z => z.StFirstName).ToList();

            studentDetails.ForEach(cc => cc.Class = _class.GetClassName(cc.Class));
            return(studentDetails);
        }
예제 #5
0
        public List <tbl_homework> GetHomeworks()
        {
            ClassController _class    = new ClassController();
            var             Homeworks = unitOfWork.HomeworkRepository.Get(orderBy: q => q.OrderBy(s => s.id));

            Homeworks.ForEach(cc => cc.@class = _class.GetClassName(cc.@class));
            return(Homeworks);
        }
예제 #6
0
        public List <StAttendance> GetAttendanceCharge()
        {
            var             AttendanceCharge = SchoolDB.StAttendances.Where(x => x.Session == SchoolSession).OrderByDescending(x => x.ID).ToList();
            ClassController _class           = new ClassController();

            AttendanceCharge.ForEach(x => x.StClass = _class.GetClassName(x.StClass));
            return(AttendanceCharge);
        }
예제 #7
0
        public List <NewFeeHeading> GetFeeHeads()
        {
            ClassController _class         = new ClassController();
            var             NewFeeHeadings = SchoolDB.NewFeeHeadings.OrderBy(x => x.FID).ToList();

            NewFeeHeadings.ForEach(x => x.Class = _class.GetClassName(x.Class));
            return(NewFeeHeadings);
        }
예제 #8
0
        public List <NewFeeHeading> GetAllNewFeeHeading()
        {
            var classFeeDetail = (from x in SchoolDB.NewFeeHeadings
                                  select x);
            ClassController _class = new ClassController();

            classFeeDetail.ToList().ForEach(x => x.Class = _class.GetClassName(x.Class));
            List <NewFeeHeading> FeeHeading = classFeeDetail.ToList();

            return(FeeHeading);
        }
예제 #9
0
        public List <NewFeeHeading> GetNewFeeHeading(string SelectedClass)
        {
            ClassController _class         = new ClassController();
            string          Selected       = _class.GetClassID(SelectedClass).ToString();
            var             classFeeDetail = (from x in SchoolDB.NewFeeHeadings
                                              where x.Class.Equals(Selected)
                                              select x);
            var classFeeDetails = classFeeDetail.ToList();

            return(classFeeDetails);
        }
예제 #10
0
        public bool IsAttendanceMarked(List <StAttendance> Attendance)
        {
            ClassController _class = new ClassController();

            Attendance.ForEach(x => x.StClass = _class.GetClassID(x.StClass).ToString());
            var SelectedClass = Attendance.GroupBy(
                p => p.StClass,
                (key, g) => new { stClass = key }).FirstOrDefault();
            var list = SchoolDB.StAttendances.ToList().Where(x => x.StClass == SelectedClass.stClass && x.Session == SchoolSession && x.Date.Value.ToString("MM-dd-yyyy") == DateTime.Now.ToString("MM-dd-yyyy")).ToList();

            return(list.Any());
        }
예제 #11
0
        public List <AdmissionForm> GetMultiChildParent()
        {
            ClassController _class         = new ClassController();
            var             studentDetails = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession)).OrderBy(x => x.Class).ToList();

            studentDetails.ForEach(cc => cc.Class = _class.GetClassName(cc.Class));
            studentDetails = studentDetails.GroupBy(item => item.FatherName)
                             .Where(group => group.Count() > 1)
                             .SelectMany(group => group)
                             .ToList();
            return(studentDetails);
        }
예제 #12
0
        public List <StudentFeeDetail> GetAllSubmitedFeeDetail(string Session)
        {
            var StFeeDetail = (from x in SchoolDB.StudentFeeDetails
                               where x.Session.Equals(Session)
                               orderby x.Id descending
                               select x);
            var             StFeeDetails = StFeeDetail.ToList();
            ClassController _class       = new ClassController();

            StFeeDetails.ForEach(x => x.Class = _class.GetClassName(x.Class));
            return(StFeeDetails);
        }
예제 #13
0
        // GET api/school/5
        public List <StudentFeeDetail> GetStudentFeeDetail(string AdmNo, string Session)
        {
            string          admissionNo = AdmNo.ToString();
            ClassController _class      = new ClassController();
            var             StFeeDetail = (from x in SchoolDB.StudentFeeDetails
                                           where x.AdmissionNo.Equals(admissionNo) && x.Session.Equals(Session)
                                           orderby x.Id descending
                                           select x);
            var StFeeDetails = StFeeDetail.ToList();

            StFeeDetails.ForEach(x => x.Class = _class.GetClassName(x.Class));
            return(StFeeDetails);
        }
예제 #14
0
        public List <AdmissionForm> GetStudentDetailByClass(string ClassID)
        {
            ClassController      _class = new ClassController();
            List <AdmissionForm> studentDetails;

            if (ClassID != "0")
            {
                studentDetails = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession) && x.Class == ClassID).OrderBy(x => x.Class).ThenBy(z => z.StFirstName).ToList();
            }
            else
            {
                studentDetails = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession)).OrderBy(x => x.Class).ThenBy(z => z.StFirstName).ToList();
            }

            studentDetails.ForEach(cc => cc.Class = _class.GetClassName(cc.Class));
            return(studentDetails);
        }
예제 #15
0
        // GET api/school/5
        public List <ChartData> GetClassFeeBalance()
        {
            List <ChartData> objList = new List <ChartData>();

            objList = SchoolDB.StudentFeeDetails.Where(x => x.Session.Contains(SchoolSession)).ToList()
                      .GroupBy(n => n.Class)
                      .Select(n => new ChartData
            {
                Label = n.Key.ToString(),
                Data  = n.Sum(x => Convert.ToDecimal(x.Balance)).ToString()
            }
                              ).ToList();
            ClassController _class = new ClassController();

            objList.ToList().ForEach(x => x.Label = _class.GetClassName(x.Label));
            return(objList);
        }
예제 #16
0
        // GET api/school/5
        public List <ChartData> GetTotalClassStudent()
        {
            List <ChartData> objList = new List <ChartData>();

            objList = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession)).ToList()
                      .GroupBy(n => n.Class)
                      .Select(n => new ChartData
            {
                Label = n.Key.ToString(),
                Data  = n.Count().ToString()
            }
                              ).ToList();

            ClassController _class = new ClassController();

            objList.ToList().ForEach(x => x.Label = _class.GetClassName(x.Label));

            return(objList);
        }
예제 #17
0
        //insert stFeeDetail
        public HttpResponseMessage AddFeeHead(NewFeeHeading newFeeHeading)
        {
            HttpRequestMessage Request = new HttpRequestMessage();

            Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());

            if (ModelState.IsValid)
            {
                ClassController _class = new ClassController();
                newFeeHeading.Class = Convert.ToString(_class.GetClassID(newFeeHeading.Class));
                SchoolDB.NewFeeHeadings.Add(newFeeHeading);
                SchoolDB.SaveChanges();
                newFeeHeading.Class = Convert.ToString(_class.GetClassName(newFeeHeading.Class));
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, newFeeHeading);
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
예제 #18
0
        //insert stFeeDetail
        public HttpResponseMessage Post(StudentFeeDetail stFeeDetail)
        {
            HttpRequestMessage Request = new HttpRequestMessage();

            Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());

            if (ModelState.IsValid)
            {
                ClassController _class = new ClassController();
                stFeeDetail.Class = Convert.ToString(_class.GetClassID(stFeeDetail.Class));
                SchoolDB.StudentFeeDetails.Add(stFeeDetail);
                SchoolDB.SaveChanges();
                stFeeDetail.Class = Convert.ToString(_class.GetClassName(stFeeDetail.Class));
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, stFeeDetail);
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
예제 #19
0
        // GET api/school/5
        public List <ChartData> GetMonthBirthday()
        {
            List <ChartData> objList = new List <ChartData>();

            try
            {
                objList = SchoolDB.AdmissionForms.Where(x => x.ESession.Contains(SchoolSession)).ToList()
                          .GroupBy(n => Convert.ToDateTime(n.DOB).ToString("MMMM", CultureInfo.InvariantCulture).ToString())
                          .Select(n => new ChartData
                {
                    Label = n.Key,
                    Data  = n.Count().ToString()
                }
                                  ).ToList();
                ClassController _class = new ClassController();
                objList.ToList().ForEach(x => x.Label = _class.GetClassName(x.Label));
            }
            catch (Exception ex)
            {
            }
            return(objList);
        }
예제 #20
0
        public HttpResponseMessage Post(List <StAttendance> Attendance)
        {
            HttpRequestMessage Request = new HttpRequestMessage();

            Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            ClassController _class = new ClassController();

            if (ModelState.IsValid)
            {
                foreach (var item in Attendance)
                {
                    item.Session = SchoolSession;
                    SchoolDB.StAttendances.Add(item);
                    SchoolDB.SaveChanges();
                }

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, Attendance);
                return(response);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
        }
예제 #21
0
        public List <StudentFeeDetail> GetTopFeeDetail(string Session, string Class = "1")
        {
            var stFeeDetailList = from r in SchoolDB.AdmissionForms
                                  join sfd in SchoolDB.StudentFeeDetails on r.AdmissionNo equals sfd.AdmissionNo into edept
                                  where r.Class == Class && r.ESession.Equals(Session)
                                  from p in edept.DefaultIfEmpty()

                                  select new
            {
                AdmissionNo          = r.AdmissionNo == null ? "" : r.AdmissionNo,
                AdmissionFee         = p.AdmissionFee == null ? "" : p.AdmissionFee,
                Balance              = p.Balance == null ? "" : p.Balance,
                BalancedShow         = p.BalancedShow == null ? "" : p.BalancedShow,
                BankName             = p.BankName == null ? "" : p.BankName,
                CardPaymentRecieptNo = p.CardPaymentRecieptNo == null ? "" : p.CardPaymentRecieptNo,
                Category             = r.Category == null ? "" : r.Category,
                ChequeDate           = p.ChequeDate == null ? "" : p.ChequeDate,
                ChequeNo             = p.ChequeNo == null ? "" : p.ChequeNo,
                Class        = r.Class == null ? "" : r.Class,
                Concession   = p.Concession == null ? "" : p.Concession,
                Date         = p.Date == null ? "" : p.Date,
                Father       = r.FatherName == null ? "" : r.FatherName,
                Fine         = p.Fine == null ? "" : p.Fine,
                GrandTotal   = p.GrandTotal == null ? 0 : p.GrandTotal,
                Id           = p.Id == null ? 0 : p.Id,
                Months       = p.Months == null ? "" : p.Months,
                Name         = r.StFirstName == null ? "" : r.StFirstName,
                OldBalanced  = p.OldBalanced == null ? "" : p.OldBalanced,
                PaidAmount   = p.PaidAmount == null ? 0 : p.PaidAmount,
                PaymentMode  = p.PaymentMode == null ? "" : p.PaymentMode,
                Phone        = r.Contact == null ? "" : r.Contact,
                PreviousDue  = p.PreviousDue == null ? "" : p.PreviousDue,
                ReciptNo     = p.ReciptNo == null ? "" : p.ReciptNo,
                Remark       = p.Remark == null ? "" : p.Remark,
                Section      = r.Section == null ? "" : r.Section,
                Session      = r.ESession == null ? "" : r.ESession,
                Status       = r.Status == null ? "" : r.Status,
                TotalAmount  = p.TotalAmount == null ? "" : p.TotalAmount,
                TransportFee = p.TransportFee == null ? "" : p.TransportFee
            };
            var stFeeDetails = stFeeDetailList.Distinct().ToList();
            List <StudentFeeDetail> StFeeDetails = stFeeDetails.Select(a => new StudentFeeDetail()
            {
                AdmissionFee         = a.AdmissionFee,
                AdmissionNo          = a.AdmissionNo,
                Balance              = (Convert.ToInt32(string.IsNullOrEmpty(a.Balance) ? "0" : a.Balance) + GetBalanceAmount(a.AdmissionNo, a.Class, a.Months)).ToString(),
                BalancedShow         = a.BalancedShow,
                BankName             = a.BankName,
                CardPaymentRecieptNo = a.CardPaymentRecieptNo,
                Category             = a.Category,
                ChequeDate           = a.ChequeDate,
                ChequeNo             = a.ChequeNo,
                Class        = a.Class,
                Concession   = a.Concession,
                Date         = a.Date,
                Father       = a.Father,
                Fine         = a.Fine,
                GrandTotal   = a.GrandTotal,
                Id           = a.Id,
                Months       = a.Months,
                Name         = a.Name,
                OldBalanced  = a.OldBalanced,
                PaidAmount   = a.PaidAmount,
                PaymentMode  = a.PaymentMode,
                Phone        = a.Phone,
                PreviousDue  = a.PreviousDue,
                ReciptNo     = a.ReciptNo,
                Remark       = a.Remark,
                Section      = a.Section,
                Session      = a.Section,
                Status       = a.Status,
                TotalAmount  = a.TotalAmount,
                TransportFee = a.TransportFee
            }).ToList();

            ClassController _class = new ClassController();

            StFeeDetails.ForEach(cc => cc.Class = _class.GetClassName(cc.Class));
            var Sortlist = StFeeDetails.OrderBy(a => a.Id).GroupBy(a => a.AdmissionNo).Select(g => g.Last()).ToList();

            return(Sortlist);
        }