//ICatalogoController public ActionResult AggiungiProdotto() { Richiesta r = Deserialize <Richiesta>(); _catalogoController.AggiungiProdotto((ElementoCatalogo)r.Parametri[0]); return(Content(Serialize <Object>(null))); }
public async Task <Richiesta> GetRichiestaAsync(int id) { richiesta = null; try { if (!string.IsNullOrEmpty(loginToken)) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", loginToken); var response = client.GetAsync(@"/api/Richieste/" + id.ToString()).Result; var output_response = await response.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(output_response)) { richiesta = JsonConvert.DeserializeObject <Richiesta>(output_response); } } } catch (Exception e) { throw new Exception(e.Message, e.InnerException); } return(richiesta); }
private void ConfermaRegistrazione_Click(object sender, EventArgs e) { Object[] arguments = new object[10]; arguments[0] = NomeBox.Text; arguments[1] = CognomeBox.Text; arguments[2] = DataBox.Value; Int32.TryParse(CivicoBox.Text, out int n); Indirizzo i = new Indirizzo(ProvinciaBox.Text, CittaBox.Text, ViaBox.Text, n); arguments[4] = EmailBox.Text; arguments[5] = TelefonoBox.Text; arguments[6] = UsernameBox.Text; arguments[7] = PasswordBox.Text; arguments[8] = DomandaBox.Text; arguments[9] = RispostaBox.Text; Richiesta r = new Richiesta("HomeProfilo", "Registrazione", "RegistraUtente", arguments); Boolean result = Task.Run(() => FiltroRichieste.GestisciRichiesta <Boolean>(r)).Result; if (result == true) { _login.Show(); } else { MessageBox.Show("Registrazione non riuscita"); } }
public AzureDataStore() { client = new HttpClient(); client.BaseAddress = new Uri($"{App.AzureBackendUrl}/"); //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //client.DefaultRequestHeaders.Accept.Clear(); //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); richieste = new List <Richiesta>(); prestazioni = new List <Prestazione>(); richiesta = null; }
public ActionResult GetCarrello() { Richiesta r = Deserialize <Richiesta>(); Dictionary <ElementoCatalogo, int> res = null; if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <Dictionary <ElementoCatalogo, int> >(res))); } res = _carrelloController.GetElencoProdotti(); return(Content(Serialize <Dictionary <ElementoCatalogo, int> >(res))); }
public ActionResult RimuoviPRodotto() { Richiesta r = Deserialize <Richiesta>(); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(false))); } bool res = _carrelloController.RimuoviProdotto((ElementoCatalogo)r.Parametri[0]); return(Content(Serialize <bool>(res))); }
//IRecuperoPasswordController public ActionResult VerificaDomandaSicurezza() { Richiesta r = Deserialize <Richiesta>(); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(false))); } bool res = _recuperoPasswordController.VerificaDomandaSicurezza((String)r.Parametri[0], (String)r.Parametri[1]); return(Content(Serialize <bool>(res))); }
//IGestioneSpesaController public ActionResult GetSaldo() { Richiesta r = Deserialize <Richiesta>(); float res = -1; if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <float>(res))); } res = _gestioneSpesaController.GetSaldo((Carrello)r.Parametri[0]); return(Content(Serialize <float>(res))); }
private void loginButton_Click(object sender, EventArgs e) { Object[] parametri = new Object[2]; parametri[0] = Username.Text; parametri[1] = Password.Text; Richiesta r = new Richiesta("HomeProfilo", "Login", "VerificaCredenziali", parametri); _utente = Task.Run(() => FiltroRichieste.GestisciRichiesta <Utente>(r)).Result; HomeSpesa hs = new HomeSpesa(_utente); hs.Show(); this.Hide(); }
//ISelezioneMarket public ActionResult GetElencoSupermarker() { Richiesta r = Deserialize <Richiesta>(); List <Supermarket> res = null; if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <List <Supermarket> >(res))); } res = _selezioneMarketController.GetElencoSupermarket(); _utente = (Utente)r.Parametri[0]; return(Content(Serialize <List <Supermarket> >(res))); }
public ActionResult GetUtente() { Richiesta r = Deserialize <Richiesta>(); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); Utente u = null; return(Content(Serialize <Utente>(u))); } Utente res = _gestioneProfiloController.GetUtente(); return(Content(Serialize <Utente>(res))); }
//IVerificaConferma public ActionResult TerminaSpesa() { Richiesta r = Deserialize <Richiesta>(); _verificaConfermaController = new VerificaConfermaController(_carrello, _utente, _session); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(false))); } bool res = _verificaConfermaController.TerminaSpesa((Indirizzo)r.Parametri[0]); GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(res))); }
static void Main(string[] args) { //List<Regola> regole = LeggiRegole(); List <Regola> regole = new List <Regola>(); foreach (string r in rr) { regole.Add(new Regola(r)); } Richiesta richiesta = LeggiRichiesta(); Calcolatore c = new Calcolatore(regole, richiesta); c.Risolvi(); }
//IGestionePofiloController public ActionResult ModificaDati() { Richiesta r = Deserialize <Richiesta>(); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(false))); } bool res = _gestioneProfiloController.ModificaDati((String)r.Parametri[0], (String)r.Parametri[1], (DateTime)r.Parametri[2], (Indirizzo)r.Parametri[3], (String)r.Parametri[4], (String)r.Parametri[5], (String)r.Parametri[6], (String)r.Parametri[7]); return(Content(Serialize <bool>(res))); }
//IStroicoController public ActionResult ElencoOrdini() { Richiesta r = Deserialize <Richiesta>(); _storicoController = new StoricoController(_utente, _session); List <ShoppyHomeServer.Models.Model.Profilo.Spesa> res = null; if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <List <ShoppyHomeServer.Models.Model.Profilo.Spesa> >(res))); } res = _storicoController.ElencoOrdini(); return(Content(Serialize <List <ShoppyHomeServer.Models.Model.Profilo.Spesa> >(res))); }
//IRegistrazioneController public ActionResult RegistraUtente() { Richiesta r = Deserialize <Richiesta>(); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <bool>(false))); } bool res = _registrazioneController.RegistraUtente((String)r.Parametri[0], (String)r.Parametri[1], (DateTime)r.Parametri[2], (Indirizzo)r.Parametri[3], (String)r.Parametri[4], (String)r.Parametri[5], (String)r.Parametri[6], (String)r.Parametri[7], (String)r.Parametri[8], (String)r.Parametri[9]); return(Content(Serialize <bool>(res))); }
public ActionResult GetCatalogo() { Richiesta r = Deserialize <Richiesta>(); _carrello = new Carrello(); _carrelloController = new CarrelloController(_carrello, _session); _catalogoController = new CatalogoController(_carrello, _session); Catalogo res = null; if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); return(Content(Serialize <Catalogo>(res))); } res = _catalogoController.GetCatalogo((Supermarket)r.Parametri[0]); return(Content(Serialize <Catalogo>(res))); }
private void Modifica_Click(object sender, EventArgs e) { Object[] arguments = new Object[11]; arguments[0] = BoxNomeModifica.Text; arguments[1] = BoxCognomeModifica.Text; arguments[2] = BoxDataModifica.Value; Int32.TryParse(BoxCivicoModifica.Text, out int n); int numeroCivico = n; arguments[3] = new Indirizzo(BoxProvinciaModifica.Text, BoxCittàModifica.Text, BoxViaModifica.Text, n); arguments[4] = BoxEmailModifica.Text; arguments[5] = BoxtelefonoModifica.Text; arguments[6] = BoxUsernameModifica.Text; arguments[7] = BoxPasswordModifica.Text; Richiesta r = new Richiesta("HomeProfilo", "Profilo", "ModificaDati", arguments); }
private void RichiediRecupero_Click(object sender, EventArgs e) { Object[] arguments = new object[2]; arguments[0] = RispostaRecupero.Text; arguments[1] = TextUsername.Text; Richiesta r = new Richiesta("HomeProfilo", "RecuperoPassword", "VerificaDomandaSicurezza", arguments); Boolean recupero = Task.Run(() => FiltroRichieste.GestisciRichiesta <Boolean>(r)).Result; if (recupero == true) { _login.Show(); } else { MessageBox.Show("Recupero Password non riuscito"); } }
public bool UpdateRichiestaAsync(Richiesta richiesta) { bool esito = false; try { if (!string.IsNullOrEmpty(loginToken)) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", loginToken); var response = client.PutAsync(@"/api/Richieste", new StringContent(JsonConvert.SerializeObject(richiesta), System.Text.Encoding.UTF8, "application/json")).Result; if (response.IsSuccessStatusCode) { esito = true; } } } catch (Exception e) { throw new Exception(e.Message, e.InnerException); } return(esito); }
public bool AddRichiestaAsync(Richiesta richiesta) { bool esito = false; try { if (!string.IsNullOrEmpty(loginToken)) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", loginToken); RichiestaSend richiestaJson = new RichiestaSend() { Id = richiesta.Id.ToString(), IdRichiedente = richiesta.IdRichiedente.ToString(), IdTipologia = richiesta.IdTipologia.ToString(), NumeroFattura = richiesta.NumeroFattura, Note = richiesta.Note, ImportoACarico = richiesta.ImportoACarico.ToString(), ImportoDaRimborsare = richiesta.ImportoDaRimborsare.ToString(), ImportoFattura = richiesta.ImportoFattura.ToString(), ImportoRimborsatoDaTerzi = richiesta.ImportoRimborsatoDaTerzi.ToString(), DataCancellazione = richiesta.DataCancellazione, DataConferma = richiesta.DataConferma, DataFattura = richiesta.DataFattura, DataRichiesta = richiesta.DataRichiesta }; var response = client.PostAsync(@"/api/Richieste", new StringContent(JsonConvert.SerializeObject(richiestaJson), System.Text.Encoding.UTF8, "application/json")).Result; if (response.IsSuccessStatusCode) { esito = true; } } } catch (Exception e) { throw new Exception(e.Message, e.InnerException); } return(esito); }
//ILogin public ActionResult VerificaCredenziali() { Richiesta r = Deserialize <Richiesta>(); Utente res = _loginController.VerificaCredenziali((String)r.Parametri[0], (String)r.Parametri[1]); if (!GestoreSessione.GetGestoreSessione().VerificaSessione(r.Mittente)) { DateTime scadenza = DateTime.Now; scadenza.AddHours(5); Sessione s = new Sessione("Cliente", DateTime.Now, scadenza, r.Mittente); GestoreSessione.GetGestoreSessione().CreaSessione(s); } else { DateTime scadenza = DateTime.Now; scadenza.AddHours(5); Sessione s = new Sessione("Cliente", DateTime.Now, scadenza, r.Mittente); GestoreSessione.GetGestoreSessione().EliminaSessione(r.Mittente); GestoreSessione.GetGestoreSessione().CreaSessione(s); } _utente = res; _gestioneProfiloController = new GestioneProfiloController(_utente, _session); return(Content(Serialize <Utente>(res))); }
public async Task <bool> ValorizzaConfirm(List <Names> names, Guid guidUser) { ROLServiceSoapClient service = new ROLServiceSoapClient(); service = getNewServiceRol(guidUser); Richiesta[] Richiesta = new Richiesta[names.Count]; int y = 0; foreach (var n in names) { Richiesta r = new Richiesta(); r.GuidUtente = n.guidUser; r.IDRichiesta = n.requestId; Richiesta[y] = r; y++; } Thread.Sleep(15000); var v = await service.ValorizzaAsync(Richiesta); int i = 0; if (v.ValorizzaResult.CEResult.Type != "I") { do { Thread.Sleep(5000); v = await service.ValorizzaAsync(Richiesta); i++; } while (v.ValorizzaResult.CEResult.Type != "I" && i < 50); } if (v.ValorizzaResult.CEResult.Type != "I") { foreach (var n in names) { var nn = _context.Names.SingleOrDefault(a => a.requestId == n.requestId); nn.requestId = null; _context.SaveChanges(); } return(false); } var ServizioEnquiryResponse = v.ValorizzaResult.ServizioEnquiryResponse.ToList(); var conferma = await service.PreConfermaAsync(Richiesta, true); int z = 0; foreach (var s in ServizioEnquiryResponse) { var n = _context.Names.SingleOrDefault(a => a.requestId == s.Richiesta.IDRichiesta); if (s.StatoLavorazione.Descrizione.ToLower() == "prezzato") { var p = new Prices() { price = Convert.ToDecimal(s.Totale.ImportoNetto), vatPrice = Convert.ToDecimal(s.Totale.ImportoIva), totalPrice = Convert.ToDecimal(s.Totale.ImportoTotale) }; if (conferma.PreConfermaResult.DestinatariRaccomandata[z] != null) { n.guidUser = s.Richiesta.GuidUtente; n.orderId = conferma.PreConfermaResult.IdOrdine; n.price = Convert.ToDecimal(s.Totale.ImportoNetto); n.vatPrice = Convert.ToDecimal(s.Totale.ImportoIva); n.totalPrice = Convert.ToDecimal(s.Totale.ImportoTotale); n.currentState = (int)currentState.PresoInCarico; n.codice = conferma.PreConfermaResult.DestinatariRaccomandata[z].NumeroRaccomandata; } else { n.valid = false; n.stato = "Errore nella conferma dell'invio"; } } else { n.valid = false; n.stato = "Errore nella conferma dell'invio"; } _context.SaveChanges(); z++; } return(true); }
public Calcolatore(List <Regola> regole, Richiesta richiesta) { Regole = regole; Risposta = richiesta; }