Anonymous user
Simple database: Difference between revisions
→{{header|C#}}
Line 378:
{
//
// For appropriate use of this program
// use standard Windows Command Processor or cmd.exe
//
Line 389:
// To start cmd just double click at cmd.bat file.
//
//
//
// Console application command line start command
Line 422:
//
//
//
//
// Command line example
Line 438 ⟶ 439:
//
// Brackets and space between arguments and parameters are necessary.
//
// If not used as shown in examples, program will show error message.
//
Line 488 ⟶ 489:
// Check parameters
//
bool parameters_ok = true;▼
foreach (string a in args)▼
▲ {
if(!a.StartsWith("[") || !a.EndsWith("]"))▼
{▼
parameters_ok = !parameters_ok;▼
break;▼
}▼
}▼
//
// Minimum one parameter, category
// Add new entry to Data base document▼
//
if(
{
//▼
//▼
//▼
Console.WriteLine();
Console.WriteLine("
Console.WriteLine();
▲ }
Console.WriteLine(" Writing new entry to database..... ");▼
{
// Create new Data base entry▼
▲ bool parameters_ok = true;
//▼
args[0] = string.Empty;▼
string line = string.Empty;▼
foreach (string a in args)
{
▲ if(!a.StartsWith("[") || !a.EndsWith("]"))
line+=a;▼
▲ {
▲ parameters_ok = !parameters_ok;
▲ break;
}
}
line+="[" + DateTime.Now.ToString() + "]";▼
args[0] = "[" + DateTime.Now.ToString() + "]";▼
//
//
// ▼
StreamWriter w = new StreamWriter("Data base.txt",true);▼
w.WriteLine(line);▼
//
if(parameters_ok)
// Close and dispose stream writer▼
//
Console.WriteLine();
//▼
Console.WriteLine(" Parameters are ok..... ");
//▼
Console.WriteLine();
Console.WriteLine("
▲ //
▲ // Create new Data base entry
▲ //
▲ args[0] = string.Empty;
▲ string line = string.Empty;
▲ foreach (string a in args)
{
▲ line+=a;
}
▲ line+="[" + DateTime.Now.ToString() + "]";
▲ args[0] = "[" + DateTime.Now.ToString() + "]";
▲ //
▲ //
▲ StreamWriter w = new StreamWriter("Data base.txt",true);
▲ w.WriteLine(line);
▲ //
▲ // Close and dispose stream writer
▲ //
w.Close();
w.Dispose();
▲ //
//
//
Console.WriteLine();
Create_Print_Documents(args);
//
//
//
Console.WriteLine();
Console.WriteLine(" Add new entry command executed. ");
//
//
//
}
else
{
Console.WriteLine();
Console.WriteLine(" ! Parameters are not ok ! ");
Console.WriteLine();
Console.WriteLine(" Add new entry command is not executed. ");
Console.WriteLine();
▲ }
}
}
|