Files
GateDge2023_ljy/00.未分类/UnitTestProject2/UnitTest1.cs
PastSaid 16fbd10312 1
2024-04-29 17:57:07 +08:00

188 lines
5.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Orm.Metadata.DataEntity;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Spire.Doc;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using HandleUtils;
using System.Data.SqlClient;
using Kingdee.BOS.Util;
using E_ZKEcc.Service;
using E_ZKEcc.Domian;
namespace UnitTestProject2
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
//var a = new DynamicObject(new DynamicObjectType("COUNT_GAIN"));
//var a = new Dictionary<string, Dictionary<string, string>>();
//a.Add("a", new Dictionary<string, string>());
//a.Add("b", new Dictionary<string, string>());
//var keys = new[] { "a", "a", "b" };
//foreach (var key in keys)
//{
// var item = a[key];
// item.Add("ttt", "1232");
//}
var rowList = new List<string>();
var rowList2 = new List<List<string>>();
Random rd = new Random();
var r1 = rd.Next(200, 1000);
for (int i = 0; i < r1; i++)
{
rowList.Add($"100123,{i},100123,2024-04-07 00:00:00,100123,100123,T_STK_STKTRANSFERINENTRY1");
}
var len = rowList.Max(x => x.Length);
var num = 8000 / 100;
int ii = 0;
var flag = rowList.Any();
while (flag)
{
ii++;
var t = rowList.Skip(num * ii).Take(num).ToList();
flag = num * ii > 8000;
}
return;
}
[TestMethod]
public void TestMethod2()
{
// HUIWE_SFTP_TST@sftp.betagrid.gxs.com 22
string ip = "sftp.betagrid.gxs.com";
string port = "22";
string user = "HUIWE_SFTP_TST";
string pwd = "@m+n|9+v^.R}1[^";
string localPath = "D:\\Work\\GateDge\\SFTP\\aatat.docx";
string remotePath = "/././POLLABLE";
SFTPHelper SFTPHelper = new SFTPHelper(ip, user, pwd, port);
var result = SFTPHelper.GetFileList(remotePath, "*BIN");
SFTPHelper.Disconnect();
return;
}
[TestMethod]
public void TestMethod4()
{
//var list = new List<EmployeeUpdateDomain>();
//list.Add(new EmployeeUpdateDomain()
//{
// pin = "AAA",
// name = ""
//});
//var str = JsonUtil.SerializeWithOutNull(list);
var apiInfo = new ApiInfoDomian();
apiInfo.appKey = "3391hexqe5h0wv4z4veju_dvn7gntnr5oiv_dxjabqtt";
apiInfo.apiVersion = "v2";
apiInfo.serverUrl = "http://14.21.32.187:8088";
var service = new EmployeeService(apiInfo);
var data = service.GetEmployee(null);
return;
}
[Serializable]
public class EmployeeUpdateDomain
{
/// <summary>
/// 人员编号 长度为1~24个字符 必填
/// </summary>
public string pin { get; set; }
/// <summary>
/// 名称。长度为1~20个字符
/// </summary>
public string name { get; set; }
/// <summary>
/// 人员所属部门编号(更新可以不填,新增必填)
/// </summary>
public string deptnumber { get; set; }
/// <summary>
/// 性别 。'M'表示男,'F'表示女 允许值: 'M', 'F'
/// </summary>
public string gender { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string identitycard { get; set; }
/// <summary>
/// 人员自助密码
/// </summary>
public string selfpassword { get; set; }
/// <summary>
/// 人员是否考勤
/// </summary>
public int? att { get; set; }
/// <summary>
/// 验证方式
/// </summary>
public int? comverifys { get; set; }
/// <summary>
/// 比对照片信息BASE64格式
/// </summary>
public string enrollpic { get; set; }
}
[TestMethod]
public void TestMethod3()
{
string sqlConn = "Data Source=ASSDB;User ID=ooa;Password=123qwe123";
SqlConnection con = new SqlConnection(sqlConn);
//SqlConnection con = new SqlConnection("Server=.;Database=ASSDB;uid=ooa;pwd=123qwe123;Trusted_Connection=False;");
con.Open();
}
[TestMethod]
public void ConvertHTMLtoWord()
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "Word|*.docx";
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
string filepath = dialog.FileName;
//创建 Document 对象
Document document = new Document();
document.LoadFromFile(filepath);
string fileExs = System.IO.Path.GetExtension(filepath);
string fileName = System.IO.Path.GetFileNameWithoutExtension(filepath);
string newFilePath = "";
//newFilePath = filepath.Replace(fileExs, ".html");
//document.SaveToFile(newFilePath, FileFormat.Html);
//document.Close();
newFilePath = filepath.Replace(fileExs, ".xml");
//document.LoadFromFile(newFilePath, FileFormat.Html);
document.SaveToFile(newFilePath, FileFormat.Xml);
document.Close();
}
}
}
}