/// <summary> /// 购票 /// </summary> /// <returns></returns> public ActionResult BuyTicket() { TicketResult result = new TicketResult(); result.ListTicket = admissionTicketService.GetNormalALL().Select(x => new ticketModel() { admissionTicketId = x.id, name = x.name, introduce = x.introduce, price = DateHelper.m_IsWorkingDay() == true ? x.amount : x.weekendAmount, }).ToList(); int userId = 0; var cookieId = Request.Cookies[SessionKeys.USERID].Value.ToString(); int.TryParse(cookieId, out userId); result.buyTickets = new BuyTickets(); result.buyTickets.pageIndex = 1; result.buyTickets.pageSize = 15; var query = ticketsService.GetList(userId, result.buyTickets.pageIndex, result.buyTickets.pageSize); if (query != null) { result.buyTickets.ListTickets = query.ModelList; } result.ListCoupons = userCouponsService.GetUserId(userId).Select(x => new UseCoupons(x)).ToList(); return(View(result)); }
public IEnumerable <TicketResult> GetTicketList(DateTime startTime, DateTime endTime, int pageNumber, int pageRows) { Database db = new DatabaseProviderFactory().Create("JIRA"); List <TicketResult> result = new List <TicketResult>(); using (DbCommand cmd = db.GetStoredProcCommand("[dbo].[GetIssueList]")) { cmd.CommandTimeout = dbTimeout; db.AddInParameter(cmd, "@StartDate", DbType.DateTime2, startTime); db.AddInParameter(cmd, "@EndDate", DbType.DateTime2, endTime); db.AddInParameter(cmd, "@PageNumber", DbType.Int32, pageNumber); db.AddInParameter(cmd, "@PageRows", DbType.Int32, pageRows); DataSet ds = db.ExecuteDataSet(cmd); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { TicketResult item = new TicketResult(); item.Id = (int)ds.Tables[0].Rows[i]["Id"]; item.Subject = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Subject"]) ? "" : (string)ds.Tables[0].Rows[i]["Subject"]; item.Status = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Status"]) ? "" : (string)ds.Tables[0].Rows[i]["Status"]; item.Priority = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Priority"]) ? "" : (string)ds.Tables[0].Rows[i]["Priority"]; item.FixVersion = DBNull.Value.Equals(ds.Tables[0].Rows[i]["FixVersion"]) ? "" : (string)ds.Tables[0].Rows[i]["FixVersion"]; item.Estimate = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Estimate"]) ? "" : (string)ds.Tables[0].Rows[i]["Estimate"]; item.Assignee = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Assignee"]) ? "" : (string)ds.Tables[0].Rows[i]["Assignee"]; item.CompletedTimeStamp = (DateTime)ds.Tables[0].Rows[i]["CompletedTimeStamp"]; item.Repoter = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Repoter"]) ? "" : (string)ds.Tables[0].Rows[i]["Repoter"]; item.CreatedTimeStamp = (DateTime)ds.Tables[0].Rows[i]["CreatedTimeStamp"]; item.Project = DBNull.Value.Equals(ds.Tables[0].Rows[i]["Assignee"]) ? "" : (string)ds.Tables[0].Rows[i]["Project"]; result.Add(item); } TicketResult.TotalCount = (int)ds.Tables[1].Rows[0]["TotalCount"]; } return(result); }
public static void ReportResult(string backAddress, TicketResult result) { if (string.IsNullOrEmpty(backAddress) || string.IsNullOrWhiteSpace(backAddress)) { Common.Utility.LogWarn(string.Format("BackAddress for ticket with ticketId: {0} aren't presented")); return; } using (var backClient = InstallationUtility.GetCallbackServiceClient(backAddress)) { backClient.ReportResult(result); } }
public TicketResult GetRandom() { InitCusRelContext(); var result = new TicketResult { Ticket = Fill(ticketEntitiesRepository.GetRandom().FromEntities()) }; if (result.Ticket == null) { result.SetFail("No ticket found"); } return(result); }
static void ReturnTicket() { using (var packageInstallationClient = new ServiceProxies.PackageInstallationService.ResultForTicketServiceClient(new BasicHttpBinding(), new EndpointAddress("http://localhost:8755/PackageInstallationService/ResultForTicket"))) { var ticketResult = new TicketResult() { TicketId = "assssd", IsSuccessful = true, OccuredException = new Exception("dddsssss"), }; packageInstallationClient.ReportResult(ticketResult); } }
public TicketResult GetLinkedTicket(int TicketId, int LinkedId, int depth = 1) { InitCusRelContext(); var result = new TicketResult { Ticket = Fill(ticketEntitiesRepository.Get(TicketId).FromEntities(LinkedId), depth) // get dependent entities too //Ticket = ticketEntitiesRepository.GetContact(TicketId).FromEntities(LinkedId) }; if (result.Ticket == null) { result.SetFail("No ticket found"); } return(result); }
private async void Paymentpage_CancelPayment(object sender, EventArgs e) { try { await Navigation.PopAsync(); }catch { } if (_ticketstatus != null && _ticketstatus.Code == 100) { var result = await App.RestClient.Post <StandarResult>($"{App.BaseUrl}/Buy/DeleteAllTicket", new Dictionary <string, object> { { "idticket", _ticketstatus.TicketNumber } }); _ticketstatus = null; } try { await Navigation.PopAsync(); } catch { } CompraContainer.IsVisible = true; Progress.IsVisible = false; BtnComprar.IsEnabled = true; }
public TicketTableModel FindIssues(int id) { TicketTableModel model = new TicketTableModel(); TicketResult result = _issueDataAccess.FindIssue(id); model.Id = result.Id; model.Subject = result.Subject; model.Status = result.Status; model.Priority = result.Priority; model.FixVersion = result.FixVersion; model.Assignee = result.Assignee; model.Estimate = result.Estimate; model.Description = result.Description; model.CompletedTimeStamp = result.CompletedTimeStamp.ToShortDateString(); model.Reporter = result.Repoter; model.CreatedTimeStamp = result.CreatedTimeStamp.ToShortDateString(); return(model); }
public TicketResult Get(int id, RequestState requestState = null) { InitCusRelContext(); var result = new TicketResult { Ticket = Fill(ticketEntitiesRepository.Get(id).FromEntities()) }; if (result.Ticket == null) { result.SetFail("No ticket found"); } else if (requestState != null) { TrackView(id, requestState.UserDetails.Id); //Track ticket view } return(result); }
public TicketModel(ServicesProxy servicesProxy, TicketResult ticketResult) { ServicesProxy = servicesProxy; if (ticketResult == null) { ticketResult = servicesProxy.TicketService.GetEmptyTicket(Ticket.EmptyTicketEnum.NewTicket); log.Debug(string.Format("TicketService.GetEmptyTicket: {0}", ticketResult)); } if (ticketResult != null) { Ticket = ticketResult.Ticket; MergeResults(ticketResult); } log.Debug(string.Format("TicketModel: {0}", ToString())); if (!OK) { return; } Init(); }
public TicketResult FindIssue(int id) { Database db = new DatabaseProviderFactory().Create("JIRA"); TicketResult result = new TicketResult(); using (DbCommand cmd = db.GetStoredProcCommand("[dbo].[FindIssue]")) { cmd.CommandTimeout = dbTimeout; db.AddInParameter(cmd, "@Id", DbType.Int32, id); DataSet ds = db.ExecuteDataSet(cmd); result.Id = (int)ds.Tables[0].Rows[0]["Id"]; result.Subject = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Subject"]) ? "" : (string)ds.Tables[0].Rows[0]["Subject"]; result.Status = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Status"]) ? "" : (string)ds.Tables[0].Rows[0]["Status"]; result.Priority = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Priority"]) ? "" : (string)ds.Tables[0].Rows[0]["Priority"]; result.FixVersion = DBNull.Value.Equals(ds.Tables[0].Rows[0]["FixVersion"]) ? "" : (string)ds.Tables[0].Rows[0]["FixVersion"]; result.Estimate = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Estimate"]) ? "" : (string)ds.Tables[0].Rows[0]["Estimate"]; result.Assignee = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Assignee"]) ? "" : (string)ds.Tables[0].Rows[0]["Assignee"]; result.CompletedTimeStamp = (DateTime)ds.Tables[0].Rows[0]["CompletedTimeStamp"]; result.Repoter = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Repoter"]) ? "" : (string)ds.Tables[0].Rows[0]["Repoter"]; result.Description = DBNull.Value.Equals(ds.Tables[0].Rows[0]["Description"]) ? "" : (string)ds.Tables[0].Rows[0]["Description"]; result.CreatedTimeStamp = (DateTime)ds.Tables[0].Rows[0]["CreatedTimeStamp"]; } return(result); }
private async void BtnComprar_Clicked(object sender, EventArgs e) { BtnComprar.IsEnabled = false; if (App.Oauth == null) { await DisplayAlert(App.AppName, "Debes registrarte para poder comprar los productos", "Aceptar"); try { var result = await DisplayActionSheet(App.AppName, "Cancelar", null, "Registrarse"); if (!string.IsNullOrEmpty(result)) { if (result.Equals("Registrarse")) { App.Instance.SetMainPage(new SIgninPage(), true); } } } catch { } return; } var direction = BoxDirection.Text ?? ""; if (!string.IsNullOrEmpty(direction) || !string.IsNullOrWhiteSpace(direction)) { Device.BeginInvokeOnMainThread(async() => { Progress.IsVisible = true; CompraContainer.IsVisible = false; foreach (var shopitem in App.ShopList) { var result = await App.RestClient.Get <VerifyQtyResult>(App.BaseUrl + "/Stock/Verify", new Dictionary <string, object> { { "IdProducto", shopitem.IdProduct.ToString() }, { "Qty", shopitem.Qty.ToString() } }); if (result != null) { if (result.Success == 0) { string message = "La cantidad que deseas comprar excede nuestro stock, nos hacen falta " + result.Qty + " para el producto " + shopitem.Product.Nombre; await DisplayAlert(App.AppName, message, "Aceptar"); Progress.IsVisible = false; CompraContainer.IsVisible = true; return; } } else { string message = "Intenta nuevamente por favor."; await DisplayAlert(App.AppName, message, "Aceptar"); Progress.IsVisible = false; CompraContainer.IsVisible = true; return; } } List <dynamic> sendtobuy = new List <dynamic>(); _request = new TicketRequest { IdUsuario = App.Oauth.IdUsuario, IdCliente = App.IdCliente }; /* * if (ReferenceToCode != null) * { * request.Total = amountwithcode; * request.IdCodigo = ReferenceToCode.IdCodigo; * } */ double total = 0; foreach (var shopitem in App.ShopList) { _request.Articulos.Add(new Articulo { IdProducto = shopitem.IdProduct, Cantidad = shopitem.Qty, Costo = shopitem.Price }); total += shopitem.Price; } if (CrossConnectivity.Current.IsConnected) { _ticketstatus = await App.RestClient.Post <TicketResult, TicketRequest>(App.BaseUrl + "/Ticket/Add", _request); if (_ticketstatus != null) { if (_ticketstatus.Code == 100) { if (MainPage.Instance != null) { MainPage.Instance.SetTextBtnGoToShop("Items: 0, Total: $0"); } // Limpiamos las listas App.Products.Clear(); App.ShopList.Clear(); // Reseteamos el carrito Init(); // Procesamos el pago... ProcessPaymentPage paymentpage = new ProcessPaymentPage(total, $"DroidShop_{_ticketstatus.TicketNumber}", App.Oauth.CustomerId, App.BaseUrl); paymentpage.ChargeResult += Paymentpage_ChargeResult; paymentpage.CancelPayment += Paymentpage_CancelPayment; await Navigation.PushAsync(paymentpage); } else { await DisplayAlert(App.AppName, "Ocurrio un error al realizar la venta, intenta más tarde", "Aceptar"); CompraContainer.IsVisible = true; Progress.IsVisible = false; BtnComprar.IsEnabled = true; } } else { await DisplayAlert(App.AppName, "Ocurrio un error al realizar la venta, intenta más tarde", "Aceptar"); CompraContainer.IsVisible = true; Progress.IsVisible = false; BtnComprar.IsEnabled = true; } } else { await DisplayAlert(App.AppName, "Necesitas conexion a internet para continuar", "Aceptar"); CompraContainer.IsVisible = true; Progress.IsVisible = false; BtnComprar.IsEnabled = true; } }); } else { await DisplayAlert(App.AppName, "Debes ingresar una direccion de envio", "Aceptar"); CompraContainer.IsVisible = true; Progress.IsVisible = false; BtnComprar.IsEnabled = true; } }
public async Task<ActionResult> Post(ulong pfsVersion) { PFSType pfsType = (PFSType)pfsVersion; _logger.LogDebug("Login request from {host} with PFS: {pfsType} ({pfsNum})", Request.Host, pfsType, (long)pfsType); if (_gsOptions.EnforceGameVersion && !EnsureVersion(pfsType)) return Forbid(); if (Request.ContentLength >= 0x300) { _logger.LogWarning("Received a ticket too big - {size} from {host}", Request.ContentLength, Request.Host); return BadRequest(); } NPTicket ticket; try { byte[] buf = new byte[(int)Request.ContentLength]; await Request.Body.ReadAsync(buf.AsMemory(0, buf.Length)); ticket = NPTicket.FromBuffer(buf); } catch (Exception e) { _logger.LogWarning(e, "Could not read NP ticket provided by client"); return BadRequest(); } if (!VerifyTicket(ticket)) return BadRequest(); _logger.LogDebug("Auth Request: NP_Ticket -> PFS: {pfsVersion} | OnlineID: {OnlineId} | Region: {Region}", pfsVersion, ticket.OnlineId, ticket.Region); // Check if already connected if (CheckAlreadyConnected(ticket.OnlineId)) _logger.LogTrace("Auth Request from OnlineID: {OnlineId} which was already connected", ticket.OnlineId); UserDTO user = await _users.GetByPSNUserIdAsync(ticket.OnlineId) ?? await CreateUser(ticket); if (user is null) { _logger.LogError("Failed to get or create user from db: Name: {name}", ticket.OnlineId); return Problem(); } var now = DateTime.Now; // From this point, auth is OK var resp = new TicketResult() { Result = "1", // Doesn't seem to do much. Nickname = ticket.OnlineId, UserId = ticket.OnlineId, UserNumber = user.Id, ServerTime = now, }; var expiryTime = now.AddHours(1); var sToken = new SessionToken(GenerateToken(expiryTime), expiryTime); var cookieOptions = new CookieOptions() { Expires = sToken.ExpiryDate }; Response.Cookies.Append("X-gt-token", sToken.Token, cookieOptions); var player = new Player(user, sToken); player.LastUpdate = now; _players.AddUser(player); return Ok(resp); }