//public ActionResult Index()
        //{
        //    var student = Connection.SMGTGetStudent();

        //    List<SMGTGetStudent_Result> Categorylist = student.ToList();
        //    StudentModel schl = new StudentModel();
        //    List<StudentModel> tcmlist = Categorylist.Select(x => new StudentModel
        //    {

        //        SchoolId = x.SchoolId,
        //        SchoolName = x.SchoolName,
        //        DateOfBirth = x.DateofBirth,
        //        CreatedDate = x.CreatedDate,
        //        StudentId = x.StudentId,
        //        StudentName = x.studentName,



        //        IsActive = x.IsActive,
        //        ModifiedBy = x.ModifiedBy,
        //        ModifiedDate = x.ModifiedDate

        //    }).ToList();



        //    return View(tcmlist);
        //}

        //
        // GET: /Student/Details/5

        public ActionResult Details(string StudentId, string SchoolId)
        {
            Authentication("STCF");
            StudentModel TModel = new StudentModel();

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


            //  TModel.IsActive = TCtable.IsActive;


            TModel.StudentId     = TCtable.StudentId;
            TModel.StudentName   = TCtable.studentName;
            TModel.DateOfBirth   = TCtable.DateofBirth;
            TModel.ClassId       = TCtable.ClassId;
            TModel.Gender        = TCtable.Gender;
            TModel.Gender        = TCtable.Gender;
            TModel.ImagePathname = TCtable.ImgUrl;
            TModel.GradeId       = TCtable.GradeId;
            TModel.HouseId       = TCtable.HouseId;

            tblClass sclrank = Connection.tblClasses.SingleOrDefault(x => x.ClassId == TModel.ClassId && x.GradeId == TModel.GradeId && x.SchoolId == SchoolId);

            TModel.ClassId = sclrank.ClassName;
            tblGrade sclgrade = Connection.tblGrades.SingleOrDefault(x => x.GradeId == TModel.GradeId);

            TModel.GradeId = sclgrade.GradeName;
            tblHouse sclhouse = Connection.tblHouses.SingleOrDefault(x => x.SchoolId == SchoolId && x.HouseId == TModel.HouseId);

            TModel.HouseId = sclhouse.HouseName;
            return(View("Detail", TModel));
        }
Exemple #2
0
        public bool Update(HouseEntity houseEntity)
        {
            try
            {
                CondominiumManagementSystemDBEntities entity = new CondominiumManagementSystemDBEntities();
                tblHouse newHouse = new tblHouse();
                newHouse.ID          = houseEntity.ID;
                newHouse.RegionID    = houseEntity.RegionID;
                newHouse.SubCityID   = houseEntity.SubCityID;
                newHouse.WoredaID    = houseEntity.WoredaID;
                newHouse.BlockNumber = houseEntity.BlockNumber;
                newHouse.FloorNumber = houseEntity.FloorNumber;
                newHouse.GovernmentTransferedDate = houseEntity.GovernmentTransferedDate;
                newHouse.HouseNumber = houseEntity.HouseNumber;
                newHouse.SiteName    = houseEntity.SiteName;

                tblHouse oldHouse = entity.tblHouses.Where(x => x.ID == houseEntity.ID).FirstOrDefault();
                entity.Entry(oldHouse).CurrentValues.SetValues(newHouse);

                entity.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #3
0
        public bool Save(HouseEntity houseEntity)
        {
            try
            {
                CondominiumManagementSystemDBEntities entity = new CondominiumManagementSystemDBEntities();
                tblHouse house = new tblHouse();
                house.ID          = houseEntity.ID;
                house.RegionID    = houseEntity.RegionID;
                house.SubCityID   = houseEntity.SubCityID;
                house.WoredaID    = houseEntity.WoredaID;
                house.BlockNumber = houseEntity.BlockNumber;
                house.FloorNumber = houseEntity.FloorNumber;
                house.GovernmentTransferedDate = houseEntity.GovernmentTransferedDate;
                house.HouseNumber = houseEntity.HouseNumber;
                house.SiteName    = houseEntity.SiteName;

                entity.tblHouses.Add(house);
                entity.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #4
0
        public ActionResult Details(string StudentId, string SchoolId)
        {
            StudentModel TModel = new StudentModel();

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


            //  TModel.IsActive = TCtable.IsActive;

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



            TModel.DateOfBirth = TCtable.DateofBirth;

            if (TCtable.DateofBirth == null)
            {
            }
            else
            {
                string   a = TCtable.DateofBirth.ToString();
                DateTime b = DateTime.Parse(a);
                TModel.datetimestring = b.ToShortDateString();
            }

            TModel.ClassId       = TCtable.ClassId;
            TModel.Gender        = TCtable.Gender;
            TModel.Gender        = TCtable.Gender;
            TModel.ImagePathname = TCtable.ImgUrl;
            TModel.GradeId       = TCtable.GradeId;
            TModel.HouseId       = TCtable.HouseId;
            if (TCtable.ImgUrl == null || TCtable.ImgUrl == "")
            {
                TModel.ImagePathname = "~/Uploads/Student/Photo/no_image.jpg";
            }
            else
            {
                TModel.ImagePathname = TCtable.ImgUrl;
            }
            tblClass sclrank = Connection.tblClasses.SingleOrDefault(x => x.ClassId == TModel.ClassId && x.GradeId == TModel.GradeId && x.SchoolId == SchoolId);

            TModel.ClassId = sclrank.ClassName;
            tblGrade sclgrade = Connection.tblGrades.SingleOrDefault(x => x.GradeId == TModel.GradeId);

            TModel.GradeId = sclgrade.GradeName;
            if (TModel.HouseId == null)
            {
            }
            else
            {
                tblHouse sclhouse = Connection.tblHouses.SingleOrDefault(x => x.SchoolId == SchoolId && x.HouseId == TModel.HouseId);
                TModel.HouseId = sclhouse.HouseName;
            }
            return(View("Detail", TModel));
        }
Exemple #5
0
        public bool Delete(int houseID)
        {
            try
            {
                CondominiumManagementSystemDBEntities entity = new CondominiumManagementSystemDBEntities();
                tblHouse oldHouse = entity.tblHouses.Where(x => x.ID == houseID).FirstOrDefault();

                entity.tblHouses.Remove(oldHouse);
                entity.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }