public WorkEntry(DateTime startTime, TimeSpan timeWorked, string notes, ClientTrackerUser user, TypesOfWork typeOfWork)
 {
     User = user;
     TypeOfWorkDone = typeOfWork;
     StartTime = startTime;
     TimeWorked = timeWorked;
     Notes = notes;
 }
 public WorkEntry(DateTime startTime, TimeSpan timeWorked, string notes, ClientTrackerUser user)
     : this(startTime, timeWorked, notes, user, TypesOfWork.NOTSPECIFIED)
 {
 }
Exemplo n.º 3
0
 public void SetUser(ClientTrackerUser user)
 {
     User = user;
 }
 public void AddWorkEntry(WorkEntry workEntry, ClientTrackerUser user)
 {
     AllWorkDone.Add(workEntry);
 }
Exemplo n.º 5
0
        private void CheckLicense()
        {
            string licenseFile = string.Empty;
            using (StreamReader sr = new StreamReader("cmlic"))
            {
                licenseFile = sr.ReadToEnd();
            }

            string passPhrase = "@0aWYM#%";        // can be any string
            string saltValue = "k%om*X8S";        // can be any string
            string hashAlgorithm = "SHA1";             // can be "MD5"
            int passwordIterations = 2;                  // can be any number
            string initVector = "ObIM5&0C%$R9IwLV"; // must be 16 bytes
            int keySize = 256;                // can be 192 or 128

            bool isLicenseValid = true;

            string licenseFileXML = string.Empty;
            string sig = string.Empty;
            try
            {
                string decryptedLicenseFile = SymetricEncryption.Decrypt(licenseFile,
                                                        passPhrase,
                                                        saltValue,
                                                        hashAlgorithm,
                                                        passwordIterations,
                                                        initVector,
                                                        keySize);
                string[] lines = Regex.Split(decryptedLicenseFile, "\r\n");
                sig = lines[0];
                licenseFileXML = lines[1];
            }
            catch
            {
                //error derypting.. license not valid
                isLicenseValid = false;
            }

            if (!isLicenseValid)
            {
                isLicenseValid = Encryption.DigitalSigning.VerifySignature(licenseFileXML, sig, publicKey);
            }

            if (isLicenseValid)
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(licenseFileXML);
                license = (LicenseClass)Serialization.Serializer.Deserialize(xDoc, typeof(LicenseClass));
                ClientTrackerUser user = new ClientTrackerUser(license.FirstName, license.LastName);
                clientActions1.SetUser(user);
                lbl_licensedTo.Text = "Registered to: " + license.FirstName + " " + license.LastName;
            }
            else
            {
                MessageBox.Show("Unable to validate license if you purchased this software and lost your license please contact" +
                    " the developer at [email protected] for a new one");
                //this.Close();
                //Thread.CurrentThread.Abort();
                Environment.Exit(0);
            }
        }