private void Load(encryptBaseEntities db) { listView.ItemsSource = db.client.ToList(); classa = new Class1(); List <ClientWallet> CLientList = new List <ClientWallet>(); foreach (var item in db.client) { //item.firstname = classa.cesarEncrypt(item.firstname, 2); ClientWallet clientWallet1 = new ClientWallet(); clientWallet1.id_client = item.id_client; clientWallet1.firstname = classa.cesarEncrypt(item.firstname, numberCode); CLientList.Add(clientWallet1); } cmb_Klient.ItemsSource = CLientList.ToList(); var linqWalletClient = from x in db.client join w in db.wallet on x.id_client equals w.id_client select new ClientWallet { id_client = x.id_client, firstname = x.firstname, surname = x.surname, Login_Name_Unique = x.Login_Name_Unique, Password_text = x.Password_text, Name_wallet = w.Name_wallet, description_Wallet = w.description_Wallet }; List <ClientWallet> CLientList2 = new List <ClientWallet>(); foreach (var item in linqWalletClient) { //item.firstname = classa.cesarEncrypt(item.firstname, 2); ClientWallet clientWallet2 = new ClientWallet(); clientWallet2.id_client = item.id_client; clientWallet2.firstname = classa.cesarEncrypt(item.firstname, numberCode); clientWallet2.surname = classa.cesarEncrypt(item.surname, numberCode); clientWallet2.Login_Name_Unique = classa.cesarEncrypt(item.Login_Name_Unique, numberCode); clientWallet2.Password_text = classa.cesarEncrypt(item.Password_text, numberCode); clientWallet2.Name_wallet = classa.cesarEncrypt(item.Name_wallet, numberCode); clientWallet2.description_Wallet = classa.cesarEncrypt(item.description_Wallet, numberCode); CLientList2.Add(clientWallet2); } listView_CLientWallet.ItemsSource = CLientList2.ToList(); }
public ClientEncrypt(encryptBaseEntities db, client client1, string code, int numberCode) { InitializeComponent(); this.db = db; this.client1 = client1; this.numberCode = numberCode; Class1 classa = new Class1(); try { int number = int.Parse(code.ToString()); txt_firstName.Text = classa.cesarEncrypt(client1.firstname.ToString(), number); txt_Name.Text = classa.cesarEncrypt(client1.surname.ToString(), number); txt_Login.Text = classa.cesarEncrypt(client1.Login_Name_Unique.ToString(), number); txt_Pass.Text = classa.cesarEncrypt(client1.Password_text.ToString(), number); List <ClientWallet> CLientList2 = new List <ClientWallet>(); foreach (var x in db.client) { ClientWallet clientWallet2 = new ClientWallet(); clientWallet2.id_client = x.id_client; clientWallet2.firstname = classa.cesarEncrypt(x.firstname, numberCode); clientWallet2.surname = classa.cesarEncrypt(x.surname, numberCode); clientWallet2.Login_Name_Unique = classa.cesarEncrypt(x.Login_Name_Unique, numberCode); clientWallet2.Password_text = classa.cesarEncrypt(x.Password_text, numberCode); CLientList2.Add(clientWallet2); } listView.ItemsSource = CLientList2; }catch (FormatException) { MessageBox.Show("Zły format"); }catch (Exception f) { MessageBox.Show(f.Message); } }