HBS.Data.Entities.SchedulingTimeTracking.Models.UserTimeTrackHistoryMapped.UserTimeTrackHistoryMapped C# (CSharp) Method

UserTimeTrackHistoryMapped() public method

public UserTimeTrackHistoryMapped ( int companyId ) : System
companyId int
return System
        public UserTimeTrackHistoryMapped(int companyId)
        {
            UserName = string.Empty;
            ClockInTime = string.Empty;
            ClockOutTime = string.Empty;
            IsDeleted = false;
            StampDate = DateTime.Now.Date; using (var dbContext = new SchTimeTrackingEntities())
            {
                var ulist = dbContext.UserProfiles.Where(c => c.CompanyId.Equals(companyId));

                List<HBS.Entities.UserProfile> userprofile = new List<HBS.Entities.UserProfile>();
                foreach (UserProfile item in ulist)
                {
                    userprofile.Add(new HBS.Entities.UserProfile(item.CompanyId, item.UserName, item.Password, item.FirstName, item.LastName, item.Email, item.UserId, (item.RoleId.HasValue ? item.RoleId.Value : 0)));
                }

                if (!string.IsNullOrEmpty(UserName))
                    Users = new SelectList(userprofile, "UserId", "UserName", UserName);
                else
                    Users = new SelectList(userprofile, "UserId", "UserName");
            }
            ClockInTimeList = new SelectList(GetTimeListOfADay(15), ClockInTime);
            ClockOutTimeList = new SelectList(GetTimeListOfADay(15), ClockOutTime);
        }