1代理改名字 2代理管理功能 3订单流水统计功能(方便报税) 4 商品预售界面-商品改价支持加减乘除四种模式
This commit is contained in:
1 parent
457a8acee6
commit
ba502650ab
69 files changed
+27720
-720
No files matched your search
+92
-8
@@ -1,4 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -9,10 +11,10 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="patch"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveFile(string patch, DataGridView dt)
|
||||
public static bool SaveFile(string path, DataGridView dt)
|
||||
{
|
||||
string temp = "";
|
||||
for (int i = 0; i < dt.ColumnCount; i++)
|
||||
@@ -24,9 +26,9 @@ namespace AllBase
|
||||
temp += "\r\n";
|
||||
try
|
||||
{
|
||||
if (File.Exists(patch))
|
||||
File.Delete(patch);
|
||||
File.WriteAllText(patch, temp, Encoding.Unicode);
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
File.WriteAllText(path, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
@@ -45,7 +47,7 @@ namespace AllBase
|
||||
{
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
File.AppendAllText(path, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
@@ -58,7 +60,7 @@ namespace AllBase
|
||||
return true;
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
File.AppendAllText(path, temp, Encoding.Unicode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -127,5 +129,87 @@ namespace AllBase
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SaveFile(string path, bool isNewFile, bool isShowHideColumn, List<DataGridViewRow> dgvRows, params string[] exceptHeaderText)
|
||||
{
|
||||
if (dgvRows == null || dgvRows.Count == 0) return false;
|
||||
var dt = dgvRows.FirstOrDefault()?.DataGridView;
|
||||
if (dt == null) return false;
|
||||
|
||||
string temp = "";
|
||||
if (isNewFile)
|
||||
{
|
||||
for (int i = 0; i < dt.ColumnCount; i++)
|
||||
{
|
||||
if ((isShowHideColumn || dt.Columns[i].Visible) && !exceptHeaderText.Contains(dt.Columns[i].HeaderText))
|
||||
temp += "\"" + dt.Columns[i].HeaderText + "\"\t";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(temp))
|
||||
temp += "\r\n";
|
||||
try
|
||||
{
|
||||
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
File.WriteAllText(path, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < dt.RowCount; i++)
|
||||
{
|
||||
if (!dgvRows.Contains(dt.Rows[i]))
|
||||
continue;
|
||||
|
||||
for (int j = 0; j < dt.ColumnCount; j++)
|
||||
{
|
||||
if ((isShowHideColumn || dt.Columns[j].Visible) && !exceptHeaderText.Contains(dt.Columns[j].HeaderText))
|
||||
temp += "\"" + dt.Rows[i].Cells[j].Value + "\"\t";
|
||||
}
|
||||
temp += "\r\n";
|
||||
if (temp.Length > 2000)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.AppendAllText(path, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(temp))
|
||||
return true;
|
||||
try
|
||||
{
|
||||
File.AppendAllText(path, temp, Encoding.Unicode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user