-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathProgram.cs
More file actions
61 lines (56 loc) · 1.46 KB
/
Program.cs
File metadata and controls
61 lines (56 loc) · 1.46 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
using ProFak.DB;
using ProFak.UI;
using System.Globalization;
using System.Text;
namespace ProFak;
public static class Program
{
[STAThread]
public static void Main(string[] args)
{
try
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Wyglad.ZaladujDomyslny();
CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("pl-PL");
Baza.UstalSciezkeBazy();
Interfejs.Przygotuj();
#if !SQLSERVER
if (!PierwszyStartBaza.Uruchom()) return;
#endif
Baza.Przygotuj();
Wyglad.WczytajZBazy();
if (args.Length > 0)
{
if (args[0] == "xsd") Wydruki.GeneratorXSD.Utworz();
if (args[0] == "sql")
{
using var kontekst = new Kontekst();
Dialog.Pokaz("ProFak", new EkranSQL() { Kontekst = kontekst }, kontekst);
}
if (args[0] == "db")
{
using var kontekst = new Kontekst();
Dialog.Pokaz("ProFak", new BazyDanych() { Kontekst = kontekst }, kontekst);
}
return;
}
using (var kontekst = new UI.Kontekst())
{
var podmiot = kontekst.Baza.Kontrahenci.FirstOrDefault(kontrahent => kontrahent.CzyPodmiot);
if (podmiot == null)
{
OknoKomunikatu.Informacja("Przed rozpoczęciem korzystania z programu należy uzupełnić dane firmy.");
var _ = Enumerable.Empty<DB.Kontrahent>();
new UI.MojaFirmaAkcja().Uruchom(kontekst, ref _);
}
}
Wydruki.Wydruk.WstepneLadowanie();
GlowneOkno.Pokaz();
}
catch (Exception exc)
{
OknoBledu.Pokaz(exc);
}
}
}