Exemplo n.º 1
0
        private List <OrganizationsJobs> GetOrganizationJobChildren(List <OrganizationsJobs> withChildrenOrganizationsJobs, int OrganizationJobID)
        {
            try
            {
                OrganizationsJobs SelectedOrganizationJob = GetByOrganizationJobID(OrganizationJobID);

                foreach (var item in new HCMEntities().OrganizationsJobs
                         .Include("Ranks")
                         .Include("Jobs")
                         .Include("OrganizationsStructures")
                         .Include("OrganizationsJobsStatus")
                         .Include("JobsOperationsTypes")
                         .Where(x => x.OrganizationJobParentID == SelectedOrganizationJob.OrganizationJobID))
                {
                    withChildrenOrganizationsJobs.Add(item);
                    GetOrganizationJobChildren(withChildrenOrganizationsJobs, item.OrganizationJobID);
                }

                return(withChildrenOrganizationsJobs);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public int Close(PromotionsRecords PromotionRecordObj)
        {
            try
            {
                using (var db = new HCMEntities())
                {
                    PromotionsRecords PromotionRecord = db.PromotionsRecords.Find(PromotionRecordObj.PromotionRecordID);
                    PromotionRecord.PromotionRecordStatusID = PromotionRecordObj.PromotionRecordStatusID;
                    PromotionRecord.ClosingBy       = PromotionRecordObj.ClosingBy;
                    PromotionRecord.ClosingTime     = PromotionRecordObj.ClosingTime;
                    PromotionRecord.LastUpdatedBy   = PromotionRecordObj.LastUpdatedBy;
                    PromotionRecord.LastUpdatedDate = PromotionRecordObj.LastUpdatedDate;

                    foreach (PromotionsRecordsEmployees PromotionRecordEmployeeObj in PromotionRecordObj.PromotionsRecordsEmployees)
                    {
                        PromotionsRecordsEmployees     PromotionRecordEmployee   = db.PromotionsRecordsEmployees.Find(PromotionRecordEmployeeObj.PromotionRecordEmployeeID);
                        PromotionsRecordsJobsVacancies PromotionRecordJobVacancy = db.PromotionsRecordsJobsVacancies.Find(PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.PromotionRecordJobVacancyID);
                        OrganizationsJobs OrganizationJobVacancy = db.OrganizationsJobs.Find(PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.OrganizationJobID);
                        OrganizationJobVacancy.IsVacant        = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.IsVacant;
                        OrganizationJobVacancy.IsReserved      = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.IsReserved;
                        OrganizationJobVacancy.LastUpdatedBy   = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.LastUpdatedBy.Value;
                        OrganizationJobVacancy.LastUpdatedDate = PromotionRecordEmployeeObj.PromotionsRecordsJobsVacancies.OrganizationsJobs.LastUpdatedDate;

                        EmployeesCareersHistory CurrentEmployeeCareerHistory = db.EmployeesCareersHistory.Find(PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.EmployeeCareerHistoryID);
                        CurrentEmployeeCareerHistory.IsActive        = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.IsActive;
                        CurrentEmployeeCareerHistory.LastUpdatedBy   = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.LastUpdatedBy.Value;
                        CurrentEmployeeCareerHistory.LastUpdatedDate = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.LastUpdatedDate;
                        OrganizationsJobs CurrentOrganizationJob = db.OrganizationsJobs.Find(PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.OrganizationJobID);
                        CurrentOrganizationJob.IsVacant        = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.IsVacant;
                        CurrentOrganizationJob.LastUpdatedBy   = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.LastUpdatedBy.Value;
                        CurrentOrganizationJob.LastUpdatedDate = PromotionRecordEmployeeObj.CurrentEmployeesCareersHistory.OrganizationsJobs.LastUpdatedDate;

                        EmployeesCareersHistory NewEmployeeCareerHistory = new EmployeesCareersHistory();
                        NewEmployeeCareerHistory.EmployeeCodeID            = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.EmployeeCodeID;
                        NewEmployeeCareerHistory.CareerHistoryTypeID       = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CareerHistoryTypeID;
                        NewEmployeeCareerHistory.OrganizationJobID         = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.OrganizationJobID;
                        NewEmployeeCareerHistory.JoinDate                  = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.JoinDate;
                        NewEmployeeCareerHistory.CareerDegreeID            = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CareerDegreeID;
                        NewEmployeeCareerHistory.TransactionStartDate      = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.TransactionStartDate;
                        NewEmployeeCareerHistory.CreatedBy                 = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CreatedBy;
                        NewEmployeeCareerHistory.CreatedDate               = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.CreatedDate;
                        NewEmployeeCareerHistory.IsActive                  = PromotionRecordEmployeeObj.NewEmployeesCareersHistory.IsActive;
                        PromotionRecordEmployee.NewEmployeesCareersHistory = NewEmployeeCareerHistory;
                    }
                    return(db.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public List <OrganizationsJobs> GetOrganizationJobHistoryOperationByOrganizationJobID(int OrganizationJobID)
        {
            List <OrganizationsJobs> OrganizationJobHistoryOperation = new List <OrganizationsJobs>();
            OrganizationsJobs        organizationsJobs = GetByOrganizationJobID(OrganizationJobID);

            if (organizationsJobs != null)
            {
                OrganizationJobHistoryOperation.AddRange(GetOrganizationJobChildren(new List <OrganizationsJobs>(), OrganizationJobID));
                OrganizationJobHistoryOperation.Add(organizationsJobs);
                OrganizationJobHistoryOperation.AddRange(GetOrganizationJobParent(new List <OrganizationsJobs>(), OrganizationJobID));
            }
            return(OrganizationJobHistoryOperation.OrderBy(c => c.OrganizationJobID).ToList());
        }
Exemplo n.º 4
0
 public int Delete(int OrganizationJobID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             OrganizationsJobs OrganizationJobObj = db.OrganizationsJobs.FirstOrDefault(x => x.OrganizationJobID.Equals(OrganizationJobID));
             db.OrganizationsJobs.Remove(OrganizationJobObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 5
0
 private List <OrganizationsJobs> GetOrganizationJobParent(List <OrganizationsJobs> withParentOrganizationsJobs, int OrganizationJobID)
 {
     try
     {
         OrganizationsJobs SelectedOrganizationJob = GetByOrganizationJobID(OrganizationJobID);
         if (SelectedOrganizationJob.OrganizationJobParentID != null)
         {
             var item = GetByOrganizationJobID((int)SelectedOrganizationJob.OrganizationJobParentID);
             withParentOrganizationsJobs.Add(item);
             GetOrganizationJobParent(withParentOrganizationsJobs, item.OrganizationJobID);
         }
         return(withParentOrganizationsJobs);
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 6
0
 public int UpdateIsVacant(OrganizationsJobs OrganizationJob)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             OrganizationsJobs OrganizationJobObj = db.OrganizationsJobs.FirstOrDefault(x => x.OrganizationJobID.Equals(OrganizationJob.OrganizationJobID));
             OrganizationJobObj.IsVacant        = OrganizationJob.IsVacant;
             OrganizationJobObj.LastUpdatedDate = OrganizationJob.LastUpdatedDate;
             OrganizationJobObj.LastUpdatedBy   = OrganizationJob.LastUpdatedBy;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 7
0
 public int Insert(OrganizationsJobs OrganizationJob)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.OrganizationsJobs.Add(OrganizationJob);
             return(db.SaveChanges());
         }
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
 }
Exemplo n.º 8
0
 public int Update(OrganizationsJobs OrganizationJob)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             OrganizationsJobs OrganizationJobObj = db.OrganizationsJobs.FirstOrDefault(x => x.OrganizationJobID.Equals(OrganizationJob.OrganizationJobID));
             OrganizationJobObj.JobNo                   = OrganizationJob.JobNo;
             OrganizationJobObj.OrganizationID          = OrganizationJob.OrganizationID;
             OrganizationJobObj.JobID                   = OrganizationJob.JobID;
             OrganizationJobObj.RankID                  = OrganizationJob.RankID;
             OrganizationJobObj.IsVacant                = OrganizationJob.IsVacant;
             OrganizationJobObj.LastUpdatedDate         = OrganizationJob.LastUpdatedDate;
             OrganizationJobObj.OrganizationJobStatusID = OrganizationJob.OrganizationJobStatusID;
             OrganizationJobObj.LastUpdatedBy           = OrganizationJob.LastUpdatedBy;
             OrganizationJobObj.IsActive                = OrganizationJob.IsActive;
             return(db.SaveChanges());
         }
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
     catch
     {
         throw;
     }
 }