public async Task <IActionResult> Create(int buildingId, [Bind("BuildingId,FloorId,FloorName,Flg")] FloorModel floorModel) { ViewBag.BuildingName = _context.Buildings.Find(buildingId).BuildingName; // Get Login User's details. var ur = _userRepo.Find(u => u.UserName == this.User.Identity.Name).FirstOrDefault(); // Set values. floorModel.Rtp = ur.Id; floorModel.Rtt = DateTime.Now; var lastFloor = _context.Floors.Where(f => f.BuildingId == buildingId); if (lastFloor.Count() == 0) { // If the building hasn't any floor. var lastFloorId = (buildingId * 100) + 1; floorModel.FloorId = lastFloorId.ToString(); } else { var lastFloorId = lastFloor.OrderByDescending(f => f.FloorId).First().FloorId; floorModel.FloorId = (System.Convert.ToInt32(lastFloorId) + 1).ToString(); } if (ModelState.IsValid) { _context.Add(floorModel); await _context.SaveChangesAsync(); return(RedirectToAction("Index", new { BuildingId = buildingId })); } return(View(floorModel)); }
//SQLiteConnection sqlconnection = new SQLiteConnection(@"Data Source=.\Data.db;Initial Catalog=T_Company;Persist Security Info=True;"); public ObservableCollection <FloorModel> GetCompanyList(int index, string bulid) { ObservableCollection <FloorModel> list = new ObservableCollection <FloorModel>(); string sql = "select ID,CompanyName,EnglishName,RoomNum,BeamNum,CompanyInfo from dt_Company where DeviceId=" + DeviceId + " and FloorNum=" + index + @" and BeamNum='" + bulid + @"' ORDER BY FloorNum,RoomNum"; DataSet ds = SQLiteHelper.Query(sql); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { FloorModel fm = new FloorModel(); fm.CompanyID = Int32.Parse(dr["ID"].ToString()); fm.CompanyName_CN = dr["CompanyName"].ToString(); fm.CompanyName_EN = dr["EnglishName"].ToString(); fm.Content = dr["CompanyInfo"].ToString(); //string room = dr["BeamNum"].ToString() + dr["RoomNum"].ToString(); string room = dr["RoomNum"].ToString(); if (room.Contains("F")) { room = dr["BeamNum"].ToString() + index.ToString() + dr["RoomNum"].ToString(); } fm.RoomNum = room; list.Add(fm); } } return(list); }
private FloorModel GetTablesModel(Int32?id) { FloorModel model = new FloorModel(); Services.Floor floor; try { id = id.HasValue ? id.Value : 0; model.Floors = _floorService.GetFloors(SessionData.customer.id); floor = _floorService.GetFloor(id.Value); if (floor == null && model.Floors.Count > 0) { floor = model.Floors[0]; } model.Floor = new Models.Floor(); if (floor != null) { SessionData.floor = floor; model.Floor.id = floor.id; model.Floor.Name = floor.Name; model.Floor.Layout = GetTables(model.Floor.id); model.Floor.Width = floor.Width; model.Floor.Height = floor.Height; } return(model); } catch (Exception ex) { base.Log(ex); } finally { } return(null); }
public bool Render() { // Clear the buffers to begin the scene. D3D.BeginScene(0, 0, 0, 1f); // Generate the view matrix based on the camera's position. Camera.Render(); // Get the world, view, and projection matrices from the camera and d3d objects. Matrix worldMatrix = D3D.WorldMatrix; Matrix viewMatrix = Camera.ViewMatrix; Matrix projectionMatrix = D3D.ProjectionMatrix; // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. FloorModel.Render(D3D.DeviceContext); // Render the model using the depth shader. if (!DepthShader.Render(D3D.DeviceContext, FloorModel.IndexCount, worldMatrix, viewMatrix, projectionMatrix)) { return(false); } // Present the rendered scene to the screen. D3D.EndScene(); return(true); }
/// <summary> /// Insert a new value in the list /// </summary> /// <param name=<em>"value"</em>>New value to be inserted</param> // POST: api/Floor public IHttpActionResult Post(FloorModel status) { if (!ModelState.IsValid) { return(BadRequest("Not a valid model")); } using (var ctx = new HTMEntities3()) { ctx.Floors.Add(new Floor() { id = status.Id, Floor_Number = status.Floor_Number, Description = status.Description, InsertedOn = status.InsertedOn, InsertedBy = status.InsertedBy, IsActive = status.IsActive, IsDelete = status.IsDelete }); ctx.SaveChanges(); } return(Ok()); }
public List <FloorModel> GetFloorsByHouseId(int houseId) { List <FloorModel> houseFloors = new List <FloorModel>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_GetFloorsByHouseId, conn); cmd.Parameters.AddWithValue("@houseId", houseId); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { FloorModel floor = new FloorModel { FloorId = Convert.ToInt32(reader["FloorId"]), HouseId = Convert.ToInt32(reader["HouseId"]), FloorNumber = Convert.ToInt32(reader["FloorNumber"]), FloorPlan = Convert.ToString(reader["FloorPlan"]) }; houseFloors.Add(floor); } } } catch (SqlException) { throw; } return(houseFloors); }
/// <summary> /// 更新信息 /// </summary> public int UpdateInfo(SqlTransaction trans, FloorModel floModel, int FloorId) { string key = "Cache_Floor_Model_" + FloorId; CacheHelper.RemoveCache(key); return(floDAL.UpdateInfo(trans, floModel, FloorId)); }
public ExecResult AddFloor(FloorModel floor) { string strSql = $"insert into Floor(FloorName,FloorDesc,CreateUser,CreateTime,EmployeeID) values('{floor.FloorName}','{floor.FloorDesc}','{floor.CreateUser}','{floor.CreateTime}',1)"; int intResult = BestWoDP.DapperHelper.ExceSQL(strSql, BestWoDP.DapperHelper.DBConnection.KnowledgeHelper); List <ExceDataResult> listResult = new List <ExceDataResult>(); if (intResult > 0) { listResult.Add(new ExceDataResult { DocumentNo = floor.FloorName, Success = true, Remark = "操作成功" }); return(new ExecResult { StatusCode = 1, Message = "操作成功", Data = listResult }); } else { listResult.Add(new ExceDataResult { DocumentNo = "", Success = false, Remark = "操作失败" }); return(new ExecResult { StatusCode = 1, Message = "操作失败", Data = listResult }); } }
private void btnSure_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtFloorName.Text.Trim())) { MessageBox.Show("请填写楼层名称!"); return; } KnowledgeDesk.ActionHelper.WebAPIHelper webapi = new ActionHelper.WebAPIHelper(); string strErr = ""; FloorModel floor = new FloorModel(); floor.FloorName = this.txtFloorName.Text.Trim(); floor.FloorDesc = this.txtDes.Text.Trim(); floor.CreateUser = "******"; floor.CreateTime = DateTime.Now; string strPost = JsonConvert.SerializeObject(floor); ExecResult result = webapi.ExecuteResultList("http://119.29.105.131:8099/api/Floor/AddFloor", strPost, "Post", ref strErr); if (result.Data[0].Success) { MessageBox.Show(result.Data[0].Remark); this.DialogResult = DialogResult.Yes; this.Close(); } else { MessageBox.Show(result.Data[0].Remark); return; } }
public bool Render() { // Clear the buffers to begin the scene. D3D.BeginScene(0, 0, 0, 1f); // Generate the view matrix based on the camera's position. Camera.Render(); // Get the world, view, and projection matrices from the camera and d3d objects. Matrix worldMatrix = D3D.WorldMatrix; Matrix viewMatrix = Camera.ViewMatrix; Matrix projectionMatrix = D3D.ProjectionMatrix; // Put the floor model vertex and index buffers on the graphics pipeline to prepare them for drawing. FloorModel.Render(D3D.DeviceContext); // Render the floor model using the texture shader. if (!TextureShader.Render(D3D.DeviceContext, FloorModel.IndexCount, worldMatrix, viewMatrix, projectionMatrix, FloorModel.GetTexture())) { return(false); } // Get the position of the camera. Vector3 cameraPosition = Camera.GetPosition(); // Set the position of the billboard model. Vector3 modelPosition = new Vector3(); modelPosition.X = 0.0f; modelPosition.Y = 1.5f; modelPosition.Z = 0.0f; // Calculate the rotation that needs to be applied to the billboard model to face the current camera position using the arc tangent function. double angle = Math.Atan2(modelPosition.X - cameraPosition.X, modelPosition.Z - cameraPosition.Z) * (180.0f / Math.PI); // Convert rotation into radians. float rotation = (float)angle * 0.0174532925f; // Setup the rotation the billboard at the origin using the world matrix. Matrix.RotationY(rotation, out worldMatrix); // Setup the translation matrix from the billboard model. Matrix translationMatrix = Matrix.Translation(modelPosition.X, modelPosition.Y, modelPosition.Z); // Finally combine the rotation and translation matrices to create the final world matrix for the billboard model. Matrix.Multiply(ref worldMatrix, ref translationMatrix, out worldMatrix); // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. BillboardModel.Render(D3D.DeviceContext); // Render the model using the texture shader. if (!TextureShader.Render(D3D.DeviceContext, BillboardModel.IndexCount, worldMatrix, viewMatrix, projectionMatrix, BillboardModel.GetTexture())) { return(false); } // Present the rendered scene to the screen. D3D.EndScene(); return(true); }
public string UpdateFloor(FloorModel floor) { Mapper.CreateMap <FloorModel, Floor>(); Floor fl = Mapper.Map <FloorModel, Floor>(floor); int i = flrService.EditFloor(fl); return(i.ToString()); }
public ActionResult FloorDetails(int id) { var model = new FloorModel(id); // Get available work points model.AvailableWP = WpRepo.GetWpListByLevel(id).ToList(); return(View(model)); }
private static FloorModel NewFloor() { FloorModel floor = new FloorModel(); floor.Level = 1; Console.WriteLine(); Console.WriteLine($"Floor Level: { floor.Level }"); return(floor); }
public ActionResult UploadFloorPlan(FloorModel fm) { //Something database get id when execute query var floorplanid = dbmapper.AddFloor(new FloorModel { BuildingID = 1, Floorplan = fm.Floorplan, FloorName = fm.FloorName }); return(RedirectToAction("EditPlan", new { id = floorplanid })); }
public FloorVM() { FloorProp.AreaVisible = false; FloorProp.HostelVisible = false; FloorProp.BlockVisible = false; FloorData = new FloorModel(); web = new MasterServices(this, this); // send id into base 64 formate web.GetAllArea(); web.GetAllRomType(); }
private void listbox_Floor_SelectionChanged(object sender, SelectionChangedEventArgs e) { FloorModel floormodel = this.listbox_Floor.SelectedItem as FloorModel; if (floormodel != null) { this.grid_Company.Visibility = Visibility.Collapsed; this.Child_Company.DataContext = floormodel; this.Child_Company.Visibility = Visibility.Visible; //MessageBox.Show(bw.CurrentUserControlName); } }
public FloorViewModel(FloorModel floorModel) { FlatsView = CollectionViewSource.GetDefaultView(flatDecorators); FlatsEnumerable = flatDecorators; Section = floorModel.Section; FloorNumber = floorModel.FloorNumber; MinFlatNumber = floorModel.MinFlatNumber; MaxFlatNumber = floorModel.MaxFlatNumber; PropertyChanged += Self_OnPropertyChanged; }
// GET: Admin/Floor/Create/5 public IActionResult Create(int buildingId) { ViewBag.BuildingName = _context.Buildings.Find(buildingId).BuildingName; // Set default value. FloorModel floorModel = new FloorModel() { BuildingId = buildingId, Flg = "Y" }; return(View(floorModel)); }
public void Shutdown() { // Release the camera object. Camera = null; // Release the depth shader object. DepthShader?.ShutDown(); DepthShader = null; // Release the Floor model object. FloorModel?.Shutdown(); FloorModel = null; // Release the Direct3D object. D3D?.ShutDown(); D3D = null; }
private Floor ConvertToBLL(FloorModel floorModel) { var bllModel = new Floor(); { bllModel.BookedPlace = floorModel.BookedPlace; bllModel.CountCarsParked = floorModel.CountCarsParked; bllModel.CountEmptyPlaces = floorModel.CountEmptyPlaces; bllModel.CountReservedPlaces = floorModel.CountReservedPlaces; bllModel.FloorNumber = floorModel.FloorNumber; bllModel.ID = floorModel.ID; bllModel.NextEmptyPlace = floorModel.NextEmptyPlace; } return(bllModel); }
/// <summary> /// 从缓存读取信息 /// </summary> public FloorModel GetCacheInfo(SqlTransaction trans, int FloorId) { string key = "Cache_Floor_Model_" + FloorId; object value = CacheHelper.GetCache(key); if (value != null) { return((FloorModel)value); } else { FloorModel floModel = floDAL.GetInfo(trans, FloorId); CacheHelper.AddCache(key, floModel, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null); return(floModel); } }
// GET: Floor/Edit/5 public ActionResult Edit(int id) { FloorBusiness floorBusiness = new FloorBusiness(new FloorDataAccess()); Floor floor = floorBusiness.GetFloor(id); FloorModel floorModel = new FloorModel { FloorId = floor.FloorId, FloorName = floor.FloorName, CreatedByUserId = floor.CreatedByUserId, CreatedDate = floor.CreatedDate, ModifiedByUserId = floor.ModifiedByUserId, ModifiedDate = floor.ModifiedDate }; return(View(floorModel)); }
private bool RenderScene() { // Clear the buffer to begin the scene as Black. D3D.BeginScene(0, 0, 0, 1f); // Generate the view matrix based on the camera position. Camera.Render(); // Get the world, view, and projection matrices from camera and d3d objects. var viewMatrix = Camera.ViewMatrix; var worldMatrix = D3D.WorldMatrix; var projectionMatrix = D3D.ProjectionMatrix; //// Rotate the world matrix by the rotation value so that the triangle will spin. Matrix.RotationY(Rotation, out worldMatrix); // Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing. Model.Render(D3D.DeviceContext); // Render the model with the texture shader. if (!TextureShader.Render(D3D.DeviceContext, Model.IndexCount, worldMatrix, viewMatrix, projectionMatrix, Model.TextureCollection.Select(item => item.TextureResource).First())) { return(false); } // Get the world matrix again and translate down for the floor model to render underneath the cube. worldMatrix = D3D.WorldMatrix; Matrix.Translation(0, -1.5f, 0, out worldMatrix); // Get the camera reflection view matrix. var reflectionMatrix = Camera.ReflectionViewMatrix; // Put the floor model vertex and index buffers on the graphics pipeline to prepare them for drawing. FloorModel.Render(D3D.DeviceContext); // Render the floor model using the reflection shader, reflection texture, and reflection view matrix. if (!ReflectionShader.Render(D3D.DeviceContext, FloorModel.IndexCount, worldMatrix, viewMatrix, projectionMatrix, FloorModel.TextureCollection.Select(item => item.TextureResource).First(), RenderTexture.ShaderResourceView, reflectionMatrix)) { return(false); } // Present the rendered scene to the screen. D3D.EndScene(); return(true); }
public FloorModel GetListTables(string tablePosition) { string query = $"SELECT * FROM ires.table_info where table_position='{tablePosition}' AND active=true"; FloorModel result = new FloorModel(); result.Name = tablePosition; WorkerToDB tableToDB = new WorkerToDB(); DataTable dtFloor = tableToDB.getRecordsCommand(query); try { for (int i = 0; i < dtFloor.Rows.Count; i++) { var table = new TableModel() { Code = dtFloor.Rows[i]["table_code"].ToString(), Id = Convert.ToInt32(dtFloor.Rows[i]["table_id"]), StatusShow = dtFloor.Rows[i]["table_status"].ToString() == "CÒN TRỐNG" ? false : true, TableName = "Bàn " + dtFloor.Rows[i]["table_number"].ToString(), TipMoney = Convert.ToInt32(dtFloor.Rows[i]["tip"].ToString() != "" ? dtFloor.Rows[i]["tip"] : 0), Promotion = dtFloor.Rows[i]["promotion"].ToString() != "" ? dtFloor.Rows[i]["promotion"].ToString() : null }; if (table.StatusShow == true) { ++result.CountBusyTables; } else { ++result.CountEmptyTables; } result.ListTables.Add(table); } result.ListTables = result.ListTables.OrderBy(x => x.Code).ToList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(result); }
public void Shutdown() { // Release the camera object. Camera = null; // Release the texture shader object. TextureShader?.ShutDown(); TextureShader = null; // Release the Floor model object. FloorModel?.Shutdown(); FloorModel = null; // Release the Billboard model object. BillboardModel?.Shutdown(); BillboardModel = null; // Release the Direct3D object. D3D?.ShutDown(); D3D = null; }
public ActionResult FloorInfo(List <FloorModel> floorModelList) { FloorModel floorModel = new FloorModel(); var bllFloorModel = ConvertToBLL(floorModel); var entityFloorModel = ConvertFromBLLToRepo(bllFloorModel); List <FloorModel> floorUIList = new List <FloorModel>(); List <Floor> bllFloorList = floorUIList.ConvertAll(x => bllFloorModel); List <FloorEntity> repoFloorList = bllFloorList.ConvertAll(x => entityFloorModel); floorEntity.GetAllFloors(); return(View("FloorInfo", floorModelList)); }
public string SaveFloor(FloorModel floor) { Mapper.CreateMap <FloorModel, Floor>(); Floor fl = Mapper.Map <FloorModel, Floor>(floor); fl.CrBy = User.Identity.Name; fl.CrDate = DateTime.Now; bool bl = flrService.IsFloorNo(floor.FloorNo, floor.TowerID); if (bl == true) { return((2).ToString()); } else { int i = flrService.AddFloor(fl); return(i.ToString()); } }
private void FillFloorsForSection(int flatsPerFloor, int startFlatNumber) { const int startFloorNumber = 2; int sectionStartFlatNumber = startFlatNumber; Dictionary <int, float> areasDict = sectionType == SectionType.Furniture ? mebelFlatAreas : hospitalFlatAreas; for (int floorNumber = startFloorNumber; floorNumber <= StaticsProvider.TotalFloorsCount; floorNumber++) { var floorModel = new FloorModel { FloorNumber = floorNumber, Section = sectionType, MinFlatNumber = sectionStartFlatNumber + (floorNumber - startFloorNumber) * flatsPerFloor, }; floorModel.MaxFlatNumber = floorModel.MinFlatNumber + flatsPerFloor - 1; var floorViewModel = new FloorViewModel(floorModel); var flats = new List <FlatViewModel>(); for (int flatIndex = 1; flatIndex < flatsPerFloor + 1; flatIndex++) { var flatModel = new FlatModel { Area = areasDict[flatIndex], FloorNumber = floorViewModel.FloorNumber, Number = startFlatNumber, Section = sectionType }; var flat = new FlatViewModel(flatModel); flats.Add(flat); startFlatNumber++; } floorViewModel.PopulateFlats(flats); var decorator = new FloorDecoratorViewModel(floorViewModel); allFloors.Add(decorator); } allFloors.Reverse(); predicatedFloors.AddRange(allFloors); }
// GET: Floor public ActionResult Index() { FloorBusiness floorBusiness = new FloorBusiness(new FloorDataAccess()); List <Floor> floorList = floorBusiness.GetFloors(); List <FloorModel> floorModelList = new List <FloorModel>(); foreach (Floor floor in floorList) { FloorModel floorModel = new FloorModel { FloorId = floor.FloorId, FloorName = floor.FloorName, CreatedByUserId = floor.CreatedByUserId, CreatedDate = floor.CreatedDate, ModifiedByUserId = floor.ModifiedByUserId, ModifiedDate = floor.ModifiedDate }; floorModelList.Add(floorModel); } return(View(floorModelList)); }
public ActionResult Index() { ElevatorBusiness elevatorBusiness = new ElevatorBusiness(new ElevatorDataAccess()); LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess()); FloorBusiness floorBusiness = new FloorBusiness(new FloorDataAccess()); List <ElevatorCoreModel.Elevator> elevatorList = elevatorBusiness.GetElevators(); List <Floor> floorList = floorBusiness.GetFloors(); List <ElevatorModel> elevatorModelList = new List <ElevatorModel>(); foreach (ElevatorCoreModel.Elevator elevator in elevatorList) { ElevatorModel elevatorModel = new ElevatorModel { ElevatorId = elevator.ElevatorId, ElevatorName = elevator.ElevatorName, FloorDuration = elevator.FloorDuration, MainStatus = (Enums.MainStatus)Enum.Parse(typeof(Enums.MainStatus), lookupBusiness.GetLookupValue(elevator.MainStatusId)), MaxWeight = elevator.MaxWeight }; elevatorModelList.Add(elevatorModel); } List <FloorModel> floorModelList = new List <FloorModel>(); foreach (Floor floor in floorList) { FloorModel floorModel = new FloorModel { FloorId = floor.FloorId, FloorName = floor.FloorName, CreatedDate = floor.CreatedDate, CreatedByUserId = floor.CreatedByUserId, ModifiedByUserId = floor.ModifiedByUserId, ModifiedDate = floor.ModifiedDate }; floorModelList.Add(floorModel); } ViewBag.elevatorList = elevatorModelList; ViewBag.floorList = floorModelList; return(View()); }