初始化
This commit is contained in:
137
Face.Web/Areas/App/Controllers/HotelController.cs
Normal file
137
Face.Web/Areas/App/Controllers/HotelController.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Services.Cache;
|
||||
using Face.Services.Manager;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Newtonsoft.Json;
|
||||
using PagedList;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Controllers.LoginController;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class HotelController : BaseController
|
||||
{
|
||||
private List<HotelGroups> GetHotelGroups//酒店项目缓存
|
||||
{
|
||||
get { return CacheHelp.GetHotelGroup(); }
|
||||
}
|
||||
// GET: App/Hotel
|
||||
|
||||
public ActionResult HotelInfo(int? page, string condition = null, string number = null)//酒店列表
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
//CacheHelp.ClearRoomGroup();
|
||||
List<HotelGroups> hotelGroups = new List<HotelGroups>();
|
||||
try
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var dm= db.Queryable<DeviceManage>().ToList();
|
||||
ViewData["dmstate"] = dm.ToList();
|
||||
}
|
||||
var userList = SqlSugarBase.authoriydb.Queryable<Hotels>().OrderBy(e => e.Id).ToList();
|
||||
List<Hotels> li = new List<Hotels>();
|
||||
//第几页
|
||||
int pageNumber = page ?? 1;
|
||||
|
||||
//每页显示多少条
|
||||
int pageSize = 10;
|
||||
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
var id = Convert.ToInt32(lit[i]);
|
||||
li.AddRange(userList.Where(x => x.Id == id).ToList());
|
||||
}
|
||||
|
||||
if (condition != "" && condition != null)
|
||||
{
|
||||
ViewData["condition"] = condition;
|
||||
li = li.Where(x => x.Name.Contains(condition)).ToList();
|
||||
}
|
||||
if (number != null && number != "")
|
||||
{
|
||||
li = li.Where(x => x.Id == int.Parse(number)).ToList();
|
||||
}
|
||||
IPagedList<Hotels> userPagedList = li.ToPagedList(pageNumber, pageSize);
|
||||
return View(userPagedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public ActionResult RoomInf(int? page, int hotelCode, string condition = "", string rommstate = null)//房间信息
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
if (lit.IndexOf(hotelCode) < 0)
|
||||
{
|
||||
Response.Redirect("~/Html_Tools/Error_404.html", false);
|
||||
return null;
|
||||
}
|
||||
List<Result> relist = null;
|
||||
List<DeviceManage> dmlist = new List<DeviceManage>();
|
||||
int pageNumber = page ?? 1;
|
||||
int pageSize = 14;
|
||||
using (var data = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
DateTime ser = Convert.ToDateTime("2000-01-01");
|
||||
var show = data.Queryable<CheckInInfo>().Where(x => x.checkOutTime == ser).ToList();
|
||||
var facelist = data.Queryable<DeviceManage>().ToList();
|
||||
dmlist = facelist.Where(x => x.HotelCode == hotelCode.ToString()).ToList();
|
||||
Session["Rommface"] = dmlist;
|
||||
ViewData["shop"] = show;
|
||||
}
|
||||
try
|
||||
{
|
||||
var ho = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == hotelCode);
|
||||
GetRoomInterface.test test = new GetRoomInterface.test
|
||||
{
|
||||
code = ho.Code.ToString(),
|
||||
creatDate = ho.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
Roominfo.Root asd = GetRoomInterface.Roomport(test);
|
||||
if (asd.IsSuccess == true)
|
||||
{
|
||||
relist = asd.Result;
|
||||
ViewData["Roomsum"] = relist.Count();
|
||||
if (rommstate != "" && rommstate != null && rommstate != "-1")
|
||||
{
|
||||
ViewData["rommstate"] = rommstate;
|
||||
relist = relist.Where(s => s.RoomStatusID == int.Parse(rommstate)).ToList();
|
||||
|
||||
}
|
||||
ViewData["hotelCode"] = hotelCode;
|
||||
if (condition != null && condition != "")
|
||||
{
|
||||
ViewData["conditionShow"] = condition;
|
||||
relist = relist.Where(s => s.RoomNumber == condition).ToList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
IPagedList<Result> userPagedList = relist.ToPagedList(pageNumber, pageSize);
|
||||
return View(userPagedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user