Ejemplo n.º 1
0
        public ActionResult GetSearchPartial()
        {
            BLLLeave _leave = new BLLLeave();

            SearchViewModel model = new SearchViewModel();
            model.LeaveType = _leave.GetAllLeaveTypes();

            return PartialView("SearchPartial", model);
        }
Ejemplo n.º 2
0
        public IEnumerable<LeaveViewModel> Search(SearchViewModel model)
        {
            using(var _context = new DataContext())
            {
                try
                {
                    var result = _context.Database.SqlQuery<LeaveViewModel>("pSearchLeaves @xIDNO, @xName," +
                                                                        "@xLeaveTypeID, @xLeaveStatus," +
                                                                        "@xDateFiled, @xDateFrom, @xDateTo",
                            new SqlParameter("@xIDNO", (object)model.IDNO ?? DBNull.Value),
                            new SqlParameter("@xName", (object)model.Name ?? DBNull.Value),
                            new SqlParameter("@xLeaveTypeID", (object)model.LeaveTypeID ?? DBNull.Value),
                            new SqlParameter("@xLeaveStatus", (object)model.Status ?? DBNull.Value),
                            new SqlParameter("@xDateFiled", model.DateFiled),
                            new SqlParameter("@xDateFrom", model.From),
                            new SqlParameter("@xDateTo", model.To)).ToList();

                    return result;
                }
                
                catch(Exception e)
                {
                    Debug.WriteLine(e);
                }

                return null;
            }
        }
Ejemplo n.º 3
0
        public ActionResult SummarySearch(SearchViewModel model)
        {
            BLLLeave _leave = new BLLLeave();

            IEnumerable<LeaveViewModel> result = _leave.Search(model);

            return PartialView("SearchResultPartial", result);
        }
Ejemplo n.º 4
0
        public IEnumerable<LeaveViewModel> Search(SearchViewModel model)
        {
            var minDate = (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue;

            if(model.From < minDate)
            {
                model.From = minDate;
            }
            if (model.To < minDate)
            {
                model.To = minDate;
            }
            if (model.DateFiled < minDate)
            {
                model.DateFiled = minDate;
            }

            DALLeave _leave = new DALLeave();

            return _leave.Search(model);
        }