//
        // GET: /TimeSheetMaster/Create

        public ActionResult Create()
        {
            ViewBag.PersonId     = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName");
            ViewBag.SupervisorId = new SelectList(TimesheetRepository.GetAllSupervisors(), "PersonId", "PersonName");
            ViewBag.CompanyId    = new SelectList(TimesheetRepository.GetAllCompanies(), "CompanyId", "CompanyDescription");
            return(View());
        }
        //
        // GET: /LeavePlan/

        public ActionResult Index()
        {
            int currentUserId = 1;
            var leavePlans    = TimesheetRepository.GetLeavePlans(currentUserId);

            return(View(leavePlans.ToList()));
        }
예제 #3
0
        public ActionResult Index()
        {
            int currentUserId = 1;
            IEnumerable <LeavePlan> leaves = TimesheetRepository.GetLeavePlans(currentUserId);

            return(View(leaves));
        }
        public ActionResult AdmitOrReject(int LeavePlanId, bool AdmitReject)
        {
            int thisUserId = 1;
            var leavePlans = TimesheetRepository.AdmitReject(LeavePlanId, AdmitReject);

            return(RedirectToAction("Supervise", leavePlans));
        }
        //
        // POST: /LeavePlan/Delete/5

        public ActionResult Supervise()
        {
            int thisUserId = 1;
            var leavePlans = TimesheetRepository.GetAllPersonsBySupervisorId(thisUserId);

            return(View(leavePlans.ToList()));
        }
예제 #6
0
        public void GetAllTest()
        {
            var emprepo = new TimesheetRepository(empcontextmock.Object);
            var emplist = emprepo.GetAll();

            Assert.AreEqual(2, emplist.Count());
        }
예제 #7
0
        //
        // GET: /CodeTable/

        public ActionResult Index()
        {
            ViewBag.Message = "List Of CodeTable";
            IEnumerable <CodeTable> model = TimesheetRepository.GetCodeTables();

            return(View(model));
        }
        public void AddTime_Success()
        {
            // Setup
            TimesheetContext db   = new TimesheetContext();
            User             user = db.Users.First();
            int  maxTimeId        = db.Times.Select(t => t.Id).Max();
            Time time             = new Time()
            {
                Date = DateTime.Today, HoursWorked = 5, UserId = user.Id
            };

            // Test action
            TimesheetRepository repository = new TimesheetRepository();

            repository.AddTime(time);

            // Assertions
            Time newTime = db.Times.First(t => t.Id > maxTimeId);

            Assert.IsNotNull(newTime);
            Assert.AreEqual(time.Date, newTime.Date);

            // Cleanup
            db.Times.Remove(newTime);
        }
예제 #9
0
        //
        // GET: /TimeSheet/Edit/5

        public ActionResult Edit(int id = 0)
        {
            TimeSheetMaster master = TimesheetRepository.GetTimeSheetMasterById(id);

            List <SelectListItem> items = new List <SelectListItem>();

            items.Add(new SelectListItem
            {
                Text  = "Approved",
                Value = "1"
            });
            items.Add(new SelectListItem
            {
                Text  = "Submitted",
                Value = "2",
            });
            items.Add(new SelectListItem
            {
                Text  = "Rejected",
                Value = "3"
            });
            ViewBag.StatusList = items;

            if (master == null)
            {
                return(HttpNotFound());
            }
            return(View(master));
        }
 public UnitOfWork(PlutoContext context)
 {
     _context   = context;
     Users      = new UserRepository(_context);
     Roles      = new RolesRepository(_context);
     Employees  = new EmployeeRepository(_context);
     Timesheets = new TimesheetRepository(_context);
 }
예제 #11
0
        public ActionResult Team()
        {
            //int currentUserId = 1;
            //IEnumerable<LeavePlan> leaves = TimesheetRepository.GetLeavePlansForTeam(currentUserId);
            IEnumerable <LeavePlan> leaves = TimesheetRepository.GetLeavePlans();

            return(View(leaves));
        }
예제 #12
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context      = context;
     Companies     = new CompanyRepository(_context);
     Employees     = new EmployeeRepository(_context);
     PayAgreements = new PayAgreementRepository(_context);
     Timesheets    = new TimesheetRepository(_context);
     Payslips      = new PayslipRepository(_context);
 }
예제 #13
0
        //
        // GET: /CodeTable/Edit/5

        public ActionResult Edit(int id = 0)
        {
            CodeTable model = TimesheetRepository.GetCodeTableById(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
예제 #14
0
        //
        // GET: /TimeSheet/Delete/5

        public ActionResult Delete(int id = 0)
        {
            TimeSheetDetail detail = TimesheetRepository.GetTimeSheetDetailById(id);

            if (detail == null)
            {
                return(HttpNotFound());
            }
            return(View(detail));
        }
예제 #15
0
        /// <summary>
        /// Initializes a new instance of the TimesheetService class.
        /// </summary>
        /// <param name="unitOfWork">UnitOfWork information</param>
        public TimesheetService(UnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException(UnitOfWorkConst);
            }

            this.unitOfWork = unitOfWork;
            this.timesheetRepository = new TimesheetRepository(this.unitOfWork);
        }
예제 #16
0
        //
        // GET: /LeavePlan/Details/5

        public ActionResult Details(int id = 0)
        {
            LeavePlan leaveplan = TimesheetRepository.GetLeavePlanById(id);

            if (leaveplan == null)
            {
                return(HttpNotFound());
            }
            return(View(leaveplan));
        }
        //
        // GET: /TimeSheetMaster/Delete/5

        public ActionResult Delete(int id = 0)
        {
            TimeSheetMaster master = TimesheetRepository.GetTimeSheetMasterById(id);

            if (master == null)
            {
                return(HttpNotFound());
            }
            return(View(master));
        }
예제 #18
0
        //
        // GET: /TimeSheet/Details/5

        public ActionResult Details(int id)
        {
            TimeSheetMaster master = TimesheetRepository.GetTimeSheetMasterById(id);
            var             detail = master.TimeSheetDetail;

            if (detail == null)
            {
                return(HttpNotFound());
            }
            return(View(detail.ToList()));
        }
예제 #19
0
        //
        // GET: /TimeSheet/Create

        public ActionResult Create()
        {
            // Create TimeSheet Master
            // Create Detail List based on the number of days from the calendar month
            PersonRepository personRepository = new PersonRepository(new ATSCEEntities());
            Staff            staff            = personRepository.GetStaffByID(2);

            TimeSheetMaster master = TimesheetRepository.CreateTimeSheetMasterTemplate(DateTime.Today, staff);

            return(View(master));
        }
예제 #20
0
 public ActionResult Edit(LeavePlan leaveplan)
 {
     if (ModelState.IsValid)
     {
         TimesheetRepository.AddUpdateLeavePlan(leaveplan);
         return(RedirectToAction("Index"));
     }
     ViewBag.LeaveCategoryId = new SelectList(TimesheetRepository.GetLeaveCategories(), "LeaveCategoryId", "LeaveCategoryDesc", leaveplan.LeaveCategoryId);
     ViewBag.PersonId        = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName", leaveplan.PersonId);
     return(View(leaveplan));
 }
예제 #21
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TimesheetTabViewModel()
        {
            //create instances of repositories
            _timesheetRepository = new TimesheetRepository();
            _employeeRepository  = new EmployeeRepository();

            //create instances of commands
            LogCommand = new RelayCommand(_log);

            //load data
            _loadTimesheet();
        }
예제 #22
0
        //
        // GET: /LeavePlan/Edit/5

        public ActionResult Edit(int id = 0)
        {
            LeavePlan leaveplan = TimesheetRepository.GetLeavePlanById(id);

            if (leaveplan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LeaveCategoryId = new SelectList(TimesheetRepository.GetLeaveCategories(), "LeaveCategoryId", "LeaveCategoryDesc", leaveplan.LeaveCategoryId);
            ViewBag.PersonId        = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName", leaveplan.PersonId);
            return(View(leaveplan));
        }
예제 #23
0
        private readonly ProjectRepository _projectRepository;         //likewise

        public TimesheetsController(IDataRepository <Timesheet> timesheetRepository, IDataRepository <Employee> employeeRepository,
                                    IDataRepository <TimesheetRow> timesheetRowRepository, IDataRepository <Credential> credentialRepository, IDataRepository <LabourGrade> labourGradeRepository, IDataRepository <WorkPackage> workPackageRepository,
                                    IDataRepository <Project> projectRepository)
        {
            this._timesheetRepository    = (TimesheetRepository)timesheetRepository;
            this._employeeRepository     = employeeRepository;
            this._timesheetRowRepository = (TimesheetRowRepository)timesheetRowRepository;
            this._credentialRepository   = (CredentialRepository)credentialRepository;
            this._labourGradeRepository  = (LabourGradeRepository)labourGradeRepository;
            this._workPackageRepository  = (WorkPackageRepository)workPackageRepository;
            this._projectRepository      = (ProjectRepository)projectRepository;
        }
 public ActionResult Create(TimeSheetMaster master)
 {
     if (ModelState.IsValid)
     {
         TimeSheetMaster newMaster = master;
         newMaster.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonId  = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName");
     ViewBag.ManagerId = new SelectList(TimesheetRepository.GetAllSupervisors(), "PersonId", "PersonName");
     ViewBag.CompanyId = new SelectList(TimesheetRepository.GetAllCompanies(), "CompanyId", "CompanyDescription");
     return(View(master));
 }
        public void GetUser_Success()
        {
            // Setup
            TimesheetContext db   = new TimesheetContext();
            User             user = db.Users.First();

            // Test action
            TimesheetRepository repository = new TimesheetRepository();
            var authenticatedUser          = repository.GetUser(user.Login, user.Password);

            // Assertions
            Assert.IsNotNull(authenticatedUser);
            Assert.AreEqual(user.Login, authenticatedUser.Login);
        }
        public void GetTimesForUser_Success()
        {
            // Setup
            TimesheetContext db   = new TimesheetContext();
            User             user = db.Times.First().User;

            // Test action
            TimesheetRepository repository = new TimesheetRepository();
            var times = repository.GetTimesForUser(user.Id);

            // Assertions
            Assert.IsNotNull(times);
            Assert.IsTrue(times.Any());
        }
        public void GetSubordinatesForUser_Success()
        {
            // Setup
            TimesheetContext db   = new TimesheetContext();
            User             user = db.Users.First(u => u.ManagerId.HasValue);

            // Test action
            TimesheetRepository repository = new TimesheetRepository();
            var subordinates = repository.GetSubordinatesForUser(user.Id);

            // Assertions
            Assert.IsNotNull(subordinates);
            Assert.IsTrue(subordinates.Any());
        }
예제 #28
0
 public WorkPackagesController(IDataRepository <WorkPackage> wpRepository, IDataRepository <Project> projRepository,
                               IDataRepository <Timesheet> timesheetRepository, IDataRepository <Employee> employeeRepository,
                               IDataRepository <WorkPackageLabourGradeAssignment> workPackageLabourGradeAssignment,
                               IDataRepository <EmployeeWorkPackageAssignment> empWorkPackageAssignment,
                               EmployeesController empController, TimesheetsController tsController)
 {
     this._workPackageRepository              = (WorkPackageRepository)wpRepository;
     this._projectRepository                  = (ProjectRepository)projRepository;
     this._timesheetRepository                = (TimesheetRepository)timesheetRepository;
     this._employeeRepository                 = (EmployeeRepository)employeeRepository;
     this._workPackageLabourGradeRepository   = (WorkPackageLabourGradeAssignmentRepository)workPackageLabourGradeAssignment;
     this._empWorkPackageAssignmentRepository =
         (EmployeeWorkPackageAssignmentRepository)empWorkPackageAssignment;
     this._empController = empController;
     this._tsController  = tsController;
 }
예제 #29
0
 public ActionResult DeleteConfirmed(int id)
 {
     TimesheetRepository.RemoveLeavePlan(id);
     return(RedirectToAction("Index"));
 }
예제 #30
0
        //
        // GET: /LeavePlan/Create

        public ActionResult Create()
        {
            ViewBag.LeaveCategoryId = new SelectList(TimesheetRepository.GetLeaveCategories(), "LeaveCategoryId", "LeaveCategoryDesc");
            ViewBag.PersonId        = new SelectList(TimesheetRepository.GetAllPersons(), "PersonId", "PersonName");
            return(View());
        }
예제 #31
0
        //
        // GET: /TimeSheet/

        public ActionResult Index()
        {
            var timeSheetMasters = TimesheetRepository.GetAllTimeSheetMasters();

            return(View(timeSheetMasters.ToList()));
        }