using Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using static ServiceReference1.blwwsSoapClient;

namespace BLW_Log.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PMSController : ControllerBase
    {
        [HttpPost()]
        public async Task<ReturnInfo> PMSCheckIn([FromForm]string Code, [FromForm]string RoomNum, [FromForm]string CheckInTime, [FromForm]string XmlString, [FromForm]string Phone, [FromForm]string IdCard)
        {
            ReturnInfo r = new ReturnInfo();
            try
            {
                r.isok = true;
                r.message = "helloasdfweroewrew";
                //var binding = new System.ServiceModel.BasicHttpBinding();
                //var endpoint = new System.ServiceModel.EndpointAddress("http://pms.boonlive-rcu.com:89/blwws.asmx");
                //ServiceReference1.blwwsSoapClient blw = new ServiceReference1.blwwsSoapClient(binding, endpoint);
                //DateTime.TryParse(CheckInTime, out DateTime CheckDateTime);
                //string msg = "";
                //var result = await blw.CheckInAsync("blw_ws@2015", Code, RoomNum, CheckDateTime, XmlString, msg, Phone, IdCard);
                //r.isok = true;
                //r.message = msg;
                //r.response = result.Body.CheckInResult;
            }
            catch (Exception ex)
            {
                r.isok = false;
                r.message = ex.Message;
            }
            return r;

        }
    }
}
