DeviceManager/SqlSugarTest/Form1.cs
2024-07-27 09:44:19 +08:00

78 lines
2.6 KiB
C#

using DeviceRepair.Models;
using DeviceRepair.Models.Device;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SqlSugarTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
TsSFCDevice.Client.Biz.Common com = new TsSFCDevice.Client.Biz.Common();
byte[] btRtn;
object param = new
{
CLIENTIP = "192.168.10.2",
CLIENTMAC = "38-D5-7A-E5-42-0D",
CLIENTNAME = "Honor"
};
try
{
var apiResponseData = com.UserLogin("myl", "EC0A56F182F85CC87B6D79E18CDC26D0", Newtonsoft.Json.JsonConvert.SerializeObject(param), out btRtn);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//try
//{
// using (SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
// {
// ConnectionString = "Data Source=www.clovejunti.cn,11433;Initial Catalog=DriveMaintenance;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;",
// DbType = SqlSugar.DbType.SqlServer,
// IsAutoCloseConnection = true,
// InitKeyType = InitKeyType.Attribute
// }))
// {
// // 获取设备计划信息
// DeviceInformationInfo Dev = db.Queryable<DeviceInformationInfo>().First(x => x.AutoID == 408);
// List<DriveMaintencePlanInfo> plans = db.Queryable<DriveMaintencePlanInfo>().Where(x => x.EquipmentID == 408 && x.MaintenanceYear == 2024 && SqlFunc.HasValue(x.MaintenanceType)).ToList();
// int[] pIds = plans.Select(x => x.AutoID).ToArray();
// List<MaintenanceRecordInfo> records = db.Queryable<MaintenanceRecordInfo>().Where(x => x.EquipmentPrimaryID == 408 && SqlFunc.ContainsArray(pIds, x.AutoID)).ToList();
// DeviceAnnPlanView devs = new DeviceAnnPlanView
// {
// Dev = Dev,
// Plans = plans,
// Records = records
// };
// }
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.Message);
//}
}
}
}