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>(); //a.Add("a", new Dictionary()); //a.Add("b", new Dictionary()); //var keys = new[] { "a", "a", "b" }; //foreach (var key in keys) //{ // var item = a[key]; // item.Add("ttt", "1232"); //} var rowList = new List(); var rowList2 = new List>(); 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(); //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 { /// /// 人员编号 长度为1~24个字符 必填 /// public string pin { get; set; } /// /// 名称。长度为1~20个字符 /// public string name { get; set; } /// /// 人员所属部门编号(更新可以不填,新增必填) /// public string deptnumber { get; set; } /// /// 性别 。'M'表示男,'F'表示女 允许值: 'M', 'F' /// public string gender { get; set; } /// /// 身份证号 /// public string identitycard { get; set; } /// /// 人员自助密码 /// public string selfpassword { get; set; } /// /// 人员是否考勤 /// public int? att { get; set; } /// /// 验证方式 /// public int? comverifys { get; set; } /// /// 比对照片信息,BASE64格式 /// 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(); } } } }