temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
@@ -0,0 +1,131 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AllBase
|
||||
{
|
||||
public class OutExcel
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="patch"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveFile(string patch, DataGridView dt)
|
||||
{
|
||||
string temp = "";
|
||||
for (int i = 0; i < dt.ColumnCount; i++)
|
||||
{
|
||||
if (dt.Columns[i].Visible && dt.Columns[i].HeaderText != "删除" && dt.Columns[i].HeaderText != "历史记录")
|
||||
temp += dt.Columns[i].HeaderText + "\t";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(temp))
|
||||
temp += "\r\n";
|
||||
try
|
||||
{
|
||||
if (File.Exists(patch))
|
||||
File.Delete(patch);
|
||||
File.WriteAllText(patch, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < dt.RowCount; i++)
|
||||
{
|
||||
for (int j = 0; j < dt.ColumnCount; j++)
|
||||
{
|
||||
if (dt.Columns[j].Visible && dt.Columns[j].HeaderText != "删除" && dt.Columns[j].HeaderText != "历史记录")
|
||||
temp += dt.Rows[i].Cells[j].Value + "\t";
|
||||
}
|
||||
temp += "\r\n";
|
||||
if (temp.Length > 2000)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
//return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(temp))
|
||||
return true;
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool SaveFileCheckBox(string patch, DataGridView dt)
|
||||
{
|
||||
string temp = "";
|
||||
for (int i = 0; i < dt.ColumnCount; i++)
|
||||
{
|
||||
if (dt.Columns[i].HeaderText != "删除" && dt.Columns[i].HeaderText != "全选")
|
||||
temp += dt.Columns[i].HeaderText + "\t";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(temp))
|
||||
temp += "\r\n";
|
||||
try
|
||||
{
|
||||
if (File.Exists(patch))
|
||||
File.Delete(patch);
|
||||
File.WriteAllText(patch, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < dt.RowCount; i++)
|
||||
{
|
||||
if (bool.Parse(dt.Rows[i].Cells["isCheckBoxColumny"].Value.ToString()) == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < dt.ColumnCount; j++)
|
||||
{
|
||||
if (dt.Columns[j].HeaderText != "删除" && dt.Columns[j].HeaderText != "全选")
|
||||
{
|
||||
temp += dt.Rows[i].Cells[j].Value + "\t";
|
||||
}
|
||||
}
|
||||
temp += "\r\n";
|
||||
if (temp.Length > 2000)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
temp = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
//return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(temp))
|
||||
return true;
|
||||
try
|
||||
{
|
||||
File.AppendAllText(patch, temp, Encoding.Unicode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user