Esempio n. 1
0
        /// <summary>
        /// New method like get settings 
        /// <developer>Rishabh</developer>
        /// </summary>
        /// <param name="objRequest"></param>
        /// <returns></returns>
        internal GetSettingsModel GetAllActivitesData(ReqSetting objRequest)
        {
            //System.Data.Entity.Core.Objects.ObjectParameter UpdatedLastSyncTime = new System.Data.Entity.Core.Objects.ObjectParameter("UpdatedLastSyncTime", typeof(string));
            //  string UpdatedLastSyncTime = "";

            GetSettingsModel response = new GetSettingsModel();
            using (var db = new WizzDataContext())
            {

                var courseData = db.tblCourses.Where(a => a.isDelete == false && a.isActive == true).ToList();
                var classes = db.tblClasses.Where(a => a.isActive == true && a.isDelete != true).ToList();
                var subjects = db.tblSubjects.Where(a => a.isActive == true && a.isDelete != true).ToList();

                response.listAcademicCourse = (from c in courseData.Where(a => a.isExtraCurricular == false)
                                               select new AcademicCoursesModel
                                          {
                                              courseId = Convert.ToString(c.pkId),
                                              courseName = c.courseName,
                                              listClasses = (from cl in classes.Where(a => a.fkCourseId == c.pkId)
                                                             select new ClassesModel
                                                             {
                                                                 classId = Convert.ToString(cl.pkId),
                                                                 className = cl.className,
                                                                 listSubejcts = (from sub in subjects.Where(a => a.fkClassId == cl.pkId)
                                                                                 select new SubjectsNewModel
                                                                                 {
                                                                                     subjectId = Convert.ToString(sub.pkId),
                                                                                     subjectName = sub.subjectName,
                                                                                 }).ToList()
                                                             }).ToList()


                                          }).ToList();
                response.listCurricularCourses = (from c in courseData.Where(a => a.isExtraCurricular == true)
                                                  select new CurricularCoursesModel
                                                  {
                                                      courseId = Convert.ToString(c.pkId),
                                                      courseName = c.courseName,
                                                      listClasses = (from cl in classes.Where(a => a.fkCourseId == c.pkId)
                                                                     select new ClassesModel
                                                                     {
                                                                         classId = Convert.ToString(cl.pkId),
                                                                         className = cl.className,
                                                                         listSubejcts = (from sub in subjects.Where(a => a.fkClassId == cl.pkId)
                                                                                         select new SubjectsNewModel
                                                                                         {
                                                                                             subjectId = Convert.ToString(sub.pkId),
                                                                                             subjectName = sub.subjectName,
                                                                                         }).ToList()
                                                                     }).ToList()


                                                  }).ToList();




            }
            return response;
        }
        public Response<GetSettingsModel> GetAllActivitesData(ReqSetting objReq)
        {
            Response<GetSettingsModel> response = new Response<GetSettingsModel>();
            List<GetSettingsModel> objResp = new List<GetSettingsModel>();


            try
            {
                if (ModelState.IsValid)
                {
                    objDbMethodV2 = new wizz.Dal.DbMethodsV2();
                    if (CheckRequestIsvalidornot(this.Request))
                    {
                        objResp.Add(objDbMethodV2.GetAllActivitesData(objReq));
                        response.Create(true, " ActivitesData", Messages.AppVersion, objResp);
                    }
                    else
                    {
                        response.Create(false, Messages.FormatMessage(Messages.InvalidReq), Messages.AppVersion, objResp);
                    }
                }
                else
                    response.Create(false, ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage, Messages.AppVersion, objResp);
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }