Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(long id)
        {
            tblSchool tblSchool = db.tblSchools.Find(id);

            db.tblSchools.Remove(tblSchool);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,SchoolName,Logo,AddressLine1,AddressLine2,AddressLine3,City,State,Country,Pincode,ContactNo1,ContactNo2,EmailId,StartingYear,CreateDate,UpdateDate")] tblSchool tblSchool)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSchool).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblSchool));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "SchoolID,Name,District")] tblSchool tblSchool)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSchool).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblSchool));
 }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "SchoolID,Name,District")] tblSchool tblSchool)
        {
            if (ModelState.IsValid)
            {
                db.tblSchools.Add(tblSchool);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblSchool));
        }
Exemplo n.º 5
0
        // GET: Schools/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblSchool tblSchool = db.tblSchools.Find(id);

            if (tblSchool == null)
            {
                return(HttpNotFound());
            }
            return(View(tblSchool));
        }
Exemplo n.º 6
0
        public ActionResult ShowEditExtra(string StudentId, string SchoolId)
        {
            StudentExtraCModel TModel = new StudentExtraCModel();

            tblStudent TCtable = Connection.tblStudents.SingleOrDefault(x => x.StudentId == StudentId && x.SchoolId == SchoolId);

            tblSchool schl = Connection.tblSchools.SingleOrDefault(x => x.SchoolId == SchoolId);
            //  TModel.IsActive = TCtable.IsActive;

            string SchoolName = schl.SchoolName;

            TModel.StudentId   = TCtable.StudentId;
            TModel.StudentName = TCtable.studentName;
            TModel.SchoolName  = SchoolName;


            var StudentSextra = Connection.SMGTloadScholExtraCadd(SchoolId, "%").ToList();



            List <tblExtraCurricularActivity> result = StudentSextra.Select(x => new tblExtraCurricularActivity
            {
                ActivityCode = x.ActivityCode,
                ActivityName = x.ActivityName
            }).ToList();

            ViewBag.studentextrac = new SelectList(StudentSextra, "ActivityCode", "ActivityName");



            TModel.SchoolId = TCtable.SchoolId;



            return(PartialView("EditStudentEXtra", TModel));
        }
        public Response SaveSchoolMasterDetails(SchoolMasterCustomModel objModel)
        {
            using (response = new Response())
            {
                using (dbcontext = new SchoolManagementEntities())
                {
                    try
                    {
                        response.success = true;
                        if (objModel.SchoolId == 0)
                        {
                            var rs = dbcontext.tblSchools.FirstOrDefault(x => x.IsDeleted == false && x.Name == objModel.Name);
                            if (rs == null)
                            {
                                tblSchool objAddNew = new tblSchool
                                {
                                    Name             = objModel.Name,
                                    MobileNo         = objModel.MobileNo,
                                    ShortDescription = objModel.ShortDescription,
                                    EmailId          = objModel.EmailId,
                                    Address          = objModel.Address,
                                    Address2         = objModel.Address2,
                                    City             = objModel.City,
                                    Country          = objModel.Country,
                                    Image            = objModel.Image,
                                    Logo             = objModel.Logo,
                                    State            = objModel.State,
                                    TagLine          = objModel.TagLine,

                                    DDate = DateTime.Now,

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

                                dbcontext.tblSchools.Add(objAddNew);
                                dbcontext.SaveChanges();
                                response.responseData = new { SchoolId = objAddNew.SchoolId, Name = objAddNew.Name };
                                response.message      = "Record Added Successfully!";
                            }
                            else
                            {
                                response.success = false;
                                response.message = "Record Already Exists!";
                            }
                        }
                        else
                        {
                            var rs = dbcontext.tblSchools.FirstOrDefault(x => x.IsDeleted == false && x.Name == objModel.Name && x.SchoolId != objModel.SchoolId);
                            if (rs == null)
                            {
                                var objUpdate = dbcontext.tblSchools.FirstOrDefault(m => m.SchoolId == objModel.SchoolId);
                                if (objUpdate != null)
                                {
                                    objUpdate.Name             = objModel.Name;
                                    objUpdate.ShortDescription = objModel.ShortDescription;
                                    objUpdate.MobileNo         = objModel.MobileNo;
                                    objUpdate.EmailId          = objModel.EmailId;
                                    objUpdate.Address          = objModel.Address;
                                    objUpdate.Address2         = objModel.Address2;
                                    objUpdate.City             = objModel.City;
                                    objUpdate.Country          = objModel.Country;
                                    objUpdate.Image            = objModel.Image;
                                    objUpdate.Logo             = objModel.Logo;
                                    objUpdate.State            = objModel.State;
                                    objUpdate.TagLine          = objModel.TagLine;

                                    objUpdate.ModifiedBy   = objModel.ModifiedBy;
                                    objUpdate.ModifiedDate = DateTime.Now;
                                    dbcontext.SaveChanges();
                                    response.responseData = new { SchoolId = objUpdate.SchoolId, Name = objUpdate.Name };
                                    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);
                    }
                }
            }
        }
        public ActionResult Edit(StudentModel Model)
        {
            string _path = "";

            //  string _pathL = "";
            string _path1 = "";

            string _pathL2 = "";

            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add update logic here
                    if (Model.StudentImageFile.ContentLength > 0)
                    {
                        string fnm        = DateTime.Now.ToString("");
                        string nwString22 = fnm.Replace("-", ".");
                        string nwString   = nwString22.Replace("/", ".");
                        string nwString2  = nwString.Replace(" ", ".");
                        string time       = nwString2.Replace(":", ".");

                        string _FileName = time + "_" + Path.GetFileName(Model.StudentImageFile.FileName);



                        _path  = Path.Combine(Server.MapPath("~/Uploads/Student/Photo"), _FileName);
                        _path1 = "~/Uploads/Student/Photo/" + _FileName;
                        Model.StudentImageFile.SaveAs(_path);
                    }
                }



                SchoolModel  TModel   = new SchoolModel();
                StudentModel stdmodel = new StudentModel();

                tblStudent tblstudnt = Connection.tblStudents.SingleOrDefault(x => x.StudentId == Model.StudentId);


                stdmodel.SchoolId     = tblstudnt.SchoolId;
                stdmodel.StudentId    = tblstudnt.StudentId;
                stdmodel.StudentName  = tblstudnt.studentName;
                stdmodel.ModifiedBy   = USession.User_Id;
                stdmodel.ModifiedDate = DateTime.Now;
                stdmodel.GradeId      = tblstudnt.GradeId;
                stdmodel.HouseId      = tblstudnt.HouseId;
                stdmodel.ClassId      = tblstudnt.ClassId;
                String tblpath = tblstudnt.ImgUrl;
                stdmodel.DateOfBirth = tblstudnt.DateofBirth;
                stdmodel.Gender      = tblstudnt.Gender;

                tblSchool TCtable = Connection.tblSchools.SingleOrDefault(x => x.SchoolId == Model.SchoolId);
                //  TModel.IsActive = TCtable.IsActive;



                if (Model.Gender == null)
                {
                    Model.Gender = stdmodel.Gender;
                }

                if (Model.SchoolId == null)
                {
                    Model.SchoolId = stdmodel.SchoolId;
                }

                if (Model.StudentName == null)
                {
                    Model.StudentName = stdmodel.StudentName;
                }

                if (Model.GradeId == null)
                {
                    Model.GradeId = stdmodel.GradeId;
                }

                if (Model.HouseId == null)
                {
                    Model.HouseId = stdmodel.HouseId;
                }

                if (_path == "")
                {
                    _path = tblstudnt.ImgUrl;
                }



                //if (Model.Email == null)
                //{
                //    Model.Email = TModel.Email;

                //}
                //if (Model.MinuteforPeriod == null)
                //{
                //    Model.MinuteforPeriod = TModel.MinuteforPeriod;

                //}

                //if (Model.Telephone == null)
                //{
                //    Model.Telephone = TModel.Telephone;

                //}

                if (_path1 == "")
                {
                    _path1 = TModel.ImagePath;
                }
                if (_pathL2 == "")
                {
                    _pathL2 = TModel.LogoPath;
                }

                //   ModelState.


                Model.UserId       = "User1";
                Model.ModifiedBy   = "User1";
                Model.ModifiedDate = DateTime.Now;


                Connection.SMGTModifyStudent(Model.SchoolId, Model.StudentId, Model.StudentName, Model.DateOfBirth, Model.GradeId, Model.ClassId, Model.Gender, Model.UserId, Model.HouseId, _path, Model.ModifiedBy, "Y");
                //Connection.DCISModifySchool(Model.SchoolId, Model.SchoolGroup, Model.SchoolName, Model.SchoolRank, "Y", Model.Division,
                //   Model.District, Model.Description, UserId, Model.Address1, Model.Address2, Model.Address3, Model.Email, Model.Fax, _path1, Convert.ToInt16(Model.MinuteforPeriod), Model.Telephone, Model.SchoolCategory, Model.Province, Model.WebAddress, _pathL2
                //   );
                Connection.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 9
0
        public ActionResult ShowEditStudent(string StudentId, string SchoolId)
        {
            StudentModel TModel = new StudentModel();

            tblStudent TCtable = Connection.tblStudents.SingleOrDefault(x => x.StudentId == StudentId && x.SchoolId == SchoolId);

            tblSchool schl = Connection.tblSchools.SingleOrDefault(x => x.SchoolId == SchoolId);
            //  TModel.IsActive = TCtable.IsActive;

            string SchoolName = schl.SchoolName;

            TModel.StudentId   = TCtable.StudentId;
            TModel.StudentName = TCtable.studentName;
            TModel.SchoolName  = SchoolName;
            TModel.DateOfBirth = TCtable.DateofBirth;
            TModel.ClassId     = TCtable.ClassId;
            TModel.Gender      = TCtable.Gender;
            TModel.UserId      = TCtable.UserId;

            List <tblSchool> Scllist = Connection.tblSchools.Where(X => X.IsActive == "Y").ToList();

            String sclid;

            if (SchoolId == null)
            {
                sclid = "%";
            }
            else
            {
                sclid = SchoolId;
            }

            var             SchoolHouse = Connection.SMGTgetSchoolHouseadd(sclid).ToList();
            List <tblHouse> Shouselist  = SchoolHouse.Select(x => new tblHouse
            {
                HouseId   = x.HouseId,
                HouseName = x.HouseName,
                IsActive  = x.IsActive
            }).ToList();



            var             SchoolGrade     = Connection.SMGTgetSchoolGrade(sclid).ToList();//Need to Pass a Session Schoolid
            List <tblGrade> SchoolGradeList = SchoolGrade.Select(x => new tblGrade
            {
                GradeId   = x.GradeId,
                GradeName = x.GradeName,
                IsActive  = x.IsActive
            }).ToList();



            List <tblClass> Sclasslist = Connection.tblClasses.Where(X => X.IsActive == "Y").ToList();

            ViewBag.classDrpDown = new SelectList(Sclasslist, "ClassId", "ClassName");


            ViewBag.SGradeDrpDown = new SelectList(SchoolGradeList, "GradeId", "GradeName");


            ViewBag.HouseDrpDown = new SelectList(Shouselist, "HouseId", "HouseName");

            ViewBag.SchoolDrpDown = new SelectList(Scllist, "SchoolId", "SchoolName");


            List <tblSchoolCategory> SCategorylist = Connection.tblSchoolCategories.Where(X => X.IsActive == "Y").ToList();

            ViewBag.SchoolCategoryDrpDown = new SelectList(SCategorylist, "SchoolCategoryId", "SchoolCategoryName");
            //  ViewBag.SchoolCategoryDrpDown = TCtable.SchoolCategory;
            List <tblProvince> provincelist = Connection.tblProvinces.Where(X => X.IsActive == "Y").ToList();

            ViewBag.ProvinceDrpDown = new SelectList(provincelist, "ProvinceId", "ProvinceName");
            List <tblSchoolGroup> schoolgrps = Connection.tblSchoolGroups.Where(X => X.IsActive == "Y").ToList();

            ViewBag.SGroupDrpDown = new SelectList(schoolgrps, "GroupId", "GroupName");
            List <tblDistrict> districtlist = Connection.tblDistricts.Where(X => X.IsActive == "Y").ToList();

            ViewBag.DistrictDrpDown = new SelectList(districtlist, "DistrictId", "DistrictName");
            List <tblDivision> divisionlist = Connection.tblDivisions.Where(X => X.IsActive == "Y").ToList();

            ViewBag.DivisionDrpDown = new SelectList(divisionlist, "DivisionId", "DivisionName");
            List <tblSchoolRank> Ranklist = Connection.tblSchoolRanks.Where(X => X.IsActive == "Y").ToList();

            ViewBag.RankDrpDown = new SelectList(Ranklist, "SchoolRankId", "SchoolRankName");
            List <tblSubject> sclSublist = Connection.tblSubjects.Where(X => X.IsActive == "Y").ToList();

            ViewBag.SubjectscldrpList = new SelectList(sclSublist, "SubjectId", "SubjectName");
            List <tblExtraCurricularActivity> excatlist = Connection.tblExtraCurricularActivities.Where(X => X.IsActive == "Y").ToList();

            ViewBag.ActivitydrpList = new SelectList(excatlist, "ActivityCode", "ActivityName");
            List <tblSubjectCategory> sclSubcatlist = Connection.tblSubjectCategories.Where(X => X.IsActive == "Y").ToList();

            ViewBag.SubcatscldrpList = new SelectList(sclSubcatlist, "SubjectCategoryId", "SubjectCategoryName");
            TModel.HouseId           = TCtable.HouseId;
            TModel.GradeId           = TCtable.GradeId;
            TModel.SchoolId          = TCtable.SchoolId;
            TModel.SchoolIdw         = TCtable.SchoolId;


            var SchoolClass = Connection.SMGTgetclassadd(SchoolId, TModel.GradeId).OrderBy(X => X.ClassName).ToList();

            List <tblClass> SchoolGradeclasseList = SchoolClass.Select(x => new tblClass
            {
                ClassId   = x.ClassId,
                ClassName = x.ClassName
            }).ToList();

            ViewBag.SelectedschoolList = new SelectList(SchoolGradeclasseList, "ClassId", "ClassName");



            return(PartialView("StudentEditView", TModel));
        }