Example #1
0
 private void frmSemester_AE_Load(object sender, EventArgs e)
 {
     if (ADD_STATE)
     {
         int yearStart = dtStart.Value.Year;
         int yearEnd   = yearStart + 1;
         txtSchoolYear.Text = string.Concat(yearStart.ToString(), "-", yearEnd.ToString());
     }
     else if (!ADD_STATE && semesterId > 0)
     {
         SemesterModel md = svc.Semester_SelectById(semesterId);
         cmbSemester.Text   = md.SemesterDesc;
         dtStart.Value      = md.StartDate;
         dtEnd.Value        = md.EndDate;
         txtSchoolYear.Text = md.SchoolYear;
         if (md.IsActive)
         {
             rdActive.Checked   = true;
             rdInactive.Checked = false;
         }
         else
         {
             rdActive.Checked   = false;
             rdInactive.Checked = true;
         }
         bttnSave.Text = "Edit Item";
     }
 }
Example #2
0
 public void Update(SemesterModel model)
 {
     if (ModelState.IsValid)
     {
         _repository.Update(model);
     }
 }
        public async Task <SemesterModel> UpdateSemesterAsync(SemesterModel semester)
        {
            var semesterEntity = _mapper.Map <Semester>(semester);
            await _semesterRepository.UpdateSemesterAsync(semesterEntity);

            return(semester);
        }
Example #4
0
        public SemesterModel CreateOrUpdate(SemesterModel model)
        {
            Logger.Debug($"{model}");

            if (model == null)
            {
                throw new System.ArgumentNullException("model");
            }

            Semester semester = null;

            if (model.Id == null || model.Id == System.Guid.Empty)
            {
                semester = this.UnitOfWork.SemesterRepository.CreateSemester(model.OrganizationId, model.Name, model.ShortName, model.HighlightColor, model.IsActive);
            }
            else
            {
                semester = this.UnitOfWork.SemesterRepository.UpdateSemester(model.Id, model.Name, model.ShortName, model.HighlightColor, model.IsActive);
            }

            this.UnitOfWork.SaveChanges();

            SemesterModel semesterModel = Mapper.Map <Models.Semester, Models.SemesterModel>(semester);

            return(semesterModel);
        }
Example #5
0
 public void Insert(SemesterModel model)
 {
     if (ModelState.IsValid)
     {
         _repository.Insert(model);
     }
 }
Example #6
0
        public IActionResult AddSemester(int semesterId, string operationType)
        {
            var model = new SemesterModel(semesterId, operationType, _semesterService);

            _session.SetString("OperationType", operationType);
            return(PartialView("_AddSemester", model));
        }
Example #7
0
        public async Task <IActionResult> AddSemester(SemesterModel model)
        {
            try
            {
                var    OperationType = _session.GetString("OperationType");
                var    semester      = new Semester();
                string mesaj         = "";

                //Yeni Kayıt İse ekle
                if (OperationType == Constants.OperationType.Insert)
                {
                    #region Semester Sistemde Var Mı Kontrolü
                    semester = await _semesterService.SingleOrDefaultAsync(x => x.Name == model.Name && x.SemesterType == model.SemesterType && x.IsDeleted == false);

                    if (semester != null)
                    {
                        return(Json(new JsonMessage {
                            HataMi = true, Baslik = "İşlem Başarısız", Mesaj = "Eklemek istediğiniz özelliklere sahip semester sistemde zaten mevcut."
                        }));
                    }
                    #endregion

                    #region Semester Ekle
                    semester = new Semester
                    {
                        Name         = model.Name,
                        SemesterType = model.SemesterType,
                        Code         = model.Code,
                        IsDeleted    = false
                    };
                    await _semesterService.AddAsync(semester);

                    mesaj = "Yeni Semester Başarıyle Eklendi.";
                    #endregion
                }
                if (OperationType == Constants.OperationType.Update)
                {
                    #region Update İşlemi
                    semester = await _semesterService.GetByIdAsync(model.Id);

                    semester.Name         = model.Name;
                    semester.SemesterType = model.SemesterType;
                    semester.Code         = model.Code;
                    _semesterService.Update(semester);
                    mesaj = "Yeni Semester Başarıyle Güncellendi.";
                    #endregion
                }

                return(Json(new JsonMessage {
                    HataMi = false, Baslik = "İşlem Başarılı", Mesaj = mesaj
                }));
            }
            catch (Exception ex)
            {
                return(Json(new JsonMessage {
                    HataMi = true, Baslik = "İşlem Başarısız", Mesaj = "İşlem Sırasında Hata Oluştu."
                }));
            }
        }
        public async Task <SemesterModel> CreateSemesterAsync(SemesterModel semester)
        {
            var semesterEntity = _mapper.Map <Semester>(semester);
            var result         = await _semesterRepository.CreateSemesterAsynd(semesterEntity);

            semester = _mapper.Map <SemesterModel>(result);
            return(semester);
        }
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            SemesterModel semesterModel = await db.Semesters.FindAsync(id);

            db.Semesters.Remove(semesterModel);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #10
0
 public IActionResult AddSemester([FromBody] SemesterModel model)
 {
     if (ModelState.IsValid)
     {
         service.AddSemester(model);
         return(Json(new Result(true)));
     }
     return(Json(new Result(ModelState.GetFirstError())));
 }
Example #11
0
        public async Task <ActionResult> Edit([Bind(Include = "SemesterID,Session")] SemesterModel semesterModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(semesterModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(semesterModel));
        }
Example #12
0
        public async Task <ActionResult> Create([Bind(Include = "SemesterID,Session")] SemesterModel semesterModel)
        {
            if (ModelState.IsValid)
            {
                db.Semesters.Add(semesterModel);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(semesterModel));
        }
Example #13
0
 public IActionResult UpdateSemester([FromBody] SemesterModel model)
 {
     if (ModelState.IsValid)
     {
         string errorMessage = string.Empty;
         if (service.UpdateSemester(model, ref errorMessage))
         {
             return(Json(new Result(true)));
         }
         return(Json(new Result(errorMessage)));
     }
     return(Json(new Result(ModelState.GetFirstError())));
 }
Example #14
0
 private ModelLocator()
 {
     SessionModel    = new SessionModel();
     CourseModel     = new CourseModel();
     ExamModel       = new ExamModel();
     FacultyModel    = new FacultyModel();
     PostModel       = new PostModel();
     ProgrammeModel  = new ProgrammeModel();
     UniversityModel = new UniversityModel();
     UserModel       = new UserModel();
     SemesterModel   = new SemesterModel();
     LogModel        = new LogModel();
 }
        // GET: UserRegistration
        public ActionResult Index()
        {
            var courseOrchestrator = new CourseOrchestrator();

            var semesterModel = new SemesterModel
            {
                Courses  = courseOrchestrator.GetAllCourses(),
                Semester = SemesterEnum.Spring,
                Year     = 2019
            };

            return(View(semesterModel));
        }
Example #16
0
 public void AddSemester(SemesterModel model)
 {
     using (SZPNUWContext context = new SZPNUWContext())
     {
         Semesters semester = new Semesters()
         {
             Fieldofstudy   = model.Department,
             Academicyear   = model.Year,
             Semesternumber = model.SemesterNumber
         };
         context.Add(semester);
         context.SaveChanges();
     }
 }
Example #17
0
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SemesterModel semesterModel = await db.Semesters.FindAsync(id);

            if (semesterModel == null)
            {
                return(HttpNotFound());
            }
            return(View(semesterModel));
        }
Example #18
0
 public SemesterModel GetSemesterById(int id)
 {
     using (SZPNUWContext context = new SZPNUWContext())
     {
         Semesters     semester = context.Semesters.FirstOrDefault(s => s.Id == id);
         SemesterModel model    = new SemesterModel()
         {
             Id             = semester.Id,
             Department     = semester.Fieldofstudy,
             SemesterNumber = semester.Semesternumber,
             Year           = semester.Academicyear
         };
         return(model);
     }
 }
Example #19
0
        public SemesterModel GetSemester(SemesterModel model)
        {
            Logger.Debug($"{model}");

            if (model == null || model.Id == null || model.Id == System.Guid.Empty)
            {
                throw new System.ArgumentNullException("model");
            }

            Semester semester = this.UnitOfWork.SemesterRepository.GetById(model.Id);

            SemesterModel semesterModel = Mapper.Map <Models.Semester, Models.SemesterModel>(semester);

            return(semesterModel);
        }
        public ActionResult Marks(long personId)
        {
            var semesters = MdlBlockDofSAgesRepository.GetAll().ToArray();

            var student    = MdlBlockDofSPersonsRepository.GetById(personId);
            var department = MdlBlockDofSDepartmentsRepository.GetById(student.departmentid.Value);

            var model = new StudentCardMarksModel();

            foreach (var semester in semesters)
            {
                var cstreamses = MdlBlockDofSCstreamsRepository
                                 .GetMany(e => e.departmentid == department.id && e.ageid == semester.id)
                                 .ToArray();

                if (cstreamses.Any())
                {
                    var semesterModel = new SemesterModel
                    {
                        Name = semester.name
                    };

                    foreach (var cstreamse in cstreamses)
                    {
                        if (MdlBlockDofSCpassedRepository.Any(e => e.programmitemid == cstreamse.programmitemid && e.studentid == personId))
                        {
                            var programmItem = MdlBlockDofSProgrammitemsRepository.GetById(cstreamse.programmitemid.Value);

                            semesterModel.Disciplines.Add(new DisciplineModel
                            {
                                Code  = cstreamse.name,
                                Hours = cstreamse.hours,
                                Name  = programmItem.name
                            });
                        }
                    }

                    if (semesterModel.Disciplines.Any())
                    {
                        model.Semesters.Add(semesterModel);
                    }
                }
            }

            return(PartialView("~/Views/StudentCard/Marks.cshtml", model));
        }
Example #21
0
 public bool UpdateSemester(SemesterModel model, ref string errorMessage)
 {
     using (SZPNUWContext context = new SZPNUWContext())
     {
         Semesters semester = context.Semesters.FirstOrDefault(x => x.Id == model.Id);
         if (semester != null)
         {
             semester.Fieldofstudy   = model.Department;
             semester.Academicyear   = model.Year;
             semester.Semesternumber = model.SemesterNumber;
             context.SaveChanges();
             return(true);
         }
         errorMessage = PortalMessages.NoSuchElement;
         return(false);
     }
 }
        public async Task <List <SemesterModel> > GetAllSemestersByStudentAsync(Guid studentId)
        {
            var result      = _mapper.Map <List <StudentSemesterModel> >(await _semesterRepository.GetAllSemestersByStudentAsync(studentId));
            var semesters   = _mapper.Map <List <SemesterModel> >(await _semesterRepository.GetAllSemesterAsync());
            var finalResult = new List <SemesterModel>();

            foreach (var item in result)
            {
                var semester = new SemesterModel
                {
                    SemesterId = item.SemesterId,
                    Name       = semesters.FirstOrDefault(x => x.SemesterId == item.SemesterId).Name
                };
                finalResult.Add(semester);
            }
            return(finalResult);
        }
Example #23
0
        public List <SemesterModel> GetSemesters()
        {
            string query = "SELECT * FROM Semester";

            Command = new SqlCommand(query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <SemesterModel> semesterList = new List <SemesterModel>();

            while (Reader.Read())
            {
                SemesterModel semester = new SemesterModel();
                semester.Id       = Convert.ToInt32(Reader["Id"]);
                semester.Semester = Reader["Semester"].ToString();

                semesterList.Add(semester);
            }
            Connection.Close();
            return(semesterList);
        }
Example #24
0
        public List <SemesterModel> GetAllSemesters()
        {
            List <SemesterModel> semestersList = new List <SemesterModel>();
            SqlConnection        connection    = new SqlConnection(connectionString);
            string     query   = "SELECT * FROM semester_tbl";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                SemesterModel aSemesterModel = new SemesterModel();
                aSemesterModel.semesterId   = Convert.ToInt32(reader["id"]);
                aSemesterModel.semesterName = reader["semester"].ToString();
                semestersList.Add(aSemesterModel);
            }
            connection.Close();
            return(semestersList);
        }
Example #25
0
        public SemesterModel GetSemesterById(int semesterId)
        {
            SemesterModel aSemesterModel = new SemesterModel();
            SqlConnection aSqlConnection = new SqlConnection(connectionString);
            string        query          = "SELECT * FROM semester_tbl WHERE id=@id";

            SqlCommand aSqlCommand = new SqlCommand(query, aSqlConnection);

            aSqlCommand.Parameters.Clear();

            aSqlCommand.Parameters.AddWithValue("@id", semesterId);
            aSqlConnection.Open();
            SqlDataReader aSqlDataReader = aSqlCommand.ExecuteReader();

            while (aSqlDataReader.Read())
            {
                aSemesterModel.semesterId   = Convert.ToInt32(aSqlDataReader["id"]);
                aSemesterModel.semesterName = aSqlDataReader["semester"].ToString();
            }
            return(aSemesterModel);
        }
Example #26
0
        // GET: Course
        public ActionResult Index()
        {
            var courseOrchestrator = new CourseOrchestrator();

            var semesterModel = new SemesterModel
            {
                Courses  = courseOrchestrator.GetAllCourses(),
                Semester = SemesterEnum.Fall,
                Year     = 2018
            };

            var detailsModel = new DetailsModel
            {
                FirstName = "Henry",
                LastName  = "Dang",
                Gender    = GenderEnum.Male,
                Age       = 21,
                Major     = "BIS"
            };

            return(View(detailsModel));
        }
Example #27
0
        public SemesterModel GetSemesterWithOrganization(SemesterModel model)
        {
            Logger.Debug($"{model}");

            if (model == null || model.Id == null || model.Id == System.Guid.Empty)
            {
                throw new System.ArgumentNullException("model");
            }

            Semester semester = this.UnitOfWork.SemesterRepository.GetById(model.Id);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Organization.Models.Organization, Organization.Models.OrganizationModel>().ForMember(x => x.Semesters, y => y.Ignore());
                cfg.CreateMap <Organization.Models.Semester, Organization.Models.SemesterModel>();
            });

            var mapper = config.CreateMapper();

            SemesterModel semesterModel = mapper.Map <Models.Semester, Models.SemesterModel>(semester);

            return(semesterModel);
        }
Example #28
0
 public void Semester_Update(SemesterModel sem)
 {
     try
     {
         using (var con = GetDbConnection())
         {
             con.Execute("dbo.Usp_Semester_Update",
                         new
             {
                 @iIntSemesterId   = sem.SemesterId,
                 @iStrSemesterDesc = sem.SemesterDesc,
                 @iStrSchoolYear   = sem.SchoolYear,
                 @iDtStartDate     = sem.StartDate,
                 @iDtEndDate       = sem.EndDate,
                 @iBitIsActive     = sem.IsActive
             }, commandType: CommandType.StoredProcedure);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #29
0
        public List <SemesterModel> GetAllSemester()
        {
            connection.ConnectionString = connectionString;

            string     query   = "SELECT * FROM Semester";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader        reader       = command.ExecuteReader();
            List <SemesterModel> semesterlist = new List <SemesterModel>();

            while (reader.Read())
            {
                SemesterModel semester = new SemesterModel();
                semester.SemesterId = Convert.ToInt32(reader["Id"].ToString());
                semester.Semester   = reader["SemesterName"].ToString();
                semesterlist.Add(semester);
            }

            reader.Close();
            connection.Close();
            return(semesterlist);
        }
        public List <SemesterModel> GateAllSemesterGateway()
        {
            SqlConnection con   = new SqlConnection(connectionString);
            string        query = "select * from Semester";
            SqlCommand    cmd   = new SqlCommand(query, con);

            con.Open();
            SqlDataReader        dataReader     = cmd.ExecuteReader();
            List <SemesterModel> semesterModels = new List <SemesterModel>();

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    SemesterModel semesterModel = new SemesterModel();
                    semesterModel.SemesterId   = Convert.ToInt32(dataReader["SemesterID"]);
                    semesterModel.SemesterName = dataReader["SemiName"].ToString();
                    semesterModels.Add(semesterModel);
                }
                dataReader.Close();
            }
            con.Close();
            return(semesterModels);
        }