Files
GateDge2023_ljy/00.未分类/UnitTestProject2/UnitTest1.cs

188 lines
5.8 KiB
C#
Raw Normal View History

2024-03-18 11:42:45 +08:00
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Orm.Metadata.DataEntity;
using Microsoft.VisualStudio.TestTools.UnitTesting;
2024-04-22 09:39:19 +08:00
using Spire.Doc;
2024-03-18 11:42:45 +08:00
using System;
using System.Collections.Generic;
2024-04-22 09:39:19 +08:00
using System.IO;
using System.Linq;
using System.Windows.Forms;
2024-04-29 17:57:07 +08:00
using HandleUtils;
using System.Data.SqlClient;
using Kingdee.BOS.Util;
using E_ZKEcc.Service;
using E_ZKEcc.Domian;
2024-03-18 11:42:45 +08:00
namespace UnitTestProject2
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
//var a = new DynamicObject(new DynamicObjectType("COUNT_GAIN"));
2024-04-22 09:39:19 +08:00
//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");
}
2024-03-18 11:42:45 +08:00
2024-04-22 09:39:19 +08:00
var len = rowList.Max(x => x.Length);
var num = 8000 / 100;
int ii = 0;
var flag = rowList.Any();
while (flag)
2024-03-18 11:42:45 +08:00
{
2024-04-22 09:39:19 +08:00
ii++;
var t = rowList.Skip(num * ii).Take(num).ToList();
flag = num * ii > 8000;
2024-03-18 11:42:45 +08:00
}
return;
}
2024-04-22 09:39:19 +08:00
[TestMethod]
public void TestMethod2()
{
2024-04-29 17:57:07 +08:00
// HUIWE_SFTP_TST@sftp.betagrid.gxs.com 22
2024-04-22 09:39:19 +08:00
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";
2024-04-29 17:57:07 +08:00
string remotePath = "/././POLLABLE";
2024-04-22 09:39:19 +08:00
SFTPHelper SFTPHelper = new SFTPHelper(ip, user, pwd, port);
2024-04-29 17:57:07 +08:00
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);
2024-04-22 09:39:19 +08:00
return;
}
2024-04-29 17:57:07 +08:00
[Serializable]
public class EmployeeUpdateDomain
2024-04-22 09:39:19 +08:00
{
/// <summary>
2024-04-29 17:57:07 +08:00
/// 人员编号 长度为1~24个字符 必填
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public string pin { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 名称。长度为1~20个字符
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public string name { get; set; }
2024-04-22 09:39:19 +08:00
2024-04-29 17:57:07 +08:00
/// <summary>
/// 人员所属部门编号(更新可以不填,新增必填)
/// </summary>
public string deptnumber { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 性别 。'M'表示男,'F'表示女 允许值: 'M', 'F'
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public string gender { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 身份证号
/// </summary>
public string identitycard { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 人员自助密码
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public string selfpassword { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 人员是否考勤
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public int? att { get; set; }
2024-04-22 09:39:19 +08:00
2024-04-29 17:57:07 +08:00
/// <summary>
/// 验证方式
/// </summary>
public int? comverifys { get; set; }
2024-04-22 09:39:19 +08:00
/// <summary>
2024-04-29 17:57:07 +08:00
/// 比对照片信息BASE64格式
2024-04-22 09:39:19 +08:00
/// </summary>
2024-04-29 17:57:07 +08:00
public string enrollpic { get; set; }
}
[TestMethod]
public void TestMethod3()
{
string sqlConn = "Data Source=ASSDB;User ID=ooa;Password=123qwe123";
2024-04-22 09:39:19 +08:00
2024-04-29 17:57:07 +08:00
SqlConnection con = new SqlConnection(sqlConn);
//SqlConnection con = new SqlConnection("Server=.;Database=ASSDB;uid=ooa;pwd=123qwe123;Trusted_Connection=False;");
con.Open();
2024-04-22 09:39:19 +08:00
}
[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();
}
}
2024-03-18 11:42:45 +08:00
}
}