328 lines
12 KiB
C#
328 lines
12 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;
|
|||
|
|
using System.Xml;
|
|||
|
|
using System.IO;
|
|||
|
|
using AForge.Video;
|
|||
|
|
using AForge.Video.DirectShow;
|
|||
|
|
|
|||
|
|
namespace WinFormTest
|
|||
|
|
{
|
|||
|
|
public partial class frmCheckIn : Form
|
|||
|
|
{
|
|||
|
|
blwws.blwwsSoapClient blwwsClient = new blwws.blwwsSoapClient();
|
|||
|
|
syncstatus.syncstatusSoapClient syncstatusClient = new syncstatus.syncstatusSoapClient();
|
|||
|
|
//ServiceReference2.ThirdpartyServiceClient client1 = new ServiceReference2.ThirdpartyServiceClient();
|
|||
|
|
private FilterInfoCollection videoDevices;
|
|||
|
|
private VideoCaptureDevice videoSource = null;
|
|||
|
|
|
|||
|
|
public frmCheckIn(string hotelCode, string roomNumber)
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
|
|||
|
|
txtHotelCode.Text = hotelCode;
|
|||
|
|
//txtRoomNumber.Text = roomNumber;
|
|||
|
|
cmbSex.SelectedIndex = 0;
|
|||
|
|
//btnFaceCheckIn.Visible = false;
|
|||
|
|
|
|||
|
|
rbtnPhoto1.CheckedChanged += new EventHandler(rbtnPhoto1_CheckedChanged);
|
|||
|
|
btnPhoto.Click += new EventHandler(btnPhoto_Click);
|
|||
|
|
this.Load += new EventHandler(frmCheckIn_Load);
|
|||
|
|
this.FormClosing += new FormClosingEventHandler(frmCheckIn_FormClosing);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void frmCheckIn_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (videoSource != null && videoSource.IsRunning)
|
|||
|
|
{
|
|||
|
|
videoSource.Stop();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool isPhoto = false;
|
|||
|
|
void btnPhoto_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (videoSource == null || !videoSource.IsRunning)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("没有找到摄像头!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
picPhoto.Image = picWebcam.Image;
|
|||
|
|
isPhoto = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void frmCheckIn_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
|
|||
|
|
if (videoDevices.Count > 0)
|
|||
|
|
{
|
|||
|
|
videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
|
|||
|
|
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
|
|||
|
|
videoSource.DesiredFrameSize = new Size(picWebcam.Size.Width, picWebcam.Size.Height);
|
|||
|
|
videoSource.Start();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
|
|||
|
|
{
|
|||
|
|
Bitmap img = (Bitmap)eventArgs.Frame.Clone();
|
|||
|
|
picWebcam.Image = img;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void rbtnPhoto1_CheckedChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (rbtnPhoto1.Checked)
|
|||
|
|
{
|
|||
|
|
txtPhotoUrl.ReadOnly = false;
|
|||
|
|
btnPhoto.Enabled = false;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
txtPhotoUrl.ReadOnly = true;
|
|||
|
|
btnPhoto.Enabled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errorMsg = "";
|
|||
|
|
string xmlString = "<interface><item idtype=\"0\" idcard = \"" + txtIDNumber.Text.Trim() + "\" customer = \"" +
|
|||
|
|
txtName.Text.Trim() + "\" sex =\"女\" country =\"0\" checkindate = \"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"/></interface>";
|
|||
|
|
if (blwwsClient.CheckIn("blw_ws@2015", txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), DateTime.Now, xmlString, ref errorMsg, txtPhoneNumber.Text.Trim(), txtIDNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("开房成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errorMsg = "";
|
|||
|
|
if (blwwsClient.CheckOut("blw_ws@2015", txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), DateTime.Now, ref errorMsg))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("退房成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errorMsg = "";
|
|||
|
|
if (blwwsClient.RentRoom("blw_ws@2015", txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), DateTime.Now, ref errorMsg))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("变更待租成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//=============将插卡信息上报给PMS=======================================
|
|||
|
|
|
|||
|
|
//XmlDocument xmlDoc = new XmlDocument();
|
|||
|
|
//xmlDoc.LoadXml(client1.GethHotelcode("宝来客控对接酒店"));
|
|||
|
|
//XmlElement element = xmlDoc.DocumentElement;
|
|||
|
|
//string hotelCode = element.GetElementsByTagName("Body")[0].ChildNodes[0].ChildNodes[0].InnerText;//"HOTEL1489374686";
|
|||
|
|
//xmlDoc = new XmlDocument();
|
|||
|
|
//XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");//创建类型声明节点
|
|||
|
|
//xmlDoc.AppendChild(node);
|
|||
|
|
//XmlNode root = xmlDoc.CreateElement("request");
|
|||
|
|
//xmlDoc.AppendChild(root);
|
|||
|
|
//XmlNode card = xmlDoc.CreateElement("cardIdentificatioinrq");
|
|||
|
|
//root.AppendChild(card);
|
|||
|
|
//XmlNode data = xmlDoc.CreateNode(XmlNodeType.Element, "hotelCode", null);
|
|||
|
|
//data.InnerText = hotelCode;//酒店代码
|
|||
|
|
//card.AppendChild(data);
|
|||
|
|
//data = xmlDoc.CreateNode(XmlNodeType.Element, "roomno", null);
|
|||
|
|
//data.InnerText = textBox1.Text.Trim();//房间号
|
|||
|
|
//card.AppendChild(data);
|
|||
|
|
//data = xmlDoc.CreateNode(XmlNodeType.Element, "remark", null);
|
|||
|
|
//data.InnerText = "";//备注
|
|||
|
|
//card.AppendChild(data);
|
|||
|
|
//data = xmlDoc.CreateNode(XmlNodeType.Element, "guestinfo", null);
|
|||
|
|
//if (string.IsNullOrEmpty(textBox2.Text.Trim()))
|
|||
|
|
//{
|
|||
|
|
// data.InnerText = "无人";
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// data.InnerText = textBox2.Text.Trim();//插卡人身份信息
|
|||
|
|
//}
|
|||
|
|
//card.AppendChild(data);
|
|||
|
|
//data = xmlDoc.CreateNode(XmlNodeType.Element, "key", null);
|
|||
|
|
//data.InnerText = "Wide_Third";//授权码
|
|||
|
|
//card.AppendChild(data);
|
|||
|
|
////logger.Error(xmlDoc.InnerXml);
|
|||
|
|
//textBox3.Text = xmlDoc.InnerXml;
|
|||
|
|
//string result = client1.SendIdentificatioinByCard(xmlDoc.InnerXml);
|
|||
|
|
//string result = TestBLL.Class1.Test(textBox1.Text.Trim(), textBox2.Text.Trim());
|
|||
|
|
//MessageBox.Show("发送成功" + Environment.NewLine + result);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void button5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(txtPhoneNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("手机号不能为空");
|
|||
|
|
txtPhoneNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errorMsg = "";
|
|||
|
|
if (blwwsClient.ChangePhoneNumber("blw_ws@2015", txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), txtPhoneNumber.Text.Trim(), txtIDNumber.Text.Trim(), ref errorMsg))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("变更手机号成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btnWXLogin_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(txtValidateCode.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("验证码不能为空");
|
|||
|
|
txtValidateCode.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (syncstatusClient.ValidateNumberByCode(txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), txtValidateCode.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("验证成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("验证失败!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btnFaceCheckIn_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(txtRoomNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("房号不能为空");
|
|||
|
|
txtRoomNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(txtName.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("姓名不能为空");
|
|||
|
|
txtName.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(txtIDNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("身份证号不能为空");
|
|||
|
|
txtIDNumber.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string errorMsg = "";
|
|||
|
|
long checkInID = 0;
|
|||
|
|
string photoUrl = txtPhotoUrl.Text.Trim();
|
|||
|
|
byte[] photo = null;
|
|||
|
|
if (rbtnPhoto2.Checked)
|
|||
|
|
{
|
|||
|
|
if (!isPhoto)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("请先拍照");
|
|||
|
|
btnPhoto.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
photoUrl = "";
|
|||
|
|
photo = GetBytePictureBox(picPhoto);
|
|||
|
|
}
|
|||
|
|
else if(string.IsNullOrEmpty(photoUrl))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("云端图片地址不能为空");
|
|||
|
|
txtPhotoUrl.Focus();
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
string xmlString = "<interface><item idtype=\"0\" idcard = \"" + txtIDNumber.Text.Trim() + "\" customer = \"" +
|
|||
|
|
txtName.Text.Trim() + "\" sex =\"女\" country =\"0\" checkindate = \"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"/></interface>";
|
|||
|
|
if (blwwsClient.CheckIn2("blw_ws@2015", txtHotelCode.Text.Trim(), txtRoomNumber.Text.Trim(), DateTime.Now, xmlString, ref errorMsg, ref checkInID, txtPhoneNumber.Text.Trim(), txtIDNumber.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
if (blwwsClient.UploadPhoto("blw_ws@2015", txtHotelCode.Text.Trim(), checkInID, 0, txtIDNumber.Text.Trim(), txtName.Text.Trim(),
|
|||
|
|
cmbSex.SelectedIndex, dtBirthday.Value.ToString("yyyy-MM-dd"), photoUrl, photo, ref errorMsg))
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("开房成功!CheckInID:" + checkInID.ToString());
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show(errorMsg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private byte[] GetBytePictureBox(System.Windows.Forms.PictureBox pb)
|
|||
|
|
{
|
|||
|
|
byte[] bt = null;
|
|||
|
|
if (!pb.Equals(null))
|
|||
|
|
{
|
|||
|
|
using (MemoryStream ms = new MemoryStream())
|
|||
|
|
{
|
|||
|
|
Bitmap bm = new Bitmap(pb.Size.Width, pb.Size.Height);
|
|||
|
|
pb.DrawToBitmap(bm, pb.ClientRectangle);
|
|||
|
|
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|||
|
|
bt = ms.GetBuffer();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return bt;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|