예제 #1
0
        public ActionResult List()
        {
            if (DataMemory.CurrentUser == null)
            {
                return(RedirectToAction("Logout", "Admin"));
            }
            var request = new SearchProjectRequest
            {
                CurrentPage = 1,
                Start       = 1,
                End         = ConfigInfo.RecordOnPage
            };

            return(View(SearchProject(request)));
        }
예제 #2
0
        public ActionResult OutstandingProject()
        {
            var request = new SearchProjectRequest
            {
                Start = 1,
                End   = 1000
            };

            var total       = 0;
            var ds          = _projectDa.Search(request, ref total);
            var lst         = CBO.Fill2ListFromDataSet <Project>(ds, typeof(Project));
            var listProject = new ListProject()
            {
                Collection = lst
            };

            return(View(listProject));
        }
예제 #3
0
        public DataSet Search(SearchProjectRequest model, ref int pTotal)
        {
            try
            {
                var spParameter = new SqlParameter[3];

                #region Set param

                var parameter = new SqlParameter("@P_START", SqlDbType.VarChar)
                {
                    Direction = ParameterDirection.Input,
                    Value     = model.Start
                };
                spParameter[0] = parameter;

                parameter = new SqlParameter("@P_END", SqlDbType.VarChar)
                {
                    Direction = ParameterDirection.Input,
                    Value     = model.End
                };
                spParameter[1] = parameter;

                parameter = new SqlParameter("@P_TOTAL", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output,
                    Value     = -1
                };
                spParameter[2] = parameter;

                #endregion

                var ds = SqlHelper.ExecuteDataset(ConfigInfo.ConnectString, CommandType.StoredProcedure,
                                                  "PROC_PROJECT_SEARCH", spParameter);

                pTotal = Convert.ToInt32(spParameter[2].Value);

                return(ds);
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex.ToString());
                return(new DataSet());
            }
        }
예제 #4
0
        private ListProject SearchProject(SearchProjectRequest request)
        {
            var total     = 0;
            var ds        = _projectDa.Search(request, ref total);
            var lstNew    = CBO.Fill2ListFromDataSet <Project>(ds, typeof(Project));
            var totalPage = Math.Ceiling(((decimal)total / ConfigInfo.RecordOnPage));
            var paging    = HtmlControllHelpers.WritePaging(totalPage, request.CurrentPage, total, ConfigInfo.RecordOnPage, "Công trình");
            var listNews  = new ListProject()
            {
                Start       = request.Start,
                Collection  = lstNew,
                Paging      = paging,
                TotalRecord = total,
                TotalPage   = totalPage,
                CurrentPage = request.CurrentPage
            };

            return(listNews);
        }
예제 #5
0
        public static void LoadPage()
        {
            try
            {
                var request = new SearchProjectRequest
                {
                    Start = 1,
                    End   = 0
                };
                var     pTotal = 0;
                PageDA  _da    = new PageDA();
                DataSet ds     = _da.Search(request, ref pTotal);
                c_lstPage = CBO <Page> .FillCollectionFromDataSet(ds);

                c_lstPage = c_lstPage.OrderByDescending(m => m.Id).ToList();
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex.ToString());
            }
        }
예제 #6
0
 public ActionResult Search(SearchProjectRequest request)
 {
     return(PartialView("~/Areas/Admin/Views/Project/_listProject.cshtml", SearchProject(request)));
 }