public bool SaveData_SchedulingLeave(EmployeeProjectPlanner_Scheduling_DocumentsViewModel model, int UserId)
 {
     if (model.Id > 0)
     {
         var Leave = _db.Employee_ProjectPlanner_Scheduling.Where(x => x.Id == model.Id).FirstOrDefault();
         Leave.EmployeeId     = model.EmployeeId;
         Leave.IsDayOrMore    = model.IsDayOrMore;
         Leave.IsLessThenADay = model.IsLessThenADay;
         if (model.IsDayOrMore)
         {
             var StartDateToString = DateTime.ParseExact(model.StartDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.StartDate = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
             var EndDateToString = DateTime.ParseExact(model.EndDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.EndDate      = Convert.ToDateTime(EndDateToString.ToString(outputFormat));
             Leave.DurationDays = model.DurationDays;
             Leave.DurationHr   = 0;
             Leave.InTimeHr     = 0;
             Leave.InTimeMin    = 0;
             Leave.EndTimeHr    = 0;
             Leave.EndTimeMin   = 0;
         }
         if (model.IsLessThenADay)
         {
             var StartDateToString = DateTime.ParseExact(model.StartDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.StartDate    = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
             Leave.InTimeHr     = model.InTimeHr;
             Leave.InTimeMin    = model.InTimeMin;
             Leave.EndTimeHr    = model.EndTimeHr;
             Leave.EndTimeMin   = model.EndTimeMin;
             Leave.DurationHr   = model.DurationHr;
             Leave.DurationDays = null;
             Leave.EndDate      = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
         }
         Leave.CustomerId       = model.Customer;
         Leave.ProjectId        = model.Project;
         Leave.AssetId          = model.Asset;
         Leave.Comment          = model.Comments;
         Leave.LastModifiedBy   = UserId;
         Leave.LastModifiedDate = DateTime.Now;
         _db.SaveChanges();
     }
     else
     {
         Employee_ProjectPlanner_Scheduling Leave = new Employee_ProjectPlanner_Scheduling();
         Leave.EmployeeId     = model.EmployeeId;
         Leave.IsDayOrMore    = model.IsDayOrMore;
         Leave.IsLessThenADay = model.IsLessThenADay;
         if (model.IsDayOrMore)
         {
             var StartDateToString = DateTime.ParseExact(model.StartDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.StartDate = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
             var EndDateToString = DateTime.ParseExact(model.EndDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.EndDate      = Convert.ToDateTime(EndDateToString.ToString(outputFormat));
             Leave.DurationDays = model.DurationDays;
         }
         if (model.IsLessThenADay)
         {
             var StartDateToString = DateTime.ParseExact(model.StartDate, inputFormat, CultureInfo.InvariantCulture);
             Leave.StartDate  = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
             Leave.InTimeHr   = model.InTimeHr;
             Leave.InTimeMin  = model.InTimeMin;
             Leave.EndTimeHr  = model.EndTimeHr;
             Leave.EndTimeMin = model.EndTimeMin;
             Leave.DurationHr = model.DurationHr;
             Leave.EndDate    = Convert.ToDateTime(StartDateToString.ToString(outputFormat));
         }
         Leave.CustomerId       = model.Customer;
         Leave.ProjectId        = model.Project;
         Leave.AssetId          = model.Asset;
         Leave.Comment          = model.Comments;
         Leave.Archived         = false;
         Leave.CreatedBy        = UserId;
         Leave.LastModifiedBy   = UserId;
         Leave.CreatedDate      = DateTime.Now;
         Leave.ApprovalStatus   = "Pending";
         Leave.LastModifiedDate = DateTime.Now;
         _db.Employee_ProjectPlanner_Scheduling.Add(Leave);
         _db.SaveChanges();
     }
     return(true);
 }
Exemple #2
0
        public PartialViewResult GetNotificationDetailsByKey(int EmployeeID, string Header, int?DetailsId)
        {
            NotificationMethod _NotificationMethod = new NotificationMethod();

            NotificationDetail _NotificationDetail = new NotificationDetail();

            if (Header == "TimeSheet Request")
            {
                var data = _NotificationMethod.GetTimeSheetNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.Hours        = data.Hours;
                    _NotificationDetail.ProjectName  = data.ProjectName;
                    _NotificationDetail.Day          = data.Day;
                    _NotificationDetail.Date         = data.Date;
                    _NotificationDetail.CustomerName = data.CustomerName;
                    _NotificationDetail.CostCode     = data.CostCode;
                    _NotificationDetail.AssetName    = data.AssetName;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_TimeSheet_Detail TimeSheetDetails = new Employee_TimeSheet_Detail();
                    TimeSheetDetails = _db.Employee_TimeSheet_Detail.Find(DetailsId);
                    if (TimeSheetDetails != null && TimeSheetDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = TimeSheetDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && TimeSheetDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            TimeSheetDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            TimeSheetDetails.IsReadAddRep = true;
                        }
                        if (TimeSheetDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            TimeSheetDetails.IsRead = true;
                        }
                        _db.Entry(TimeSheetDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            if (Header == "Training Request Worker")
            {
                var data = _NotificationMethod.getEmployeeTrainingById(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId          = data.EmployeeId;
                    _NotificationDetail.HeaderType          = "Training Request Worker";
                    _NotificationDetail.StartDate           = Convert.ToString(data.StartDate);
                    _NotificationDetail.EndDate             = Convert.ToString(data.EndDate);
                    _NotificationDetail.TrainingDescription = data.Description;

                    EmployeeTraining trainingDetails = new EmployeeTraining();
                    trainingDetails = _db.EmployeeTrainings.Find(DetailsId);
                    trainingDetails.IsReadWorker     = true;
                    _db.Entry(trainingDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Skill Added")
            {
                var data = _NotificationMethod.getEmployeeSkillById(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.HeaderType = "Skill Added";
                    if (data.GeneralSkillsName != "" && data.GeneralSkillsName != null)
                    {
                        int GenralSkillName = Convert.ToInt32(data.GeneralSkillsName);
                        _NotificationDetail.generalSkill = _db.SkillSets.Where(x => x.Id == GenralSkillName).FirstOrDefault().Name;
                    }
                    else
                    {
                        _NotificationDetail.generalSkill = null;
                    }
                    if (data.TechnicalSkillsName != "" && data.TechnicalSkillsName != null)
                    {
                        int TechnSkillName = Convert.ToInt32(data.TechnicalSkillsName);
                        _NotificationDetail.technicalskill = _db.SkillSets.Where(x => x.Id == TechnSkillName).FirstOrDefault().Name;
                    }
                    else
                    {
                        _NotificationDetail.technicalskill = null;
                    }
                    _NotificationDetail.StartDate = Convert.ToString(data.CreatedDate);

                    Employee_Skills EmpSkillDetails = new Employee_Skills();
                    EmpSkillDetails                  = _db.Employee_Skills.Find(DetailsId);
                    EmpSkillDetails.IsRead           = true;
                    _db.Entry(EmpSkillDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Scheduling Request")
            {
                var data = _NotificationMethod.GetScheduleNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.Hours        = data.Hours;
                    _NotificationDetail.ProjectName  = data.Project;
                    _NotificationDetail.CustomerName = data.Customer;
                    _NotificationDetail.CostCode     = data.AssetName;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.Duration     = data.duration;
                    _NotificationDetail.AssetName    = data.AssetName;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_ProjectPlanner_Scheduling SchedulingDetails = new Employee_ProjectPlanner_Scheduling();
                    SchedulingDetails = _db.Employee_ProjectPlanner_Scheduling.Find(DetailsId);
                    if (SchedulingDetails != null && SchedulingDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = SchedulingDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && SchedulingDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            SchedulingDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            SchedulingDetails.IsReadAddRes = true;
                        }
                        if (SchedulingDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            SchedulingDetails.IsRead = true;
                        }
                        _db.Entry(SchedulingDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Travel Request")
            {
                var data = _NotificationMethod.GetTravelNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.TravelType   = data.Type;
                    _NotificationDetail.FromCountry  = data.FromCountry;
                    _NotificationDetail.FromTown     = data.FromCity;
                    _NotificationDetail.FromPlace    = data.FromPlace;
                    _NotificationDetail.ToCountry    = data.ToCountry;
                    _NotificationDetail.ToTown       = data.ToCity;
                    _NotificationDetail.Toplace      = data.ToPlace;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.Duration     = data.Duration;
                    _NotificationDetail.Hours        = data.Hour;
                    _NotificationDetail.CustomerName = data.CustomerName;
                    _NotificationDetail.ProjectName  = data.ProjectName;
                    _NotificationDetail.CostCode     = data.CostCode;
                    _NotificationDetail.Function     = "";
                    _NotificationDetail.Link         = "";
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();

                    Employee_TravelLeave TravelLeaveDetails = new Employee_TravelLeave();
                    TravelLeaveDetails = _db.Employee_TravelLeave.Find(DetailsId);
                    if (TravelLeaveDetails != null && TravelLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = TravelLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && TravelLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            TravelLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            TravelLeaveDetails.IsReadAddReport = true;
                        }
                        if (TravelLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            TravelLeaveDetails.IsRead = true;
                        }
                        _db.Entry(TravelLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Annual Leave Request")
            {
                var data = _NotificationMethod.GetAnnualLeaveNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.StartDate  = data.StartDate;
                    _NotificationDetail.EndDate    = data.EndDate;
                    _NotificationDetail.HeaderType = "Annual Leave Request";
                    _NotificationDetail.Duration   = data.Duration;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_AnualLeave AnualLeaveDetails = new Employee_AnualLeave();
                    AnualLeaveDetails = _db.Employee_AnualLeave.Find(DetailsId);
                    if (AnualLeaveDetails != null && AnualLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = AnualLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && AnualLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            AnualLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            AnualLeaveDetails.IsReadAddRep = true;
                        }
                        if (AnualLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            AnualLeaveDetails.IsRead = true;
                        }
                        _db.Entry(AnualLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Other Leave Request")
            {
                var data = _NotificationMethod.GetOtherLeaveNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.HeaderType = data.HeaderType;
                    _NotificationDetail.StartDate  = data.StartDate;
                    _NotificationDetail.EndDate    = data.EndDate;
                    _NotificationDetail.Duration   = data.Duration;
                    _NotificationDetail.Reason     = data.Reason;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_OtherLeave OtherLeaveDetails = new Employee_OtherLeave();
                    OtherLeaveDetails = _db.Employee_OtherLeave.Find(DetailsId);
                    if (OtherLeaveDetails != null && OtherLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = OtherLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && OtherLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            OtherLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            OtherLeaveDetails.IsReadAddRep = true;
                        }
                        if (OtherLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            OtherLeaveDetails.IsRead = true;
                        }
                        _db.Entry(OtherLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Maternity/Paternity Leave")
            {
                var data = _NotificationMethod.GetMaternityPatLeaveByKey(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeID;
                    _NotificationDetail.HeaderType = "Maternity/Paternity Leave";
                    _NotificationDetail.StartDate  = Convert.ToString(data.ActualStartDate);
                    _NotificationDetail.EndDate    = Convert.ToString(data.ActualEndDate);
                    _NotificationDetail.dueDate    = Convert.ToString(data.DueDate);
                    _NotificationDetail.Link       = data.Link;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_MaternityOrPaternityLeaves MatPatLeaveDetails = new Employee_MaternityOrPaternityLeaves();
                    MatPatLeaveDetails = _db.Employee_MaternityOrPaternityLeaves.Find(DetailsId);
                    if (MatPatLeaveDetails != null && MatPatLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = MatPatLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && MatPatLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            MatPatLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            MatPatLeaveDetails.IsReadAddRes = true;
                        }
                        if (MatPatLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            MatPatLeaveDetails.IsRead = true;
                        }
                        _db.Entry(MatPatLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Sick Leave")
            {
                var data = _NotificationMethod.getSickLeaveByKey(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId    = data.EmployeeId;
                    _NotificationDetail.HeaderType    = "Sick Leave Request";
                    _NotificationDetail.StartDate     = Convert.ToString(data.StartDate);
                    _NotificationDetail.EndDate       = Convert.ToString(data.EndDate);
                    _NotificationDetail.Duration      = Convert.ToDecimal(data.DurationDays);
                    _NotificationDetail.DoctConsulted = data.DoctorConsulted;
                    _NotificationDetail.Paid          = data.IsPaid;
                    var reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    Employee_SickLeaves SickLeaveDetails = new Employee_SickLeaves();
                    SickLeaveDetails = _db.Employee_SickLeaves.Find(DetailsId);
                    if (SickLeaveDetails != null && SickLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = SickLeaveDetails.ApprovalStatus;
                    }
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    if (aspnetUserDetails != null && SickLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            SickLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            SickLeaveDetails.IsReadAddRep = true;
                        }
                        if (SickLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            SickLeaveDetails.IsRead = true;
                        }

                        _db.Entry(SickLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Training Request")
            {
                var data = _NotificationMethod.GetTrainingNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.TrainingName = data.TrainingName;
                    _NotificationDetail.Provider     = data.Provider;
                    if (data.Importance == 1)
                    {
                        _NotificationDetail.Importance = "Mandatory";
                    }
                    else
                    {
                        _NotificationDetail.Importance = "Optional";
                    }

                    _NotificationDetail.Cost       = data.Cost;
                    _NotificationDetail.Day        = Convert.ToString(data.Days);
                    _NotificationDetail.HeaderType = "Training Request";

                    EmployeeTraining EmployeeTraining = new EmployeeTraining();
                    EmployeeTraining                  = _db.EmployeeTrainings.Find(DetailsId);
                    EmployeeTraining.IsRead           = true;
                    _db.Entry(EmployeeTraining).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "New Vacancy")
            {
                var data = _NotificationMethod.GetNewVacancyNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId          = null;
                    _NotificationDetail.HeaderType          = "New Vacancy";
                    _NotificationDetail.Vacancy             = data.Title;
                    _NotificationDetail.ClosingDate         = data.ClosingDate;
                    _NotificationDetail.RecruitementProcess = data.RecruitmentProcesses;
                    _NotificationDetail.SalaryRange         = data.Salary;
                    _NotificationDetail.Location            = data.Location;
                    _NotificationDetail.Business            = data.Business;
                    _NotificationDetail.Division            = data.Division;
                    _NotificationDetail.Pool     = data.Pool;
                    _NotificationDetail.Function = data.Functions;

                    Vacancy VacancyDetails = new Vacancy();
                    VacancyDetails                  = _db.Vacancies.Find(DetailsId);
                    VacancyDetails.IsRead           = true;
                    _db.Entry(VacancyDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Uplift Submission")
            {
                var data = _NotificationMethod.GetUpLiftNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId           = data.EmployeeId;
                    _NotificationDetail.HeaderType           = data.HeaderType;
                    _NotificationDetail.Day                  = data.day;
                    _NotificationDetail.Date                 = data.Date;
                    _NotificationDetail.UpliftPosition       = data.UpliftPostionId;
                    _NotificationDetail.Hours                = data.Hours;
                    _NotificationDetail.ProjectName          = data.Project;
                    _NotificationDetail.CustomerName         = data.Customer;
                    _NotificationDetail.ChangeInWorkRate     = data.WorkerRate;
                    _NotificationDetail.ChangeInCustomerRate = data.CustomerRate;

                    Employee_ProjectPlanner_Uplift_Detail UpliftDetails = new Employee_ProjectPlanner_Uplift_Detail();
                    var reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    UpliftDetails = _db.Employee_ProjectPlanner_Uplift_Detail.Find(DetailsId);
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Id == EmployeeID && x.Archived == false).FirstOrDefault();
                    if (UpliftDetails != null && UpliftDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = UpliftDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && UpliftDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            UpliftDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            UpliftDetails.IsReadAddRep = true;
                        }
                        if (UpliftDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            UpliftDetails.IsRead = true;
                        }
                        _db.Entry(UpliftDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Skill Endorsement")
            {
                Employee_AddEndrosementSkills EndrosementSkillseDetails = new Employee_AddEndrosementSkills();
                EndrosementSkillseDetails                  = _db.Employee_AddEndrosementSkills.Find(DetailsId);
                EndrosementSkillseDetails.IsRead           = true;
                _db.Entry(EndrosementSkillseDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Resource")
            {
                var data = _NotificationMethod.getNewResourceDetails(EmployeeID);
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.Id;
                    _NotificationDetail.HeaderType = "New Resource";
                    _NotificationDetail.StartDate  = Convert.ToString(data.StartDate);
                    _NotificationDetail.email      = Convert.ToString(data.UserName);

                    AspNetUser aspDetails   = new AspNetUser();
                    var        reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    aspDetails = _db.AspNetUsers.Find(EmployeeID);
                    if (aspDetails.HRResponsible == SessionProxy.UserId)
                    {
                        aspDetails.IsReadHRRespo = true;
                    }
                    if (aspDetails.AdditionalReportsto == SessionProxy.UserId)
                    {
                        aspDetails.IsReadAddReport = true;
                    }
                    if (reportTodata != null && reportTodata.Reportsto == SessionProxy.UserId)
                    {
                        aspDetails.IsReadNewResource = true;
                    }
                    _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Delete employee")
            {
                var data = _NotificationMethod.getDeleteResourceDetails(EmployeeID);
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.Id;
                    _NotificationDetail.HeaderType   = "Delete employee";
                    _NotificationDetail.EmployeeName = data.FirstName + " " + data.LastName;
                    _NotificationDetail.StartDate    = Convert.ToString(data.StartDate);
                    _NotificationDetail.email        = Convert.ToString(data.UserName);

                    AspNetUser aspDetails = new AspNetUser();
                    aspDetails = _db.AspNetUsers.Find(EmployeeID);
                    aspDetails.IsReadArchived   = true;
                    _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "New Document")
            {
                var data = _NotificationMethod.getEmployeeDocumentByKey(Convert.ToInt32(DetailsId));
                _NotificationDetail.EmployeeId   = data.Id;
                _NotificationDetail.HeaderType   = "New Document";
                _NotificationDetail.DocumentName = data.DocumentPath;
                _NotificationDetail.Description  = data.Description;
                _NotificationDetail.DocLink      = data.LinkURL;
                Employee_Document aspDetails = new Employee_Document();
                aspDetails                  = _db.Employee_Document.Find(DetailsId);
                aspDetails.IsRead           = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "Document Signature")
            {
                var data = _NotificationMethod.getEmployeeDocumentForSignatureByKey(Convert.ToInt32(DetailsId));
                _NotificationDetail.EmployeeId   = data.Id;
                _NotificationDetail.HeaderType   = "Document Signature";
                _NotificationDetail.DocumentName = data.DocumentPath;
                _NotificationDetail.Description  = data.Description;
                _NotificationDetail.DocLink      = data.LinkURL;
                Employee_Document aspDetails = new Employee_Document();
                aspDetails = _db.Employee_Document.Find(DetailsId);
                aspDetails.IsReadSignature  = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Vacancy Posted")
            {
                var data = _NotificationMethod.getVacancyByKey(Convert.ToInt32(DetailsId));

                _NotificationDetail.EmployeeId = data.Id;
                _NotificationDetail.HeaderType = "New Vacancy Posted";
                Vacancy vacDetails = new Vacancy();
                vacDetails = _db.Vacancies.Find(DetailsId);
                vacDetails.IsReadVacancy    = true;
                _db.Entry(vacDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Applicant")
            {
                var data = _NotificationMethod.getTMSApplicantDetailByKey(Convert.ToInt32(EmployeeID));

                _NotificationDetail.EmployeeId = data.Id;
                _NotificationDetail.HeaderType = "New Applicant";
                TMS_Applicant aspDetails = new TMS_Applicant();
                aspDetails = _db.TMS_Applicant.Find(EmployeeID);
                aspDetails.IsReadHiringLead = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            return(PartialView("_GetNotificationDetails", _NotificationDetail));
        }