|
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DocumentIDReader
{
static class Program
{
public const int STRINGDATA_DOCUMENTID = 100;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public static void DisplayDocumentID(string documentName)
{
bool documentIDExists = false;
FileOperation fileOperation=new FileOperation();
string DocumentID=String.Empty;
documentIDExists = fileOperation.ReadData(documentName, STRINGDATA_DOCUMENTID, ref DocumentID, 256);
if (documentIDExists)
{
// MessageBox.Show("DocumentID Found ! \n ____________________________________________\n\n" + "ID : " + DocumentID, "Found", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show(DocumentID);
}
else
{
// MessageBox.Show("DocumentID Not Found !! " + DocumentID, "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("DocumentID not found");
}
}
public static void AddDocumentID(string documentName)
{
Boolean success = false;
FileOperation fileOperation = new FileOperation();
string DocumentID = Guid.NewGuid().ToString();
success = fileOperation.AddData(documentName, STRINGDATA_DOCUMENTID, DocumentID);
if (success==true)
MessageBox.Show("DocumentID added ");
//MessageBox.Show("DocumentID added ! \n ____________________________________________\n\n" + "ID : " +DocumentID,"success",MessageBoxButtons.OK,MessageBoxIcon.Information);
else
MessageBox.Show("Failed");
//MessageBox.Show("Failed", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.