public static EmployeeDTO GetAll()
        {
            EmployeeDTO dto = new EmployeeDTO();

            dto.Department = DepartmentDAO.GetDepartments();
            dto.Posiiton   = PositionDAO.GetPositions();
            dto.Employees  = EmployeeDAO.GetEmployees();
            return(dto);
        }
        public static PermissionDTO GetAll()
        {
            PermissionDTO dto = new PermissionDTO();

            dto.Departments = DepartmentDAO.GetDepartments();
            dto.Positions   = PositionDAO.GetPositions();
            dto.States      = PermissionDAO.GetStates();
            dto.Permissions = PermissionDAO.GetPermissions();
            return(dto);
        }
Example #3
0
        public static SalaryDTO GetAll()
        {
            SalaryDTO dto = new SalaryDTO();

            dto.Employees   = EmployeeDAO.GetEmployees();
            dto.Departments = DepartmentDAO.GetDepartments();
            dto.Positions   = PositionDAO.GetPositions();
            dto.Months      = SalaryDAO.GetMonths();
            dto.Salaries    = SalaryDAO.GetSalaries();
            return(dto);
        }
        public static TaskDTO GetAll()
        {
            TaskDTO taskdto = new TaskDTO();

            taskdto.Employees   = EmployeeDAO.GetEmployees();
            taskdto.Departments = DepartmentDAO.GetDepartments();
            taskdto.Positions   = PositionDAO.GetPositions();
            taskdto.TaskStates  = TaskDAO.GetTaskStates();
            taskdto.Tasks       = TaskDAO.GetTasks();
            return(taskdto);
        }
        public static SalaryDTO GetAll()
        {
            SalaryDTO salaryDTO = new SalaryDTO();

            salaryDTO.Employees   = EmployeeDAO.GetEmployees();
            salaryDTO.Departments = DepartmentDAO.GetDepartments();
            salaryDTO.Positions   = PositionDAO.GetPositions();
            salaryDTO.Months      = SalaryDAO.GetMonths();
            salaryDTO.Salaries    = SalaryDAO.GetSalaries();

            return(salaryDTO);
        }
        public List <int> ExtractSalesReports( )
        {
            int year = DateTime.Now.Year;

            EmployeeDAO employeeDAO = new EmployeeDAO();

            RequestDAO requestDAO = new RequestDAO();

            DepartmentDAO departmentDAO = new DepartmentDAO();

            List <Department> departments = departmentDAO.GetDepartments();

            List <int> monthlySales = new List <int>(); //{paper,pen,stapler}

            foreach (Department d in departments)
            {
                List <RequestReport> requestReports = requestDAO.GetRequestsByDepartment(d.Id);

                if (requestReports != null)
                {
                    int[] sales = new int[3];

                    foreach (RequestReport request in requestReports)
                    {
                        if (request.ReqYear == year)     //DateTime.Today.year)
                        {
                            if (request.CategoryID == 1) //paper
                            {
                                sales[0] += request.Qty;
                            }
                            else if (request.CategoryID == 2) //pen
                            {
                                sales[1] += request.Qty;
                            }
                            else //stapler
                            {
                                sales[2] += request.Qty;
                            }
                        }
                    }
                    //monthlySales.Add(DateTime.Today.Month);
                    monthlySales.Add(sales[0]);
                    monthlySales.Add(sales[1]);
                    monthlySales.Add(sales[2]);
                }
            }
            System.Diagnostics.Debug.WriteLine(monthlySales);
            return(monthlySales);
        }
        //public ActionResult GenerateDisbursementList(string deptId)
        //{
        //    DateTime cutoff = DateTime.Now.Date;    //Ensures that orders only up to yesterday 2359 is taken into consideration
        //    List<DisbursementDetail> disbursementdetails = new List<DisbursementDetail>();
        //    Disbursement dis = new Disbursement();

        //    using (db)
        //    {
        //        var resultSet = from rd in db.RequestDetail
        //                        from r in db.Request
        //                        where (r.Status.Contains("New") || r.Status.Contains("Outstanding"))
        //                        && r.RequestId == rd.RequestId && r.DeptId == deptId
        //                        && r.ReqDate < cutoff
        //                        group rd by new { rd.ProductId, r.DeptId } into g
        //                        select new DisbursementDetailViewModel//Note to self: Groupby only works with enums or primitive data types
        //                        {
        //                            ProductId = g.Key.ProductId,
        //                            DepartmentId = g.Key.DeptId,
        //                            Quantity = g.Sum(x => x.ReqQty)
        //                        };
        //        List<DisbursementDetailViewModel> consolidatedOrders = resultSet.ToList();
        //        dis = new Disbursement
        //        {
        //            DisDate = DateTime.Now,
        //            Status = "Pending"
        //            //Field for department appears to be missing
        //            //dis.StoreStaff = null;
        //        };
        //        foreach (DisbursementDetailViewModel p in consolidatedOrders)
        //        {
        //            DisbursementDetail dd = new DisbursementDetail
        //            {
        //                ProductId = p.ProductId,
        //                //RequiredQty = p.Quantity
        //                ReceivedQty = 0,   //Should set to zero
        //                DisId = dis.DisId
        //            };
        //            disbursementdetails.Add(dd);
        //        }
        //        db.Disbursement.Add(dis);
        //        db.DisbursementDetail.AddRange(disbursementdetails);
        //        db.SaveChanges();
        //    }

        //    return RedirectToAction("DetailedDisbursementList", new { id = dis.DisId });
        //}
        public ActionResult FindDisbursementList(string deptId, string startDate, string endDate)
        {
            List <Department>   departments   = departmentDAO.GetDepartments();
            List <Disbursement> disbursements = new List <Disbursement>();

            if (deptId != null)
            {
                disbursements = disbursementDAO.GetDisbursements(deptId);
            }
            if (startDate != null && endDate != null)
            {
                disbursements = disbursementDAO.GetDisbursements(DateTime.Parse(startDate), DateTime.Parse(endDate));
            }

            ViewData["departments"]   = departments;
            ViewData["disbursements"] = disbursements;

            return(View());
        }
 public static List <DEPARTMENT> GetDepartments()
 {
     return(DepartmentDAO.GetDepartments());
 }
Example #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="whereClause"></param>
 /// <param name="dataTable"></param>
 /// <returns></returns>
 public List <DepartmentDTO> GetDepartments(Dictionary <string, string> whereClause, ref DataTable dataTable)
 {
     return(departmentDao.GetDepartments(whereClause, ref dataTable));
 }
Example #10
0
 public static List <Department> GetDepartments()
 {
     return(DepartmentDAO.GetDepartments());
 }
Example #11
0
        public List <DepartmentViewModel> GetDepartments()
        {
            List <DepartmentViewModel> myModels = DepartmentDAO.GetDepartments();

            return(myModels);
        }