DOT NET: I need the form object and the code in dot net for the following requir
ID: 664326 • Letter: D
Question
DOT NET: I need the form object and the code in dot net for the following requirements document and the question is shown in the figure.
Application Title: Bank Reconciliation
Purpose: Student Services wants a Windows application that students can use to balance their
Check books using computers in the library.
Program Procedures:
From a window on the screen, the user is directed to enter his beginning balance and his for the month. Three types of transactions are accepted: Checks, ATM withdrawals and Deposits. Each transaction type is displayed in its own listbox. After all items have been entered, the program displays the ending balance.
Algorithms, Processing, and Conditions:
1. User enters banking information.
2. User selects transaction type from a combo box and clicks Enter Transaction button.
3. Program presents InputBox item entry window for selected item type.
4. User enters item data in InputBox window and clicks OK button on InputBox item entry window to submit item information.
5. Program validates item entry and displays it in the appropriate listbox.
6. Program displays clear error messages for each validation error.
7. Item type entry continues until user clicks Cancel on InputBox after which user may select new item type and restart Item entry by clicking Enter Transaction button.
8. Item entry continues until user clicks Compute Balance button.
9. Program displays totals and count of each transaction type and ending account balance.
10. A File menu contains a Clear Checks List, a Clear ATM List, a Clear Deposits List, a Clear All, and an Exit options. Clear options clear the designated items. The Exit option closes the application.
Notes and Restrictions:
1. The user should not be able to enter transactions until a transaction type has been selected.
2. User should not be able to change any bank info after a transaction type has been selected.
3. The user should not be able to enter transactions after the end transaction entry button (Compute Balance) has been clicked.
4. The user may exit the application without entering any transactions.
5. User should not be able to enter blank transactions.
6. User should not be able end transaction entry until at least one transaction of any type has been entered.
7. Listboxes automatically scroll for additional entries that exceed a 10 item display capacity of each listbox.
8. Validate numeric input with Try-Catch blocks.
Valid -1000 > BeginBalance < 10000
Valid 0 > Check < 5000
Valid 0 > ATM < 500
Valid 0 > Deposit < 3000
Use at least three SUB procedures and at least Three FUNCTION procedures. Pass values to at least four procedures using ByRef parameters.
Comments:
1. A splash screen is shown for 3 seconds before the main window opens.
Explanation / Answer
///<summary>
/// Enum defining log levels to use in the common logging interface
/// </summary>
public enum LogLevel
{
FATAL = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
VERBOSE =4
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DesigningWithInterfaces.LoggingInterface
{
/// <summary>
/// Defines the common logging interface specification
/// </summary>
public interface ILogger
{
/// <summary>
/// Writes a message to the log
/// </summary>
/// <param name="category">A String of the category to write to</param>
/// <param name="level">A LogLevel value of the level of this message</param>
/// <param name="message">A String of the message to write to the log</param>
void WriteMessage(string category, LogLevel level, string message);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DesigningWithInterfaces.LoggingInterface;
using log4net;
namespace DesigningWithInterfaces.Log4Net
{
/// <summary>
/// Driver class to adapts calls from ILogger to work with a log4net backend
/// </summary>
internal class Log4NetLogger : ILogger
{
public Log4NetLogger()
{
// Configures log4net by using log4net's XMLConfigurator class
log4net.Config.XmlConfigurator.Configure();
}
/// <summary>
/// Writes messages to the log4net backend.
/// </summary>
/// <remarks>
/// This method is responsible for converting the WriteMessage call of
/// the interface into something log4net can understand. It does this
/// by doing a switch/case on the log level and then calling the
/// appropriate log method
/// </remarks>
/// <param name="category">A string of the category to log to</param>
/// <param name="level">A LogLevel value of the level of the log</param>
/// <param name="message">A String of the message to write to the log</param>
public void WriteMessage(string category, LogLevel level, string message)
{
// Get the Log we are going to write this message to
ILog log = LogManager.GetLogger(category);
switch (level)
{
case LogLevel.FATAL:
if (log.IsFatalEnabled) log.Fatal(message);
break;
case LogLevel.ERROR:
if (log.IsErrorEnabled) log.Error(message);
break;
case LogLevel.WARN:
if (log.IsWarnEnabled) log.Warn(message);
break;
case LogLevel.INFO:
if (log.IsInfoEnabled) log.Info(message);
break;
case LogLevel.VERBOSE:
if (log.IsDebugEnabled) log.Debug(message);
break;
}
}
/// logging interface
/// </summary>
internal class EnterpriseLibraryLogger : ILogger
{
public void WriteMessage(string category, LogLevel level, string message)
{
// First thing we need to do is translate our generic log level enum value
// into a priority for Enterprise Library. Along the way, we will also
// assign a TraceEventType value
TraceEventType eventSeverity = TraceEventType.Information;
int priority = -1;
switch (level)
{
case LogLevel.FATAL:
eventSeverity = TraceEventType.Critical;
priority = 10;
break;
case LogLevel.ERROR:
eventSeverity = TraceEventType.Error;
priority = 8;
break;
case LogLevel.WARN:
eventSeverity = TraceEventType.Warning;
priority = 6;
break;
case LogLevel.INFO:
eventSeverity = TraceEventType.Information;
priority = 4;
break;
case LogLevel.VERBOSE:
eventSeverity = TraceEventType.Verbose;
priority = 2;
break;
}
// This creates an object to specify the log entry and assigns
// values to the appropriate properties
LogEntry entry = new LogEntry();
entry.Categories.Add(category);
entry.Message = message;
entry.Priority = priority;
entry.Severity = eventSeverity;
// This line actually writes the entry to the log(s)
Logger.Write(entry);
}
public static ILogger GetLogger()
{
string logger_key = ConfigurationManager.AppSettings["LoggerKey"];
if (logger_key.Equals("log4net"))
{
return new Log4NetLogger();
}
else if (logger_key.Equals("EnterpriseLibrary"))
{
return new EnterpriseLibraryLogger();
}
else
{
throw ApplicationException("Unknown Logger");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Reflection;
namespace DesigningWithInterfaces.LoggingInterface
{
/// <summary>
/// Factory class to get the appropriate ILogger based on what is specified in
/// the App.Config file
/// </summary>
public class LoggerFactory
{
#region Member Variables
// reference to the ILogger object. Get a reference the first time then keep it
private static ILogger logger;
// This variable is used as a lock for thread safety
private static object lockObject = new object();
#endregion
public static ILogger GetLogger()
{
lock (lockObject)
{
if (logger == null)
{
string asm_name = ConfigurationManager.AppSettings["Logger.AssemblyName"];
string class_name = ConfigurationManager.AppSettings["Logger.ClassName"];
if (String.IsNullOrEmpty(asm_name) || String.IsNullOrEmpty(class_name))
throw new ApplicationException("Missing config data for Logger");
Assembly assembly = Assembly.LoadFrom(asm_name);
logger = assembly.CreateInstance(class_name) as ILogger;
if (logger == null)
throw new ApplicationException(
string.Format("Unable to instantiate ILogger class {0}/{1}",
asm_name, class_name));
}
return logger;
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.