public IActionResult CheckedOutByScore(int id) { Score s = _context.Score.Find(id); CheckInModel check = new CheckInModel(s.Title, id); //Select any piece from the desired score that is checked out. IEnumerable <Piece> pieces = from p in _context.Piece where _context.CheckedOut.Any (e => e.PartId == p.PieceId) && p.ScoreId == id select p; foreach (Piece p in pieces) { //Select any musician with a piece in the score currently checked out. IEnumerable <Musician> musicians = from m in _context.Musician where _context.CheckedOut.Any(e => e.MusicianId == m.MusicianId && e.PartId == p.PieceId) select m; foreach (Musician m in musicians) { check.AddMusician(m); check.AddPiece(p, m.MusicianId); } } return(View(check)); }
public ActionResult Find(string id, string building, int?page, string querybit) { if (!Authenticate()) { return(Content("not authorized")); } Response.NoCache(); CurrentDatabase.SetNoLock(); DbUtil.LogActivity("CheckinFind " + building + " " + id); var m = new CheckInModel(CurrentDatabase); var matches = m.Find(id); if (!matches.Any()) { return(new FindResult(0, building, querybit)); } if (matches.Count() == 1) { return(new FindResult(matches.Single().Familyid.Value, building, querybit)); } return(new MultipleResult(matches, page)); }
public ActionResult Match(string id, int campus, int thisday, int?page, string kiosk, bool?kioskmode) { if (!Authenticate()) { return(Content("not authorized")); } Response.NoCache(); DbUtil.Db.SetNoLock(); DbUtil.LogActivity("checkin " + id); List <CheckinMatch> matches; if (CheckInModel.UseOldCheckin()) { var m = new CheckInModel(); matches = m.MatchOld(id); } else { matches = DbUtil.Db.CheckinMatch(id).ToList(); } if (!matches.Any()) { return(new FamilyResult(0, campus, thisday, 0, false)); // not found } if (matches.Count() == 1) { return(new FamilyResult(matches.Single().Familyid.Value, campus, thisday, 0, matches[0].Locked ?? false)); } return(new MultipleResult(matches, page)); }
//public ActionResult Delete(long id) //{ // Projects projects = db.Projects.Single(p => p.Project_id == id); // return View(projects); //} //[HttpPost, ActionName("Delete")] //public ActionResult DeleteConfirmed(long id) //{ // Projects projects = db.Projects.Single(p => p.Project_id == id); // db.Projects.DeleteObject(projects); // db.SaveChanges(); // return RedirectToAction("Index"); //} public string CheckIn(CheckInModel model) { string userName = User.Identity.Name.Split('\\')[1]; var user = db.User.SingleOrDefault(x => x.User_name == userName); if (user == null) { db.User.Add(new User() { User_name = userName }); db.SaveChanges(); user = db.User.SingleOrDefault(x => x.User_name == userName); } UserProjectsM2M m2m = new UserProjectsM2M() { Projects_id = model.ProjectId, User_id = user.User_id, UserProjectsM2M_hours = model.Hours, UserProjectsM2M_date = model.Date, UserProjectsM2M_comment = model.Comment }; db.UserProjectsM2M.Add(m2m); db.SaveChanges(); return("ok"); }
public ActionResult UpdateAttend(string data) { // Authenticate first if (!Auth()) { return(Message.createErrorReturn("Authentication failed, please try again", Message.API_ERROR_INVALID_CREDENTIALS)); } Message message = Message.createFromString(data); Message response = new Message(); AttendanceBundle bundle = JsonConvert.DeserializeObject <AttendanceBundle>(message.data); bundle.recordAttendance(CurrentDatabase); if (message.device == Message.API_DEVICE_WEB) { string bundleData = SerializeJSON(bundle); CheckInModel checkInModel = new CheckInModel(CurrentDatabase); checkInModel.SavePrintJob(message.kiosk, null, bundleData); response.setNoError(); response.count = 1; response.data = bundleData; } else { response.setNoError(); response.count = 1; response.data = SerializeJSON(bundle.createLabelData(CurrentDatabase)); } return(response); }
public async Task <IActionResult> AdPutCheckInModel([FromBody] CheckInDTO model) { var user = await _userManager.FindByNameAsync(model.UserName); string userId = user.Id; var checkIn = new CheckInModel { ID = model.ID, Day = model.Day, FirstEntry = model.FirstEntry, SecondEntry = model.SecondEntry, OwnerId = userId }; _context.Entry(checkIn).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CheckInModelExists(model.ID)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult Index() { var model = new CheckInModel(); model.Bookings = _b.GetTodayBookings(); return(View(model)); }
public async Task <IActionResult> PutCheckInModel([FromBody] CheckInModel checkInModel) { string userId = User.Claims.First(c => c.Type == "UserID").Value; var id = _context.CheckIn.Where(u => u.OwnerId == userId) .FirstOrDefault(i => i.Day == DateTime.Today).ID; if (id != checkInModel.ID) { return(BadRequest()); } //_context.Entry(checkInModel).State = EntityState.Modified; var dbModel = await _context.CheckIn.FindAsync(id); dbModel.ID = checkInModel.ID; dbModel.SecondEntry = checkInModel.SecondEntry; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CheckInModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task CheckIn() { CheckInModel checkIn = new CheckInModel { Client = Client, Phone = Phone, RoomType = SelectedRoomType, RoomNumber = SelectedRoomNumber, RoomCapacity = RoomCapacity, RoomPrice = RoomPrice, DateIn = DateIn, DateOut = DateOut, StayDays = StayDays, GuestNumber = GuestNumber }; await _checkInEndpoint.PostCheckIn(checkIn); List <RoomModel> allRooms = await _roomEndpoint.GetAllRooms(); RoomModel checkedInRoom = allRooms.Where(x => x.RoomNumber == SelectedRoomNumber).FirstOrDefault(); checkedInRoom.IsAvailable = false; await _roomEndpoint.UpdateRoom(checkedInRoom); ClearCheckIn(); }
public int GetCheckInID(CheckInModel checkIn) { SqlDataAccess sql = new SqlDataAccess(); var output = sql.LoadData <int, dynamic>("dbo.spCheckInIDLookUp", new { checkIn.Client, checkIn.Phone }, "OHMData").FirstOrDefault(); return(output); }
public void SavePrintJobTest() { var model = new CheckInModel(db); model.SavePrintJob("TestKiosk1", null, "{\"fake\":\"test json\"}"); db.PrintJobs.Where(m => m.Id == "TestKiosk1").Count().ShouldBeGreaterThan(0); }
// GET: CheckIn/Delete/5 public ActionResult Delete(int?id) { CheckInModel checkInModels = db.CheckInModels.Find(id); db.CheckInModels.Remove(checkInModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <string> Add(CheckInModel checkInModel) { string strRequestJson = checkInModel.ToJson(); ("原始请求内容:" + strRequestJson).WriteToLog(); if (string.IsNullOrEmpty(strRequestJson)) { return(ResponseMessageHandle("", "S05", "消息内容为空")); } //2、消息类型检查 if (!string.Equals(checkInModel.msg_type, BaseInfo.OrderCreateMsgType)) { return(ResponseMessageHandle("", "S04", "消息类型msg_type错误")); } //3、签名检查 try { if (!SignHelper.CheckDataDigest(checkInModel.logistics_interface, checkInModel.data_digest, BaseInfo.SecretKey)) { return(ResponseMessageHandle("", "S02", "消息签名不符,请检查签名")); } } catch (Exception ex) { var mess = new StringBuilder(); mess.Append("报文消息签名检查失败:\n"); mess.Append("\n报文内容:" + checkInModel.logistics_interface); mess.Append("\n错误信息:" + ex.Message + "\n" + ex.StackTrace); mess.ToString().WriteToLog(LogerType.Error); return(ResponseMessageHandle("", "S02", "报文消息签名检查失败")); } //4、报文转换为实体对象 TaobaoOrderModel model; try { model = checkInModel.logistics_interface.ToObjectIgnoreNull <TaobaoOrderModel>(); } catch (Exception ex) { var mess = new StringBuilder(); mess.Append("报文内容格式不符合规范,Json格式转换失败:\n"); mess.Append("\n报文内容:" + checkInModel.logistics_interface); mess.Append("\n错误信息:" + ex.Message + "\n" + ex.StackTrace); mess.ToString().WriteToLog(LogerType.Error); return(ResponseMessageHandle("", "S01", "报文内容格式不符合规范,Json格式转换失败")); } #region 5、写入Mysql数据库 var ret = await t_MySql_OrderService.AddTaoBao(model); return(!ret? ResponseMessageHandle(model.txLogisticID, "S07", "订单写入数据库失败", LogerType.Fatal) : ResponseMessageHandle(model.txLogisticID, "", "", LogerType.Info, true)); #endregion }
public void Clear() { CheckIn = new CheckInModel(); Guests.Clear(); Services.Clear(); RoomType = new RoomTypeModel(); GuestDocuments.Clear(); roominess = roomNumber = -1; id = 0; }
public CompleteCheckIn() { checkInService = BLL.ServiceModules.IoC.Get <ICheckInService>(); dbInfo = BLL.ServiceModules.IoC.Get <IDbInfo>(); dbCrud = BLL.ServiceModules.IoC.Get <IDbCrud>(); checkIn = new CheckInModel(); guests = new List <GuestModel>(); services = new List <ServiceData>(); guestDocuments = new List <GuestDocuments>(); }
public ActionResult Edit([Bind(Include = "Id,UserId,BeerId")] CheckInModel checkInModel) { if (ModelState.IsValid) { db.Entry(checkInModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(checkInModel)); }
public async Task UpdateCheckIn(CheckInModel checkIn) { using (HttpResponseMessage response = await _apiHelper.ApiClient.PutAsJsonAsync($"/api/CheckIn/{ checkIn.Id }", checkIn)) { if (response.IsSuccessStatusCode == false) { throw new Exception(response.ReasonPhrase); } } }
public ActionResult FetchBuildingActivities(string id) { if (!Authenticate()) { return(Content("not authorized")); } var m = new CheckInModel(); return(Content(DbUtil.Db.Content($"BuildingCheckin-{id}.xml", "<BuildingActivity/>"), "text/xml")); }
public ActionResult FetchPrintJobs(string id) { if (!Authenticate()) { return(Content("not authorized")); } var m = new CheckInModel(); var b = m.GetNextPrintJobs(id); return(Content(b, "text/xml")); }
public async Task <ActionResult <CheckInModel> > PostCheckInModel(CheckInModel checkInModel) { string userId = User.Claims.First(c => c.Type == "UserID").Value; checkInModel.OwnerId = userId; checkInModel.Day = DateTime.Today; checkInModel.SecondEntry = checkInModel.FirstEntry; _context.CheckIn.Add(checkInModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCheckInModel", new { id = checkInModel.ID }, checkInModel)); }
public IActionResult SearchById([Bind("BookingId")] CheckInModel checkInModel) { try { checkInModel.Rooms = _b.GetAvailableRoomsForCheckin(checkInModel.BookingId); return(View(nameof(Index), checkInModel)); } catch (BookingException ex) { ModelState.AddModelError(ex.Source, ex.Message); } return(View(nameof(Index), checkInModel)); }
public void CreateCheckIn(CheckInModel checkIn) { db.ChecksIn.Create(new CheckIn() { StartDate = checkIn.StartDate, EndDate = checkIn.EndDate, RoomId = checkIn.RoomId, RoomCost = checkIn.RoomCost, ServicesCost = checkIn.ServicesCost, LastEmployeeId = checkIn.LastEmployeeId }); Save(); }
public void UpdateCheckIn(CheckInModel checkIn) { CheckIn prevCheckIn = db.ChecksIn.GetItem(checkIn.CheckInId); prevCheckIn.RoomId = checkIn.RoomId; prevCheckIn.RoomCost = checkIn.RoomCost; prevCheckIn.ServicesCost = checkIn.ServicesCost; prevCheckIn.StartDate = checkIn.StartDate; prevCheckIn.EndDate = checkIn.EndDate; prevCheckIn.LastEmployeeId = checkIn.LastEmployeeId; Save(); }
// GET: CheckIn/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CheckInModel checkInModels = db.CheckInModels.Find(id); if (checkInModels == null) { return(HttpNotFound()); } return(View(checkInModels)); }
public ContentResult UploadPrintJob(string id) { if (!Authenticate()) { return(Content("not authorized")); } var reader = new StreamReader(Request.InputStream); var job = reader.ReadToEnd(); var m = new CheckInModel(); m.SavePrintJob(id, job); return(Content("done")); }
public ContentResult Membership(int PeopleId, int OrgId, bool Member) { if (!Authenticate()) { return(Content("not authorized")); } DbUtil.LogActivity($"checkin {PeopleId}, {OrgId}, {(Member ? "join" : "unjoin")}"); var m = new CheckInModel(); m.JoinUnJoinOrg(PeopleId, OrgId, Member); var r = new ContentResult(); r.Content = "success"; return(r); }
public ContentResult RecordAttend(int PeopleId, int OrgId, bool Present, int thisday, string kiosk) { if (!Authenticate()) { return(Content("not authorized")); } DbUtil.LogActivity($"checkin {PeopleId}, {OrgId}, {(Present ? "attend0" : "unattend0")}"); var m = new CheckInModel(); m.RecordAttend(PeopleId, OrgId, Present, thisday); var r = new ContentResult(); r.Content = "success"; return(r); }
public async Task <int> GetCheckInID(CheckInModel checkIn) { using (HttpResponseMessage response = await _apiHelper.ApiClient.PostAsJsonAsync("/api/CheckIn/PostForID", checkIn)) { if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsAsync <int>(); return(result); } else { throw new Exception(response.ReasonPhrase); } } }
public ActionResult Create(CheckInModel checkInModel) { if (ModelState.IsValid) { var guest = new Guest(); guest = checkInModel.Guest; guestBL.InsertGuest(guest); //var checkIn = new CheckIn { // PlanId = checkInModel.PlanId //}; //checkIn = (CheckIn)checkInModel; //checkInBL.CreateCheckIn(checkIn); return(RedirectToAction("Create")); } return(View(checkInModel)); }
public IActionResult Search(string bookingId) { var model = new CheckInModel(); try { model.BookingId = Convert.ToInt32(bookingId); model.Rooms = _b.GetAvailableRoomsForCheckin(model.BookingId); return(View(nameof(Index), model)); } catch (BookingException ex) { ModelState.AddModelError(ex.Source, ex.Message); } return(View(nameof(Index), model)); }