Advertisement
l-kikov

Random Generator

Feb 29th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. /*Random generator*/
  2. http://www.codeproject.com/Articles/14403/Generating-Unique-Keys-in-Net
  3.  
  4. update history=>>>>>
  5.  
  6.     protected Boolean UpdateLoginsHistory()
  7.         {
  8.             Int32 i32RetVal = 0;
  9.  
  10.             try
  11.             {
  12.                 SQLDatabase DBConnection = new SQLDatabase(ConfigurationManager.ConnectionStrings["dbConnectionString"].ToString());
  13.                 if( DBConnection == null )
  14.                     throw new NullReferenceException();
  15.  
  16.                 DBConnection.Connect();
  17.  
  18.                 LoginDB Function = new LoginDB( DBConnection );
  19.                 if( Function == null )
  20.                     throw new NullReferenceException();
  21.  
  22.                 //Function.UpdateLoginsHistory( Context.User.Identity.Name, Context.User.Identity.Name, ref i32RetVal );
  23.                
  24.                 Function.UpdateLoginsHistory( Session["LoginUserName"].ToString(), Session["LoginUserName"].ToString(), ref i32RetVal );
  25.                 if( i32RetVal < 0 )
  26.                     return false;
  27.                                                                                
  28.                 DBConnection.Disconnect(); 
  29.             }
  30.             catch( SQLException Ex )
  31.             {
  32.                 ERP.Global.ErrorMessage( Ex, Context );
  33.                 return false;
  34.             }
  35.             catch( NullReferenceException Ex )
  36.             {
  37.                 ERP.Global.ErrorMessage( Ex, Context );
  38.                 return false;
  39.             }
  40.  
  41.  
  42.             return true;
  43.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement