using Face.Domain.Entities; using Face.Services.Manager; using System; using System.Collections.Generic; using System.Linq; using System.Web; using WebServer; using static Face.Services.Cache.CacheHelp; using static Face.Web.Areas.App.Models.Roominfo; namespace Face.Web.Areas.App.Models { public class Roominfo { public class Result { /// /// /// public int ID { get; set; } /// /// /// public string HostNumber { get; set; } /// /// /// public string RoomNumber { get; set; } /// /// /// public DateTime RegisterDate { get; set; } /// /// /// public int RoomStatusID { get; set; } /// /// 空房 /// public string RoomStatusName { get; set; } /// /// /// public int RoomTypeID { get; set; } /// /// /// public string RoomTypeName { get; set; } /// /// /// public string MAC { get; set; } /// /// /// public string IP { get; set; } = null; /// /// /// public string Remark { get; set; } public string HotelID { get; set; } } public class Root { /// /// /// public bool IsSuccess { get; set; } /// /// /// public List Result { get; set; } } } public class FJHelp { public static bool outinfos(string id)//退房信息 { List relist = null; CheckinTest sun; try { using (var db = SqlSugarBase.GesmartDb()) { int dtid = int.Parse(id); sun = db.Queryable().First(x => x.id == dtid); } var hotelcode = SqlSugarBase.authoriydb.Queryable().First(x => x.Id == sun.hotelid); var idi = int.Parse(sun.Roomid.ToString()); GetRoomInterface.test test = new GetRoomInterface.test { code = hotelcode.Code.ToString(), creatDate = hotelcode.CreateTime.ToString("yyyy-MM-dd") }; Roominfo.Root asd = GetRoomInterface.Roomport(test); if (asd.IsSuccess == true) { relist = asd.Result; } var roomname = relist.FirstOrDefault(x => x.ID == idi).RoomNumber; bool fp = outinfo(new OutClass { HotelCode = hotelcode.Code.ToString(), roomid = roomname, checkOutTime = DateTime.Now }); if (fp) { SqlSugarBase.Db.Updateable().SetColumns(it => it.testState == 2).Where(x => x.id == sun.id).ExecuteCommand(); SqlSugarBase.Db.Updateable().SetColumns(it => it.CheckoutTime == DateTime.Now).Where(x => x.id == sun.id).ExecuteCommand(); } else { SqlSugarBase.Db.Updateable().SetColumns(it => it.testState ==3).Where(x => x.id == sun.id).ExecuteCommand(); //.Entry(sun).State = EntityState.Modified; } return fp ; } catch (Exception ex) { LogHelp.WriteExceptionLog(ex); return false; } } public static bool outinfo(OutClass po)//退房测试 { try { var whether = WebHelp.CheckOut(new CheckOutInfo { code = po.HotelCode, roomNumber = po.roomid }); return whether; } catch (Exception ex) { LogHelp.WriteExceptionLog(ex); throw; } } } }