Wednesday, 26 August 2015

Insert the data/password by using Cryptography (Encryption/Decryption)


  • Always store password using reversible encryption so as the encrypted password can also be decrypted when need to be used.
  • But at the same time it is also important to use the strong encryption algorithm.
  • Here I'll demonstrate you one of the method for encrypting the data and storing them into database. And Vice-versa.

  • Two Class file one is DBAccess where all database stuffs are done and another EncDecClass file for encrypting and decrypting the data.


  • This code shows the button click event for storing the encrypted password into database. It calls "Encrypt" method of Class file for encrypting the password.

  • Before encryption you should generate a key which is as shown below.


  • Now let us see how Encrypt method works:
  • And in the same way for decryption. We'll call decrypt method from codebehind file for decryption of password .
  • This code shows the button click event for retrieving the encrypted password into database. It calls "Decrypt" method of Class file for decrypting  the password.

  • Now let use see how the decryption works.


  • And yes this is it.  Here your password get decrypted.
  • For more information leave comments please.
  • And let me know the difficulties you are facing I'll definitely try to sort it out if I had gone through it.
  • Good Luck!

Update the records from DataGrid in WPF

  • In the previous post I've posted that how to delete the record from datagrid using Stored Procedure in WPF.
  •  In this  post we would see how to update the records from datagrid in WPF.
  1. XAML Code:




2. Code Behind :



  • This is it.  It's done your record will be updated. Enjoy. For any query please comment me.
  •  Here framework element is used to get the data from current cell of row.




Tuesday, 18 August 2015

Delete in WPF Data Grid (Simple Stuff no more code) C#


  • Yes it's really not much confusing as we understand to delete or update the data in datagrid in wpf. Actually while googling i too got much confused why are all using Linq to Sql class or EF for such an easy thing.
  • I thought this code to post because some of the person asked me that is there not any simple way to delete the record from data grid rather than using Linq to Sql Class and EF.
  • Yes you can also do it with stored procedure or either simply firing normal query it's upto you.
  • I will show you one simple way to achieve with stored procedure.
  1. XAML Code:




2. Code Behind :


 

  • This is it.  It's done your record will be deleted. Enjoy. For any query please comment me.
P.S. This code is just for deleting the record.


How To Pass An Array As A Parameter While Calling an ASP.NET Web API C#

Please visit my C# Corner Blog for this, where I have provided better efforts to make this concept more understandable - www.c-sharpcorner....