Beispiel #1
0
        public void UpdateEducationCategoryDetails(long userId, string userName)
        {
            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    var existingDocCate = ctx.AdminEducationCategoryForUsers.Where(a => a.UserID == userId && a.IsActive == true).ToList();

                    if (existingDocCate != null)
                    {
                        foreach (var item in existingDocCate)
                        {
                            //entry exist
                            item.IsActive    = false;
                            item.UpdatedBy   = userName;
                            item.UpdatedDate = DateTime.UtcNow;
                            ctx.SaveChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #2
0
        public string GetLatestEmploymentNo(int userId)
        {
            string result = string.Empty;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    List <EmploymentDetail> employmentDetails = ctx.EmploymentDetails.Where(m => m.UserID == userId).ToList();
                    if (employmentDetails != null && employmentDetails.Count > 0)
                    {
                        long   MaxEmpId    = employmentDetails.Max(m => m.EmploymentDetID);
                        string latestEmpNo = employmentDetails.Where(m => m.EmploymentDetID == MaxEmpId).Select(m => m.EmployementNo).FirstOrDefault();
                        if (!string.IsNullOrWhiteSpace(latestEmpNo))
                        {
                            int latestno = Convert.ToInt32(latestEmpNo.Remove(0, 13));
                            latestno = latestno + 1;
                            result   = "EmployementNo" + latestno;
                        }
                    }
                    else
                    {
                        result = "EmployementNo1";
                    }
                }
                catch (Exception ex)
                {
                    result = string.Empty;
                }
            }
            return(result);
        }
Beispiel #3
0
        public bool CheckSelectedEmploymentStatus(int userId, int employmentDetID)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    EmploymentDetail employmnetDetails = ctx.EmploymentDetails.Where(m => m.UserID == userId && m.IsActive == true && m.IsCurrentEmployment == true && m.EmploymentDetID == employmentDetID).FirstOrDefault();

                    if (employmnetDetails != null)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }

            return(result);
        }
Beispiel #4
0
        public bool UpdateEmployeeLeavingDetails(EmployeeMaster empdataobj)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    var empdetails = ctx.EmployeeMasters.Where(m => m.Id == empdataobj.Id).FirstOrDefault();

                    if (empdetails != null)
                    {
                        empdetails.ReasonForleaving = empdataobj.ReasonForleaving;
                        empdetails.LeavingDate      = empdataobj.LeavingDate;
                        empdetails.Active           = 0;
                        empdetails.JoiningDate      = empdataobj.JoiningDate;
                        ctx.SaveChanges();
                    }
                    var logindetails = ctx.LoginDetails.Where(m => m.UserID == empdataobj.UserId).FirstOrDefault();
                    if (logindetails != null)
                    {
                        logindetails.IsActive = 0;
                    }

                    ctx.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
        //public bool UpdateDesignationList(string designationName)
        // {
        //     var designationList = GetDesignationList();
        //     var count = 0;
        //     if(designationList != null)
        //     {
        //         foreach(var designation in designationList)
        //         {
        //             if(designation.Designation == designationName)
        //             {
        //                 count++;
        //             }
        //             if(count > 0)
        //             {


        //             }
        //         }
        //     }
        // return true;
        // }

        public bool UpdateProfessionalDetails(EmployeeMaster empobj, EmployeeProfessionalDetail profobj)
        {
            using (IPDEntities ctx = new IPDEntities())
            {
                var employeedata = ctx.EmployeeMasters.Where(m => m.EmpNo == empobj.EmpNo).FirstOrDefault();
                if (employeedata != null)
                {
                    employeedata.EmployeeName = empobj.EmployeeName;
                    employeedata.EmpNo        = empobj.EmpNo;
                }
                var proffesionaldata = ctx.EmployeeProfessionalDetails.Where(m => m.EmpProfID == profobj.EmpProfID).FirstOrDefault();
                if (proffesionaldata != null)
                {
                    proffesionaldata.TotalExprInMonths = profobj.TotalExprInMonths;
                    proffesionaldata.TotalExprInYears  = profobj.TotalExprInYears;
                    proffesionaldata.DesignationID     = profobj.DesignationID;
                    proffesionaldata.DepartmentID      = profobj.DepartmentID;
                }
                else
                {
                    EmployeeProfessionalDetail profInsertObj = new EmployeeProfessionalDetail();
                    if (profobj.UserID != 0) //dont save details if userid is not available
                    {
                        profInsertObj.TotalExprInMonths = profobj.TotalExprInMonths;
                        profInsertObj.TotalExprInYears  = profobj.TotalExprInYears;
                        profInsertObj.DesignationID     = profobj.DesignationID;
                        profInsertObj.DepartmentID      = profobj.DepartmentID;
                        profInsertObj.UserID            = profobj.UserID;
                        ctx.EmployeeProfessionalDetails.Add(profInsertObj);
                    }
                }
                ctx.SaveChanges();
            }
            return(true);
        }
Beispiel #6
0
        public bool DeleteUser(int ID)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    LoginDetail loginDetail = ctx.LoginDetails.Where(m => m.UserID == ID).FirstOrDefault();
                    //Code change - Column datatype changed from int to bool
                    loginDetail.IsDelete = true;
                    EmployeeMaster empMaster = ctx.EmployeeMasters.Where(m => m.UserId == ID).FirstOrDefault();
                    if (empMaster != null)
                    {
                        empMaster.Active = 0;
                    }
                    ctx.SaveChanges();

                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
Beispiel #7
0
        public bool SetActive(DocumentDetail documentDetail)
        {
            var status = false;

            try
            {
                using (var context = new IPDEntities())
                {
                    var data = context.DocumentDetails.FirstOrDefault(x => x.DocumentID == documentDetail.DocumentID && x.DocDetID == documentDetail.DocDetID && x.UserID == documentDetail.UserID);
                    if (data != null)
                    {
                        data.IsActive    = true;
                        data.UpdatedBy   = HttpContext.Current.User.Identity.Name;
                        data.UpdatedDate = DateTime.UtcNow;
                        status           = Convert.ToBoolean(context.SaveChanges());
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(status);
        }
        public List <Master_EducationCategory> GetEducationcategoryListByUserId(int userId)
        {
            List <Master_EducationCategory> catlist = new List <Master_EducationCategory>();

            using (var context = new IPDEntities())
            {
                List <AdminEducationCategoryForUser> result = context.AdminEducationCategoryForUsers.Where(x => x.UserID == userId && x.IsActive == true).ToList();
                var master_EducationCategory = context.Master_EducationCategory;

                if (result.Any() && result.Count != 0 && master_EducationCategory.Any() && master_EducationCategory.Count() != 0)
                {
                    catlist = (from item in result
                               join eCat in master_EducationCategory
                               on item.EducationCategoryId equals eCat.EducationCategoryID
                               select eCat).ToList();
                }
                if (context.EmployeeEducationDetails.Any() && context.EmployeeEducationDetails.Count() != 0)
                {
                    foreach (var item in context.EmployeeEducationDetails.Where(x => x.IsActive == true && x.UserID == userId).ToList())
                    {
                        catlist.Remove(catlist.ToList().FirstOrDefault(x => x.EducationCategoryID == item.EducationCategoryID));
                    }
                }
                return(catlist);
            }
        }
Beispiel #9
0
 public LoginDetail GetUserExists(string Firstsname, string Lastname, string Email)
 {
     using (IPDEntities ctx = new IPDEntities())
     {
         var result = ctx.LoginDetails.Where(T => T.FirstName == Firstsname && T.LastName == Lastname && T.Email == Email).FirstOrDefault();
         return(result);
     }
 }
Beispiel #10
0
 public Master_Department GetDepartmentId(string Name)
 {
     using (IPDEntities ctx = new IPDEntities())
     {
         var result = ctx.Master_Department.Where(T => T.DepartmentName == Name).FirstOrDefault();
         return(result);
     }
 }
        public List <Master_Designation> GetDesignationList()
        {
            List <Data.Master_Designation> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.Master_Designation.Where(m => m.IsActive == true).ToList();
            }
            return(data);
        }
Beispiel #12
0
        public List <AdminEducationCategoryForUser> GetSelectedCategories(long userId)
        {
            List <Data.AdminEducationCategoryForUser> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.AdminEducationCategoryForUsers.Where(a => a.UserID == userId && a.IsActive == true).ToList();
            }
            return(data);
        }
Beispiel #13
0
        public List <Master_Bloodgroup> GetBloodGroupList()
        {
            List <Data.Master_Bloodgroup> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.Master_Bloodgroup.ToList();
            }
            return(data);
        }
        public List <Master_Department> GetDepartMentList()
        {
            List <Data.Master_Department> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.Master_Department.Where(m => m.IsActive == true).ToList();
            }
            return(data);
        }
Beispiel #15
0
        public List <GetDocumentDetails_Result> GetDocumentDetailsList()
        {
            List <GetDocumentDetails_Result> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.GetDocumentDetails().ToList();
            }
            return(data);
        }
        public List <GetProffesionalDetails_Result> GetProffesionalDetails()
        {
            List <GetProffesionalDetails_Result> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.GetProffesionalDetails().ToList();
            }
            return(data);
        }
Beispiel #17
0
        public List <EmploymentDetail> GetEmploymnetByUser(int UserID)
        {
            List <EmploymentDetail> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.EmploymentDetails.Where(m => m.UserID == UserID && m.IsActive == true).ToList();
            }
            return(data);
        }
Beispiel #18
0
        public List <Master_Currency> GetCurrencies()
        {
            List <Master_Currency> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.Master_Currency.ToList();
            }
            return(data);
        }
        public Data.EmploymentCount GetEmploymentCountByUserId(int userId)
        {
            EmploymentCount employmentCount = new EmploymentCount();

            using (IPDEntities ctx = new IPDEntities())
            {
                employmentCount = ctx.EmploymentCounts.Where(m => m.UserID == userId).FirstOrDefault();
            }
            return(employmentCount);
        }
        public List <GetEducationList_Result> GetEducationList(object UserID)
        {
            List <GetEducationList_Result> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.GetEducationList((int)UserID).ToList();
            }
            return(data);
        }
Beispiel #21
0
        public List <LoginDetail> GetActiveUsers()
        {
            var users = new List <LoginDetail>();

            using (var context = new IPDEntities())
            {
                users = context.LoginDetails.Where(x => x.IsActive == 1 && x.RoleID == 16 && (!x.IsDelete ?? false)).ToList();
                return(users);
            }
        }
Beispiel #22
0
        public EmployeePersonalDetail GetPersonalDetailsByUserId(int userId)
        {
            EmployeePersonalDetail personalDetails = new EmployeePersonalDetail();

            using (IPDEntities ctx = new IPDEntities())
            {
                personalDetails = ctx.EmployeePersonalDetails.Where(m => m.UserID == userId).FirstOrDefault();
            }
            return(personalDetails);
        }
Beispiel #23
0
        public List <DocumentStatus_Result> DocumentStatusList(string userId)
        {
            List <DocumentStatus_Result> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                data = ctx.DocumentStatus(userId).ToList();
            }
            return(data);
        }
Beispiel #24
0
        public List <string> GetPendingRequests(long userId)
        {
            List <string> data = null;

            using (IPDEntities ctx = new IPDEntities())
            {
                //neither reject nor approve
                data = ctx.CandidateChangeRequestsDetails.Where(c => c.IsApproved == null && c.UserID == userId).Select(c => c.FieldName).ToList();
            }
            return(data);
        }
 public bool UpdateEmployeeEducation(EmployeeEducationDetail obj)
 {
     using (var context = new IPDEntities())
     {
         //db.SaveChanges();
         var local = context.EmployeeEducationDetails.Find(obj.EduDetID);
         context.Entry(local).CurrentValues.SetValues(obj);
         context.Entry(local).State = EntityState.Modified;
         bool status = Save();
         return(status);
     }
 }
Beispiel #26
0
        public List <DocumentDetail> GetDocumentDetailsByUserId(int userId = 0)
        {
            var documentDetails = new List <DocumentDetail>();

            if (userId > 0)
            {
                using (var context = new IPDEntities())
                {
                    documentDetails = context.DocumentDetails.Where(x => x.UserID == userId && x.IsActive == true).ToList();
                }
            }
            return(documentDetails);
        }
Beispiel #27
0
        public bool IsFresher(int UserID)
        {
            var status = false;

            using (IPDEntities ctx = new IPDEntities())
            {
                var data = ctx.LoginDetails.FirstOrDefault(m => m.UserID == UserID && m.IsFresher == true);
                if (data != null && data.IsFresher.HasValue)
                {
                    status = data.IsFresher ?? false;
                }
            }
            return(status);
        }
Beispiel #28
0
        //Code change

        /// <summary>
        ///   //Code change  Adding new method to fetch department name
        /// </summary>
        /// <param name="departmentId"></param>
        /// <returns></returns>
        public string GetDepartmentName(int departmentId)
        {
            var data = "";

            if (departmentId != 0)
            {
                using (IPDEntities ctx = new IPDEntities())
                {
                    var list_data = ctx.Master_Department.Where(m => m.DepartmentID == departmentId).FirstOrDefault();
                    data = list_data.DepartmentName;
                }
            }
            return(data);
        }
Beispiel #29
0
        /// <summary>
        ///   //Code change  Adding new method to fetch designation name
        /// <param name="designationId"></param>
        /// <returns></returns>
        public string GetDesignationName(int designationId)
        {
            var data = "";

            if (designationId != 0)
            {
                using (IPDEntities ctx = new IPDEntities())
                {
                    var list_data = ctx.Master_Designation.Where(m => m.DesignationID == designationId).FirstOrDefault();
                    data = list_data.Designation;
                }
            }
            return(data);
        }
Beispiel #30
0
        public ActivityDetails GetActivityDetails(long userId)
        {
            ActivityDetails data = new ActivityDetails();

            using (IPDEntities ctx = new IPDEntities())
            {
                data.PersonalDetailsDate       = ctx.EmployeePersonalDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
                data.ContactDetailsDate        = ctx.EmployeeContactDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
                data.EducationDetailsDate      = ctx.EmployeeEducationDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
                data.EmploymentDetailsDate     = ctx.EmploymentDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
                data.FamilyDetailsDate         = ctx.EmployeeFamilyDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
                data.UploadDocumentDetailsDate = ctx.DocumentDetails.Where(a => a.UserID == userId).OrderByDescending(m => m.UpdatedDate).Select(a => a.UpdatedDate).FirstOrDefault();
            }
            return(data);
        }