diff --git a/其他程序/LadfDataApp/.cr/personal/FavoritesList/List.xml b/其他程序/LadfDataApp/.cr/personal/FavoritesList/List.xml
new file mode 100644
index 0000000..a60e5ed
--- /dev/null
+++ b/其他程序/LadfDataApp/.cr/personal/FavoritesList/List.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp.sln b/其他程序/LadfDataApp/LadfDataApp.sln
new file mode 100644
index 0000000..0f5a5cf
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31410.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LadfDataApp", "LadfDataApp\LadfDataApp.csproj", "{AA75C812-16A4-498C-BF4D-F1C2CB8E0015}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AA75C812-16A4-498C-BF4D-F1C2CB8E0015}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA75C812-16A4-498C-BF4D-F1C2CB8E0015}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AA75C812-16A4-498C-BF4D-F1C2CB8E0015}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA75C812-16A4-498C-BF4D-F1C2CB8E0015}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {CD3FE4D7-213D-4D71-A405-8B7222DBA8C2}
+ EndGlobalSection
+EndGlobal
diff --git a/其他程序/LadfDataApp/LadfDataApp/App.config b/其他程序/LadfDataApp/LadfDataApp/App.config
new file mode 100644
index 0000000..56c8bf7
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/App.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/FrmMain.Designer.cs b/其他程序/LadfDataApp/LadfDataApp/FrmMain.Designer.cs
new file mode 100644
index 0000000..2b8df10
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/FrmMain.Designer.cs
@@ -0,0 +1,234 @@
+
+namespace LadfDataApp
+{
+ partial class FrmMain
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows 窗体设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要修改
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.loginInfoPanel = new System.Windows.Forms.Panel();
+ this.timeUnitLab = new System.Windows.Forms.Label();
+ this.timeIntervalLab = new System.Windows.Forms.Label();
+ this.timeIntervalBox = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.projectComboBox = new System.Windows.Forms.ComboBox();
+ this.dataBaseLab = new System.Windows.Forms.Label();
+ this.dataBaseBox = new System.Windows.Forms.TextBox();
+ this.serverLab = new System.Windows.Forms.Label();
+ this.serverBox = new System.Windows.Forms.TextBox();
+ this.startBtn = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.loginPasswordBox = new System.Windows.Forms.TextBox();
+ this.loginNameLab = new System.Windows.Forms.Label();
+ this.loginNameBox = new System.Windows.Forms.TextBox();
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.tipsTextBox = new System.Windows.Forms.TextBox();
+ this.loginInfoPanel.SuspendLayout();
+ this.panel2.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // loginInfoPanel
+ //
+ this.loginInfoPanel.BackColor = System.Drawing.SystemColors.Control;
+ this.loginInfoPanel.Controls.Add(this.timeUnitLab);
+ this.loginInfoPanel.Controls.Add(this.timeIntervalLab);
+ this.loginInfoPanel.Controls.Add(this.timeIntervalBox);
+ this.loginInfoPanel.Controls.Add(this.label2);
+ this.loginInfoPanel.Controls.Add(this.projectComboBox);
+ this.loginInfoPanel.Controls.Add(this.dataBaseLab);
+ this.loginInfoPanel.Controls.Add(this.dataBaseBox);
+ this.loginInfoPanel.Controls.Add(this.serverLab);
+ this.loginInfoPanel.Controls.Add(this.serverBox);
+ this.loginInfoPanel.Controls.Add(this.startBtn);
+ this.loginInfoPanel.Controls.Add(this.label1);
+ this.loginInfoPanel.Controls.Add(this.loginPasswordBox);
+ this.loginInfoPanel.Controls.Add(this.loginNameLab);
+ this.loginInfoPanel.Controls.Add(this.loginNameBox);
+ this.loginInfoPanel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.loginInfoPanel.Location = new System.Drawing.Point(0, 0);
+ this.loginInfoPanel.Name = "loginInfoPanel";
+ this.loginInfoPanel.Size = new System.Drawing.Size(603, 164);
+ this.loginInfoPanel.TabIndex = 0;
+ //
+ // timeUnitLab
+ //
+ this.timeUnitLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.timeUnitLab.Location = new System.Drawing.Point(243, 127);
+ this.timeUnitLab.Name = "timeUnitLab";
+ this.timeUnitLab.Size = new System.Drawing.Size(45, 25);
+ this.timeUnitLab.TabIndex = 13;
+ this.timeUnitLab.Text = "分钟";
+ this.timeUnitLab.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // timeIntervalLab
+ //
+ this.timeIntervalLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.timeIntervalLab.Location = new System.Drawing.Point(12, 127);
+ this.timeIntervalLab.Name = "timeIntervalLab";
+ this.timeIntervalLab.Size = new System.Drawing.Size(70, 25);
+ this.timeIntervalLab.TabIndex = 12;
+ this.timeIntervalLab.Text = "间 隔:";
+ this.timeIntervalLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // timeIntervalBox
+ //
+ this.timeIntervalBox.Location = new System.Drawing.Point(88, 127);
+ this.timeIntervalBox.Name = "timeIntervalBox";
+ this.timeIntervalBox.Size = new System.Drawing.Size(149, 21);
+ this.timeIntervalBox.TabIndex = 11;
+ //
+ // label2
+ //
+ this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label2.Location = new System.Drawing.Point(12, 89);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(70, 25);
+ this.label2.TabIndex = 10;
+ this.label2.Text = "项 目:";
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // projectComboBox
+ //
+ this.projectComboBox.FormattingEnabled = true;
+ this.projectComboBox.Location = new System.Drawing.Point(88, 91);
+ this.projectComboBox.Name = "projectComboBox";
+ this.projectComboBox.Size = new System.Drawing.Size(200, 20);
+ this.projectComboBox.TabIndex = 9;
+ //
+ // dataBaseLab
+ //
+ this.dataBaseLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.dataBaseLab.Location = new System.Drawing.Point(308, 54);
+ this.dataBaseLab.Name = "dataBaseLab";
+ this.dataBaseLab.Size = new System.Drawing.Size(70, 25);
+ this.dataBaseLab.TabIndex = 8;
+ this.dataBaseLab.Text = "数据库:";
+ this.dataBaseLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // dataBaseBox
+ //
+ this.dataBaseBox.Location = new System.Drawing.Point(384, 54);
+ this.dataBaseBox.Name = "dataBaseBox";
+ this.dataBaseBox.Size = new System.Drawing.Size(200, 21);
+ this.dataBaseBox.TabIndex = 7;
+ //
+ // serverLab
+ //
+ this.serverLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.serverLab.Location = new System.Drawing.Point(12, 54);
+ this.serverLab.Name = "serverLab";
+ this.serverLab.Size = new System.Drawing.Size(70, 25);
+ this.serverLab.TabIndex = 6;
+ this.serverLab.Text = "服务器:";
+ this.serverLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // serverBox
+ //
+ this.serverBox.Location = new System.Drawing.Point(88, 54);
+ this.serverBox.Name = "serverBox";
+ this.serverBox.Size = new System.Drawing.Size(200, 21);
+ this.serverBox.TabIndex = 5;
+ //
+ // startBtn
+ //
+ this.startBtn.Location = new System.Drawing.Point(482, 127);
+ this.startBtn.Name = "startBtn";
+ this.startBtn.Size = new System.Drawing.Size(102, 31);
+ this.startBtn.TabIndex = 4;
+ this.startBtn.Text = "开始同步";
+ this.startBtn.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.label1.Location = new System.Drawing.Point(308, 18);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(70, 25);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "密 码:";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // loginPasswordBox
+ //
+ this.loginPasswordBox.Location = new System.Drawing.Point(384, 18);
+ this.loginPasswordBox.Name = "loginPasswordBox";
+ this.loginPasswordBox.PasswordChar = '●';
+ this.loginPasswordBox.Size = new System.Drawing.Size(200, 21);
+ this.loginPasswordBox.TabIndex = 2;
+ //
+ // loginNameLab
+ //
+ this.loginNameLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.loginNameLab.Location = new System.Drawing.Point(12, 18);
+ this.loginNameLab.Name = "loginNameLab";
+ this.loginNameLab.Size = new System.Drawing.Size(70, 25);
+ this.loginNameLab.TabIndex = 1;
+ this.loginNameLab.Text = "用户名:";
+ this.loginNameLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // loginNameBox
+ //
+ this.loginNameBox.Location = new System.Drawing.Point(88, 18);
+ this.loginNameBox.Name = "loginNameBox";
+ this.loginNameBox.Size = new System.Drawing.Size(200, 21);
+ this.loginNameBox.TabIndex = 0;
+ //
+ // panel2
+ //
+ this.panel2.Controls.Add(this.tipsTextBox);
+ this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel2.Location = new System.Drawing.Point(0, 164);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(603, 364);
+ this.panel2.TabIndex = 1;
+ //
+ // tipsTextBox
+ //
+ this.tipsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.tipsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tipsTextBox.Location = new System.Drawing.Point(0, 0);
+ this.tipsTextBox.Multiline = true;
+ this.tipsTextBox.Name = "tipsTextBox";
+ this.tipsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.tipsTextBox.Size = new System.Drawing.Size(603, 364);
+ this.tipsTextBox.TabIndex = 0;
+ //
+ // FrmMain
+ //
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.ClientSize = new System.Drawing.Size(603, 528);
+ this.Controls.Add(this.panel2);
+ this.Controls.Add(this.loginInfoPanel);
+ this.Name = "FrmMain";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "朗速科技物联网同步平台";
+ this.loginInfoPanel.ResumeLayout(false);
+ this.loginInfoPanel.PerformLayout();
+ this.panel2.ResumeLayout(false);
+ this.panel2.PerformLayout();
+ this.ResumeLayout(false);
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/FrmMain.cs b/其他程序/LadfDataApp/LadfDataApp/FrmMain.cs
new file mode 100644
index 0000000..c2c6e01
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/FrmMain.cs
@@ -0,0 +1,652 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration;
+using System.Data;
+using System.Data.SqlClient;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace LadfDataApp
+{
+ public partial class FrmMain : Form
+ {
+ private string sid = string.Empty;//认证码
+ private System.Timers.Timer timer = new System.Timers.Timer();//指定间隔循环
+ private int timeInterval = 0;
+ public FrmMain()
+ {
+ InitializeComponent();
+ this.Load += OnFrmMainLoad;
+ this.startBtn.Click += OnStartBtnClick;
+ this.loginNameBox.TextChanged += OnTextChanged;
+ this.loginPasswordBox.TextChanged += OnTextChanged;
+ }
+ private void OnFrmMainLoad(object sender, EventArgs e)
+ {
+ this.loginNameBox.Text = ConfigurationManager.AppSettings["loginName"];
+ this.serverBox.Text = ConfigurationManager.AppSettings["server"];
+ this.dataBaseBox.Text = ConfigurationManager.AppSettings["database"];
+ this.timeIntervalBox.Text = ConfigurationManager.AppSettings["intervalTime"];
+ if (this.loginNameBox.Text.Equals("lserptest"))
+ {
+ this.loginPasswordBox.Text = "lserpAdmin";
+ }
+ }
+ private void OnTextChanged(object sender, EventArgs e)
+ {
+ if (!string.IsNullOrEmpty(this.loginNameBox.Text) && !string.IsNullOrEmpty(this.loginPasswordBox.Text))
+ {
+ if (Login())
+ {
+ InitComboBox();
+ UpdateMsg($"用户登录成功\r\n");
+ }
+ else
+ {
+ //UpdateMsg($"用户登录失败\r\n");
+ }
+ }
+ }
+ ///
+ /// 加载项目下拉框数据源
+ ///
+ private void InitComboBox()
+ {
+ try
+ {
+ this.projectComboBox.Items.Clear();
+ string url = "https://api.123321yun.com/api/user/queryProjectList";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("isAll", "true");
+ pmsDic.Add("pageNum", "1");
+ pmsDic.Add("pageSize", "10");
+ Dictionary headerDic = new Dictionary();
+ headerDic.Add("__sid", sid);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, headerDic, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ JArray projectArray = (JArray)resultJObject["data"];
+ foreach (JObject projectJObject in projectArray)
+ {
+ try
+ {
+ string projectName = projectJObject["name"] + "";
+ this.projectComboBox.Items.Add(projectName);
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ private void OnStartBtnClick(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(this.loginNameBox.Text) || string.IsNullOrEmpty(this.loginPasswordBox.Text))
+ {
+ MessageBox.Show("用户名或密码不能为空", "提示");
+ return;
+ }
+ if (string.IsNullOrEmpty(this.serverBox.Text) || string.IsNullOrEmpty(this.dataBaseBox.Text))
+ {
+ MessageBox.Show("服务器或数据库不能为空", "提示");
+ return;
+ }
+ if (string.IsNullOrEmpty(this.projectComboBox.SelectedItem + ""))
+ {
+ MessageBox.Show("未选择项目", "提示");
+ return;
+ }
+ if (!int.TryParse(this.timeIntervalBox.Text, out timeInterval) && timeInterval <= 0)
+ {
+ MessageBox.Show("间隔时间必须大于0", "提示");
+ return;
+ }
+ timer.Elapsed += OnTimerElapsed;
+ timer.Interval = 100;
+ timer.Start();
+ }
+ ///
+ /// 获取数据事件
+ ///
+ ///
+ ///
+ private void OnTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+ try
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.startBtn.Enabled = false;
+ this.loginNameBox.Enabled = false;
+ this.loginPasswordBox.Enabled = false;
+ this.serverBox.Enabled = false;
+ this.dataBaseBox.Enabled = false;
+ this.timeIntervalBox.Enabled = false;
+ this.projectComboBox.Enabled = false;
+ }));
+ if (timer.Interval == 100)
+ {
+ timer.Interval = timeInterval * 60 * 1000;
+ }
+ ClearMsg();
+ QueryProjectList();
+ UpdateMsg("同步完成,所有数据已成功写入\r\n");
+ string nextTime = DateTime.Now.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss");
+ UpdateMsg($"下次同步时间:{nextTime}\r\n");
+ }
+ catch (Exception)
+ {
+ }
+ finally
+ {
+ this.Invoke(new Action(() =>
+ {
+ this.loginNameBox.Enabled = true;
+ this.loginPasswordBox.Enabled = true;
+ this.startBtn.Enabled = true;
+ this.serverBox.Enabled = true;
+ this.dataBaseBox.Enabled = true;
+ this.timeIntervalBox.Enabled = true;
+ this.projectComboBox.Enabled = true;
+ }));
+ }
+ }
+ ///
+ /// 登录
+ ///
+ ///
+ private bool Login()
+ {
+ bool isLogin = false;
+ try
+ {
+ string url = "https://api.123321yun.com/api/user/login";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("username", this.loginNameBox.Text);
+ pmsDic.Add("password", this.loginPasswordBox.Text);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, null, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ sid = resultJObject["data"] + "";
+ isLogin = true;
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ return isLogin;
+ }
+ ///
+ /// 查询项目列表
+ ///
+ private void QueryProjectList()
+ {
+ try
+ {
+ string url = "https://api.123321yun.com/api/user/queryProjectList";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("isAll", "true");
+ pmsDic.Add("pageNum", "1");
+ pmsDic.Add("pageSize", "10");
+ Dictionary headerDic = new Dictionary();
+ headerDic.Add("__sid", sid);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, headerDic, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ string selectProjectName = "";
+ this.Invoke(new Action(() =>
+ {
+ selectProjectName = projectComboBox.SelectedItem + "";
+ }));
+ JArray projectArray = (JArray)resultJObject["data"];
+ bool isConnection = CreateConnection();
+ if (isConnection)
+ {
+ foreach (JObject projectJObject in projectArray)
+ {
+ try
+ {
+ if (projectJObject.ContainsKey("name") && (projectJObject["name"] + "").Equals(selectProjectName))
+ {
+ try
+ {
+ UpdateMsg($"正在读取项目:{projectJObject["name"]}\r\n");
+ ProjectModel projectModel = new ProjectModel();
+ projectModel.projectId = projectJObject["id"] + "";
+ projectModel.name = projectJObject["name"] + "";
+ projectModel.delFlag = projectJObject["delFlag"] + "";
+ projectModel.province = projectJObject["province"] + "";
+ projectModel.city = projectJObject["city"] + "";
+ projectModel.county = projectJObject["county"] + "";
+ projectModel.address = projectJObject["address"] + "";
+ projectModel.propertyOwner = projectJObject["propertyOwner"] + "";
+ projectModel.constructionTime = projectJObject["constructionTime"] + "";
+ projectModel.acreage = projectJObject["acreage"] + "";
+ projectModel.typeId = projectJObject["typeId"] + "";
+ projectModel.state = projectJObject["state"] + "";
+ projectModel.enableTime = projectJObject["enableTime"] + "";
+ projectModel.energyConsumption = projectJObject["energyConsumption"] + "";
+ projectModel.imgUrl = projectJObject["imgUrl"] + "";
+ projectModel.remarks = projectJObject["remarks"] + "";
+ projectModel.contractor = projectJObject["contractor"] + "";
+ projectModel.propertyMgmt = projectJObject["propertyMgmt"] + "";
+ projectModel.projectTypeId = projectJObject["projectType"]["id"] + "";
+ projectModel.projectTypeName = projectJObject["projectType"]["name"] + "";
+ StringBuilder projectSqlStrBuilder = new StringBuilder();
+ StringBuilder projectInsertKeys = new StringBuilder();
+ StringBuilder projectInsertValues = new StringBuilder();
+ PropertyInfo[] devicePmsPropertyInfos = projectModel.GetType().GetProperties();
+ foreach (System.Reflection.PropertyInfo projectPropertyInfo in devicePmsPropertyInfos)
+ {
+ projectInsertKeys.Append($"{projectPropertyInfo.Name},");
+ projectInsertValues.Append($"'{(projectPropertyInfo.GetValue(projectModel, null) + "").Replace("'", "''")}',");
+ }
+ projectSqlStrBuilder.Append($"delete from LadfProjectTab where projectid = '{projectModel.projectId}';\r\n" +
+ $"insert into LadfProjectTab ({projectInsertKeys.ToString().TrimEnd(',')}) values ({projectInsertValues.ToString().TrimEnd(',')});\r\n");
+ if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
+ {
+ SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
+ }
+ QueryDeviceByProject(projectModel);
+ UpdateMsg($"项目:{projectJObject["name"]}数据写入完成\r\n");
+ }
+ catch (Exception ex)
+ {
+ UpdateMsg($"项目:{projectJObject["name"]}数据写入失败,原因:{ex.Message}\r\n");
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+ else
+ {
+ UpdateMsg($"读取项目失败,服务器连接失败\r\n");
+ }
+ }
+ else if (code.Equals("4012"))
+ {
+ UpdateMsg($"登录失败\r\n");
+ Login();
+ QueryProjectList();
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ ///
+ /// 查询项目的设备列表
+ ///
+ private void QueryDeviceByProject(ProjectModel projectModel)
+ {
+ StringBuilder projectSqlStrBuilder = new StringBuilder();
+ UpdateMsg($"正在读取项目:{projectModel.name}的设备\r\n");
+ try
+ {
+ string url = "https://api.123321yun.com/api/device/queryDeviceByProject";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("projId", projectModel.projectId);
+ Dictionary headerDic = new Dictionary();
+ headerDic.Add("__sid", sid);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, headerDic, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ JArray deviceArray = (JArray)resultJObject["data"];
+ foreach (JObject deviceJObject in deviceArray)
+ {
+ try
+ {
+ UpdateMsg($"正在读取设备:{deviceJObject["name"]}\r\n");
+ DeviceModel deviceModel = new DeviceModel();
+ deviceModel.deviceId = deviceJObject["id"] + "";
+ deviceModel.brand = deviceJObject["brand"] + "";
+ deviceModel.model = deviceJObject["model"] + "";
+ deviceModel.typeId = deviceJObject["typeId"] + "";
+ deviceModel.projectId = deviceJObject["projectId"] + "";
+ deviceModel.power = deviceJObject["power"] + "";
+ deviceModel.regionId = deviceJObject["regionId"] + "";
+ deviceModel.produceTime = deviceJObject["produceTime"] + "";
+ deviceModel.deviceTypeId = deviceJObject["deviceType"]["id"] + "";
+ deviceModel.deviceTypeName = deviceJObject["deviceType"]["name"] + "";
+ deviceModel.name = deviceJObject["name"] + "";
+ StringBuilder deviceInsertKeys = new StringBuilder();
+ StringBuilder deviceInsertValues = new StringBuilder();
+ PropertyInfo[] devicePropertyInfos = deviceModel.GetType().GetProperties();
+ foreach (System.Reflection.PropertyInfo devicePropertyInfo in devicePropertyInfos)
+ {
+ deviceInsertKeys.Append($"{devicePropertyInfo.Name},");
+ deviceInsertValues.Append($"'{(devicePropertyInfo.GetValue(deviceModel, null) + "").Replace("'", "''")}',");
+ }
+ projectSqlStrBuilder.Append($"delete from LadfDeviceTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
+ $"delete from LadfDeviceParamTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
+ $"delete from LadfDeviceParamStatusTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
+ $"delete from LadfDeviceParamStatusHistoryTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}' and datetime >= {GetNowTime0Stamp()} and datetime <= {GetNowTime24Stamp()};\r\n");
+ projectSqlStrBuilder.Append($"insert into LadfDeviceTab ({deviceInsertKeys.ToString().TrimEnd(',')}) values ({deviceInsertValues.ToString().TrimEnd(',')});\r\n");
+ if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
+ {
+ SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
+ }
+ QueryDeviceParamStatus(deviceModel);
+ QueryDeviceParamStatusHistory(deviceModel);
+ }
+ catch (Exception ex)
+ {
+ UpdateMsg($"读取设备{deviceJObject["name"]}失败,原因:{ex.Message}\r\n");
+ }
+ }
+ }
+ else if (code.Equals("4012"))
+ {
+ UpdateMsg($"登录失败\r\n");
+ Login();
+ QueryDeviceByProject(projectModel);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.Message.Contains("未将对象引用设置到"))
+ {
+ UpdateMsg($"读取项目:{projectModel.name}的设备失败,原因:未查询到数据\r\n");
+ }
+ else
+ {
+ UpdateMsg($"读取项目:{projectModel.name}的设备失败,原因:{ex.Message}\r\n");
+ }
+ }
+ }
+ ///
+ /// 查询单个设备的属性
+ ///
+ private void QueryDeviceParamStatus(DeviceModel deviceModel)
+ {
+ StringBuilder projectSqlStrBuilder = new StringBuilder();
+ UpdateMsg($"正在读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性数据\r\n");
+ try
+ {
+ string url = "https://api.123321yun.com/api/device/queryDeviceParamStatus";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("id", deviceModel.deviceId);
+ Dictionary headerDic = new Dictionary();
+ headerDic.Add("__sid", sid);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, headerDic, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ JObject deviceParamJObject = (JObject)resultJObject["data"];
+ DeviceParamModel deviceParamModel = new DeviceParamModel();
+ deviceParamModel.deviceTypeId = deviceParamJObject["deviceType"]["id"] + "";
+ deviceParamModel.deviceTypeName = deviceParamJObject["deviceType"]["name"] + "";
+ deviceParamModel.deviceId = deviceParamJObject["deviceId"] + "";
+ deviceParamModel.deviceName = deviceParamJObject["deviceName"] + "";
+ deviceParamModel.workload = deviceParamJObject["workload"] + "";
+ deviceParamModel.elec = deviceParamJObject["elec"] + "";
+ deviceParamModel.errorParamNum = deviceParamJObject["errorParamNum"] + "";
+ deviceParamModel.warnParamNum = deviceParamJObject["warnParamNum"] + "";
+ deviceParamModel.errorTimeSum = deviceParamJObject["errorTimeSum"] + "";
+ deviceParamModel.runTimeSum = deviceParamJObject["runTimeSum"] + "";
+ deviceParamModel.warnEventSum = deviceParamJObject["warnEventSum"] + "";
+ deviceParamModel.errorEventSum = deviceParamJObject["errorEventSum"] + "";
+ deviceParamModel.projectId = deviceParamJObject["projectId"] + "";
+ deviceParamModel.status = deviceParamJObject["status"] + "";
+ deviceParamModel.timestamp = deviceParamJObject["timestamp"] + "";
+ StringBuilder deviceParamInsertKeys = new StringBuilder();
+ StringBuilder deviceParamInsertValues = new StringBuilder();
+ PropertyInfo[] deviceParamPropertyInfos = deviceParamModel.GetType().GetProperties();
+ foreach (System.Reflection.PropertyInfo deviceParamPropertyInfo in deviceParamPropertyInfos)
+ {
+ deviceParamInsertKeys.Append($"{deviceParamPropertyInfo.Name},");
+ deviceParamInsertValues.Append($"'{(deviceParamPropertyInfo.GetValue(deviceParamModel, null) + "").Replace("'", "''")}',");
+ }
+ projectSqlStrBuilder.Append($"insert into LadfDeviceParamTab ({deviceParamInsertKeys.ToString().TrimEnd(',')}) values ({deviceParamInsertValues.ToString().TrimEnd(',')});\r\n");
+ JArray devicePmsArray = (JArray)deviceParamJObject["jsonParams"];
+ foreach (JObject devicePmsJObject in devicePmsArray)
+ {
+ try
+ {
+ DeviceParamStatusModel devicePmsModel = new DeviceParamStatusModel();
+ devicePmsModel.projectId = deviceModel.projectId;
+ devicePmsModel.deviceId = deviceModel.deviceId;
+ devicePmsModel.qs = devicePmsJObject["qs"] + "";
+ devicePmsModel.realValue = devicePmsJObject["realValue"] + "";
+ devicePmsModel.flag = devicePmsJObject["flag"] + "";
+ devicePmsModel.id = devicePmsJObject["id"] + "";
+ devicePmsModel.paramName = devicePmsJObject["paramName"] + "";
+ devicePmsModel.value = devicePmsJObject["value"] + "";
+ devicePmsModel.unitName = devicePmsJObject["unitName"] + "";
+ devicePmsModel.dataType = devicePmsJObject["dataType"] + "";
+ StringBuilder devicePmsInsertKeys = new StringBuilder();
+ StringBuilder devicePmsInsertValues = new StringBuilder();
+ PropertyInfo[] devicePmsPropertyInfos = devicePmsModel.GetType().GetProperties();
+ foreach (System.Reflection.PropertyInfo devicePmsPropertyInfo in devicePmsPropertyInfos)
+ {
+ devicePmsInsertKeys.Append($"{devicePmsPropertyInfo.Name},");
+ devicePmsInsertValues.Append($"'{(devicePmsPropertyInfo.GetValue(devicePmsModel, null) + "").Replace("'", "''")}',");
+ }
+ projectSqlStrBuilder.Append($"insert into LadfDeviceParamStatusTab ({devicePmsInsertKeys.ToString().TrimEnd(',')}) values ({devicePmsInsertValues.ToString().TrimEnd(',')});\r\n");
+ }
+ catch (Exception)
+ {
+ }
+ }
+ if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
+ {
+ SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
+ }
+ }
+ else if (code.Equals("4012"))
+ {
+ UpdateMsg($"登录失败\r\n");
+ Login();
+ QueryDeviceParamStatus(deviceModel);
+ }
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性成功\r\n");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.Message.Contains("未将对象引用设置到"))
+ {
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性成功,但未查询到数据\r\n");
+ }
+ else
+ {
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性数据失败,原因:{ex.Message}\r\n");
+ }
+ }
+ }
+ ///
+ /// 查询历史数据
+ ///
+ private void QueryDeviceParamStatusHistory(DeviceModel deviceModel)
+ {
+ StringBuilder projectSqlStrBuilder = new StringBuilder();
+ UpdateMsg($"正在读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性历史数据\r\n");
+ try
+ {
+ string url = "https://api.123321yun.com/api/device/queryDeviceParamHistoryData";
+ HttpUtil.setting("application/x-www-form-urlencoded", null, null);
+ Dictionary pmsDic = new Dictionary();
+ pmsDic.Add("deviceId", deviceModel.deviceId);
+ pmsDic.Add("start", GetNowTime0Stamp());
+ pmsDic.Add("end", GetNowTime24Stamp());
+ pmsDic.Add("type", "1");
+ Dictionary headerDic = new Dictionary();
+ headerDic.Add("__sid", sid);
+ HttpWebResponse webResponse = HttpUtil.Post(url, "", pmsDic, headerDic, HttpUtil.Method.POST);
+ string result = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
+ if (webResponse != null && !string.IsNullOrEmpty(result))
+ {
+ JObject resultJObject = (JObject)JsonConvert.DeserializeObject(result);
+ string code = resultJObject["code"] + "";
+ if (code.Equals("200"))
+ {
+ JArray deviceParamHistoryJArray = (JArray)resultJObject["data"];
+ foreach (JObject deviceParamHistoryJObject in deviceParamHistoryJArray)
+ {
+ int datetime;
+ if (!int.TryParse(deviceParamHistoryJObject["datetime"] + "", out datetime))
+ {
+ Console.WriteLine("时间转换失败");
+ }
+ IEnumerable properties = deviceParamHistoryJObject.Properties();
+ foreach (JProperty item in properties)
+ {
+ string flag = item.Name.ToString().Replace("'", "''");
+ string value = item.Value.ToString().Replace("'", "''");
+ projectSqlStrBuilder.Append($"insert into LadfDeviceParamStatusHistoryTab (projectId,deviceId,flag,value,datetime) values ('{deviceModel.projectId}','{deviceModel.deviceId}','{flag}','{value}',{datetime});\r\n");
+ }
+ }
+ if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
+ {
+ SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
+ }
+ }
+ else if (code.Equals("4012"))
+ {
+ UpdateMsg($"登录失败\r\n");
+ Login();
+ QueryDeviceParamStatusHistory(deviceModel);
+ }
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性历史数据成功\r\n");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex.Message.Contains("未将对象引用设置到"))
+ {
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性历史数据失败,原因:未查询到数据\r\n");
+ }
+ else
+ {
+ UpdateMsg($"读取设备:{deviceModel.name}{deviceModel.deviceTypeName}的属性历史数据失败,原因:{ex.Message}\r\n");
+ }
+ }
+ }
+ ///
+ /// 连接数据库
+ ///
+ ///
+ private bool CreateConnection()
+ {
+ string connStr = GetConnection();
+ if (SqlHelper._connection != null)
+ {
+ try
+ {
+ SqlHelper._connection.Close();
+ SqlHelper._connection.Dispose();
+ }
+ catch (Exception)
+ {
+ }
+ SqlHelper._connection = null;
+ }
+ try
+ {
+ SqlHelper._connection = new SqlConnection(connStr);
+ SqlHelper._connection.Open();
+ return true;
+ }
+ catch (Exception)
+ {
+ // LogHelper.Instance.WriteLog(ex.Message);
+ }
+ return false;
+ }
+ private void CloseConnection()
+ {
+ if (SqlHelper._connection != null)
+ {
+ try
+ {
+ SqlHelper._connection.Close();
+ SqlHelper._connection.Dispose();
+ }
+ catch (Exception)
+ {
+ }
+ SqlHelper._connection = null;
+ }
+ }
+ ///
+ /// 获取连接服务器的字符串
+ ///
+ ///
+ public string GetConnection()
+ {
+ return string.Format("Server={0};Database={1};Persist Security Info=True;User ID={2};Password={3};Connection Timeout=5;MultipleActiveResultSets=true", this.serverBox.Text, this.dataBaseBox.Text, "lserpAdmin", "lserp110");
+ }
+ ///
+ /// 获取当天零点的时间戳
+ ///
+ ///
+ public string GetNowTime0Stamp()
+ {
+ int year = DateTime.Now.Year;
+ int month = DateTime.Now.Month;
+ int day = DateTime.Now.Day;
+ DateTime dateTime = new DateTime(year, month, day, 0, 0, 0, 0);
+ TimeSpan tspan = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(tspan.TotalSeconds).ToString();
+ }
+ ///
+ /// 获取当天24点的时间戳
+ ///
+ ///
+ public string GetNowTime24Stamp()
+ {
+ int year = DateTime.Now.Year;
+ int month = DateTime.Now.Month;
+ int day = DateTime.Now.Day;
+ DateTime dateTime = new DateTime(year, month, day, 23, 59, 59, 999);
+ TimeSpan tspan = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Con
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/FrmMain.resx b/其他程序/LadfDataApp/LadfDataApp/FrmMain.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/FrmMain.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/HttpUtil.cs b/其他程序/LadfDataApp/LadfDataApp/HttpUtil.cs
new file mode 100644
index 0000000..fe3ddfc
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/HttpUtil.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+
+namespace LadfDataApp
+{
+ public static class HttpUtil
+ {
+ public static CookieContainer cookie = new CookieContainer(); // 用于记录访问网页时cookie数据
+ public static CookieCollection cookieCollection;
+
+ private static string ContentType = string.Empty;// "application/x-www-form-urlencoded";
+ private static string Accept = string.Empty;//"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
+ private static string UserAgent = string.Empty;//"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
+ public enum Method
+ {
+ POST = 0,
+ GET = 1
+ }
+ public static void setting(string contentType, string accept, string userAgent)
+ {
+ ContentType = contentType;
+ Accept = accept;
+ UserAgent = userAgent;
+ }
+ ///
+ /// post数据到指定的网址,获取cookie数据,和返回页
+ ///
+ public static HttpWebResponse Post(string url, string postData, Dictionary pmsDic, Dictionary headerDic, Method method)
+ {
+ return Post(url, postData, pmsDic, headerDic, method, out cookieCollection);
+ }
+ ///
+ /// post数据到指定的网址,获取cookie数据,和返回页
+ ///
+ public static HttpWebResponse Post(string url, string postData, Dictionary pmsDic, Dictionary headerDic, Method method, out CookieCollection cookieCollection)
+ {
+ HttpWebResponse httpWebResponse = null;
+ try
+ {
+ HttpWebRequest httpWebRequest;
+ httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
+
+ httpWebRequest.CookieContainer = cookie;
+ httpWebRequest.ContentType = ContentType;
+ //httpWebRequest.Referer = url;
+ httpWebRequest.Accept = Accept;
+ httpWebRequest.UserAgent = UserAgent;
+ httpWebRequest.Method = method == Method.POST ? "POST" : "GET";
+ byte[] byteRequest = null;
+ if (headerDic != null)
+ {
+ foreach (var item in headerDic)
+ {
+ httpWebRequest.Headers.Add(item.Key, item.Value);
+ }
+ }
+ if (!string.IsNullOrEmpty(postData))
+ {
+ byteRequest = Encoding.Default.GetBytes(postData);
+ httpWebRequest.ContentLength = byteRequest.Length;
+ }
+ else
+ {
+ StringBuilder builder = new StringBuilder();
+ int i = 0;
+ foreach (var item in pmsDic)
+ {
+ if (i > 0)
+ builder.Append("&");
+ builder.AppendFormat("{0}={1}", item.Key, item.Value);
+ i++;
+ }
+ byteRequest = Encoding.UTF8.GetBytes(builder.ToString());
+ httpWebRequest.ContentLength = byteRequest.Length;
+ }
+ Stream stream = httpWebRequest.GetRequestStream();
+ stream.Write(byteRequest, 0, byteRequest.Length);
+ stream.Close();
+ httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
+
+ cookieCollection = cookie.GetCookies(new Uri(url));
+ return httpWebResponse;
+ }
+ catch (Exception)
+ {
+ cookieCollection = null;
+ return httpWebResponse;
+ }
+ }
+ public static HttpWebResponse Post(string url, string postData, Dictionary dic, Method method, out CookieCollection cookieCollection, out string result)
+ {
+ result = "";
+ HttpWebResponse httpWebResponse = null;
+ try
+ {
+ HttpWebRequest httpWebRequest;
+ httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
+
+ httpWebRequest.CookieContainer = cookie;
+ httpWebRequest.ContentType = ContentType;
+ //httpWebRequest.Referer = url;
+ httpWebRequest.Accept = Accept;
+ httpWebRequest.UserAgent = UserAgent;
+ httpWebRequest.Method = method == Method.POST ? "POST" : "GET";
+ byte[] byteRequest = null;
+ if (!string.IsNullOrEmpty(postData))
+ {
+ byteRequest = Encoding.Default.GetBytes(postData);
+ httpWebRequest.ContentLength = byteRequest.Length;
+ }
+ else
+ {
+ StringBuilder builder = new StringBuilder();
+ int i = 0;
+ if (dic != null)
+ {
+ foreach (var item in dic)
+ {
+ if (i > 0)
+ builder.Append("&");
+ builder.AppendFormat("{0}={1}", item.Key, item.Value);
+ i++;
+ }
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/LadfDataApp.csproj b/其他程序/LadfDataApp/LadfDataApp/LadfDataApp.csproj
new file mode 100644
index 0000000..c5ef6ac
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/LadfDataApp.csproj
@@ -0,0 +1,90 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {AA75C812-16A4-498C-BF4D-F1C2CB8E0015}
+ WinExe
+ LadfDataApp
+ LadfDataApp
+ v4.0
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\引用DLL\Newtonsoft.Json.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ FrmMain.cs
+
+
+
+
+
+
+
+ FrmMain.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Model/DeviceModel.cs b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceModel.cs
new file mode 100644
index 0000000..5459931
Binary files /dev/null and b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceModel.cs differ
diff --git a/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamModel.cs b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamModel.cs
new file mode 100644
index 0000000..e6d2f61
Binary files /dev/null and b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamModel.cs differ
diff --git a/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamStatusModel.cs b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamStatusModel.cs
new file mode 100644
index 0000000..965c853
Binary files /dev/null and b/其他程序/LadfDataApp/LadfDataApp/Model/DeviceParamStatusModel.cs differ
diff --git a/其他程序/LadfDataApp/LadfDataApp/Model/ProjectModel.cs b/其他程序/LadfDataApp/LadfDataApp/Model/ProjectModel.cs
new file mode 100644
index 0000000..381f92b
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Model/ProjectModel.cs
@@ -0,0 +1,4 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.T
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Program.cs b/其他程序/LadfDataApp/LadfDataApp/Program.cs
new file mode 100644
index 0000000..008380d
Binary files /dev/null and b/其他程序/LadfDataApp/LadfDataApp/Program.cs differ
diff --git a/其他程序/LadfDataApp/LadfDataApp/Properties/AssemblyInfo.cs b/其他程序/LadfDataApp/LadfDataApp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..b75432c
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Properties/AssemblyInfo.cs
@@ -0,0 +1,9 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("LadfDataApp")]
+[assembly: Asse
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.Designer.cs b/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..36dbf40
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.Designer.cs
@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本: 4.0.30319.42000
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+//
+//------------------------------------------------------------------------------
+
+
+namespace LadfDataApp.Properties
+{
+ ///
+ /// 强类型资源类,用于查找本地化字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// 返回此类使用的缓存 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager Resour
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.resx b/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.Designer.cs b/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..3051383
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.Designer.cs
@@ -0,0 +1 @@
+//-------------------------------------------------------------------
\ No newline at end of file
diff --git a/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.settings b/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/其他程序/LadfDataApp/LadfDataApp/SqlUtil.cs b/其他程序/LadfDataApp/LadfDataApp/SqlUtil.cs
new file mode 100644
index 0000000..43ed7af
--- /dev/null
+++ b/其他程序/LadfDataApp/LadfDataApp/SqlUtil.cs
@@ -0,0 +1,566 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+
+namespace LadfDataApp
+{
+ public static class SqlHelper
+ {
+ ///
+ /// 数据连接
+ ///
+ public static SqlConnection _connection;
+ ///
+ /// 请求超时时间
+ ///
+ public static int CommandTimeout;
+
+ #region ExecuteAdapter
+
+ ///
+ /// 说明:获取适配器
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// The command parameters.
+ /// SqlDataAdapter.
+ public static SqlDataAdapter ExecuteAdapter(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
+ {
+ SqlDataAdapter adapter;
+ SqlCommand cmd = new SqlCommand();
+ try
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
+ adapter = new SqlDataAdapter(cmd);
+ }
+ catch
+ {
+ throw;
+ }
+ return adapter;
+ }
+
+
+ ///
+ /// 说明:获取适配器
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// SqlDataAdapter.
+ public static SqlDataAdapter ExecuteAdapter(CommandType cmdType, string cmdText)
+ {
+ SqlDataAdapter adapter;
+ SqlCommand cmd = new SqlCommand();
+ try
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
+ adapter = new SqlDataAdapter(cmd);
+ }
+ catch
+ {
+ throw;
+ }
+ return adapter;
+ }
+ #endregion
+
+ #region ExecuteDataTable
+ ///
+ /// 说明:执行sql返回DataTable
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The command text.
+ /// DataTable.
+ public static DataTable ExecuteDataTable(string cmdText)
+ {
+ return ExecuteDataSet(cmdText).Tables[0];
+ }
+ ///
+ /// 说明:执行sql返回DataTable
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The command text.
+ /// DataTable.
+ public static DataTable ExecuteDataTable(string cmdText, params SqlParameter[] commandParameters)
+ {
+ return ExecuteDataSet(CommandType.Text, cmdText, "temp", commandParameters).Tables[0];
+ }
+
+ ///
+ /// 说明:执行sql返回指定字段值
+ /// 创建人:龚宇超
+ /// 创建日期:2017-08-15
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Name of the field.
+ /// The command text.
+ /// System.Object.
+ public static object ExecuteObject(string fieldName, string cmdText)
+ {
+ object result = null;
+ try
+ {
+ result = ExecuteDataSet(cmdText).Tables[0].Rows[0][fieldName];
+ }
+ catch (Exception)
+ {
+
+ }
+ return result;
+ }
+ ///
+ /// 说明:执行sql返回指定字段值
+ /// 创建人:龚宇超
+ /// 创建日期:2017-11-27
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Name of the field.
+ /// The command text.
+ /// The command parameters.
+ /// System.Object.
+ public static object ExecuteObject(string fieldName, string cmdText, params SqlParameter[] commandParameters)
+ {
+ object result = null;
+ try
+ {
+ result = ExecuteDataSet(CommandType.Text, cmdText, "temp", commandParameters).Tables[0].Rows[0][fieldName];
+ }
+ catch (Exception)
+ {
+
+ }
+ return result;
+ }
+ ///
+ /// 说明:执行sql返回指定字段值
+ /// 创建人:龚宇超
+ /// 创建日期:2017-08-15
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Name of the field.
+ /// The command text.
+ /// System.Object.
+ public static string ExecuteString(string fieldName, string cmdText)
+ {
+ object obj = ExecuteObject(fieldName, cmdText);
+ return obj == null ? "" : obj.ToString();
+ }
+ ///
+ /// 说明:执行sql返回指定字段值
+ /// 创建人:龚宇超
+ /// 创建日期:2017-11-27
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Name of the field.
+ /// The command text.
+ /// The command parameters.
+ /// System.String.
+ public static string ExecuteString(string fieldName, string cmdText, params SqlParameter[] commandParameters)
+ {
+ object obj = ExecuteObject(fieldName, cmdText, commandParameters);
+ return obj == null ? "" : obj.ToString();
+ }
+ #endregion
+
+ #region ExecuteDataSet
+
+ ///
+ /// 说明:查询结果集
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// Name of the tab.
+ /// The command parameters.
+ /// DataSet.
+ public static DataSet ExecuteDataSet(int cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
+ {
+ CommandType _cmdType = CommandType.Text;
+ switch (cmdType)
+ {
+ case 4:
+ _cmdType = CommandType.StoredProcedure;
+ break;
+ case 512:
+ _cmdType = CommandType.TableDirect;
+ break;
+ }
+ return ExecuteDataSet(_cmdType, cmdText, tabName, commandParameters);
+ }
+ ///
+ /// 说明:查询结果集
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// 语句类型存储过程或者sql语句
+ /// 执行内容
+ /// 表名
+ /// 参数
+ /// DataSet.
+ public static DataSet ExecuteDataSet(CommandType cmdType, string cmdText, string tabName, params SqlParameter[] commandParameters)
+ {
+ DataSet set2;
+ SqlCommand cmd = new SqlCommand();
+ try
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
+ SqlDataAdapter adapter = new SqlDataAdapter(cmd);
+ DataSet dataSet = new DataSet();
+ adapter.Fill(dataSet, tabName);
+ //adapter.FillSchema(dataSet, SchemaType.Mapped, tabName);
+ set2 = dataSet;
+ }
+ catch (Exception e)
+ {
+ if (e.Message.StartsWith("在从服务器接收结果时发生传输级错误") ||
+ e.Message.StartsWith("在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误") ||
+ e.Message.StartsWith("在向服务器发送请求时发生传输级错误"))
+ {
+ throw new Exception("无法连接服务器,请检查网络连接.");
+ }
+ else
+ {
+ throw;
+ }
+ }
+ finally
+ {
+ cmd.Dispose();
+ }
+
+ return set2;
+ }
+ ///
+ /// 说明:查询结果集
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// 语句类型存储过程或者sql语句
+ /// 执行内容
+ /// 表名
+ /// DataSet.
+ public static DataSet ExecuteDataSet(CommandType cmdType, string cmdText, string tabName)
+ {
+ return ExecuteDataSet(cmdType, cmdText, tabName, null);
+ }
+ ///
+ /// 说明:查询结果集
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// 执行内容
+ /// DataSet.
+ public static DataSet ExecuteDataSet(string cmdText)
+ {
+ return ExecuteDataSet(CommandType.Text, cmdText, "temp");
+ }
+ ///
+ /// 说明:查询结果集
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Name of the procedure.
+ /// 表名
+ /// The parameter names.
+ /// The parameter values.
+ /// DataSet.
+ public static DataSet ExecuteDataSet(string procedureName, string tabName, string[] parameterNames, object[] parameterValues)
+ {
+ DataSet set2;
+ try
+ {
+ SqlCommand cmd = new SqlCommand(procedureName, _connection);
+ cmd.CommandType = CommandType.StoredProcedure;
+
+ if (parameterNames != null && parameterValues != null)
+ {
+ for (int i = 0; i < parameterNames.Length && i < parameterValues.Length; i++)
+ {
+ cmd.Parameters.AddWithValue(parameterNames[i], parameterValues[i]);
+ }
+ }
+ SqlDataAdapter adapter = new SqlDataAdapter(cmd);
+ DataSet dataSet = new DataSet();
+ adapter.Fill(dataSet, tabName);
+ set2 = dataSet;
+ }
+ catch
+ {
+ throw;
+ }
+ return set2;
+ }
+ #endregion
+
+ #region ExecuteNonQuery
+ ///
+ /// 说明:执行sql语句或者存储过程
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// The command parameters.
+ /// System.Int32.
+ public static int ExecuteNonQuery(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
+ {
+ SqlCommand cmd = new SqlCommand();
+ int num = 0;
+ try
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
+ num = cmd.ExecuteNonQuery();
+ cmd.Parameters.Clear();
+ }
+ catch (Exception e)
+ {
+ if (e.Message.StartsWith("在从服务器接收结果时发生传输级错误") ||
+ e.Message.StartsWith("在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误") ||
+ e.Message.StartsWith("在向服务器发送请求时发生传输级错误"))
+ {
+ throw new Exception("无法连接服务器,请检查网络连接.");
+ }
+ else
+ {
+ throw;
+ }
+ }
+ finally
+ {
+ cmd.Dispose();
+ }
+ return num;
+ }
+ ///
+ /// 说明:执行sql语句或者存储过程
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// System.Int32.
+ public static int ExecuteNonQuery(CommandType cmdType, string cmdText)
+ {
+ return ExecuteNonQuery(CommandType.Text, cmdText, null);
+ }
+ ///
+ /// 说明:执行sql语句或者存储过程
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The command text.
+ /// System.Int32.
+ public static int ExecuteNonQuery(string cmdText)
+ {
+ return ExecuteNonQuery(CommandType.Text, cmdText);
+ }
+ #endregion
+
+ #region ExecuteReader
+ ///
+ /// 说明:执行sql语句或者存储过程并返回结果集(只读、只进)
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// The command parameters.
+ /// SqlDataReader.
+ public static SqlDataReader ExecuteReader(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
+ {
+ SqlDataReader reader2;
+ SqlCommand cmd = new SqlCommand();
+ try
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
+ SqlDataReader reader = cmd.ExecuteReader();
+ cmd.Parameters.Clear();
+ reader2 = reader;
+ }
+ catch
+ {
+ throw;
+ }
+ return reader2;
+ }
+ #endregion
+
+ #region ExecuteScalar
+ ///
+ /// 说明:执行sql语句或者存储过程并返回结果集第一行第一列
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The connectionection.
+ /// Type of the command.
+ /// The command text.
+ /// The command parameters.
+ /// System.Object.
+ public static object ExecuteScalar(SqlConnection Connectionection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
+ {
+ SqlCommand cmd = new SqlCommand();
+ PrepareCommand(cmd, Connectionection, null, cmdType, cmdText, commandParameters);
+ object obj2 = cmd.ExecuteScalar();
+ cmd.Parameters.Clear();
+ return obj2;
+ }
+ ///
+ /// 说明:执行sql语句或者存储过程并返回结果集第一行第一列
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// The command parameters.
+ /// System.Object.
+ public static object ExecuteScalar(CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
+ {
+ SqlCommand cmd = new SqlCommand();
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, commandParameters);
+ object obj2 = cmd.ExecuteScalar();
+ cmd.Parameters.Clear();
+ return obj2;
+ }
+ }
+ ///
+ /// 说明:执行sql语句或者存储过程并返回结果集第一行第一列
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// Type of the command.
+ /// The command text.
+ /// System.Object.
+ public static object ExecuteScalar(CommandType cmdType, string cmdText)
+ {
+ SqlCommand cmd = new SqlCommand();
+ {
+ PrepareCommand(cmd, _connection, null, cmdType, cmdText, null);
+ object obj2 = cmd.ExecuteScalar();
+ cmd.Parameters.Clear();
+ return obj2;
+ }
+ }
+ ///
+ /// 说明:执行sql语句或者存储过程并返回结果集第一行第一列
+ /// 创建人:龚宇超
+ /// 创建日期:2017-08-21
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The command text.
+ /// System.Object.
+ public static object ExecuteScalar(string cmdText)
+ {
+ SqlCommand cmd = new SqlCommand();
+ {
+ PrepareCommand(cmd, _connection, null, CommandType.Text, cmdText, null);
+ object obj2 = cmd.ExecuteScalar();
+ cmd.Parameters.Clear();
+ return obj2;
+ }
+ }
+ #endregion
+
+ #region PrepareCommand
+ ///
+ /// 说明: sql参数处理
+ /// 创建人:龚宇超
+ /// 创建日期:2017-07-24
+ /// 修改人:
+ /// 修改日期:
+ /// 修改备注:
+ /// 版本:1.0
+ ///
+ /// The command.
+ /// The connection.
+ /// The trans.
+
\ No newline at end of file