随笔分类 -  C#

1
摘要:1.WorkRepository.cs文件中写动态获取方法 2.在Configurations.cs文件中写一个LoadConfigurations public static string Url; public static void LoadConfigurations(IServicePro 阅读全文
posted @ 2025-06-06 13:27 艺洁 阅读(44) 评论(0) 推荐(0)
摘要:1、接收xml controller中写法如下 [HttpPost, ActionName("Sign_off")] [Produces("application/xml")]//接收[Consumes("application/xml")]//返回public async Task Sign_of 阅读全文
posted @ 2023-10-09 14:03 艺洁 阅读(711) 评论(0) 推荐(0)
摘要://表格字段都是大写的 想要实现首字母小写(特定操作配置输出序列化选项)[HttpPost, ActionName("QueryAll")] public ActionResult QueryAll() { return new JsonResult( _bll.QueryAll(), new Js 阅读全文
posted @ 2022-06-29 10:30 艺洁 阅读(612) 评论(0) 推荐(0)
摘要:[HttpGet] [Route("GetPurchaseItemWord")] public IHttpActionResult Get_PurchaseItemWord(string id) { #region 文件流 var model = _purchaseRepository.Get(id 阅读全文
posted @ 2020-10-27 09:30 艺洁 阅读(398) 评论(0) 推荐(0)
摘要:新建Timer类 using BaseAsset.Data.Infrastructure; using BaseAsset.Data.Repositories; using BaseAsset.Entities; using BaseAsset.Services; using BaseAsset.S 阅读全文
posted @ 2020-07-02 15:16 艺洁 阅读(1149) 评论(0) 推荐(0)
摘要:如果是单机版,就是部署一个服务器站点的我们可以使用很经典的lock锁,或者queue队列,针对单机版 同步访问共享资源的首选技术是C#的lock关键字。这个关键字允许定义一段线程同步的代码语句。后进入的线程不会中断当前线程,而是停止自身下一步执行,线程在进入锁定范伟的时候必须获得l标记。比较安全(推 阅读全文
posted @ 2020-06-03 17:08 艺洁 阅读(1611) 评论(0) 推荐(0)
摘要:AutoMapper初始化 在global.axax的Application_Start中使用AutoMapperConfiguration.Configure(); using AutoMapper; using System; using System.Collections.Generic; 阅读全文
posted @ 2019-11-21 13:26 艺洁 阅读(165) 评论(0) 推荐(0)
摘要:一、文件上传 IE中file会把文件所在物理路径带上 后台用 HttpFileCollection files = HttpContext.Current.Request.Files; foreach (string key in files.AllKeys){ HttpPostedFile fil 阅读全文
posted @ 2019-10-15 09:27 艺洁 阅读(464) 评论(0) 推荐(0)
摘要:[HttpPost] public ActionResult ImportTaskItem() { if (Request.Files != null) { try { HttpFileCollection files = System.Web.HttpContext.Current.Request 阅读全文
posted @ 2019-10-11 16:26 艺洁 阅读(384) 评论(0) 推荐(0)
摘要://导出word文档(注:需制定导出模板 并在内容处填入书签) //导出表格 public ActionResult ExportTZNoticeData(string id, string create_date) { try { string sPath = AppDomain.CurrentD 阅读全文
posted @ 2019-10-11 16:15 艺洁 阅读(719) 评论(0) 推荐(0)
摘要:1.一个参数 2.多个参数 3.一个实体对象 var url = ServerIp + '/api/food/foodsupply'; var ajaxTimeoutTest=$.ajax({ type: "Get", timeout: 10000, url: url, data: { page: 阅读全文
posted @ 2019-10-11 14:07 艺洁 阅读(1659) 评论(0) 推荐(0)
摘要:post 2.dynamic 后台接收 [HttpPost] [Route("Batchbook")] public IHttpActionResult Batch_book(dynamic obj) { string group_id = Convert.ToString(obj.group_id 阅读全文
posted @ 2019-10-11 13:56 艺洁 阅读(939) 评论(0) 推荐(0)
摘要:[HttpPost] public ActionResult ConfirmUpload() { string businessId = Request["businessId"]; string businessType = Request["businessType"]; string item 阅读全文
posted @ 2019-09-30 17:16 艺洁 阅读(365) 评论(0) 推荐(0)
摘要:引用AliyunOSS.dll 封装一个AliyunOSS帮助类 public static class AliyunOSS { static string accessKeyId = Config.AccessKeyId; static string accessKeySecret = Confi 阅读全文
posted @ 2019-09-30 17:14 艺洁 阅读(2802) 评论(0) 推荐(0)
摘要:#region 二维码生成 /// <summary> /// 批量生成二维码图片 /// </summary> [Route("createCodes"), HttpPost] public List<imageModel> Create_CodeImages(dynamic data) { st 阅读全文
posted @ 2019-09-29 10:44 艺洁 阅读(273) 评论(0) 推荐(0)
摘要:后台返回HttpResponseMessage 类型 前台ajax中dataType: "text" public HttpResponseMessage AddFoodSupply(HttpRequestMessage request, FoodSupplyViewModel foodModel) 阅读全文
posted @ 2019-09-27 17:36 艺洁 阅读(303) 评论(0) 推荐(0)
摘要:配置文件中<httpRuntime targetFramework="4.6.1" maxRequestLength="1024000 " /> 阅读全文
posted @ 2019-09-27 17:11 艺洁 阅读(234) 评论(0) 推荐(0)
摘要:public IHttpActionResult ImportFood() { HttpFileCollection files = HttpContext.Current.Request.Files; foreach (string key in files.AllKeys) { HttpPost 阅读全文
posted @ 2019-09-27 17:08 艺洁 阅读(460) 评论(0) 推荐(0)
摘要:[HttpGet] [Route("exportfoodapplydetail")] public HttpResponseMessage Export_Foodapplydetail(string id, string title) { var list = _fooddetailReposito 阅读全文
posted @ 2019-09-27 17:06 艺洁 阅读(738) 评论(0) 推荐(0)
摘要:public IHttpActionResult ConfirmUpload() { HttpFileCollection files = HttpContext.Current.Request.Files; if (files != null) { try { foreach (string ke 阅读全文
posted @ 2019-09-27 17:05 艺洁 阅读(697) 评论(0) 推荐(0)

1