Example #1
0
        public string DeleteConditionInGroupCondition(Guid GroupConditionID, string ConditionIDs)
        {
            using (var context = new VnrHrmDataContext())
            {
                var         unitOfWork     = (IUnitOfWork)(new UnitOfWork(context));
                var         repo           = new Rec_GroupConditionRepository(unitOfWork);
                var         ilConditionIDs = ConditionIDs.Split(',');
                List <Guid> lsConditionIDs = new List <Guid>();
                lsConditionIDs = ConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();

                Rec_GroupCondition GroupCondition = repo.GetById(GroupConditionID);
                if (GroupCondition == null)
                {
                    return(null);
                }
                List <Guid> lstCondition = new List <Guid>();
                lstCondition = GroupCondition.JobConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                if (lstCondition != null && lstCondition.Count != 0)
                {
                    lstCondition = lstCondition.Where(x => !lsConditionIDs.Contains(x)).ToList();
                    GroupCondition.JobConditionIDs = string.Join(",", lstCondition);
                    repo.SaveChanges();
                    return(GroupCondition.JobConditionIDs);
                }
            }
            return(null);
        }
Example #2
0
        public string DeleteConditionInGroupCondition(Guid GroupConditionID, string ConditionIDs)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_GroupConditionRepository(unitOfWork);
                var ilConditionIDs = ConditionIDs.Split(',');
                List<Guid> lsConditionIDs = new List<Guid>();
                lsConditionIDs = ConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();

                Rec_GroupCondition GroupCondition = repo.GetById(GroupConditionID);
                if (GroupCondition == null)
                    return null;
                List<Guid> lstCondition = new List<Guid>();
                lstCondition = GroupCondition.JobConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                if (lstCondition != null && lstCondition.Count != 0)
                {
                    lstCondition = lstCondition.Where(x => !lsConditionIDs.Contains(x)).ToList();
                    GroupCondition.JobConditionIDs = string.Join(",", lstCondition);
                    repo.SaveChanges();
                    return GroupCondition.JobConditionIDs;
                }
            }
            return null;
        }
Example #3
0
 public string AddConditionIntoGroupCondition(Guid GroupConditionID, string ConditionIDs)
 {
     using (var context = new VnrHrmDataContext())
     {
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo       = new Rec_GroupConditionRepository(unitOfWork);
         Rec_GroupCondition GroupCondition = repo.GetById(GroupConditionID);
         if (GroupCondition == null)
         {
             return(null);
         }
         List <Guid> lstCondition    = new List <Guid>();
         List <Guid> lstAddCondition = new List <Guid>();
         lstAddCondition = ConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
         if (!string.IsNullOrEmpty(GroupCondition.JobConditionIDs))
         {
             lstCondition = GroupCondition.JobConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
         }
         lstCondition.AddRange(lstAddCondition);
         lstCondition = lstCondition.Distinct().ToList();
         GroupCondition.JobConditionIDs = string.Join(",", lstCondition);
         repo.SaveChanges();
         return(GroupCondition.JobConditionIDs);
     }
 }
Example #4
0
        public string AddConditionIntoGroupCondition(Guid GroupConditionID, string ConditionIDs)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_GroupConditionRepository(unitOfWork);
                Rec_GroupCondition GroupCondition = repo.GetById(GroupConditionID);
                if (GroupCondition == null)
                    return null;
                List<Guid> lstCondition = new List<Guid>();
                List<Guid> lstAddCondition = new List<Guid>();
                lstAddCondition = ConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                if (!string.IsNullOrEmpty(GroupCondition.JobConditionIDs))
                {
                    lstCondition = GroupCondition.JobConditionIDs.Split(',').Select(x => Guid.Parse(x)).ToList();
                }
                lstCondition.AddRange(lstAddCondition);
                lstCondition = lstCondition.Distinct().ToList();
                GroupCondition.JobConditionIDs = string.Join(",", lstCondition);
                repo.SaveChanges();
                return GroupCondition.JobConditionIDs;
            }

        }