-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
78 lines (61 loc) · 2.38 KB
/
Copy pathProgram.cs
File metadata and controls
78 lines (61 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using PatientBillingSystem.Forms;
namespace PatientBillingSystem
{
public enum AccountMode
{
Administrator, Registrar, Nurse, Doctor, Cashier, Patient
}
internal static class Program
{
public static string LoggedUsername;
public static AccountMode AccountMode { get; set; } = AccountMode.Administrator;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
if (Environment.OSVersion.Version.Major >= 6)
SetProcessDPIAware();
Database.SqlConnection.Open();
Database.SqlConnection.Close();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LoginForm());
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
// PUBLIC STATIC METHODS
public static int CalculateAge(DateTime birthDate)
{
DateTime currentDate = DateTime.Now;
int age = currentDate.Year - birthDate.Year;
if (currentDate.Month < birthDate.Month) age--;
else if (currentDate.Month == birthDate.Month && currentDate.Day < birthDate.Day) age--;
else if (birthDate.Month == 2 && birthDate.Day == 29 && !DateTime.IsLeapYear(currentDate.Year)) age--;
return age;
}
public static string GetPesoAmount(string amount)
{
return string.Format(CultureInfo.CreateSpecificCulture("en-PH"), "{0:C}", double.Parse("0" + amount));
}
public static bool ShowDiscardInputDialog()
{
DialogResult dialogResult = MessageBox.Show("Are you sure? Your input will be discarded",
"Discard Input", MessageBoxButtons.YesNo);
return dialogResult == DialogResult.Yes;
// Project developed by Dave Laurence Tolentino | BSIT-2B
// FINAL TASK PERFORMANCE FOR
// INFORMATION MANAGEMENT & INTEGRATIVE PROGRAMMING
// Final revision submitted at 06/15/2024
}
}
}