private void btn_login_Click(object sender, EventArgs e) { string username = this.txt_username.Text; string password = this.txt_password.Text; if (datamanager.LoginIsOK(username, password)) { if (datamanager.UserIsAnOwner(username)) { ContoCorrente cc = datamanager.GetContocorrenteByUsername(username); ManageCCForm manageform = new ManageCCForm(cc.GetNumeroConto()); manageform.Tag = this; manageform.Show(); this.Hide(); } else { //OpenCCForm openform = new OpenCCForm(); //openform.CurrentUser = username; OpenCCForm openform = new OpenCCForm(username); openform.Tag = this; openform.Show(); this.Hide(); } } else { this.lbl_loginerror.Text = "Invalid Credentials!"; } }
private void btn_Conferma_Click(object sender, EventArgs e) { string username = this.lbl_cliente.Text; string numconto = this.lbl_NumeroConto.Text; string nome = this.txt_nome.Text; string cognome = this.txt_cognome.Text; string codfisc = this.txt_CF.Text; ContoCorrente newCC = new ContoCorrente(numconto); Cliente newCliente = new Cliente() { Username = username, FirstName = nome, LastName = cognome, CF = codfisc, mioConto = newCC }; DataOperationResult result = dataManager.CreatenewCliente(newCliente); if (result.IsOk) { ManageCCForm manageForm = new ManageCCForm(numconto); manageForm.Tag = this; manageForm.Show(); this.Hide(); } else { this.label7.Text = result.Message; } }
public DataOperationResult CreateNewCliente(Cliente newCliente) // devo scrivere una riga nel file clienti { DataOperationResult result = new DataOperationResult(); try { System.IO.StreamWriter sw_clienti = System.IO.File.AppendText(clientiFileName); string new_cliente = newCliente.Username + ";" + newCliente.FirstName + ";" + newCliente.LastName + ";" + newCliente.CF; sw_clienti.WriteLine(new_cliente); sw_clienti.Close(); System.IO.StreamWriter sw_cc = System.IO.File.AppendText(CCFileName); // creo il conto corrente solo se ho un cliente ContoCorrente new_cc = newCliente.mioConto; string s_new_cc = new_cc.GetNumeroConto() + ";" + new_cc.GetSaldo() + ";" + newCliente.Username; sw_cc.WriteLine(s_new_cc); sw_cc.Close(); result.isOK = true; } catch (Exception excp) { result.isOK = false; result.Message = excp.Message; } return(result); }
private void Init() { try { Record2ContoCorrente = new ContoCorrente(); RecordContoCorrente = new ContoCorrente(); TwoRecordConto = new ContoCorrenteList(); AmountChangedValue = 0; SrchShares = ""; ListContoCorrente = _liquidAssetServices.GetContoCorrenteList(); CommonFieldsEnabled = true; OperazioneEnabled = true; CedoleEnabled = false; GirocontoEnabled = false; VolatiliEnabled = false; CambioValutaEnabled = false; CanUpdateDelete = false; CanInsert = false; FiltroConto = ""; FiltroGestione = ""; FiltroTipoSoldi = ""; FiltroTipoMovimento = ""; } catch (Exception err) { throw new Exception("Errore in init." + Environment.NewLine + err.Message); } }
private void btn_login_Click(object sender, EventArgs e) { //se le credenziali sono corrette ti indirizzo all'altra interfaccia grafica, //altrimenti ti dò un messaggio di errore //Per verificare le credenziali, devo creare un'altra classe string username = this.txt_User.Text; string password = this.txt_Password.Text; if (dataManager.LoginIsOK(username, password)) { if (dataManager.IsAnOwner(username)) //se è già un cliente, allora vado in ManageForm { ContoCorrente cc = dataManager.GetContoCorrenteByUsername(username); ManageCCForm manageForm = new ManageCCForm(cc.GetNumeroConto()); manageForm.Tag = this; manageForm.Show(); this.Hide(); } else //se non è cliente, quindi non ha un conto corrente, vado in OpenForm per aprirne uno { //OpenCCForm openForm = new OpenCCForm(); //openForm.CurrentUser = username; OpenCCForm openForm = new OpenCCForm(username); openForm.Tag = this; //this è il puntatore openForm.Show(); this.Hide(); } lbl_error.Text = ""; } else { this.lbl_error.Text = "Nome utente e/o password errati"; } }
/// <summary> /// Imposto is campi sopra la griglia quando viene selezionata una riga /// nell'elenco sottostante /// </summary> /// <param name="sender">Grid dei dati</param> /// <param name="e">Cambio di selezione</param> public void GridSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0) { e.Handled = true; } else if (e.AddedItems[0] is ContoCorrente CC) { RecordContoCorrente = CC; if (CC.Id_tipo_movimento == (int)TipologiaMovimento.Cedola || CC.Id_tipo_movimento == (int)TipologiaMovimento.InsertVolatili || CC.Id_tipo_movimento == (int)TipologiaMovimento.Costi) { CommonFieldsEnabled = CC.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto ? true : false; OperazioneEnabled = false; CedoleEnabled = CC.Id_tipo_movimento == (int)TipologiaMovimento.Cedola ? true : false; VolatiliEnabled = CC.Id_tipo_movimento == (int)TipologiaMovimento.InsertVolatili ? true : false; CambioValutaEnabled = false; CanUpdateDelete = true; } else if (CC.Id_Quote_Investimenti == 0 & (CC.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto || CC.Id_tipo_movimento == (int)TipologiaMovimento.CambioValuta)) { // cerco il record corrispondente al giroconto o al cambio valuta utilizzando il campo // modified (e poi aggiorno il campo stesso per entrambi - forse non serve) TwoRecordConto = _liquidAssetServices.Get2ContoCorrentes(CC.Modified); // RecordContoCorrente è quello attivo in modifica quindi imposto il record derivato Record2ContoCorrente = TwoRecordConto[0].Id_RowConto == RecordContoCorrente.Id_RowConto ? TwoRecordConto[1] : TwoRecordConto[0]; CommonFieldsEnabled = CC.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto ? true : false; GirocontoEnabled = CC.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto ? true : false;; OperazioneEnabled = false; CanUpdateDelete = true; } else if (CC.Id_Quote_Investimenti > 0 & CC.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto) { MessageBox.Show("Questo giroconto è stato gestito da `Quote investitori`" + Environment.NewLine + "Qua puoi solo vederlo, se vuoi modificarlo devi andare in `Quote investitori`.", "Gestione Conto Corrente", MessageBoxButton.OK, MessageBoxImage.Information); GirocontoEnabled = false; CedoleEnabled = false; VolatiliEnabled = false; CambioValutaEnabled = false; CommonFieldsEnabled = false; CanUpdateDelete = false; OperazioneEnabled = false; } else { RecordContoCorrente = new ContoCorrente(); GirocontoEnabled = false; CedoleEnabled = false; VolatiliEnabled = false; CambioValutaEnabled = false; CommonFieldsEnabled = false; CanUpdateDelete = false; OperazioneEnabled = false; } CanInsert = false; e.Handled = true; } }
public IHttpActionResult CreateAccount(int id, ContoCorrente account) { Client cli = lst.Where(c => c.IDClient == id).FirstOrDefault(); cli.Conto = account; Persist(); return(Ok(cli)); }
/// <summary> /// ha il caricamento del dialogo, viene generato l'evento load che utilizzo per inizializzare le componenti del dialogo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StatoCC_Load(object sender, EventArgs e) { // trovo tramite iban il conto corrente su cui voglio effettuare la visualizzazione dello stato // come già scritto in altri commenti iban è selezionato da una listview per cui non può essere sbagliato cc = banca.Get(iban); // visualizzo il saldo del conto corrente lblSaldo.Text = cc.Saldo().ToString(); // aggiorno l'elenco aggiornaElencoCC(); }
public ManageCCForm(ContoCorrente cc, string numconto, double saldo, string sender) { InitializeComponent(); conto = numconto; this.lbl_CC.Text = numconto; // passo il numero di conto this.lbl_saldo.Text = saldo.ToString(); start_form = sender; contocorrente = cc; datamanager1 = new FileSystemDataManager(); //this.txt_movimenti.Text = string.Join("\r\n", contocorrente.ShowMovimenti()); }
private void BtnCreaCC_Click(object sender, EventArgs e) { var nome = txtNome.Text; var cognome = txtCognome.Text; var dataNascita = dtpDataNascita.Value; var email = txtEmail.Text; var indirizzo = txtIndirizzo.Text; var creditoIniziale = txtCreditoIniziale.Text; // controllo che le credenziali siano valide if (nome.Length > 0 && cognome.Length > 0) { ContoCorrente cc = null; // controllo il tipo di conto corrente che si vuole creare if (cbContoCorrenteOnline.Checked) { // creo il conto corrente con un valore iniziale di saldo uguale a 0 cc = new ContoCorrenteOnline(ParametriApplicazione.maxPrelievoOnline, 0, ParametriApplicazione.maxMovimenti); } else { // creo il conto corrente con un valore iniziale di saldo uguale a 0 cc = new ContoCorrente(0, ParametriApplicazione.maxMovimenti); } // creo dati anagrafici del soggetto Intestatario soggetto = new Intestatario(string.Format("{0} {1}", cognome, nome), dataNascita, indirizzo, email); // assegno i dati anagrafici al conto corrente cc.SetIntestatario(soggetto); // aggiunge alla banca il conto corrente banca.Add(cc); // se il credito iniziale è maggiore di 0, allora effettuo un versamento con il valore del credito iniziale if (Convert.ToDouble(creditoIniziale) > 0) { // effettuo il versamento del credito iniziale cc.Versamento(Convert.ToDouble(creditoIniziale)); } // esco dal dialogo assegnando il result ad ok DialogResult = DialogResult.OK; Close(); } else { MessageBox.Show("Il campo Nome e Cognome sono obbligatori."); } }
private void btn_conferma_Click(object sender, EventArgs e) { string numconto = this.label3.Text; string username = this.lbl_owner.Text; string nome = this.txt_nome.Text; string cognome = this.txt_cognome.Text; string CF = this.txt_CF.Text; ContoCorrente newCC = new ContoCorrente(numconto, 0); // creo una nuova entità conto corrente Cliente newCliente = new Cliente() // creo una nuova entità cliente, a cui però devo pasare un oggetto conto corrente { Username = username, FirstName = nome, LastName = cognome, CF = CF, mioConto = newCC }; //ora devo creare un'entità cliente e una conto corrente DataOperationResult result = datamanager.CreateNewCliente(newCliente); // ora scrivo i dati usando datamanager if (result.isOK) { ManageCCForm manageform = new ManageCCForm(newCC, numconto, newCC.GetSaldo(), "OpenCC"); manageform.Tag = this; // this è open ccform manageform.Show(); this.Hide(); } else { this.label7.Text = "L'operazione non è andata a buon fine, riprovare"; } //ManageCCForm manageform = new ManageCCForm(); //manageform.Show(); //this.Hide(); //manageform.Tag = this; //manageform.Show(this); //this.Hide(); }
/// <summary> /// ha il caricamento del dialogo, viene generato l'evento load che utilizzo per inizializzare le componenti del dialogo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListaVersamentiCC_Load(object sender, EventArgs e) { // trovo tramite iban il conto corrente su cui voglio effettuare la visualizzazione dello stato // come già scritto in altri commenti iban è selezionato da una listview per cui non può essere sbagliato cc = banca.Get(iban); // visualizzo il saldo del conto corrente lblSaldo.Text = cc.Saldo().ToString(); // prende l'elenco dei movimenti del CC raggruppati per data elencoPerData = cc.GetMovimentiPerData(); // ciclo l'elenco e prende la chiave del dictionary che corrisponde alla data del movimento/i foreach (var item in elencoPerData) { // aggiunge la data alla comboBox di visualizzazione cbDateMovimenti.Items.Add(item.Key); } }
private void button1_Click(object sender, EventArgs e) //bottone login { // se credenziali corrette vado all'altra form, altrimenti errore string username = this.textBox1.Text; string password = this.textBox2.Text; if (datamanager.LoginIsOK(username, password)) { if (datamanager.UserIsAnOwner(username)) { //// devo trovare il contocorrente per poter aprire manage form ContoCorrente cc = datamanager.GetContoCorrenteByUsername(username); ManageCCForm manageform = new ManageCCForm(cc, cc.GetNumeroConto(), cc.GetSaldo(), "Login"); manageform.Show(); manageform.Tag = this; manageform.Show(); this.Hide(); } else // apro open cc quando user non è un owner { lbl_login_error.Text = ""; OpenCCForm openform = new OpenCCForm(username); // Form1 crea gli altri 2 form a seconda //openform.Show(); //this.Hide(); // devo passare il nome del cliente ( nel costruttore) openform.Tag = this; // proprietà tag di operform (suo padre è il login form) openform.Show(); //this è un puntatore this.Hide(); } } else { lbl_login_error.Text = "Invalid credentials"; } }
/// <summary> /// /// </summary> /// <param name="newCliente"></param> /// <returns></returns> public DataOperationResult CreateNewCliente(Cliente newCliente) { DataOperationResult result = new DataOperationResult(); // Write a row in Clienti.txt try { // comment .... https://stackoverflow.com/a/21795858 using (System.IO.StreamWriter sw_clienti = File.AppendText(clientiFileName)) { string s_new_cliente = newCliente.Username + ";" + newCliente.FirstName + ";" + newCliente.LastName + ";" + newCliente.CF; sw_clienti.WriteLine(s_new_cliente); sw_clienti.Close(); } using (System.IO.StreamWriter sw_cc = File.AppendText(ccFileName)) { ContoCorrente new_cc = newCliente.mioConto; string s_new_cc = new_cc.GetNumeroConto() + ";" + new_cc.GetSaldo() + ";" + newCliente.Username; sw_cc.WriteLine(s_new_cc); sw_cc.Close(); } result.IsOK = true; } catch (Exception excp) { result.IsOK = false; result.Message = excp.Message; } return(result); }
private void btn_conferma_Click(object sender, EventArgs e) { string numconto = this.lbl_numeroconto.Text; string username = this.lbl_cliente.Text; string nome = this.txt_nome.Text; string cognome = this.txt_cognome.Text; string cf = this.txt_cf.Text; ContoCorrente newcc = new ContoCorrente(numconto); Cliente newclient = new Cliente() { Username = username, FirstName = nome, LastName = cognome, CF = cf, mioConto = newcc }; //datamanager.CreateNewContoCorrente(newcc); DataOperationResult result = datamanager.CreateNewCliente(newclient); //le entity che vengono create, si salvano nei supporti dati tramite il DataManager //Il dialogo tra le parti avviene tramite entities che sono distaccate dal DataManager if (result.IsOk) { //FormLogin formlogin = (FormLogin)Tag; //formlogin.Close(); FormManageCC manageform = new FormManageCC(numconto); manageform.Tag = this; manageform.Show(); this.Hide(); } else { this.lbl_error.Text = result.Message; } }
public async Task<ActionResult> OpenAccount(int id, ContoCorrente account) { var api_url = "api/createaccount?id=" + id; var model = new Client(); String jsonAccount = JsonConvert.SerializeObject(account); var httpContent = new StringContent(jsonAccount, Encoding.UTF8, "application/json"); HttpResponseMessage egsResponse = await client.PostAsync(api_url, httpContent); if (egsResponse.IsSuccessStatusCode) { string content = await egsResponse.Content.ReadAsStringAsync(); // get the paging info from the header var client = JsonConvert.DeserializeObject<Client>(content); model = client; } else { return Content("An error occurred."); } return RedirectToAction("Detail", new { id = id }); }
public DataOperationResult CreatenewCliente(Cliente newCliente) { DataOperationResult result = new DataOperationResult(); //scrivere una riga in Clienti.txt try { using ( System.IO.StreamWriter sw_clienti = File.AppendText(clientiFilename)) { string s_new_cliente = newCliente.Username + ";" + newCliente.FirstName + ";" + newCliente.LastName + ";" + newCliente.CF; sw_clienti.WriteLine(s_new_cliente); sw_clienti.Close(); } using (System.IO.StreamWriter sw_cc = File.AppendText(CCFilename)) { ContoCorrente newCC = newCliente.mioConto; string s_newcc = newCC.GetNumeroConto() + ";" + newCC.GetSaldo() + ";" + newCliente.Username; sw_cc.WriteLine(s_newcc); sw_cc.Close(); } result.IsOk = true; } catch (Exception excp) { result.IsOk = false; result.Message = excp.Message; } return(result); }
private void btn_login_Click(object sender, EventArgs e) { //chiudo una form e ne apro un'altra //bisogna controllare se l'username è 'registrato' e che username e password sono corretti. //qui siamo su un'interfaccia grafica, quindi non è competenza di questo codice decidere se username e pw sono corretti. //per verificare le credenziali dovrò leggere su un qualche supporto //qui: se le credenziali sono corrette indirizzo nella form successiva, //altrimenti plotto qualcosa nella label login_error string username = this.txt_username.Text; string password = this.txt_password.Text; if (datamanager.LoginIsOk(username, password)) { if (!datamanager.ThereIsCC(username)) { FormOpenCC openform = new FormOpenCC(username); openform.Tag = this; openform.Show(); this.Hide(); //così apro l'altra form e chiudo la mia. } else { ContoCorrente cc = datamanager.GetContoCorrenteByUsername(username); FormManageCC manageform = new FormManageCC(cc.GetNumeroConto()); manageform.Tag = this; manageform.Show(); this.Hide(); } } else { this.login_error.Text = "Non sei registrato!"; } }
private void UpdateCollection() { try { QuotePerPeriodoList ListQuoteGuadagnoOriginale = _managerLiquidServices.GetAllRecordQuote_Guadagno(); ListQuoteGuadagno.Clear(); foreach (QuotePerPeriodo quotePerPeriodo in ListQuoteGuadagnoOriginale) { if (quotePerPeriodo.Id_Tipo_Soldi == 16) { ListQuoteGuadagno.Add(quotePerPeriodo); } } ContoCorrenteSelected = new ContoCorrente(); ActualQuote = new QuoteTab(); ValoreInEuro = 0; RecordQuoteGuadagno = new GuadagnoPerQuote(); Causale = ""; ListQuoteInv = _managerLiquidServices.GetQuoteInv(); ListTabQuote = _managerLiquidServices.GetQuoteTab(); ListQuoteDettaglioGuadagno = _managerLiquidServices.GetQuoteGuadagno(2); ListQuoteSintesiGuadagno = _managerLiquidServices.GetQuoteGuadagno(1); ListQuoteSuperSintesiGuadagno = _managerLiquidServices.GetQuoteGuadagno(0); ListLocation = _registryServices.GetRegistryLocationList(); ListTipoSoldi = _registryServices.GetTipoSoldiList(); ListValutePrelievo = _registryServices.GetRegistryCurrencyList(); ListValuteVersGiro = _registryServices.GetRegistryCurrencyList(); } catch (Exception err) { MessageBox.Show("Errore nella richiesta dei dati." + Environment.NewLine + err.Message, "DAF-C Quote Investitori"); } }
public ContoCorrente GetContocorrenteByUsername(string username) { ContoCorrente cc_result = null; using (System.IO.StreamReader file = new System.IO.StreamReader(ccFileName)) { string line; char[] chararray = new char[1]; // se scrivessi char[] ca starei dichiarando un puntatore vuoto chararray[0] = ';'; while (!String.IsNullOrEmpty(line = file.ReadLine())) // quella tra paresntesi si chiama guardia ed e' un espressione booleana { String[] resultArray = line.Split(chararray); string current_user = resultArray[2]; if (username == current_user) { cc_result = new ContoCorrente(resultArray[0]); break; } } file.Close(); } return(cc_result); }
private void Bonifico_Load(object sender, EventArgs e) { cc = banca.Get(iban); aggiornaElencoCC(); }