Пример #1
0
        public bool CheckIfContactDocumentNumberExits(Contact model)
        {
            var result = false;
            var data   = GetAll.FirstOrDefault(x => x.ContactDocumentNumber == model.ContactDocumentNumber);

            if (data != null)
            {
                result = data.ContactId == model.ContactId ? false : true;

                _context.Entry(data).State = EntityState.Detached;
                _context.Entry(data.ContactAddres).State        = EntityState.Detached;
                _context.Entry(data.ContactCommunication).State = EntityState.Detached;
                //_context.Entry(data.ContactCommunication.Communication).State = EntityState.Detached;
            }


            return(result);
        }
        public void Save(ScholarshipProgramTracingStudentPractice model)
        {
            var now = DateTime.Now;

            if (model.Id != 0)
            {
                var currentData = _context.ScholarshipProgramTracingStudentPractice.Find(model.Id);
                model.UpgradeDate = now;
                //_context.ScholarshipProgramTracingStudentPractice.Update(model);

                _context.Entry(currentData).CurrentValues.SetValues(model);
                _context.Entry(currentData).State = EntityState.Modified;
            }
            else
            {
                model.CreationDate = now;
                model.StatusId     = StatusValues.Activo;
                _context.Add(model);
            }
            _context.SaveChanges();
        }
Пример #3
0
        public void Save(File model)
        {
            var now = DateTime.Now;

            if (model.FileId != 0)
            {
                var currentData = _context.File.Find(model.FileId);
                model.UpgradeDate = now;
                model.UpgradeDate = now;

                _context.Entry(currentData).CurrentValues.SetValues(model);
                _context.Entry(currentData).State = EntityState.Modified;
            }
            else
            {
                model.CreationDate = now;
                model.StatusId     = StatusValues.Activo;
                _context.Add(model);
            }
            _context.SaveChanges();
        }
        public void Save(ResultsFromThePreviousPeriod model)
        {
            var now = DateTime.Now;

            if (model.PreviousPeriodId != 0)
            {
                var currentData = _context.ResultsFromThePreviousPeriod.Find(model.PreviousPeriodId);


                model.UpgradeDate = now;
                _context.Entry(currentData).CurrentValues.SetValues(model);
                _context.Entry(currentData).State = EntityState.Modified;
            }

            else
            {
                model.StatusId     = StatusValues.Activo;
                model.CreationDate = now;
                _context.Add(model);
            }

            _context.SaveChanges();
        }
        public void Save(ScholarshipProgramTracingPracticePlanning model)
        {
            var now             = DateTime.Now;
            var stactusActivate = 1;

            if (model.Id != 0)
            {
                var currentData = _context.ScholarshipProgramTracingPracticePlanning.Find(model.Id);

                model.UpgradeDate = now;

                _context.Entry(currentData).CurrentValues.SetValues(model);
                _context.Entry(currentData).State = EntityState.Modified;
            }
            else
            {
                model.CreationDate = now;
                model.StatusId     = stactusActivate;
                _context.Add(model);
            }

            _context.SaveChanges();
        }
Пример #6
0
        public bool CheckIfSubjectMatterCodeExits(SubjectMatter subjectMatter)
        {
            var checkIfItExits = GetAll.FirstOrDefault(x => x.SubjectMatterCode == subjectMatter.SubjectMatterCode &&
                                                       x.ScholarshipProgramUniversityId == subjectMatter.ScholarshipProgramUniversityId);


            bool result = false;;

            if (checkIfItExits != null)
            {
                if (checkIfItExits.SubjectMatterId != subjectMatter.SubjectMatterId)
                {
                    result = true;
                }
            }

            if (checkIfItExits != null)
            {
                _context.Entry(checkIfItExits).State = EntityState.Detached;
                _context.Entry(checkIfItExits.TracingStudyPlanDevelopment).State = EntityState.Detached;
            }

            return(result);
        }