Exemple #1
0
 public Response SaveSectionAllocationDetails(SectionAllocationCustomModel objModel)
 {
     using (objDAL = new SectionAllocationRepo())
     {
         return(objDAL.SaveSectionAllocationDetails(objModel));
     }
 }
Exemple #2
0
 public object GetSectionAllocationListing(SectionAllocationCustomModel objModel)
 {
     using (objDAL = new SectionAllocationRepo())
     {
         return(objDAL.GetSectionAllocationListing(objModel));
     }
 }
        public ActionResult UpdateAllocationList(string[] Parameters, int SessionId, int ClassId, int SectionId)
        {
            string ResultMessage = "";

            try
            {
                int TotalStudent = 0;
                objBDC = new SectionAllocationBusiness();
                SectionAllocationCustomModel objModel = new SectionAllocationCustomModel();
                TotalStudent = objBDC.GetTotalStudentInSection(SessionId, ClassId, SectionId);

                if (TotalStudent > 30)
                {
                    ResultMessage = "Only 70 students are allowed in one batch.";
                }

                if (Parameters.Length > 0)
                {
                    int AfterStudentCount = TotalStudent + Parameters.Length;
                    if (AfterStudentCount > 30)
                    {
                        ResultMessage = "Only 30 students are allowed in one section. You have selected " + Parameters.Length + " students. There are already " + TotalStudent + " students in this section.";
                    }
                    else
                    {
                        foreach (string Id in Parameters)
                        {
                            objModel.SessionId   = SessionId;
                            objModel.ClassId     = ClassId;
                            objModel.SectionId   = SectionId;
                            objModel.AdmissionId = Convert.ToInt32(Id);
                            objModel.IsActive    = true;
                            objModel.Status      = "Attending";

                            objBDC.SaveSectionAllocationDetails(objModel);
                        }
                        ResultMessage = "Student Allocated in batch Successfully.";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(ResultMessage));
        }
        public ActionResult Index(SectionAllocationCustomModel collection)
        {
            //var fru = collection.SelectedFruits;

            return(View());
        }
Exemple #5
0
        public object GetSectionAllocationListing(SectionAllocationCustomModel objModel)
        {
            IList <SectionAllocationCustomModel>      SectionAllocationListModel  = new List <SectionAllocationCustomModel>();
            IQueryable <SectionAllocationCustomModel> SectionAllocationListDetail = null;
            int TotalRec        = 0;
            int CurrentPageSize = 0;

            using (response = new Response())
            {
                using (dbcontext = new SchoolManagementEntities())
                {
                    try
                    {
                        response.success            = true;
                        SectionAllocationListDetail = dbcontext.tblPromoteToClasses.Where(x => x.IsDeleted == false)
                                                      .Select(x => new SectionAllocationCustomModel
                        {
                            PromoteToClassId = x.PromoteToClassId,
                            SessionId        = x.SessionId,
                            EnquiryId        = x.EnquiryId,
                            AdmissionId      = x.AdmissionId,
                            ClassId          = x.ClassId,
                            SectionId        = x.SectionId,
                            Status           = x.Status,

                            IsActive     = x.IsActive,
                            IsDeleted    = x.IsDeleted,
                            CreatedBy    = x.CreatedBy,
                            CreatedDate  = x.CreatedDate,
                            ModifiedBy   = x.ModifiedBy,
                            ModifiedDate = x.ModifiedDate
                        }).OrderByDescending(x => x.PromoteToClassId);

                        if (objModel.pageModel != null)
                        {
                            //if (objModel.pageModel.SerachTerm != null && objModel.pageModel.SerachTerm != "")
                            //{
                            //    SectionAllocationListDetail = SectionAllocationListDetail.Where(x =>
                            //    (x.Title.ToLower().Trim().Contains(objModel.pageModel.SerachTerm.ToLower().Trim()) || objModel.pageModel.SerachTerm.Trim() == String.Empty)
                            //    || (x.ShortDescription.ToLower().Trim().Contains(objModel.pageModel.SerachTerm.ToLower().Trim()) || objModel.pageModel.SerachTerm.Trim() == String.Empty)
                            //    );
                            //}

                            if (!String.IsNullOrEmpty(objModel.pageModel.SortBy))
                            {
                                //SectionAllocationListDetail= objModel.pageModel.SortDir.ToLower() == "desc" ? SectionAllocationListDetail.OrderByDescending(objModel.pageModel.SortBy)
                                //    : SectionAllocationListDetail.OrderBy(objModel.pageModel.SortBy);
                            }

                            TotalRec = SectionAllocationListDetail.Count();
                            if (objModel.pageModel.PageSize > 0)
                            {
                                SectionAllocationListDetail = SectionAllocationListDetail.Skip(objModel.pageModel.Skip);
                                SectionAllocationListDetail = SectionAllocationListDetail.Take(objModel.pageModel.PageSize);
                            }

                            SectionAllocationListModel = SectionAllocationListDetail.ToList() as IList <SectionAllocationCustomModel>;
                        }
                        else
                        {
                            TotalRec = SectionAllocationListDetail.Count();
                            SectionAllocationListModel = SectionAllocationListDetail.ToList() as IList <SectionAllocationCustomModel>;
                        }

                        //CurrentPageSize = objModel.pageModel.PageSize;

                        //if (SectionAllocationListModel.Count() > 0 && CurrentPageSize > 0)
                        //{
                        //    SectionAllocationListModel[0].pageModel = new PagingViewModel();

                        //    SectionAllocationListModel[0].pageModel.TotalRecords = TotalRec;
                        //    if ((TotalRec % CurrentPageSize) == 0)
                        //    {
                        //        SectionAllocationListModel[0].pageModel.TotalPages = TotalRec / CurrentPageSize;
                        //    }
                        //    else
                        //    {
                        //        SectionAllocationListModel[0].pageModel.TotalPages = (TotalRec / CurrentPageSize) + 1;
                        //    }
                        //}

                        return(SectionAllocationListModel);
                    }
                    catch (Exception ex)
                    {
                        response.success = false;
                        response.message = ex.Message;
                        return(response);
                    }
                }
            }
        }
Exemple #6
0
        public Response SaveSectionAllocationDetails(SectionAllocationCustomModel objModel)
        {
            using (response = new Response())
            {
                using (dbcontext = new SchoolManagementEntities())
                {
                    try
                    {
                        response.success = true;
                        if (objModel.PromoteToClassId == 0)
                        {
                            var rs = dbcontext.tblPromoteToClasses.FirstOrDefault(x => x.IsDeleted == false && x.SessionId == objModel.SessionId && x.ClassId == objModel.ClassId && x.AdmissionId == objModel.AdmissionId);
                            if (rs == null)
                            {
                                tblPromoteToClass objAddNew = new tblPromoteToClass
                                {
                                    SessionId = objModel.SessionId,
                                    //EnquiryId = objModel.EnquiryId,
                                    AdmissionId = objModel.AdmissionId,
                                    ClassId     = objModel.ClassId,
                                    SectionId   = objModel.SectionId,
                                    Status      = "Attending",

                                    IsActive     = true,
                                    IsDeleted    = false,
                                    CreatedBy    = objModel.CreatedBy,
                                    CreatedDate  = DateTime.Now,
                                    ModifiedBy   = objModel.ModifiedBy,
                                    ModifiedDate = DateTime.Now
                                };

                                dbcontext.tblPromoteToClasses.Add(objAddNew);
                                dbcontext.SaveChanges();
                                response.responseData = new { PromoteToClassId = objAddNew.PromoteToClassId, Status = objAddNew.Status };
                                response.message      = "Record Added Successfully!";
                            }
                            else
                            {
                                rs.SectionId = objModel.SectionId;
                                rs.Status    = objModel.Status;
                                rs.IsActive  = true;

                                rs.ModifiedBy   = objModel.ModifiedBy;
                                rs.ModifiedDate = DateTime.Now;
                                dbcontext.SaveChanges();
                                response.responseData = new { PromoteToClassId = rs.PromoteToClassId, Status = rs.Status };
                                response.message      = "Record Updated Successfully!";
                            }
                        }
                        else
                        {
                            var rs = dbcontext.tblPromoteToClasses.FirstOrDefault(x => x.IsDeleted == false && x.SessionId == objModel.SessionId && x.ClassId == objModel.ClassId && x.AdmissionId == objModel.AdmissionId && x.PromoteToClassId != objModel.PromoteToClassId);
                            if (rs == null)
                            {
                                var objUpdate = dbcontext.tblPromoteToClasses.FirstOrDefault(m => m.PromoteToClassId == objModel.PromoteToClassId);
                                if (objUpdate != null)
                                {
                                    objUpdate.SessionId   = objModel.SessionId;
                                    objUpdate.EnquiryId   = objModel.EnquiryId;
                                    objUpdate.AdmissionId = objModel.AdmissionId;
                                    objUpdate.ClassId     = objModel.ClassId;
                                    objUpdate.SectionId   = objModel.SectionId;

                                    objUpdate.ModifiedBy   = objModel.ModifiedBy;
                                    objUpdate.ModifiedDate = DateTime.Now;
                                    dbcontext.SaveChanges();
                                    response.responseData = new { PromoteToClassId = objUpdate.PromoteToClassId, Status = objUpdate.Status };
                                    response.message      = "Record Updated Successfully!";
                                }
                            }
                            else
                            {
                                response.success = false;
                                response.message = "Record Already Exists!";
                            }
                        }
                        return(response);
                    }
                    catch (Exception ex)
                    {
                        response.success = false;
                        response.message = ex.Message;
                        return(response);
                    }
                }
            }
        }