コード例 #1
0
        public JsonResult QueryAll()
        {
            LogOuts.Info("Query");
            var list = Service.FetchAll();

            return(Json(list));
        }
コード例 #2
0
        public JsonResult QueryNoPages(TQuery query)
        {
            LogOuts.Info("Query");
            var list = Service.FetchAll(query);

            return(Json(list));
        }
コード例 #3
0
ファイル: LoggingHelper.cs プロジェクト: yhh1234/web_test
        //private const String _errLogFilePath = @"aoplog.txt";

        public static void Writelog(String message)
        {
            //StreamWriter sw = new StreamWriter(_errLogFilePath, true);
            //String logContent = String.Format("[{0}]{1}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), message);
            //sw.WriteLine(logContent);
            //sw.Flush();
            //sw.Close();
            LogOuts.Info("aoplog:" + message);
        }
コード例 #4
0
 public virtual ActionResult Save(TDto dto)
 {
     LogOuts.Info("Save");
     if (!ModelState.IsValid)
     {
         return(View(dto));
     }
     Service.Add(dto);
     return(Ok("SaveSuccess"));
 }
コード例 #5
0
        public FileResult Download(TQuery query)
        {
            LogOuts.Info("Download");
            var list   = Service.FetchAll(query);
            var stream = Service.ExportExcel(list);

            stream.Seek(0, SeekOrigin.Begin);
            string name = DateTime.Now.Millisecond.ToString();

            return(File(stream.ToArray(), "application/vnd.ms-excel", name + ".xls"));;
        }
コード例 #6
0
 public virtual ActionResult Delete(string ids)
 {
     LogOuts.Info("Delete");
     if (ids.Contains(","))
     {
         Service.BatchDelete(ids);
     }
     else
     {
         Service.Delete(ids);
     }
     return(Ok("Sucess"));
 }
コード例 #7
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~") + @"\log4net.config"));
            LogOuts.Info("Application_Start");

            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            Container.RegisterMvc(typeof(MvcApplication).Assembly, new SecurityConfig());
            LogOuts.Info("Application_End");
        }
コード例 #8
0
        public virtual ActionResult Query(TQuery query)
        {
            LogOuts.Info("Query");
            SetPage(query);
            PagerList <TDto> list = null;

            try
            {
                list = Service.FetchPages(query);
            }
            catch (Exception e)
            {
                LogOuts.Info("FetchPages Error:" + e.Message);
            }

            return(ToDataGridResult(list, list.TotalCount));
        }
コード例 #9
0
ファイル: ServiceStudyBase.cs プロジェクト: yhh1234/web_test
        public virtual PagerList <TDto> FetchPages(TQuery query)
        {
            PagerList <TDto> pagers = new PagerList <TDto>(0);

            try
            {
                string       fetchQuery     = GetQuerySqlId();
                int          total          = 0;
                int          wiilShowedPage = query.Page;
                int          pageSize       = query.PageSize;
                IList <TDto> list           = DataMapper.QueryForListWithPage <TDto>(fetchQuery, query, query.Order, wiilShowedPage, pageSize, ref total);
                query.TotalCount = total;
                pagers           = new PagerList <TDto>(query);
                pagers.AddRange(list);
            }
            catch (Exception e)
            {
                LogOuts.Info("FetchPages error:" + e.ToString());
            }
            return(pagers);
        }
コード例 #10
0
 public virtual ActionResult Update(TDto dto)
 {
     LogOuts.Info("Update");
     Service.Update(dto);
     return(Ok("UpdateSuccess"));
 }
コード例 #11
0
 public virtual PartialViewResult Look(string id)
 {
     LogOuts.Info("Look");
     return(PartialView(CommonName.LookForm, Service.FetchOne(id)));
 }
コード例 #12
0
 public virtual PartialViewResult Edit(string id)
 {
     LogOuts.Info("Edit");
     return(PartialView(CommonName.EditForm, Service.FetchOne(id)));
 }
コード例 #13
0
 public virtual PartialViewResult Add()
 {
     LogOuts.Info("Add");
     return(PartialView(CommonName.AddForm, Service.Create()));
 }