1代理改名字 2代理管理功能 3订单流水统计功能(方便报税) 4 商品预售界面-商品改价支持加减乘除四种模式
This commit is contained in:
1 parent
457a8acee6
commit
ba502650ab
69 files changed
+27720
-720
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace AllBase
|
||||
@@ -72,5 +73,54 @@ namespace AllBase
|
||||
{
|
||||
return DecodeBase64(Encoding.UTF8, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件转Base64编码
|
||||
/// </summary>
|
||||
/// <param name="fileName">文件全路径</param>
|
||||
/// <returns></returns>
|
||||
public static string DocumentToBase64Str(string fileName)
|
||||
{
|
||||
FileStream filestream = new FileStream(fileName, FileMode.Open);
|
||||
|
||||
byte[] bt = new byte[filestream.Length];
|
||||
//调用read读取方法
|
||||
filestream.Read(bt, 0, bt.Length);
|
||||
string base64Str = Convert.ToBase64String(bt);
|
||||
filestream.Close();
|
||||
return base64Str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base64字符串转文件并保存
|
||||
/// </summary>
|
||||
/// <param name="base64String">base64字符串</param>
|
||||
/// /// <param name="fileFullPath">保存的文件路径 </param>
|
||||
/// <param name="fileName">保存的文件名</param>
|
||||
/// <returns>是否转换并保存成功</returns>
|
||||
public static bool Base64StringToFile(string base64String, string fileFullPath, string fileName)
|
||||
{
|
||||
bool opResult = false;
|
||||
try
|
||||
{
|
||||
|
||||
if (!Directory.Exists(fileFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(fileFullPath);
|
||||
}
|
||||
MemoryStream stream = new MemoryStream(Convert.FromBase64String(base64String));
|
||||
FileStream fs = new FileStream(fileFullPath + "\\" + fileName, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
byte[] b = stream.ToArray();
|
||||
fs.Write(b, 0, b.Length);
|
||||
fs.Close();
|
||||
|
||||
opResult = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
return opResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user