Retrieve_Information_Class

    1| using System;
    2| using System.Collections.Generic;
    3| using System.Linq;
    4| using System.Text;
    5| 
    6| //add references
    7| using System.Security.Principal;
    8| 
    9| namespace PC_Spy_Info
  10| {
  11|     class Retrieve_Information_Class
  12|     {
  13|         //Class constructor method
  14|         public Retrieve_Information_Class()
  15|         {
  16| 
  17|         }
  18| 
  19|         // return the user's ID
  20|         public string Get_UserID()
  21|         {
  22|             string sUserID = "";
  23|             int intSub = 0;
  24| 
  25|             WindowsIdentity idObj = WindowsIdentity.GetCurrent();
  26| 
  27|             sUserID = idObj.Name;
  28| 
  29|             intSub = sUserID.LastIndexOf("\\") + 1;
  30| 
  31|              sUserID = sUserID.Substring(intSub);
  32| 
  33|             return sUserID;
  34|         }
  35| 
  36|         //Get current system date
  37|          public string Get_User_Date()
  38|         {
  39|             string sDate = "";
  40| 
  41|             sDate = DateTime.Now.ToLongDateString();
  42| 
  43|             return sDate;
  44|         }
  45| 
  46|         //Get current system time
  47|         public string Get_User_Time()
  48|         {
  49|             string sTime = "";
  50| 
  51|             sTime = DateTime.Now.ToLongTimeString();
  52| 
  53|             return sTime;
  54|         }
  55| 
  56|         //Get military time
  57| 
  58|         public string Get_Military_Time()
  59|         {
  60|             string sMilitaryTime = "";
  61| 
  62|             //Joshua Preboski method of military time
  63|             sMilitaryTime = DateTime.Now.ToString("HH.mm");
  64| 
  65|             return sMilitaryTime;
  66|         }
  67| 
  68|         //Get formatted date
  69|         public string Get_Formatted_Date()
  70|         {
  71|              string sFormatteTime = "";
  72| 
  73|             sFormatteTime = DateTime.Now.ToString("yyyy/MM/dd");
  74| 
  75|             return sFormatteTime;
  76|         }
  77| 
  78|     }//end of class
  79| }