示例#1
0
        public ActionResult CreateLog(int?id)
        {
            if (id == null)
            {
                return(View(new EmployeeLog()));
            }
            var employeeLog = _iFEmployeeLog.Read(id.Value);

            if (employeeLog.SuccesLogin)
            {
                var employee = _iFEmployee.Read(employeeLog.EmployeeId);
                employeeLog.EmployeeImageBase64 = employee.EmployeeImageBase64;
            }

            return(View(employeeLog));
        }
示例#2
0
        public ActionResult Create(EmployeeLog employeeLog)
        {
            var employee = _iFEmployee.Read(employeeLog.EmployeeNumber, employeeLog.Pin);

            if (employee.EmployeeId == 0)
            {
                //return View(employeeLog); //return error
                ModelState.AddModelError("EmployeeNumber", "Employee Number or Pin does not exist");
                return(View(new EmployeeLog()));
            }
            else
            {
                employeeLog.EmployeeId = employee.EmployeeId;
                _iFEmployeeLog.Create(UserId, employeeLog);
                return(RedirectToAction("Index"));
            }
        }
示例#3
0
        public ActionResult Create(EmployeeLog employeeLog)
        {
            var  employee  = _iFEmployee.Read(employeeLog.EmployeeNumber, employeeLog.Pin);
            var  logname   = _iFEmployeeLog.Readlogtype(employeeLog.LogTypeId);
            bool IsSuccess = employee.EmployeeId != 0 && employee.Pin == employeeLog.Pin;

            employeeLog.LogName       = logname.Name;
            employeeLog.EmployeeId    = employee.EmployeeId;
            employeeLog.SuccesLogin   = IsSuccess;
            employeeLog               = _iFEmployeeLog.Create(UserId, employeeLog);
            employeeLog.EmployeeImage = employee.EmployeeImage;
            if (!IsSuccess)
            {
                return(View(employeeLog));
            }
            else
            {
                return(View(employeeLog));
            }
        }