94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace WinFormTest
|
|
{
|
|
public partial class frmFaceDevice : Form
|
|
{
|
|
public event EventHandler SaveEvent;
|
|
syncstatus.syncstatusSoapClient client = new syncstatus.syncstatusSoapClient();
|
|
|
|
private long _id;
|
|
private bool _multipleHotel;
|
|
public frmFaceDevice(long id, string serialNo, string devName, string hotelCode, string roomNumber, string curHotelCode, bool multipleHotel)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_id = id;
|
|
_multipleHotel = multipleHotel;
|
|
|
|
txtSerialNo.Text = serialNo;
|
|
txtDevName.Text = devName;
|
|
txtRoomNumber.Text = roomNumber;
|
|
|
|
DataSet ds = client.GetHotelCode();
|
|
cmbHotels.ValueMember = "Code";
|
|
cmbHotels.DisplayMember = "Remark";
|
|
cmbHotels.DataSource = ds.Tables[0];
|
|
if (string.IsNullOrEmpty(curHotelCode))
|
|
{
|
|
cmbHotels.SelectedValue = hotelCode;
|
|
}
|
|
else
|
|
{
|
|
cmbHotels.SelectedValue = curHotelCode;
|
|
}
|
|
cmbHotels.Enabled = _multipleHotel;
|
|
}
|
|
|
|
private void frmFaceDevice_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (cmbHotels.SelectedIndex < 0)
|
|
{
|
|
MessageBox.Show("请选择所属酒店");
|
|
cmbHotels.Focus();
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|
{
|
|
MessageBox.Show("请输入房号");
|
|
txtRoomNumber.Focus();
|
|
return;
|
|
}
|
|
DataSet dsDevices = client.GetDevices("");
|
|
foreach (DataRow row in dsDevices.Tables[0].Rows)
|
|
{
|
|
if (row["HotelCode"].ToString() == cmbHotels.SelectedValue.ToString() &&
|
|
row["RoomNumber"].ToString() == txtRoomNumber.Text.Trim() && row["SerialNo"].ToString() != txtSerialNo.Text)
|
|
{
|
|
MessageBox.Show(string.Format("该酒店客房已绑定了人脸机({0}),请先解除绑定。", row["SerialNo"].ToString()));
|
|
return;
|
|
}
|
|
}
|
|
if (client.SaveDevice(_id, cmbHotels.SelectedValue.ToString(), txtRoomNumber.Text.Trim()) > 0)
|
|
{
|
|
MessageBox.Show("绑定房号成功");
|
|
if (SaveEvent != null)
|
|
{
|
|
SaveEvent(this, EventArgs.Empty);
|
|
}
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("绑定房号失败");
|
|
}
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|