예제 #1
0
        public async Task Update(Employee_Document entity)
        {
            try
            {
                var lstEmp_document = adbContext.employee_document.Where(x => x.Emp_Doc_Id == entity.Emp_Doc_Id && x.Emp_Id == entity.Emp_Id).FirstOrDefault();
                if (lstEmp_document != null)
                {
                    lstEmp_document.Emp_Id            = entity.Emp_Id;
                    lstEmp_document.Parent_Emp_Doc_Id = entity.Parent_Emp_Doc_Id;
                    lstEmp_document.Doc_Id            = entity.Doc_Id;
                    lstEmp_document.Emp_Doc_Name      = entity.Emp_Doc_Name;
                    lstEmp_document.Doc_Path          = entity.Doc_Path;
                    lstEmp_document.Notes             = entity.Notes;

                    lstEmp_document.isActive  = entity.isActive;
                    lstEmp_document.UpdatedBy = entity.UpdatedBy;
                    lstEmp_document.UpdatedOn = DateTime.Now;

                    adbContext.employee_document.Update(lstEmp_document);
                    await Task.FromResult(adbContext.SaveChanges());
                }
                else
                {
                    throw new Exception("Data Not Available");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public async Task <IActionResult> Edit(Employee_Document employee_Document)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = "Invalid Model State";
                return(BadRequest(objHelper));
            }

            try
            {
                if (employee_DocumentRepository.Exists(employee_Document))
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Data already available";
                    return(Ok(objHelper));
                }

                await employee_DocumentRepository.Update(employee_Document);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                return(Ok(objHelper));
            }
            catch
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = "Get Unsuccessful";
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
예제 #3
0
 public async Task Insert(Employee_Document entity)
 {
     try
     {
         entity.AddedOn = DateTime.Now;
         adbContext.employee_document.Add(entity);
         await Task.FromResult(adbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public bool Exists(Employee_Document entity)
 {
     try
     {
         int intCount = 0;
         if (entity.Emp_Doc_Id > 0) //Update Validation
         {
             intCount = adbContext.employee_document.Where(w => w.Emp_Doc_Id != entity.Emp_Doc_Id && w.Emp_Id == entity.Emp_Id && (w.Emp_Doc_Name == entity.Emp_Doc_Name)).Count();
         }
         else //Insert Validation
         {
             intCount = adbContext.employee_document.Where(w => w.Emp_Id == entity.Emp_Id && (w.Emp_Doc_Name == entity.Emp_Doc_Name)).Count();
         }
         return(intCount > 0 ? true : false);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
        public bool SaveDocumentData(EmployeeDocumentViewModel DataModel, int UserId)
        {
            //DateTime Create = new DateTime();
            if (DataModel.Id == 0)
            {
                Employee_Document model = new Employee_Document();
                model.EmployeeID           = DataModel.EmployeeID;
                model.DocumentOriginalPath = DataModel.DocumentOriginalPath;
                model.DocumentPath         = DataModel.DocumentPath;
                model.LinkDisplayText      = DataModel.LinkDisplayText;
                model.LinkURL              = DataModel.LinkURL;
                model.Description          = DataModel.Description;
                model.BusinessID           = DataModel.BusinessID;
                model.DivisionID           = DataModel.DivisionID;
                model.PoolID               = DataModel.PoolID;
                model.FunctionID           = DataModel.FunctionID;
                model.Category             = DataModel.Category;
                model.EmployeeAccess       = DataModel.EmployeeAccess;
                model.ManagerAccess        = DataModel.ManagerAccess;
                model.CustomerAccess       = DataModel.CustomerAccess;
                model.SpecificWorker       = DataModel.SpecificWorker;
                model.WorkerID             = DataModel.WorkerID;
                model.SpecificManager      = DataModel.SpecificManager;
                model.ManagerID            = DataModel.ManagerID;
                model.SpecificCustomer     = DataModel.SpecificCustomer;
                model.CustomerID           = DataModel.CustomerID;
                model.SignatureRequire     = DataModel.SignatureRequire;
                model.IpAddress            = DataModel.IpAddress;
                model.Archived             = false;
                model.IsRead               = false;
                model.IsReadSignature      = false;
                model.UserIDCreatedBy      = UserId;
                model.UserIDLastModifiedBy = UserId;
                model.CreatedDate          = DateTime.Now;
                model.LastModified         = DateTime.Now;
                _db.Employee_Document.Add(model);
                _db.SaveChanges();
            }
            else
            {
                var model = _db.Employee_Document.Where(x => x.Id == DataModel.Id).FirstOrDefault();
                model.EmployeeID           = DataModel.EmployeeID;
                model.DocumentOriginalPath = DataModel.DocumentOriginalPath;
                model.DocumentPath         = DataModel.DocumentPath;
                model.LinkDisplayText      = DataModel.LinkDisplayText;
                model.LinkURL              = DataModel.LinkURL;
                model.Description          = DataModel.Description;
                model.BusinessID           = DataModel.BusinessID;
                model.DivisionID           = DataModel.DivisionID;
                model.PoolID               = DataModel.PoolID;
                model.FunctionID           = DataModel.FunctionID;
                model.Category             = DataModel.Category;
                model.EmployeeAccess       = DataModel.EmployeeAccess;
                model.ManagerAccess        = DataModel.ManagerAccess;
                model.CustomerAccess       = DataModel.CustomerAccess;
                model.SpecificWorker       = DataModel.SpecificWorker;
                model.WorkerID             = DataModel.WorkerID;
                model.SpecificManager      = DataModel.SpecificManager;
                model.ManagerID            = DataModel.ManagerID;
                model.SpecificCustomer     = DataModel.SpecificCustomer;
                model.CustomerID           = DataModel.CustomerID;
                model.SignatureRequire     = DataModel.SignatureRequire;
                model.IpAddress            = DataModel.IpAddress;
                model.UserIDLastModifiedBy = UserId;
                model.LastModified         = DateTime.Now;
                _db.SaveChanges();
            }

            return(true);
        }
예제 #6
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));
        }