Exemplo n.º 1
0
        public static List <AttendanceEntity> GetAttendance(int AttendanceId, int UserId, int ManagerId, DateTime?StartDate, DateTime?EndDate)
        {
            List <AttendanceEntity> AttendanceList = null;

            try
            {
                using (HRMEntities db = new HRMEntities())
                {
                    AttendanceList = (from a in db.sp_GetAttendance(AttendanceId, UserId, ManagerId, StartDate, EndDate)
                                      select new AttendanceEntity
                    {
                        AttendanceId = a.AttendanceId,
                        UserId = a.UserId,
                        UserName = a.UserName,
                        PunchIn = a.PunchIn,
                        PunchInMessage = a.PunchInMessage,
                        PunchOut = a.PunchOut,
                        PunchOutMessage = a.PunchOutMessage,
                        Duration = a.Duration
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(AttendanceList);
        }
        public static List <HolidayEntity> GetHoliday(int HolidayId, string HolidayName, DateTime?StartDate, DateTime?EndDate, int LeaveDurationId)
        {
            List <HolidayEntity> HolidayList = null;

            try
            {
                using (HRMEntities db = new HRMEntities())
                {
                    HolidayList = (from h in db.sp_GetHoliday(HolidayId, HolidayName, StartDate, EndDate, LeaveDurationId)
                                   select new HolidayEntity
                    {
                        HolidayId = h.HolidayId,
                        HolidayName = h.HolidayName,
                        StartDate = h.StartDate,
                        EndDate = h.EndDate,
                        TotalDays = h.TotalDays == null ? 0 : (decimal)h.TotalDays,
                        LeaveDurationId = h.LeaveDurationId,
                        DurationType = h.DurationType,
                        CreatedBy = h.CreatedBy,
                        UpdatedBy = h.UpdatedBy,
                        CreatedOn = h.CreatedOn,
                        UpdatedOn = h.UpdatedOn
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(HolidayList);
        }
Exemplo n.º 3
0
        public static AttendanceEntity GetLastPunchInTime(int UserId)
        {
            try
            {
                AttendanceEntity AttendanceObj = null;


                using (HRMEntities db = new HRMEntities())
                {
                    AttendanceObj = (from a in db.Attendances
                                     join u in db.Users on a.UserId equals u.UserId
                                     where ((u.UserId == UserId) && (a.PunchOut == null))
                                     select new AttendanceEntity
                    {
                        AttendanceId = a.AttendanceId,
                        UserId = a.UserId,
                        UserName = u.UserName,
                        PunchIn = a.PunchIn,
                        PunchInMessage = a.PunchInMessage,
                        PunchOut = a.PunchOut,
                        PunchOutMessage = a.PunchOutMessage,
                        Duration = a.Duration
                    }).FirstOrDefault();
                }
                return(AttendanceObj);
            }
            catch
            {
                throw;
            }
        }
        public static int InsertUpdateHoliday(HolidayEntity ob)
        {
            try
            {
                int HolidayId = 0;
                using (HRMEntities db = new HRMEntities())
                {
                    System.Data.Entity.Core.Objects.ObjectParameter OutPut = new System.Data.Entity.Core.Objects.ObjectParameter("Output", typeof(int));
                    db.sp_InsertUpdateHolidays(ob.HolidayId, ob.HolidayName, ob.StartDate, ob.EndDate, ob.LeaveDurationId, ob.CreatedBy, ob.UpdatedBy, OutPut);
                    HolidayId = int.Parse(OutPut.Value.ToString());
                }

                return(HolidayId);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 5
0
        public static int PunchInOut(AttendanceEntity ob)
        {
            try
            {
                int AttendanceId = 0;
                using (HRMEntities db = new HRMEntities())
                {
                    System.Data.Entity.Core.Objects.ObjectParameter OutPut = new System.Data.Entity.Core.Objects.ObjectParameter("Output", typeof(int));
                    db.sp_InsertUpdateAttendance(ob.AttendanceId, ob.UserId, ob.PunchInMessage, ob.PunchOutMessage, OutPut);
                    AttendanceId = int.Parse(OutPut.Value.ToString());
                }

                return(AttendanceId);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public static int InsertUpdateLeave(LeaveRequestEntity ob)
        {
            try
            {
                int LeaveId = 0;
                using (HRMEntities db = new HRMEntities())
                {
                    System.Data.Entity.Core.Objects.ObjectParameter OutPut = new System.Data.Entity.Core.Objects.ObjectParameter("Output", typeof(int));
                    db.sp_InsertUpdateLeaveRequest(ob.RequestId, ob.UserId, ob.LeaveStatusId, ob.LeaveTypeId, ob.LeaveDurationId, ob.StartTime, ob.EndTime, ob.Description, ob.UpdatedBy, OutPut);
                    LeaveId = int.Parse(OutPut.Value.ToString());
                }

                return(LeaveId);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 7
0
        public static List <UserEntity> GetUser(int UserId, int ManagerId, string Name, string UserName, string Email, string Rolename)
        {
            List <UserEntity> rType = new List <UserEntity>();

            try
            {
                using (HRMEntities db = new HRMEntities())
                {
                    rType = (from u in db.sp_GetUser(UserId, ManagerId, Name, UserName, Email, Rolename)
                             select new UserEntity
                    {
                        UserId = u.UserId,
                        UserName = u.UserName,
                        Name = u.Name,
                        Guid = u.Guid,
                        Role = u.RoleName,
                        ManagerId = u.ManagerId,
                        ManagerName = u.ManagerName,
                        DesignationId = u.DesignationId,
                        DesignationName = u.DesignationName,
                        Email = u.Email,
                        PersonalEmail = u.PersonalEmail,
                        ContactNo = u.ContactNo,
                        Address = u.Address,
                        Salary = u.Salary,
                        Image = u.Image,
                        DOB = u.DOB,
                        DOJ = u.DOJ,
                        DOR = u.DOR,
                        Status = u.Status,
                        CreatedOn = u.CreatedOn,
                        UpdatedOn = u.UpdatedOn
                    }
                             ).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(rType);
        }
Exemplo n.º 8
0
        public static int InsertUpdateUser(UserEntity ob)
        {
            int UserID = 0;

            try
            {
                using (HRMEntities db = new HRMEntities())
                {
                    System.Data.Entity.Core.Objects.ObjectParameter OutPut = new System.Data.Entity.Core.Objects.ObjectParameter("Output", typeof(int));
                    db.sp_InsertUpdateUser(ob.UserId, ob.Guid, ob.Name, ob.UserName, ob.Email, ob.PersonalEmail, ob.ManagerId, ob.DesignationId, ob.ContactNo, ob.Address, ob.Salary, ob.Image, ob.DOB, ob.DOJ, ob.DOR, ob.Status, OutPut);
                    UserID = int.Parse(OutPut.Value.ToString());
                }
            }
            catch
            {
                throw;
            }

            return(UserID);
        }
Exemplo n.º 9
0
        public static List <LeaveRequestEntity> GetLeave(int RequestId, int UserId, int ManagerId, int LeaveStatusId, DateTime?StartDate, DateTime?EndDate, int UpdatedBy)
        {
            List <LeaveRequestEntity> LeaveList = null;

            try
            {
                using (HRMEntities db = new HRMEntities())
                {
                    LeaveList = (from a in db.sp_GetLeaveRequest(RequestId, UserId, ManagerId, LeaveStatusId, StartDate, EndDate, UpdatedBy)
                                 select new LeaveRequestEntity
                    {
                        RequestId = a.RequestId,
                        UserId = a.UserId,
                        Name = a.Name,
                        LeaveTypeId = a.LeaveTypeId,
                        LeaveTypeName = a.TypeName,
                        LeaveDurationId = a.LeaveDurationId,
                        LeaveDurationType = a.DurationType,
                        TotalDays = a.TotalDays == null ? 0 : (decimal)a.TotalDays,
                        StartTime = a.StartTime,
                        EndTime = a.EndTime,
                        Description = a.Description,
                        LeaveStatusId = a.LeaveStatusId,
                        LeaveStatus = a.LeaveStatus,
                        RequestDate = a.RequestDate,
                        UpdatedBy = a.UpdatedBy,
                        UpdatedByName = a.UpdatedByName
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(LeaveList);
        }