Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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());
        }
Exemplo n.º 5
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));
            }
        }
Exemplo n.º 6
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));
            }
        }