海康云眸

This commit is contained in:
李超 2026-05-13 07:06:29 +08:00
parent f9b2fe12a0
commit 16640dfed4
19 changed files with 2336 additions and 284 deletions

View File

@ -0,0 +1,30 @@
INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'项目设备', NULL, N'ProjectData/ProjectDevices.aspx', '86', N'0', N'Menu_ProjectSet', '0', '1', '1');
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'1E3A5ADC-BAA7-45BC-AAF9-012A024F4752', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'保存', '4');
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'37E51622-FB4E-40F4-8D37-603EE626DB7F', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'增加', '1');
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'6EBFA308-581A-4260-9ECA-7E30283EF9EA', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'删除', '3');
INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'939F4F2D-F03B-4DBD-963C-D55196535D8C', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'修改', '2');
Alter TABLE [dbo].[SitePerson_Person] add
[YunMouState] [nvarchar](50) NULL
CREATE TABLE [dbo].[Project_Devices](
[DeviceId] [nvarchar](50) NOT NULL,
[DeviceName] [nvarchar](50) NULL,
[Address] [nvarchar](500) NULL,
[CreateDate] [date] NULL,
[ProjectId] [nvarchar](50) NULL,
[DeviceSerial] [nvarchar](50) NULL,
[isInOut] [nvarchar](50) NULL,
[ValidateCode] [nvarchar](50) NULL,
[YunMouDeviceId] [nvarchar](50) NULL,
[YunMouPermission] [nvarchar](50) NULL,
CONSTRAINT [PK_Project_Devices] PRIMARY KEY CLUSTERED
(
[DeviceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
ALter TABLE [dbo].[Base_Project] add
[IsYunMou] [bit] NULL,
[YunMouGroupId] [nvarchar](50) NULL

View File

@ -75,6 +75,14 @@
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Office.Interop.Word.15.0.4797.1004\lib\net20\Microsoft.Office.Interop.Word.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.QualityTools.Testing.Fakes.16.11.230815\lib\net35\Microsoft.QualityTools.Testing.Fakes.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
@ -113,7 +121,8 @@
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.12.14\lib\net461\StackExchange.Redis.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\StackExchange.Redis.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@ -318,6 +327,7 @@
<Compile Include="Common\WeatherService.cs" />
<Compile Include="Common\WeekDayService.cs" />
<Compile Include="Common\WordHelp.cs" />
<Compile Include="Common\YunMouHelper.cs" />
<Compile Include="CostGoods\MeasuresPlanService.cs" />
<Compile Include="CostGoods\PayRegistrationService.cs" />
<Compile Include="CostGoods\SubPayRegistrationService.cs" />
@ -836,6 +846,7 @@
<Compile Include="Person\Person_TrainingPlanService.cs" />
<Compile Include="ProjectData\MainItemService.cs" />
<Compile Include="ProjectData\ProjectData_CodeTemplateRuleService.cs" />
<Compile Include="ProjectData\ProjectDeviceService.cs" />
<Compile Include="ProjectData\ProjectSateService.cs" />
<Compile Include="ProjectData\ProjectService.cs" />
<Compile Include="ProjectData\ProjectSetMapService.cs" />

View File

@ -6702,7 +6702,10 @@ namespace BLL
/// 中央企业安全生产治本攻坚三年行动工作台账
/// </summary>
public const string ActionWorkLedgerMenuId = "CB76394B-BDEB-4F45-9D19-F38612DC6591";
/// <summary>
/// 项目设备
/// </summary>
public const string ProjectDevicesMenuId = "E4DC0A35-C585-4C4F-8F79-10F528892314";
/// <summary>
/// 中央企业安全生产管理评价工作调度台账

View File

@ -0,0 +1,604 @@

using Newtonsoft.Json;
using System;
using System.Configuration;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text;
namespace BLL.Common
{
public class YunMouHelper
{
public static string YunMouUrl = ConfigurationManager.AppSettings["YunMouUrl"];
public static string ClientSecret = ConfigurationManager.AppSettings["ClientSecret"];
public static string ClientId = ConfigurationManager.AppSettings["ClientId"];
public static string getToken()
{
try
{
string data = "client_id=" + ClientId + "&client_secret=" + ClientSecret + "&grant_type=client_credentials&scope=app";
string result = Post(YunMouUrl + "oauth/token", data, "application/x-www-form-urlencoded", "");
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
return j2.access_token;
}
catch (Exception e)
{
}
return "";
}
/// <summary>
/// 添加设备组(一个项目一个)
/// </summary>
/// <param name="groupName"></param>
/// <param name="groupNo"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addDevicesGroups(string groupName, string groupNo, string access_token)
{
if (groupName.Length > 64)
{
groupName = groupName.Substring(0, 63);
}
string data = "{\"groupName\":\"" + groupName + "\",\"groupNo\":\"" + groupNo + "\"}";
string result = Post(YunMouUrl + "api/v1/open/basic/groups/create", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 删除设备分组
/// </summary>
/// <param name="groupName"></param>
/// <param name="groupNo"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string deleteDevicesGroups(string groupNo, string access_token)
{
string result = Post(YunMouUrl + "api/v1/open/basic/groups/delete?groupNo=" + groupNo, "", "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 添加设备
/// </summary>
/// <param name="deviceSerial"></param>
/// <param name="groupNo"></param>
/// <param name="validateCode"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addDevices(string deviceSerial, string groupNo, string validateCode, string access_token, out string res)
{
string data = "{\"deviceSerial\":\"" + deviceSerial + "\",\"groupNo\":\"" + groupNo + "\",\"validateCode\":\"" + validateCode + "\"}";
string result = Post(YunMouUrl + "api/v1/open/basic/devices/create", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
{
res = j2.message;
return j2.data.groupId;
}
else
{
res = j2.message;
return "";
}
}
/// <summary>
/// 修改设备名称(按设备序列号)
/// </summary>
/// <param name="deviceSerial"></param>
/// <param name="deviceName"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string updateDevices(string deviceSerial, string deviceName, string access_token)
{
string data = "{\"deviceSerial\":\"" + deviceSerial + "\",\"deviceName\":\"" + deviceName + "\"}";
string result = Post(YunMouUrl + "api/v1/open/basic/devices/update", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 删除设备
/// </summary>
/// <param name="deviceSerial"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string deleteDevices(string deviceSerial, string access_token)
{
string result = Post(YunMouUrl + "api/v1/open/basic/devices/delete?deviceSerial=" + deviceSerial, "", "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 添加权限组,建议一个项目一个
/// </summary>
/// <param name="groupName"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addPermissionGroups(string groupName, string access_token)
{
char[] TrimChar = { '、', ' ', '-', '\'', '\"', '\\', '.', '、', '-', '[', ']', '【', '】', '(', ')', '#', '@', '~', '<', '>' };
//groupname不能大于32位
if (groupName.Length > 32)
{
groupName = groupName.Substring(0, 31).Trim(TrimChar);
}
groupName = groupName.Replace("、", "").Replace("/", "").Replace(".", "").Replace("-", "").Replace("[", "").Replace("]", "").Replace("【", "").Replace("】", "").Replace("(", "")
.Replace(")", "").Replace("#", "").Replace("@", "").Replace("~", "").Replace("<", "").Replace(">", "")
.Replace("", "")
.Replace("", "");
string data = "{\"groupName\":\"" + groupName + "\"}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/create", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.data.groupId;
else
{
return "";
}
}
/// <summary>
/// 根据权限组下发权限
/// </summary>
/// <param name="groupName"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string issuedByGroup(string groupId, string access_token)
{
string data = "{\"groupId\":\"" + groupId + "\"}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/allots/actions/issuedByGroup", data, "application/json;charset=UTF-8", access_token);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.code;
else
{
return "";
}
}
/// <summary>
/// 删除权限组(会同时移除权限组下人员和设备下发记录以及已下发到设备的权限)
/// </summary>
/// <param name="groupId"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string deletePermissionGroups(string groupId, string access_token)
{
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/delete?groupId=" + groupId, "", "application/json;charset=UTF-8", access_token);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
{
return j2.data.groupId;
}
else
{
return "";
}
}
/// <summary>
/// 填加员工到权限组
/// </summary>
/// <param name="groupId"></param>
/// <param name="employeeNos"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addPersonsToGroups(string groupId, string[] employeeNos, string access_token)
{
//string permissions = "";
//if (employeeNos.Length == 1)
//{
// permissions = "\"permissions\":[{\"employeeNo\": \"" + employeeNos[0] + "\",\"validBeginTime\": \"2020-01-11\"," +
// "\"validEndTime\": \"2050-12-30\"}]";
//}
string data = "{\"groupId\":\"" + groupId + "\",\"employeeNos\":[\"" + string.Join("\", \"", employeeNos) + "\"],\"autoIssue\":\"true\"}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/actions/addPersons", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.data.statisticsId;
else
{
return "";
}
}
/// <summary>
/// 从权限组移除员工
/// </summary>
/// <param name="groupId"></param>
/// <param name="employeeNos"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string deletePersonsFromGroups(string groupId, string[] employeeNos, string access_token)
{
string data = "{\"groupId\":\"" + groupId + "\",\"employeeNos\":[\"" + string.Join("\", \"", employeeNos) + "\"]}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/actions/removePersons", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.data.statisticsId;
else
{
return "";
}
}
/// <summary>
/// 添加设备到权限组
/// </summary>
/// <param name="groupId"></param>
/// <param name="devices"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addDevicesToGroups(string groupId, string[] devices, string access_token)
{
string data = "{\"groupId\":\"" + groupId + "\",\"deviceSerials\":[\"" + string.Join("\", \"", devices) + "\"],\"autoIssue\":true,\"checkCapability\":true}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/actions/addDevices", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.code;
else
{
return "";
}
}
/// <summary>
/// 从权限组移除设备
/// </summary>
/// <param name="groupId"></param>
/// <param name="devices"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string deleteDevicesFromGroups(string groupId, string[] devices, string access_token)
{
string data = "{\"groupId\":\"" + groupId + "\",\"deviceSerials\":[\"" + string.Join("\", \"", devices) + "\"],\"autoIssue\":true,\"checkCapability\":true}";
string result = Post(YunMouUrl + "api/v1/open/accessControl/permissionGroups/actions/removeDevices", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 添加人员
/// </summary>
/// <param name="employeeNo"></param>
/// <param name="personName"></param>
/// <param name="personPhone"></param>
/// <param name="pic"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addPerson(string employeeNo, string personName, string personPhone, string pic, string access_token)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
string filename = rootUrl + pic;
FileInfo fi1 = new FileInfo(filename);
if (fi1.Length > 200 * 1024)//base64编码的人脸图片图片大小需小于200kB数据需去除base64前缀
{
filename = filename.Replace(".jpg", "_new.jpg").Replace(".jpeg", "_new.jpeg");
CropImage(fi1.FullName, filename, 200);
}
string faceImageBase64 = ImageToByte64String(filename, System.Drawing.Imaging.ImageFormat.Jpeg); // 图片的base64编码
string data = "{\"employeeNo\":\"" + employeeNo + "\",\"personName\":\"" + personName + "\",\"faceImageBase64\":\"" + faceImageBase64 + "\",\"verifyImage\":true}";
string result = Post(YunMouUrl + "api/v1/open/basic/persons/create", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(personName + result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
return j2.code;
}
/// <summary>
/// 根据employeeNo更新人员信息
/// </summary>
/// <param name="employeeNo"></param>
/// <param name="personName"></param>
/// <param name="personPhone"></param>
/// <param name="pic"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string updatePerson(string employeeNo, string personName, string personPhone, string pic, string access_token)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
string filename = rootUrl + pic;
FileInfo fi1 = new FileInfo(filename);
if (fi1.Length > 200 * 1024)//base64编码的人脸图片图片大小需小于200kB数据需去除base64前缀
{
filename = filename.Replace(".jpg", "_new.jpg").Replace(".jpeg", "_new.jpeg");
CropImage(fi1.FullName, filename, 200);
}
string faceImageBase64 = ImageToByte64String(filename, System.Drawing.Imaging.ImageFormat.Jpeg); // 图片的base64编码
string data = "{\"employeeNo\":\"" + employeeNo + "\",\"personName\":\"" + personName + "\",\"faceImageBase64\":\"" + faceImageBase64 + "\",\"verifyImage\":true}";
string result = Post(YunMouUrl + "api/v1/open/basic/persons/update", data, "application/json;charset=UTF-8", access_token);
ErrLogInfo.WriteLog(personName + result);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
return j2.code;
}
/// <summary>
/// 获取人员
/// </summary>
/// <param name="employeeNo"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string getPerson(string employeeNo, string access_token)
{
string result = Get(YunMouUrl + "api/v1/open/basic/persons/get?employeeNo=" + employeeNo, "application/json;charset=UTF-8", access_token);
return result;
}
/// <summary>
/// 设备布防
/// </summary>
/// <param name="deviceSerial"></param>
/// <param name="isDefence"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string setDefence(string deviceSerial, string isDefence, string access_token)
{
string result = Post(YunMouUrl + "api/v1/ezviz/devices/actions/setDefence/deviceSerial?deviceSerial=" + deviceSerial + "&isDefence=" + isDefence, "", "application/json;charset=UTF-8", access_token);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.message;
else
{
return "";
}
}
/// <summary>
/// 添加消息通道
/// </summary>
/// <param name="access_token"></param>
/// <returns></returns>
public static string addConsumer(string access_token)
{
try
{
string result = Post(YunMouUrl + "api/v1/mq/consumer/group1", "", "application/json;charset=UTF-8", access_token);
var j2 = JsonConvert.DeserializeObject<dynamic>(result);
if (j2.code == "200")
return j2.data.consumerId;
}
catch (Exception e) { }
return "";
}
/// <summary>
/// 提交偏移量
/// </summary>
/// <param name="consumerId"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string offsets(string consumerId, string access_token)
{
string data = "consumerId=" + consumerId;
string result = Post(YunMouUrl + "api/v1/mq/consumer/offsets", data, "application/x-www-form-urlencoded", access_token);
return result;
}
/// <summary>
/// 消费消息
/// </summary>
/// <param name="consumerId"></param>
/// <param name="access_token"></param>
/// <returns></returns>
public static string consumerMessage(string consumerId, string access_token)
{
try
{
string data = "consumerId=" + consumerId + "&autoCommit=true";
string result = Post(YunMouUrl + "api/v1/mq/consumer/messages", data, "application/x-www-form-urlencoded", access_token);
return result;
}
catch (Exception e) { }
return "";
}
/// <summary>
/// POST请求
/// </summary>
/// <param name="url"></param>
/// <param name="data"></param>
/// <param name="ContentType"></param>
/// <param name="token"></param>
/// <returns></returns>
public static string Post(string url, string data, string ContentType, string token)
{
Encoding encoding = Encoding.Default;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;//设置这个安全协议必须在创建请求之前!
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;//创建请求对象
request.Method = "POST";//请求方式
request.ContentType = ContentType;//链接类型
if (!string.IsNullOrEmpty(token))
{
request.Headers.Add("Authorization", "Bearer " + token);
}
try
{
byte[] buffer = Encoding.UTF8.GetBytes(data);
//RequestStream.Write(bytes, 0, bytes.Length);
// byte[] buffer = encoding.GetBytes(data);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse webresponse = request.GetResponse() as HttpWebResponse;
using (Stream s = webresponse.GetResponseStream())
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(s, Encoding.UTF8);
string res = reader.ReadToEnd();
ErrLogInfo.WriteLog(res);
return res;
}
}
catch (Exception ex)
{
return "";
}
}
/// <summary>
/// GET请求
/// </summary>
/// <param name="url"></param>
/// <param name="ContentType"></param>
/// <param name="token"></param>
/// <returns></returns>
public static string Get(string url, string ContentType, string token)
{
Encoding encoding = Encoding.Default;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;//设置这个安全协议必须在创建请求之前!
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;//创建请求对象
request.Method = "GET";//请求方式
request.ContentType = ContentType;//链接类型
if (!string.IsNullOrEmpty(token))
{
request.Headers.Add("Authorization", "Bearer " + token);
}
try
{
HttpWebResponse webresponse = request.GetResponse() as HttpWebResponse;
using (Stream s = webresponse.GetResponseStream())
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(s, Encoding.UTF8);
return reader.ReadToEnd();
}
}
catch (Exception ex)
{
return "";
}
}
public static string ImageToByte64String(string filePath, System.Drawing.Imaging.ImageFormat format)
{
Bitmap bitmap = new Bitmap(filePath);
MemoryStream memoryStream = new MemoryStream();
bitmap.Save(memoryStream, format);
byte[] array = new byte[memoryStream.Length];
memoryStream.Position = 0L;
memoryStream.Read(array, 0, (int)memoryStream.Length);
memoryStream.Close();
return Convert.ToBase64String(array);
}
public static void CropImage(string inputFilePath, string outputFilePath, int maxSizeInKB)
{
// 加载图片
using (Image image = Image.FromFile(inputFilePath))
{
// 计算最大字节大小
int maxSizeBytes = maxSizeInKB * 1024;
// 如果图片大小已经小于或等于最大限制,则不裁剪直接保存
if (GetImageSizeInBytes(image) <= maxSizeBytes)
{
image.Save(outputFilePath, image.RawFormat);
return;
}
// 裁剪图片
// 这里只是一个简单的示例,实际应用中可能需要根据需求来裁剪图片
using (Image croppedImage = CropImageToHalfSize(image))
{
// 保存裁剪后的图片
using (MemoryStream memoryStream = new MemoryStream())
{
croppedImage.Save(memoryStream, image.RawFormat);
// 如果裁剪后的图片大小仍然大于限制,则递归裁剪
if (memoryStream.Length > maxSizeBytes)
{
memoryStream.Position = 0;
string tempFile = outputFilePath.Replace(".jpg", "temp.jpg").Replace(".jpeg", "temp.jpg");
using (FileStream fileStream = new FileStream(tempFile, FileMode.Create))
{
memoryStream.CopyTo(fileStream);
}
CropImage(tempFile, outputFilePath, maxSizeInKB);
}
else
{
// 保存到文件
memoryStream.Position = 0;
using (FileStream fileStream = new FileStream(outputFilePath, FileMode.Create))
{
memoryStream.CopyTo(fileStream);
}
}
}
}
}
}
private static Image CropImageToHalfSize(Image image)
{
// 这里只是一个示例,实际情况可能需要根据需求来裁剪图片
int newWidth = image.Width / 2;
int newHeight = image.Height / 2;
return image.GetThumbnailImage(newWidth, newHeight, () => { return false; }, IntPtr.Zero);
}
private static long GetImageSizeInBytes(Image image)
{
using (MemoryStream memoryStream = new MemoryStream())
{
image.Save(memoryStream, image.RawFormat);
return memoryStream.Length;
}
}
}
}

View File

@ -0,0 +1,86 @@
namespace BLL
{
using System.Collections.Generic;
using System.Linq;
using Model;
public static class ProjectDeviceService
{
/// <summary>
///获取项目单位信息
/// </summary>
/// <returns></returns>
public static Model.Project_Devices GetProjectDeviceById(string deviceId)
{
return Funs.DB.Project_Devices.FirstOrDefault(e => e.DeviceId == deviceId);
}
/// <summary>
/// 增加项目设备信息
/// </summary>
/// <returns></returns>
public static void AddProjectDevice(Project_Devices projectDevices)
{
SUBQHSEDB db = Funs.DB;
Project_Devices newProjectUnit = new Project_Devices
{
DeviceId = SQLHelper.GetNewID(typeof(Model.Project_Devices)),
ProjectId = projectDevices.ProjectId,
DeviceName = projectDevices.DeviceName,
DeviceSerial = projectDevices.DeviceSerial,
CreateDate = projectDevices.CreateDate,
Address = projectDevices.Address,
IsInOut = projectDevices.IsInOut,
ValidateCode = projectDevices.ValidateCode,
YunMouDeviceId = projectDevices.YunMouDeviceId,
YunMouPermission = projectDevices.YunMouPermission,
};
db.Project_Devices.InsertOnSubmit(newProjectUnit);
db.SubmitChanges();
}
/// <summary>
///修改项目设备信息
/// </summary>
/// <param name="projectUnit"></param>
public static void UpdateProjectDevice(Model.Project_Devices devices)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Project_Devices newDevices = db.Project_Devices.FirstOrDefault(e => e.DeviceId == devices.DeviceId);
if (newDevices != null)
{
newDevices.ProjectId = devices.ProjectId;
newDevices.DeviceName = devices.DeviceName;
newDevices.DeviceSerial = devices.DeviceSerial;
newDevices.CreateDate = devices.CreateDate;
newDevices.Address = devices.Address;
newDevices.IsInOut = devices.IsInOut;
newDevices.ValidateCode = devices.ValidateCode;
newDevices.YunMouPermission = devices.YunMouPermission;
newDevices.YunMouDeviceId = devices.YunMouDeviceId;
db.SubmitChanges();
}
}
/// <summary>
/// 根据项目单位Id删除一个项目单位信息
/// </summary>
/// <param name="projectUnitId"></param>
public static void DeleteProjectDeviceById(string deviceId)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Project_Devices devices = db.Project_Devices.FirstOrDefault(e => e.DeviceId == deviceId);
if (devices != null)
{
db.Project_Devices.DeleteOnSubmit(devices);
db.SubmitChanges();
}
}
}
}

View File

@ -114,16 +114,16 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPOI">
<Reference Include="NPOI, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML">
<Reference Include="NPOI.OOXML, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net">
<Reference Include="NPOI.OpenXml4Net, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats">
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
@ -1164,6 +1164,8 @@
<Content Include="indexold.aspx" />
<Content Include="indexProjectOld.aspx" />
<Content Include="ProjectData\LocationSelect.aspx" />
<Content Include="ProjectData\ProjectDevices.aspx" />
<Content Include="ProjectData\ProjectDevicesEdit.aspx" />
<Content Include="QualityAudit\SubcontractLeasingProtocolAttachUrl\2024-11\638666775877584960_微信图片_20241106163356.png" />
<Content Include="QualityAudit\SubcontractLeasingProtocolAttachUrl\2024-11\638666786935571590_微信图片_20241106163356.png" />
<Content Include="QualityAudit\SubcontractLeasingProtocolAttachUrl\2024-11\638666869899670730_微信图片_20241106163356.png" />
@ -12649,6 +12651,20 @@
<Compile Include="ProjectData\LocationSelect.aspx.designer.cs">
<DependentUpon>LocationSelect.aspx</DependentUpon>
</Compile>
<Compile Include="ProjectData\ProjectDevices.aspx.cs">
<DependentUpon>ProjectDevices.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ProjectData\ProjectDevices.aspx.designer.cs">
<DependentUpon>ProjectDevices.aspx</DependentUpon>
</Compile>
<Compile Include="ProjectData\ProjectDevicesEdit.aspx.cs">
<DependentUpon>ProjectDevicesEdit.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ProjectData\ProjectDevicesEdit.aspx.designer.cs">
<DependentUpon>ProjectDevicesEdit.aspx</DependentUpon>
</Compile>
<Compile Include="SysManage\Schedule.aspx.cs">
<DependentUpon>Schedule.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -18522,7 +18538,7 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -103,6 +103,8 @@
</f:Button>
<f:Button ID="btnPersonOut" ToolTip="批量出场" Icon="UserGo" runat="server" Hidden="true" Text="批量出场" OnClick="btnPersonOut_Click">
</f:Button>
<f:Button ID="Button1" ToolTip="同步人员到云眸" Icon="Add" runat="server" Text="同步人员到云眸" OnClick="btnToYunMou_Click">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" Hidden="true" runat="server" Text="导入"
OnClick="btnImport_Click">
</f:Button>
@ -151,6 +153,8 @@
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="入场时间"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField HeaderText="同步云眸" ColumnID="YunMouState" DataField="YunMouState" SortField="YunMouState"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="110px"> </f:RenderField>
<%-- <f:RenderField HeaderText="电话" ColumnID="Telephone" DataField="Telephone" SortField="Telephone"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="110px">
</f:RenderField>--%>

View File

@ -12,6 +12,7 @@ using Aspose.Words;
using System.IO;
using System.Threading;
using Model;
using BLL.Common;
namespace FineUIPro.Web.HSSE.SitePerson
{
@ -850,7 +851,39 @@ namespace FineUIPro.Web.HSSE.SitePerson
}
return age;
}
protected void btnToYunMou_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var person = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == rowID);
if (!string.IsNullOrEmpty(person.PhotoUrl))
{
var token = YunMouHelper.getToken();
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
var res1 = YunMouHelper.addPerson(person.IdentityCard, person.PersonName, string.IsNullOrEmpty(person.Telephone) ? "" : person.Telephone, person.PhotoUrl, token);
var res3 = YunMouHelper.updatePerson(person.IdentityCard, person.PersonName, string.IsNullOrEmpty(person.Telephone) ? "" : person.Telephone, person.PhotoUrl, token);
var res2 = YunMouHelper.addPersonsToGroups(project.YunMouGroupId, new string[] { person.IdentityCard }, token);
person.YunMouState = "已经同步";
Funs.DB.SubmitChanges();
}
}
this.BindGrid();
}
else
{
ShowNotify("请选择用户", MessageBoxIcon.Warning);
}
}
protected void btnUpToYunMou_Click(object sender, EventArgs e)
{
var person = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == Grid1.SelectedRowID);
var token = YunMouHelper.getToken();
var res3 = YunMouHelper.updatePerson(person.IdentityCard, person.PersonName, string.IsNullOrEmpty(person.Telephone) ? "" : person.Telephone, person.PhotoUrl, token);
}
protected void butExport_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <自动生成>
// 此代码由工具生成。
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.SitePerson
@ -15,389 +15,398 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
/// <summary>
/// form1 control.
/// form1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// Panel1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion1 control.
/// panelLeftRegion1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion1;
/// <summary>
/// ContentPanel1 control.
/// ContentPanel1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ContentPanel ContentPanel1;
/// <summary>
/// ucTree control.
/// ucTree 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Web.Controls.UnitProjectTControl ucTree;
/// <summary>
/// panelLeftRegion control.
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// tvProjectAndUnit control.
/// tvProjectAndUnit 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree tvProjectAndUnit;
/// <summary>
/// Toolbar2 control.
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// btnPersonUnit control.
/// btnPersonUnit 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPersonUnit;
/// <summary>
/// panelCenterRegion control.
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Grid1 control.
/// Grid1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 control.
/// Toolbar3 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// txtPersonName control.
/// txtPersonName 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPersonName;
/// <summary>
/// txtIdentityCard control.
/// txtIdentityCard 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtIdentityCard;
/// <summary>
/// txtCardNo control.
/// txtCardNo 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCardNo;
/// <summary>
/// drpPost control.
/// drpPost 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpPost;
/// <summary>
/// drpTreamGroup control.
/// drpTreamGroup 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpTreamGroup;
/// <summary>
/// Toolbar1 control.
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// drpIsUsedTypeName control.
/// drpIsUsedTypeName 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpIsUsedTypeName;
/// <summary>
/// ckIdCardInfoNotOK control.
/// ckIdCardInfoNotOK 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox ckIdCardInfoNotOK;
/// <summary>
/// ckTrain control.
/// ckTrain 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox ckTrain;
/// <summary>
/// ToolbarFill1 control.
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btSearch control.
/// btSearch 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btSearch;
/// <summary>
/// btnNew control.
/// btnNew 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnApprove control.
/// btnApprove 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnApprove;
/// <summary>
/// btnPersonOut control.
/// btnPersonOut 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPersonOut;
/// <summary>
/// btnImport control.
/// Button1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button Button1;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut control.
/// btnOut 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// btnQR control.
/// btnQR 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnQR;
/// <summary>
/// lblAge control.
/// lblAge 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblAge;
/// <summary>
/// lbI control.
/// lbI 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbI;
/// <summary>
/// ToolbarSeparator1 control.
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 control.
/// Window1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 control.
/// Window2 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Window3 control.
/// Window3 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window3;
/// <summary>
/// WindowPunishRecord control.
/// WindowPunishRecord 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowPunishRecord;
/// <summary>
/// Menu1 control.
/// Menu1 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit control.
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnPrinter control.
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
/// <summary>
/// btnMenuDelete control.
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}

View File

@ -0,0 +1,134 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectDevices.aspx.cs" Inherits="FineUIPro.Web.ProjectData.ProjectDevices" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>项目设备</title>
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.f-grid-row .f-grid-cell-inner {
white-space: normal;
word-break: break-all;
}
.f-grid-row.red
{
background-color: #FF7575;
background-image: none;
}
.fontred
{
color: #FF7575;
background-image: none;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch" >
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="项目单位"
EnableCollapse="true" runat="server" BoxFlex="1" EnableColumnLines="true"
DataKeyNames="DeviceId" AllowCellEditing="true" ClicksToEdit="2" DataIDField="DeviceId"
AllowSorting="true" SortField="CreateDate" SortDirection="DESC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" Label="设备名称" ID="txtDeviceName" EmptyText="输入查询条件"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="250px" LabelWidth="80px"></f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnAdd" ToolTip="新增" Icon="Add" Hidden="true" runat="server" Text="新增"
OnClick="btnAdd_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField ColumnID="tfNumber" Width="55px" HeaderText="序号" HeaderTextAlign="Center"
TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="250px" ColumnID="DeviceName" DataField="DeviceName" SortField="DeviceName"
FieldType="String" HeaderText="设备名称" HeaderTextAlign="Center" TextAlign="Left" >
</f:RenderField>
<f:RenderField Width="250px" ColumnID="DeviceSerial" DataField="DeviceSerial" SortField="DeviceSerial"
FieldType="String" HeaderText="序列号" HeaderTextAlign="Center" TextAlign="Left" >
</f:RenderField>
<f:RenderField Width="100px" ColumnID="IsInOutValue" DataField="IsInOutValue" SortField="IsInOutValue"
FieldType="String" HeaderText="进出方向" HeaderTextAlign="Center" TextAlign="Left" >
</f:RenderField>
<f:RenderField Width="250px" ColumnID="DeviceToYunMou" DataField="DeviceToYunMou" SortField="DeviceToYunMou"
FieldType="String" HeaderText="同步设到云眸" HeaderTextAlign="Center" TextAlign="Left" >
</f:RenderField>
<f:RenderField Width="250px" ColumnID="YunMouPermission" DataField="YunMouPermission" SortField="YunMouPermission"
FieldType="String" HeaderText="权限" HeaderTextAlign="Center" TextAlign="Left" >
</f:RenderField>
<f:RenderField Width="110px" ColumnID="CreateDate" DataField="CreateDate" SortField="CreateDate"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="添加时间"
HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="250px" ColumnID="Address" DataField="Address" SortField="Address"
FieldType="String" HeaderText="位置" HeaderTextAlign="Center" TextAlign="Left" ExpandUnusedSpace="true">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Hidden="true"
Icon="Pencil" runat="server" Text="编辑">
</f:MenuButton>
<f:MenuButton ID="btnMenuDeviceToYunMou" OnClick="btnMenuDeviceToYunMou_Click" EnablePostBack="true" Hidden="true"
Icon="Pencil" runat="server" Text="同步设备">
</f:MenuButton>
<f:MenuButton ID="btnMenuSyncPermission" OnClick="btnMenuSyncPermission_Click" EnablePostBack="true" Hidden="true"
Icon="Pencil" runat="server" Text="关联权限">
</f:MenuButton>
<f:MenuButton ID="btnMenuDeletePermission" OnClick="btnMenuDeletePermission_Click" EnablePostBack="true" Hidden="true"
Icon="Delete" runat="server" Text="移除权限">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Hidden="true"
Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show();
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>

View File

@ -0,0 +1,328 @@
using BLL;
using BLL.Common;
using FineUIPro.Web.DataShow;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Services.Description;
using WIA;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.ProjectData
{
public partial class ProjectDevices : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
////权限按钮方法
this.GetButtonPower();
}
}
#endregion
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @" Select * ,case when [isInOut] =1 then '进' else '出' end [IsInOutValue] ,case when [YunMouDeviceId] is not null and [YunMouDeviceId] <> '' then '是' else '' end [DeviceToYunMou] from Project_Devices WHERE ";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(this.txtDeviceName.Text.Trim()))
{
strSql += " AND DeviceName LIKE @DeviceName";
listStr.Add(new SqlParameter("@DeviceName", "%" + this.txtDeviceName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#region Events
/// <summary>
/// 右键删除事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
string unitName = string.Empty;
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string deviceId = Grid1.DataKeys[rowIndex][0].ToString();
Model.Project_Devices devices = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == deviceId);
var token = YunMouHelper.getToken();
YunMouHelper.deleteDevices(devices.DeviceSerial, token);
Funs.DB.Project_Devices.DeleteOnSubmit(devices);
Funs.DB.SubmitChanges();
}
BindGrid();
if (string.IsNullOrEmpty(unitName))
{
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
}
}
}
#endregion
#region
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
BindGrid();
}
#endregion
/// <summary>
/// 增加按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAdd_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference("ProjectDevicesEdit.aspx", "添加设备", 800, 300));
}
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditData();
}
/// <summary>
/// 右键编辑事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
this.EditData();
}
protected void btnMenuDeviceToYunMou_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID);
if (device != null)
{
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
var token = YunMouHelper.getToken();
string addMessage = "";
string data;
data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase);
var YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token,out addMessage);//添加设备
if (!string.IsNullOrEmpty(YunMouDeviceId))
{
device.YunMouDeviceId = YunMouDeviceId;
Funs.DB.SubmitChanges();
ShowNotify("同步成功", MessageBoxIcon.Success);
BindGrid();
}
else
{
Alert.ShowInTop("同步设备出错:"+ addMessage, MessageBoxIcon.Warning);
}
}
}
protected void btnMenuSyncPermission_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID);
if (device != null)
{
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
var token = YunMouHelper.getToken();
var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组
YunMouHelper.setDefence(device.DeviceSerial, "1", token);
if (string.IsNullOrEmpty(res))
{
Alert.ShowInTop("关联权限出错!", MessageBoxIcon.Warning);
}
else
{
device.YunMouPermission = "是";
Funs.DB.SubmitChanges();
ShowNotify("关联成功", MessageBoxIcon.Success);
BindGrid();
}
}
}
protected void btnMenuDeletePermission_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID);
if (device != null)
{
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
var token = YunMouHelper.getToken();
var res = YunMouHelper.deleteDevicesFromGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//从权限组移除设备
if (string.IsNullOrEmpty(res))
{
Alert.ShowInTop("关联权限出错!", MessageBoxIcon.Warning);
}
else
{
device.YunMouPermission = null;
Funs.DB.SubmitChanges();
BindGrid();
}
}
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditData()
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectDevicesEdit.aspx?DeviceId={0}", Grid1.SelectedRowID), "编辑项目单位", 800, 300));
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
string menuId = BLL.Const.ProjectDevicesMenuId;
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId); ;
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnAdd.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuDeletePermission.Hidden = false;
this.btnAdd.Hidden = false;
this.btnMenuEdit.Hidden = false;
this.btnMenuDeviceToYunMou.Hidden = false;
this.btnMenuSyncPermission.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
this.GetButtonPower();
}
#endregion
}
}

View File

@ -0,0 +1,179 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.ProjectData
{
public partial class ProjectDevices
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// txtDeviceName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtDeviceName;
/// <summary>
/// btnAdd 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAdd;
/// <summary>
/// lblNumber 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumber;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDeviceToYunMou 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDeviceToYunMou;
/// <summary>
/// btnMenuSyncPermission 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuSyncPermission;
/// <summary>
/// btnMenuDeletePermission 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDeletePermission;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}

View File

@ -0,0 +1,63 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectDevicesEdit.aspx.cs"
Inherits="FineUIPro.Web.ProjectData.ProjectDevicesEdit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>编辑班组信息</title>
<base target="_self" />
<link href="../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtDeviceName" runat="server" Label="设备名称" Required="true" MaxLength="50"
ShowRedStar="true" >
</f:TextBox>
<f:TextBox ID="txtDeviceSerial" runat="server" Label="设备序列号" Required="true" MaxLength="50"
ShowRedStar="true" >
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="进场时间" ID="dpCreateDate" ></f:DatePicker>
<f:DropDownList ID="drpInOut" runat="server" Label="进出方向">
<f:ListItem Value="1" Text="进门" />
<f:ListItem Value="0" Text="出门" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtValidateCode" runat="server" Label="验证码" Required="true" MaxLength="50"
ShowRedStar="true" >
</f:TextBox>
<f:TextBox ID="txtAddress" runat="server" Label="设备地址" Required="true" MaxLength="500"
ShowRedStar="true" >
</f:TextBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1" Text="保存"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose" Text="关闭">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
</body>
</html>

View File

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using BLL.Common;
using FastReport.Cloud.OAuth;
using FineUIPro.Web.DataShow;
using Org.BouncyCastle.Crypto;
namespace FineUIPro.Web.ProjectData
{
public partial class ProjectDevicesEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string DeviceId
{
get
{
return (string)ViewState["DeviceId"];
}
set
{
ViewState["DeviceId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.DeviceId = Request.Params["DeviceId"];
if (!string.IsNullOrEmpty(this.DeviceId))
{
Model.Project_Devices device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == this.DeviceId);
if (device != null)
{
this.txtDeviceName.Text = device.DeviceName;
this.txtDeviceSerial.Text = device.DeviceSerial;
this.txtAddress.Text = device.Address;
this.txtValidateCode.Text = device.ValidateCode;
if (!string.IsNullOrEmpty(device.IsInOut))
{
this.drpInOut.SelectedValue = device.IsInOut;
}
//this.txtThirdTeamCode.Text = teamGroup.ThirdTeamCode;
if (device.CreateDate != null)
{
this.dpCreateDate.Text = string.Format("{0:yyyy-MM-dd}", device.CreateDate);
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.Project_Devices device = new Model.Project_Devices
{
ProjectId = this.CurrUser.LoginProjectId,
DeviceName = this.txtDeviceName.Text.Trim(),
DeviceSerial = this.txtDeviceSerial.Text.Trim(),
Address = txtAddress.Text.Trim(),
ValidateCode = txtValidateCode.Text.Trim(),
CreateDate = Funs.GetNewDateTime(this.dpCreateDate.Text.Trim())
};
if (this.drpInOut.SelectedValue != BLL.Const._Null)
{
device.IsInOut = this.drpInOut.SelectedValue;
}
if (!string.IsNullOrEmpty(this.DeviceId))
{
device.DeviceId = this.DeviceId;
BLL.ProjectDeviceService.UpdateProjectDevice(device);
var token = YunMouHelper.getToken();
YunMouHelper.updateDevices(device.DeviceSerial, device.DeviceName, token);
BLL.LogService.AddSys_Log(this.CurrUser, device.DeviceName, device.DeviceId, BLL.Const.ProjectDevicesMenuId, BLL.Const.BtnModify);
}
else
{
this.DeviceId = SQLHelper.GetNewID(typeof(Model.Project_Devices));
device.DeviceId = this.DeviceId;
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
var token = YunMouHelper.getToken();
string data;
data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase);
string addMessage = "";
device.YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token,out addMessage);//添加设备之后,将权限添加到权限组
var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组
if (!string.IsNullOrEmpty(res))
{
device.YunMouPermission = "已关联";
}
BLL.ProjectDeviceService.AddProjectDevice(device);
BLL.LogService.AddSys_Log(this.CurrUser, device.DeviceName, device.DeviceId, BLL.Const.ProjectDevicesMenuId, BLL.Const.BtnAdd);
}
ShowNotify("保存数据成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}

View File

@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.ProjectData
{
public partial class ProjectDevicesEdit
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtDeviceName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtDeviceName;
/// <summary>
/// txtDeviceSerial 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtDeviceSerial;
/// <summary>
/// dpCreateDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker dpCreateDate;
/// <summary>
/// drpInOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpInOut;
/// <summary>
/// txtValidateCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtValidateCode;
/// <summary>
/// txtAddress 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtAddress;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
}
}

View File

@ -20,6 +20,16 @@
Layout="VBox" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
LabelAlign="Right">
<Rows>
<f:FormRow runat="server">
<Items>
<f:CheckBox ID="ckbIsYunMou" runat="server" Label="云眸人脸识别" Text="是否启用" LabelWidth="200">
</f:CheckBox>
<f:Label runat="server"></f:Label>
</Items>
</f:FormRow>
<f:FormRow runat="server">
<Items>
<f:CheckBox ID="ckbIsFace" runat="server" Label="移动端人脸识别" Text="是否启用" LabelWidth="200">

View File

@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text.RegularExpressions;
using BLL;
using BLL.Common;
namespace FineUIPro.Web.common.ProjectSet
{
@ -87,6 +89,9 @@ namespace FineUIPro.Web.common.ProjectSet
ShowNotify("请选择项目!", MessageBoxIcon.Warning);
return;
}
#region
///通用
var getProject = ProjectService.GetProjectByProjectId(projectId);
@ -94,6 +99,31 @@ namespace FineUIPro.Web.common.ProjectSet
{
getProject.IsFace = this.ckbIsFace.Checked;
getProject.IsAutoFetch = this.ckbIsAutoFetch.Checked;
getProject.IsYunMou = this.ckbIsYunMou.Checked;
if (this.ckbIsYunMou.Checked)
{
var token = YunMouHelper.getToken();
string data;
data = Regex.Replace(getProject.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase);
YunMouHelper.addDevicesGroups(getProject.ProjectName, data, token);
var groupId = YunMouHelper.addPermissionGroups(getProject.ProjectName, token);
if (!string.IsNullOrEmpty(groupId))
{
getProject.YunMouGroupId = groupId;
}
}
else
{
var token = YunMouHelper.getToken();
string data;
data = Regex.Replace(getProject.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase);
YunMouHelper.deleteDevicesGroups(data, token);//删除设备分组,如果有子节点,可以不删除
}
Funs.DB.SubmitChanges();
}
#endregion
@ -455,6 +485,11 @@ namespace FineUIPro.Web.common.ProjectSet
{
this.ckbIsFace.Checked = true;
}
///是否启用云眸
if (getProject != null && getProject.IsYunMou == true)
{
this.ckbIsYunMou.Checked = true;
}
if (getProject != null && getProject.IsAutoFetch == true)
{
this.ckbIsAutoFetch.Checked = true;

View File

@ -68,6 +68,15 @@ namespace FineUIPro.Web.common.ProjectSet
/// </remarks>
protected global::FineUIPro.Form Form4;
/// <summary>
/// ckbIsYunMou 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox ckbIsYunMou;
/// <summary>
/// ckbIsFace 控件。
/// </summary>

View File

@ -1994,6 +1994,9 @@ namespace Model
partial void InsertProject_CQMSData_CQMS(Project_CQMSData_CQMS instance);
partial void UpdateProject_CQMSData_CQMS(Project_CQMSData_CQMS instance);
partial void DeleteProject_CQMSData_CQMS(Project_CQMSData_CQMS instance);
partial void InsertProject_Devices(Project_Devices instance);
partial void UpdateProject_Devices(Project_Devices instance);
partial void DeleteProject_Devices(Project_Devices instance);
partial void InsertProject_FileCabinet(Project_FileCabinet instance);
partial void UpdateProject_FileCabinet(Project_FileCabinet instance);
partial void DeleteProject_FileCabinet(Project_FileCabinet instance);
@ -8304,6 +8307,14 @@ namespace Model
}
}
public System.Data.Linq.Table<Project_Devices> Project_Devices
{
get
{
return this.GetTable<Project_Devices>();
}
}
public System.Data.Linq.Table<Project_FileCabinet> Project_FileCabinet
{
get
@ -28011,6 +28022,10 @@ namespace Model
private System.Nullable<bool> _IsAutoFetch;
private System.Nullable<bool> _IsYunMou;
private string _YunMouGroupId;
private EntitySet<Accident_AccidentHandle> _Accident_AccidentHandle;
private EntitySet<Accident_AccidentPersonRecord> _Accident_AccidentPersonRecord;
@ -28771,6 +28786,10 @@ namespace Model
partial void OnSubjectUnitWebUrlChanged();
partial void OnIsAutoFetchChanging(System.Nullable<bool> value);
partial void OnIsAutoFetchChanged();
partial void OnIsYunMouChanging(System.Nullable<bool> value);
partial void OnIsYunMouChanged();
partial void OnYunMouGroupIdChanging(string value);
partial void OnYunMouGroupIdChanged();
#endregion
public Base_Project()
@ -29981,6 +30000,46 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsYunMou", DbType="Bit")]
public System.Nullable<bool> IsYunMou
{
get
{
return this._IsYunMou;
}
set
{
if ((this._IsYunMou != value))
{
this.OnIsYunMouChanging(value);
this.SendPropertyChanging();
this._IsYunMou = value;
this.SendPropertyChanged("IsYunMou");
this.OnIsYunMouChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouGroupId", DbType="NVarChar(50)")]
public string YunMouGroupId
{
get
{
return this._YunMouGroupId;
}
set
{
if ((this._YunMouGroupId != value))
{
this.OnYunMouGroupIdChanging(value);
this.SendPropertyChanging();
this._YunMouGroupId = value;
this.SendPropertyChanged("YunMouGroupId");
this.OnYunMouGroupIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentHandle_Base_Project", Storage="_Accident_AccidentHandle", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")]
public EntitySet<Accident_AccidentHandle> Accident_AccidentHandle
{
@ -210320,8 +210379,6 @@ namespace Model
private EntityRef<Base_Unit> _Base_Unit;
private EntityRef<HSSE_Hazard_HazardRegisterTypes> _HSSE_Hazard_HazardRegisterTypes;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
@ -210425,7 +210482,6 @@ namespace Model
public HSSE_Hazard_HazardRegister()
{
this._Base_Unit = default(EntityRef<Base_Unit>);
this._HSSE_Hazard_HazardRegisterTypes = default(EntityRef<HSSE_Hazard_HazardRegisterTypes>);
OnCreated();
}
@ -210944,10 +211000,6 @@ namespace Model
{
if ((this._RegisterTypesId != value))
{
if (this._HSSE_Hazard_HazardRegisterTypes.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnRegisterTypesIdChanging(value);
this.SendPropertyChanging();
this._RegisterTypesId = value;
@ -211411,40 +211463,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_HSSE_Hazard_HazardRegisterTypes", Storage="_HSSE_Hazard_HazardRegisterTypes", ThisKey="RegisterTypesId", OtherKey="RegisterTypesId", IsForeignKey=true)]
public HSSE_Hazard_HazardRegisterTypes HSSE_Hazard_HazardRegisterTypes
{
get
{
return this._HSSE_Hazard_HazardRegisterTypes.Entity;
}
set
{
HSSE_Hazard_HazardRegisterTypes previousValue = this._HSSE_Hazard_HazardRegisterTypes.Entity;
if (((previousValue != value)
|| (this._HSSE_Hazard_HazardRegisterTypes.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._HSSE_Hazard_HazardRegisterTypes.Entity = null;
previousValue.HSSE_Hazard_HazardRegister.Remove(this);
}
this._HSSE_Hazard_HazardRegisterTypes.Entity = value;
if ((value != null))
{
value.HSSE_Hazard_HazardRegister.Add(this);
this._RegisterTypesId = value.RegisterTypesId;
}
else
{
this._RegisterTypesId = default(string);
}
this.SendPropertyChanged("HSSE_Hazard_HazardRegisterTypes");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
@ -211562,8 +211580,6 @@ namespace Model
private EntityRef<Base_Unit> _Base_Unit;
private EntityRef<HSSE_Hazard_HazardRegisterTypes> _HSSE_Hazard_HazardRegisterTypes;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
@ -211661,7 +211677,6 @@ namespace Model
public HSSE_Hazard_HazardRegister_Unit()
{
this._Base_Unit = default(EntityRef<Base_Unit>);
this._HSSE_Hazard_HazardRegisterTypes = default(EntityRef<HSSE_Hazard_HazardRegisterTypes>);
OnCreated();
}
@ -212109,7 +212124,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HandleIdea", DbType="NVarChar(500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HandleIdea", DbType="NVarChar(2000)")]
public string HandleIdea
{
get
@ -212180,10 +212195,6 @@ namespace Model
{
if ((this._RegisterTypesId != value))
{
if (this._HSSE_Hazard_HazardRegisterTypes.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnRegisterTypesIdChanging(value);
this.SendPropertyChanging();
this._RegisterTypesId = value;
@ -212493,7 +212504,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Requirements", DbType="NVarChar(400)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Requirements", DbType="NVarChar(2000)")]
public string Requirements
{
get
@ -212587,40 +212598,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_Unit_HSSE_Hazard_HazardRegister_UnitTypes", Storage="_HSSE_Hazard_HazardRegisterTypes", ThisKey="RegisterTypesId", OtherKey="RegisterTypesId", IsForeignKey=true)]
public HSSE_Hazard_HazardRegisterTypes HSSE_Hazard_HazardRegisterTypes
{
get
{
return this._HSSE_Hazard_HazardRegisterTypes.Entity;
}
set
{
HSSE_Hazard_HazardRegisterTypes previousValue = this._HSSE_Hazard_HazardRegisterTypes.Entity;
if (((previousValue != value)
|| (this._HSSE_Hazard_HazardRegisterTypes.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._HSSE_Hazard_HazardRegisterTypes.Entity = null;
previousValue.HSSE_Hazard_HazardRegister_Unit.Remove(this);
}
this._HSSE_Hazard_HazardRegisterTypes.Entity = value;
if ((value != null))
{
value.HSSE_Hazard_HazardRegister_Unit.Add(this);
this._RegisterTypesId = value.RegisterTypesId;
}
else
{
this._RegisterTypesId = default(string);
}
this.SendPropertyChanged("HSSE_Hazard_HazardRegisterTypes");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
@ -212662,10 +212639,6 @@ namespace Model
private System.Nullable<bool> _IsPunished;
private EntitySet<HSSE_Hazard_HazardRegister> _HSSE_Hazard_HazardRegister;
private EntitySet<HSSE_Hazard_HazardRegister_Unit> _HSSE_Hazard_HazardRegister_Unit;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
@ -212688,8 +212661,6 @@ namespace Model
public HSSE_Hazard_HazardRegisterTypes()
{
this._HSSE_Hazard_HazardRegister = new EntitySet<HSSE_Hazard_HazardRegister>(new Action<HSSE_Hazard_HazardRegister>(this.attach_HSSE_Hazard_HazardRegister), new Action<HSSE_Hazard_HazardRegister>(this.detach_HSSE_Hazard_HazardRegister));
this._HSSE_Hazard_HazardRegister_Unit = new EntitySet<HSSE_Hazard_HazardRegister_Unit>(new Action<HSSE_Hazard_HazardRegister_Unit>(this.attach_HSSE_Hazard_HazardRegister_Unit), new Action<HSSE_Hazard_HazardRegister_Unit>(this.detach_HSSE_Hazard_HazardRegister_Unit));
OnCreated();
}
@ -212833,32 +212804,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_HSSE_Hazard_HazardRegisterTypes", Storage="_HSSE_Hazard_HazardRegister", ThisKey="RegisterTypesId", OtherKey="RegisterTypesId", DeleteRule="NO ACTION")]
public EntitySet<HSSE_Hazard_HazardRegister> HSSE_Hazard_HazardRegister
{
get
{
return this._HSSE_Hazard_HazardRegister;
}
set
{
this._HSSE_Hazard_HazardRegister.Assign(value);
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_Unit_HSSE_Hazard_HazardRegister_UnitTypes", Storage="_HSSE_Hazard_HazardRegister_Unit", ThisKey="RegisterTypesId", OtherKey="RegisterTypesId", DeleteRule="NO ACTION")]
public EntitySet<HSSE_Hazard_HazardRegister_Unit> HSSE_Hazard_HazardRegister_Unit
{
get
{
return this._HSSE_Hazard_HazardRegister_Unit;
}
set
{
this._HSSE_Hazard_HazardRegister_Unit.Assign(value);
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
@ -212878,30 +212823,6 @@ namespace Model
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_HSSE_Hazard_HazardRegister(HSSE_Hazard_HazardRegister entity)
{
this.SendPropertyChanging();
entity.HSSE_Hazard_HazardRegisterTypes = this;
}
private void detach_HSSE_Hazard_HazardRegister(HSSE_Hazard_HazardRegister entity)
{
this.SendPropertyChanging();
entity.HSSE_Hazard_HazardRegisterTypes = null;
}
private void attach_HSSE_Hazard_HazardRegister_Unit(HSSE_Hazard_HazardRegister_Unit entity)
{
this.SendPropertyChanging();
entity.HSSE_Hazard_HazardRegisterTypes = this;
}
private void detach_HSSE_Hazard_HazardRegister_Unit(HSSE_Hazard_HazardRegister_Unit entity)
{
this.SendPropertyChanging();
entity.HSSE_Hazard_HazardRegisterTypes = null;
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.HSSE_MajorSecurityRisk")]
@ -322611,6 +322532,284 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project_Devices")]
public partial class Project_Devices : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private string _DeviceId;
private string _DeviceName;
private string _Address;
private System.Nullable<System.DateTime> _CreateDate;
private string _ProjectId;
private string _DeviceSerial;
private string _IsInOut;
private string _ValidateCode;
private string _YunMouDeviceId;
private string _YunMouPermission;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnDeviceIdChanging(string value);
partial void OnDeviceIdChanged();
partial void OnDeviceNameChanging(string value);
partial void OnDeviceNameChanged();
partial void OnAddressChanging(string value);
partial void OnAddressChanged();
partial void OnCreateDateChanging(System.Nullable<System.DateTime> value);
partial void OnCreateDateChanged();
partial void OnProjectIdChanging(string value);
partial void OnProjectIdChanged();
partial void OnDeviceSerialChanging(string value);
partial void OnDeviceSerialChanged();
partial void OnIsInOutChanging(string value);
partial void OnIsInOutChanged();
partial void OnValidateCodeChanging(string value);
partial void OnValidateCodeChanged();
partial void OnYunMouDeviceIdChanging(string value);
partial void OnYunMouDeviceIdChanged();
partial void OnYunMouPermissionChanging(string value);
partial void OnYunMouPermissionChanged();
#endregion
public Project_Devices()
{
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceId", DbType="NVarChar(50) NOT NULL", CanBeNull=false, IsPrimaryKey=true)]
public string DeviceId
{
get
{
return this._DeviceId;
}
set
{
if ((this._DeviceId != value))
{
this.OnDeviceIdChanging(value);
this.SendPropertyChanging();
this._DeviceId = value;
this.SendPropertyChanged("DeviceId");
this.OnDeviceIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceName", DbType="NVarChar(50)")]
public string DeviceName
{
get
{
return this._DeviceName;
}
set
{
if ((this._DeviceName != value))
{
this.OnDeviceNameChanging(value);
this.SendPropertyChanging();
this._DeviceName = value;
this.SendPropertyChanged("DeviceName");
this.OnDeviceNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Address", DbType="NVarChar(500)")]
public string Address
{
get
{
return this._Address;
}
set
{
if ((this._Address != value))
{
this.OnAddressChanging(value);
this.SendPropertyChanging();
this._Address = value;
this.SendPropertyChanged("Address");
this.OnAddressChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CreateDate", DbType="Date")]
public System.Nullable<System.DateTime> CreateDate
{
get
{
return this._CreateDate;
}
set
{
if ((this._CreateDate != value))
{
this.OnCreateDateChanging(value);
this.SendPropertyChanging();
this._CreateDate = value;
this.SendPropertyChanged("CreateDate");
this.OnCreateDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
public string ProjectId
{
get
{
return this._ProjectId;
}
set
{
if ((this._ProjectId != value))
{
this.OnProjectIdChanging(value);
this.SendPropertyChanging();
this._ProjectId = value;
this.SendPropertyChanged("ProjectId");
this.OnProjectIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeviceSerial", DbType="NVarChar(50)")]
public string DeviceSerial
{
get
{
return this._DeviceSerial;
}
set
{
if ((this._DeviceSerial != value))
{
this.OnDeviceSerialChanging(value);
this.SendPropertyChanging();
this._DeviceSerial = value;
this.SendPropertyChanged("DeviceSerial");
this.OnDeviceSerialChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Name="isInOut", Storage="_IsInOut", DbType="NVarChar(50)")]
public string IsInOut
{
get
{
return this._IsInOut;
}
set
{
if ((this._IsInOut != value))
{
this.OnIsInOutChanging(value);
this.SendPropertyChanging();
this._IsInOut = value;
this.SendPropertyChanged("IsInOut");
this.OnIsInOutChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ValidateCode", DbType="NVarChar(50)")]
public string ValidateCode
{
get
{
return this._ValidateCode;
}
set
{
if ((this._ValidateCode != value))
{
this.OnValidateCodeChanging(value);
this.SendPropertyChanging();
this._ValidateCode = value;
this.SendPropertyChanged("ValidateCode");
this.OnValidateCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouDeviceId", DbType="NVarChar(50)")]
public string YunMouDeviceId
{
get
{
return this._YunMouDeviceId;
}
set
{
if ((this._YunMouDeviceId != value))
{
this.OnYunMouDeviceIdChanging(value);
this.SendPropertyChanging();
this._YunMouDeviceId = value;
this.SendPropertyChanged("YunMouDeviceId");
this.OnYunMouDeviceIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouPermission", DbType="NVarChar(50)")]
public string YunMouPermission
{
get
{
return this._YunMouPermission;
}
set
{
if ((this._YunMouPermission != value))
{
this.OnYunMouPermissionChanging(value);
this.SendPropertyChanging();
this._YunMouPermission = value;
this.SendPropertyChanged("YunMouPermission");
this.OnYunMouPermissionChanged();
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Project_FileCabinet")]
public partial class Project_FileCabinet : INotifyPropertyChanging, INotifyPropertyChanged
{
@ -379126,6 +379325,8 @@ namespace Model
private System.Nullable<bool> _IsTrain;
private string _YunMouState;
private EntitySet<Accident_AccidentPersonRecord> _Accident_AccidentPersonRecord;
private EntitySet<Accident_AccidentReportOtherItem> _Accident_AccidentReportOtherItem;
@ -379338,6 +379539,8 @@ namespace Model
partial void OnIsSyncWelderChanged();
partial void OnIsTrainChanging(System.Nullable<bool> value);
partial void OnIsTrainChanged();
partial void OnYunMouStateChanging(string value);
partial void OnYunMouStateChanged();
#endregion
public SitePerson_Person()
@ -380887,6 +381090,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YunMouState", DbType="NVarChar(50)")]
public string YunMouState
{
get
{
return this._YunMouState;
}
set
{
if ((this._YunMouState != value))
{
this.OnYunMouStateChanging(value);
this.SendPropertyChanging();
this._YunMouState = value;
this.SendPropertyChanged("YunMouState");
this.OnYunMouStateChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentPersonRecord_SitePerson_Person", Storage="_Accident_AccidentPersonRecord", ThisKey="PersonId", OtherKey="PersonId", DeleteRule="NO ACTION")]
public EntitySet<Accident_AccidentPersonRecord> Accident_AccidentPersonRecord
{
@ -480496,6 +480719,8 @@ namespace Model
private string _States;
private string _ReviewedManId;
private string _IsEffective;
private string _ResponsibleMan;
@ -480866,6 +481091,22 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReviewedManId", DbType="NVarChar(2000)")]
public string ReviewedManId
{
get
{
return this._ReviewedManId;
}
set
{
if ((this._ReviewedManId != value))
{
this._ReviewedManId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsEffective", DbType="Char(1)")]
public string IsEffective
{
@ -481026,7 +481267,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HandleIdea", DbType="NVarChar(500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HandleIdea", DbType="NVarChar(2000)")]
public string HandleIdea
{
get
@ -481410,7 +481651,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RegisterTypesName", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RegisterTypesName", DbType="NVarChar(50)")]
public string RegisterTypesName
{
get
@ -481474,7 +481715,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Requirements", DbType="NVarChar(400)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Requirements", DbType="NVarChar(2000)")]
public string Requirements
{
get