Beispiel #1
0
        public ActionResult AddEmployee(EmployeeEmployeeData model)
        {
            Employee employee = new Employee
            {
                Name          = model.Name,
                SSN           = model.SSN,
                AddedDate     = DateTime.UtcNow,
                ModifiedDate  = DateTime.UtcNow,
                EmployeeDatas = new List <EmployeeData> {
                    new EmployeeData {
                        AddedDate    = DateTime.UtcNow,
                        ModifiedDate = DateTime.UtcNow,
                        Age          = model.Age,
                        Address      = model.Address,
                        Latitude     = model.Latitude,
                        City         = model.City,
                        ZipCode      = model.ZipCode,
                        Longitude    = model.Longitude,
                        State        = model.State
                    }
                }
            };

            repoEmployee.Insert(employee);
            return(RedirectToAction("Index"));
        }
        public ActionResult ReportViewer(int id)
        {
            var employees     = employeeService.GetAllEmployees().Where(c => c.ManagerId == id);
            var employeesData = employeeDataService.GetAllEmployeesData();
            List <EmployeeEmployeeData> employeeDataVM = new List <EmployeeEmployeeData>();

            foreach (var item in employees)
            {
                foreach (var emp in employeesData)
                {
                    if (emp.Id == item.Id)
                    {
                        EmployeeEmployeeData employeeData = new EmployeeEmployeeData
                        {
                            Address   = emp.Address,
                            Age       = emp.Age,
                            City      = emp.City,
                            Latitude  = emp.Latitude,
                            Longitude = emp.Longitude,
                            State     = emp.State,
                            ZipCode   = emp.ZipCode,
                            Name      = item.Name
                        };

                        employeeDataVM.Add(employeeData);
                    }
                }
            }
            return(View(employeeDataVM));
        }
        private void PopulateReportData()
        {
            var employees     = employeeService.GetAllEmployees().Where(c => c.ManagerId == 1);
            var employeesData = employeeDataService.GetAllEmployeesData();
            List <EmployeeEmployeeData> employeeDataVM = new List <EmployeeEmployeeData>();

            foreach (var item in employees)
            {
                foreach (var emp in employeesData)
                {
                    if (emp.Id == item.Id)
                    {
                        EmployeeEmployeeData employeeData = new EmployeeEmployeeData
                        {
                            Address   = emp.Address,
                            Age       = emp.Age,
                            City      = emp.City,
                            Latitude  = emp.Latitude,
                            Longitude = emp.Longitude,
                            State     = emp.State,
                            ZipCode   = emp.ZipCode,
                            Name      = item.Name
                        };

                        employeeDataVM.Add(employeeData);
                    }
                }
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportDataSource rd1 = new ReportDataSource("MyDataSet", employeeDataVM);
                ReportViewer1.LocalReport.DataSources.Add(rd1);
                ReportViewer1.LocalReport.Refresh();
            }
        }
Beispiel #4
0
        public PartialViewResult AddEmployee()
        {
            EmployeeEmployeeData model = new EmployeeEmployeeData();

            return(PartialView("_AddEmployee", model));
        }
        public ActionResult AddEmployee()
        {
            EmployeeEmployeeData model = new EmployeeEmployeeData();

            return(View("AddEmployee", model));
        }