随笔分类 - c#
摘要:背景 邮件中需要发送一些图片报表,报表长宽比过大, 长度 1800,宽 8000,此时发送到邮件显示的图片宽度过小。此时在HTML设置长宽等参数无效 解决方案 尝试发送一张 1000 * 1000的图片,设置图片的长宽各为1000,此时在邮件中显示正常。 使用代码将图片进行分割,除了最后一张图片,所
阅读全文
摘要://判断用户是否在系统中,如果不在,跳转到NoAccess页面 var attrs = filterContext.ActionDescriptor.GetCustomAttributes(true); if (attrs.Any(c => c.GetType() == typeof(AllowAn
阅读全文
摘要:OR Expression<Func<Inventory, bool>> expression = c => 1 == 1; Expression<Func<Inventory, bool>> expression1 = c => cnPlants.Contains(c.Plant) && (c.S
阅读全文
摘要:var files = Request.Files; if (files == null || files.Count == 0) { return Json(new { code = 1, msg = "未获取到文件" }); } var file = files[0]; var dt = Rea
阅读全文
摘要:public void SendEmail() { var path = Path.Combine(Server.MapPath("../"), "Content\\template\\email\\eCalendar.html"); var template = System.IO.File.Re
阅读全文
摘要:var sharedPath = @"\\10.27.128.125\share"; ///2024/07/29/14/DefectListReport-240727990000000558/images sharedPath += @"\"+ SheetDateTime.Year; sharedP
阅读全文
摘要:(dayData * ratio.transformation_ratio / 1000).ToString("N0") //240,841,195
阅读全文
摘要:public QueryResult SqlBulkCopy(DataTable dt, string tableName) { try { connection.Open(); using (var copy = new SqlBulkCopy(connection)) { copy.Destin
阅读全文
摘要:添加配置文件 设置属性:复制到输出目录,如果较新则复制 <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w
阅读全文
摘要:新建资源文件夹 添加 ASP.NET 文件夹 选择 App_GlobalResources 新建资源文件 language.resx language.en.resx 创建了中文、英文两个语言的资源文件,中文是程序的默认语言。 然后是 language.en.resx,中间的“en”是英语的 Cul
阅读全文
摘要:安装包 Microsoft.CodeDom.Providers.DotNetCompilerPlatform 如果已有包,则卸载重装
阅读全文
摘要:DataTable public static class DataTableExtension { public static T GetData<T>(this DataTable dt, int rowIndex, string colName) { if (dt == null || dt.
阅读全文
摘要:public void ExtractArchive(Stream stream, string destinationPath) { using (var reader = ReaderFactory.Open(stream)) { while (reader.MoveToNextEntry())
阅读全文
摘要:namespace NPOI { /// <summary> /// 表示单元格的维度,通常用于表达合并单元格的维度 /// </summary> public struct Dimension { /// <summary> /// 含有数据的单元格(通常表示合并单元格的第一个跨度行第一个跨度列)
阅读全文
摘要:AES 算法加密(ECB模式),加密后进行base64编码 异常 Specified key is not a valid size for this algorithm 解决方法:AES加密中参数key应是32位,如果位数不对会报此错。 /// <summary> /// AES 算法加密(ECB
阅读全文
摘要:激活码激活方式 远程连网激活 本地生成注册 配套密钥文件 离线激活码 本地生成注册 这种方式是根据客户机的环境,获取客户机的信息,比如硬盘、MAC地址、CPU等硬件信息。根据一定的算法将这些信息生成一个注册码。目前超过一半的软件都是采用这种方式来实现的 用户安装系统后,软件系统会根据用户机器的关键信
阅读全文
摘要:在.net mvc 5中仅仅设置 Route 属性是不够的 [Route("interfaces/api/amr/missionStateCallback")] [HttpPost] public ActionResult missionStateCallback(Missionstatecallb
阅读全文

浙公网安备 33010602011771号