private void btn_Save_Click(object sender, EventArgs e) { this.sRecord.dRecord.Rating = (int)this.RatingCtrl.Value; this.sRecord.dRecord.Classification = this.cboClass.Text; this.sRecord.dRecord.Security = AccountSecurity.GetByString(this.cboSecurity.Text); this.sRecord.IsDescUpdate = false; if (!this.sRecord.dRecord.ShortDesc.Equals(this.txtShortDesc.Text)) { this.sRecord.IsDescUpdate = true; } this.sRecord.dRecord.ShortDesc = this.txtShortDesc.Text; this.sRecord.dRecord.SetName = this.txtSetID.Text; this.sRecord.dRecord.CADNumber = (this.txtCAD.Text); this.sRecord.dRecord.RMSNumber = (this.txtRMS.Text); this.sRecord.dRecord.IsIndefinite = this.chk_PSIsIndefinite.Checked; this.sRecord.dRecord.IsEvidence = this.chk_PSEvidence.Checked; base.DialogResult = DialogResult.OK; base.Close(); }
private void LogScan() { string str = Path.Combine(this.FilePath, this.DocName); FileInfo fileInfo = new FileInfo(str); using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { DataFile dataFile = new DataFile() { AccountId = this.AccountID, Classification = "Unclassified", FileAddedTimestamp = new DateTime?(DateTime.Now), FileExtension = ".PDF", FileExtension2 = "" }; HashAlgorithm sHA1 = HashAlgorithms.SHA1; switch (Global.DefaultHashAlgorithm) { case HASH_ALGORITHM.MD5: { sHA1 = HashAlgorithms.MD5; break; } case HASH_ALGORITHM.SHA1: { sHA1 = HashAlgorithms.SHA1; break; } case HASH_ALGORITHM.SHA256: { sHA1 = HashAlgorithms.SHA256; break; } case HASH_ALGORITHM.SHA384: { sHA1 = HashAlgorithms.SHA384; break; } case HASH_ALGORITHM.SHA512: { sHA1 = HashAlgorithms.SHA512; break; } case HASH_ALGORITHM.RIPEMD160: { sHA1 = HashAlgorithms.RIPEMD160; break; } } dataFile.FileHashCode = Hash.GetHashFromFile(str, sHA1); dataFile.FileSize = fileInfo.Length; dataFile.FileTimestamp = new DateTime?(fileInfo.LastWriteTime); dataFile.GPS = ""; dataFile.IsEncrypted = new bool?(false); dataFile.IsPurged = new bool?(false); dataFile.OriginalFileName = this.DocGuid.ToString(); dataFile.PurgeFileName = ""; dataFile.Rating = 0; dataFile.Security = AccountSecurity.GetByString(this.cboSecurity.Text); dataFile.SetName = ""; dataFile.ShortDesc = this.txtTitle.Text; dataFile.StoredFileName = this.DocGuid.ToString(); dataFile.Thumbnail = Utilities.ImageToByte(this.ThumbnailImage); dataFile.TrackingID = Guid.Empty; dataFile.UNCName = this.UNC; dataFile.UNCPath = this.DataPath; string machineName = Environment.MachineName; string userName = Environment.UserName; string userDomainName = Environment.UserDomainName; dataFile.MachineName = machineName; dataFile.MachineAccount = userName; dataFile.UserDomain = userDomainName; dataFile.SourcePath = this.ScannerName; dataFile.LoginID = Global.LoginIDName; rPMDataFile.SaveUpdate(dataFile); rPMDataFile.Save(); } }