code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
[CustomMessages] de.dotnetfx35sp1lp_title=.NET Framework 3.5 SP1 Sprachpaket: Deutsch de.dotnetfx35sp1lp_size=22 MB - 98 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx en.dotnetfx35sp1lp_lcid=1033 de.dotnetfx35sp1lp_lcid=1031 de.dotnetfx35sp1lp_url=http://download.microsoft.com/download/d/7/2/d728b7b9-454b-4b57-8270-45dac441b0ec/dotnetfx35langpack_x86de.exe [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx35sp1lp}"; Description: "{cm:dotnetfx35sp1lp_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx35sp1lp_title}}"; Parameters: "/lang:enu /quiet /norestart"; Flags: skipifdoesntexist [Code] procedure dotnetfx35sp1lp(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5\' + CustomMessage('dotnetfx35sp1lp_lcid'), 'SP', version); if IntToStr(version) < '1' then InstallPackage('dotnetfx35sp1lp', 'dotnetfx35sp1lp.exe', CustomMessage('dotnetfx35sp1lp_title'), CustomMessage('dotnetfx35sp1lp_size'), CustomMessage('dotnetfx35sp1lp_url')); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx35sp1lp.iss
Inno Setup
gpl3
1,059
[CustomMessages] de.dotnetfx20sp1lp_title=.NET Framework 2.0 SP1 Sprachpaket: Deutsch de.dotnetfx20sp1lp_size=3,4 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx en.dotnetfx20sp1lp_lcid=1033 de.dotnetfx20sp1lp_lcid=1031 de.dotnetfx20sp1lp_url=http://download.microsoft.com/download/8/a/a/8aab7e6a-5e58-4e83-be99-f5fb49fe811e/NetFx20SP1_x86de.exe [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx20sp1lp}"; Description: "{cm:dotnetfx20sp1lp_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx20sp1lp_title}}"; Parameters: "/q:a /c:""install /q /l"""; Flags: skipifdoesntexist [Code] procedure dotnetfx20sp1lp(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\' + CustomMessage('dotnetfx20sp1lp_lcid'), 'SP', version); if IntToStr(version) < '1' then InstallPackage('dotnetfx20sp1lp', ExpandConstant('dotnetfx20sp1_langpack_{language}.exe'), CustomMessage('dotnetfx20sp1lp_title'), CustomMessage('dotnetfx20sp1lp_size'), CustomMessage('dotnetfx20sp1lp_url')); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx20sp1lp.iss
Inno Setup
gpl3
1,082
[CustomMessages] msi20_title=Windows Installer 2.0 en.msi20_size=1.7 MB de.msi20_size=1,7 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,msi20}"; Description: "{cm:msi20_title}"; StatusMsg: "{cm:depinstall_status,{cm:msi20_title}}"; Parameters: "/q:a /c:""msiinst /delayrebootq"""; Flags: skipifdoesntexist [Code] const msi20_url = 'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe'; procedure msi20(MinVersion: string); begin // Check for required Windows Installer 2.0 on Windows 98 and ME if maxwinversion(4, 9) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then InstallPackage('msi20', 'msi20.exe', CustomMessage('msi20_title'), CustomMessage('msi20_size'), msi20_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/msi20.iss
Inno Setup
gpl3
773
[CustomMessages] iis_title=Internet Information Services [Code] function iis(): boolean; begin if not RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\W3SVC\Security') then MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [CustomMessage('iis_title')]), mbError, MB_OK) else Result := true; end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/iis.iss
Inno Setup
gpl3
324
[CustomMessages] de.dotnetfx11lp_title=.NET Framework 1.1 Sprachpaket: Deutsch de.dotnetfx11lp_size=1,4 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx en.dotnetfx11lp_lcid=1033 de.dotnetfx11lp_lcid=1031 de.dotnetfx11lp_url=http://download.microsoft.com/download/6/8/2/6821e687-526a-4ef8-9a67-9a402ec5ac9e/langpack.exe [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx11lp}"; Description: "{cm:dotnetfx11lp_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx11lp_title}}"; Parameters: "/q:a /c:""inst.exe /q /l"""; Flags: skipifdoesntexist [Code] procedure dotnetfx11lp(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322\' + CustomMessage('dotnetfx11lp_lcid'), 'Install', version); if IntToStr(version) <> '1' then InstallPackage('dotnetfx11lp', ExpandConstant('dotnetfx11_langpack_{language}.exe'), CustomMessage('dotnetfx11lp_title'), CustomMessage('dotnetfx11lp_size'), CustomMessage('dotnetfx11lp_url')); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx11lp.iss
Inno Setup
gpl3
1,033
[Code] function GetFullVersion(VersionMS, VersionLS: cardinal): string; var version: string; begin version := IntToStr(word(VersionMS shr 16)); version := version + '.' + IntToStr(word(VersionMS and not $ffff0000)); version := version + '.' + IntToStr(word(VersionLS shr 16)); version := version + '.' + IntToStr(word(VersionLS and not $ffff0000)); Result := version; end; function fileversion(file: string): string; var versionMS, versionLS: cardinal; begin if (GetVersionNumbers(file, versionMS, versionLS)) then begin Result := GetFullVersion(versionMS, versionLS); end else Result := '0'; end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/fileversion.iss
Inno Setup
gpl3
637
[Code] var WindowsVersion: TWindowsVersion; function minwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major >= MajorVersion) and (WindowsVersion.Minor >= MinorVersion) end; function maxwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major <= MajorVersion) and (WindowsVersion.Minor <= MinorVersion) end; function exactwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major = MajorVersion) and (WindowsVersion.Minor = MinorVersion) end; function minspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if (exactwinversion(MajorVersion, MinorVersion)) then Result := (WindowsVersion.ServicePackMajor >= SpVersion) else Result := true; end; function maxspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if (exactwinversion(MajorVersion, MinorVersion)) then Result := (WindowsVersion.ServicePackMajor <= SpVersion) else Result := true; end; function exactspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if (exactwinversion(MajorVersion, MinorVersion)) then Result := (WindowsVersion.ServicePackMajor = SpVersion) else Result := true; end; procedure initwinversion(); begin GetWindowsVersionEx(WindowsVersion); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/winversion.iss
Inno Setup
gpl3
1,399
// WARNING: express setup (downloads and installs the components depending on your OS) // http://www.microsoft.com/downloads/details.aspx?FamilyID=1E1550CB-5E5D-48F5-B02B-20B602228DE [CustomMessages] ie6_title=Internet Explorer 6 en.ie6_size=46 MB de.ie6_size=46 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,ie6}"; Description: "{cm:ie6_title}"; StatusMsg: "{cm:depinstall_status,{cm:ie6_title}}"; Parameters: "/q:a /C:""setup /QNT"""; Flags: skipifdoesntexist [Code] const ie6_url = 'http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/ie6setup.exe'; procedure ie6(MinVersion: string); var version: string; begin RegQueryStringValue(HKLM, 'Software\Microsoft\Internet Explorer', 'Version', version); if (version < MinVersion) then InstallPackage('ie6', 'ie6.exe', CustomMessage('ie6_title'), CustomMessage('ie6_size'), ie6_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/ie6.iss
Inno Setup
gpl3
900
// requires Windows Server 2003 Service Pack 1, Windows Server 2008, Windows Vista, Windows XP Service Pack 2 // requires windows installer 3.1 // WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below // http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7 [CustomMessages] dotnetfx35sp1_title=.NET Framework 3.5 Service Pack 1 en.dotnetfx35sp1_size=3 MB - 232 MB de.dotnetfx35sp1_size=3 MB - 232 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx35sp1}"; Description: "{cm:dotnetfx35sp1_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx35sp1_title}}"; Parameters: "/lang:enu /quiet /norestart"; Flags: skipifdoesntexist [Code] const dotnetfx35sp1_url = 'http://download.microsoft.com/download/0/6/1/061f001c-8752-4600-a198-53214c69b51f/dotnetfx35setup.exe'; procedure dotnetfx35sp1(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5', 'SP', version); if IntToStr(version) < '1' then InstallPackage('dotnetfx35sp1', 'dotnetfx35sp1.exe', CustomMessage('dotnetfx35sp1_title'), CustomMessage('dotnetfx35sp1_size'), dotnetfx35sp1_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx35sp1.iss
Inno Setup
gpl3
1,303
[CustomMessages] de.dotnetfx35lp_title=.NET Framework 3.5 Sprachpaket: Deutsch de.dotnetfx35lp_size=13 MB - 51 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx en.dotnetfx35lp_lcid=1033 de.dotnetfx35lp_lcid=1031 de.dotnetfx35lp_url=http://download.microsoft.com/download/d/1/e/d1e617c3-c7f4-467e-a7de-af832450efd3/dotnetfx35langpack_x86de.exe [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx35lp}"; Description: "{cm:dotnetfx35lp_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx35lp_title}}"; Parameters: "/lang:enu /quiet /norestart"; Flags: skipifdoesntexist [Code] procedure dotnetfx35lp(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5\' + CustomMessage('dotnetfx35lp_lcid'), 'Install', version); if IntToStr(version) <> '1' then InstallPackage('dotnetfx35lp', 'dotnetfx35lp.exe', CustomMessage('dotnetfx35lp_title'), CustomMessage('dotnetfx35lp_size'), CustomMessage('dotnetfx35lp_url')); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx35lp.iss
Inno Setup
gpl3
1,018
[CustomMessages] mdac28_title=MDAC 2.8 en.mdac28_size=5.4 MB de.mdac28_size=5,4 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,mdac28}"; Description: "{cm:mdac28_title}"; StatusMsg: "{cm:depinstall_status,{cm:mdac28_title}}"; Parameters: "/q:a /c:""install /q /l"""; Flags: skipifdoesntexist [Code] const mdac28_url = 'http://download.microsoft.com/download/c/d/f/cdfd58f1-3973-4c51-8851-49ae3777586f/MDAC_TYP.EXE'; procedure mdac28(MinVersion: string); var version: string; begin // Check for required MDAC installation RegQueryStringValue(HKLM, 'Software\Microsoft\DataAccess', 'FullInstallVer', version); if (version < MinVersion) then InstallPackage('mdac28', 'mdac28.exe', CustomMessage('mdac28_title'), CustomMessage('mdac28_size'), mdac28_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/mdac28.iss
Inno Setup
gpl3
794
// http://www.microsoft.com/technet/security/bulletin/ms04-011.mspx // http://www.microsoft.com/downloads/details.aspx?FamilyId=0692C27E-F63A-414C-B3EB-D2342FBB6C00 [CustomMessages] en.kb835732_title=Security Update (KB835732) de.kb835732_title=Sicherheitsupdate (KB835732) en.kb835732_size=6.8 MB de.kb835732_size=6,8 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,kb835732}"; Description: "{cm:kb835732_title}"; StatusMsg: "{cm:depinstall_status,{cm:kb835732_title}}"; Parameters: "/q:a /c:""install /q"""; Flags: skipifdoesntexist [Code] const kb835732_url = 'http://download.microsoft.com/download/f/a/a/faa796aa-399d-437a-9284-c3536e9f2e6e/Windows2000-KB835732-x86-ENU.EXE'; procedure kb835732(); begin if (exactwinversion(5, 0) and minspversion(5, 0, 2) and maxspversion(5, 0, 4)) then begin if (not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB835732\Filelist')) then InstallPackage('kb835732', 'kb835732.exe', CustomMessage('kb835732_title'), CustomMessage('kb835732_size'), kb835732_url); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/kb835732.iss
Inno Setup
gpl3
1,070
// requires Windows 2000; Windows Server 2003 Service Pack 1 for Itanium-based Systems; Windows Server 2003 x64 editions; Windows Server 2008 Datacenter; Windows Server 2008 Enterprise; Windows Server 2008 for Itanium-based Systems; Windows Server 2008 Standard; Windows Vista Business; Windows Vista Enterprise; Windows Vista Home Basic; Windows Vista Home Premium; Windows Vista Starter; Windows Vista Ultimate; Windows XP; Windows XP Professional x64 Edition; Windows NT 4.0 Service Pack 6a // requires internet explorer 5.0.1 or higher // http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3 [CustomMessages] dotnetfx11_title=.NET Framework 1.1 en.dotnetfx11_size=23.1 MB de.dotnetfx11_size=23,1 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx11}"; Description: "{cm:dotnetfx11_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx11_title}}"; Parameters: "/q:a /c:""install /q /l"""; Flags: skipifdoesntexist [Code] const dotnetfx11_url = 'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe'; procedure dotnetfx11(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'Install', version); if IntToStr(version) <> '1' then InstallPackage('dotnetfx11', 'dotnetfx11.exe', CustomMessage('dotnetfx11_title'), CustomMessage('dotnetfx11_size'), dotnetfx11_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx11.iss
Inno Setup
gpl3
1,460
// requires Windows 2000 Service Pack 4, Windows Server 2003, Windows XP Service Pack 2 // requires KB 835732 on Windows 2000 Service Pack 4 // http://www.microsoft.com/downloads/details.aspx?FamilyID=79bc3b77-e02c-4ad3-aacf-a7633f706ba5 [CustomMessages] dotnetfx20sp1_title=.NET Framework 2.0 Service Pack 1 en.dotnetfx20sp1_size=23.6 MB de.dotnetfx20sp1_size=23,6 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx20sp1}"; Description: "{cm:dotnetfx20sp1_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx20sp1_title}}"; Parameters: "/q:a /t:{tmp}{\}dotnetfx20sp1 /c:""install /q /l /msipassthru MSI_PROP_BEGIN"" REBOOT=Suppress ""MSI_PROP_END"""; Flags: skipifdoesntexist [Code] const dotnetfx20sp1_url = 'http://download.microsoft.com/download/0/8/c/08c19fa4-4c4f-4ffb-9d6c-150906578c9e/NetFx20SP1_x86.exe'; procedure dotnetfx20sp1(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'SP', version); if IntToStr(version) < '1' then InstallPackage('dotnetfx20sp1', 'dotnetfx20sp1.exe', CustomMessage('dotnetfx20sp1_title'), CustomMessage('dotnetfx20sp1_size'), dotnetfx20sp1_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx20sp1.iss
Inno Setup
gpl3
1,202
[CustomMessages] msi31_title=Windows Installer 3.1 en.msi31_size=2.5 MB de.msi31_size=2,5 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,msi31}"; Description: "{cm:msi31_title}"; StatusMsg: "{cm:depinstall_status,{cm:msi31_title}}"; Parameters: "/quiet /norestart"; Flags: skipifdoesntexist [Code] const msi31_url = 'http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe'; procedure msi31(MinVersion: string); begin // Check for required Windows Installer 3.0 on Windows 2000 or higher if minwinversion(5, 0) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then InstallPackage('msi31', 'msi31.exe', CustomMessage('msi31_title'), CustomMessage('msi31_size'), msi31_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/msi31.iss
Inno Setup
gpl3
788
// requires Windows 2000 Service Pack 3, Windows 98, Windows 98 Second Edition, Windows ME, Windows Server 2003, Windows XP Service Pack 2 // requires internet explorer 5.0.1 or higher // requires windows installer 2.0 on windows 98, ME // requires windows installer 3.1 on windows 2000 or higher // http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5 [CustomMessages] dotnetfx20_title=.NET Framework 2.0 en.dotnetfx20_size=23 MB de.dotnetfx20_size=23 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx20}"; Description: "{cm:dotnetfx20_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx20_title}}"; Parameters: "/q:a /t:{tmp}{\}dotnetfx20 /c:""install /q /l"""; Flags: skipifdoesntexist [Code] const dotnetfx20_url = 'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe'; procedure dotnetfx20(); var version: cardinal; begin RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'Install', version) if IntToStr(version) <> '1' then InstallPackage('dotnetfx20', 'dotnetfx20.exe', CustomMessage('dotnetfx20_title'), CustomMessage('dotnetfx20_size'), dotnetfx20_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx20.iss
Inno Setup
gpl3
1,251
[CustomMessages] de.dotnetfx20lp_title=.NET Framework 2.0 Sprachpaket: Deutsch de.dotnetfx20lp_size=1,8 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx en.dotnetfx20lp_lcid=1033 de.dotnetfx20lp_lcid=1031 de.dotnetfx20lp_url=http://download.microsoft.com/download/2/9/7/29768238-56c3-4ea6-abba-4c5246f2bc81/langpack.exe [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx20lp}"; Description: "{cm:dotnetfx20lp_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx20lp_title}}"; Parameters: "/q:a /c:""install /q /l"""; Flags: skipifdoesntexist [Code] procedure dotnetfx20lp(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\' + CustomMessage('dotnetfx20lp_lcid'), 'Install', version); if IntToStr(version) <> '1' then InstallPackage('dotnetfx20lp', ExpandConstant('dotnetfx20_langpack_{language}.exe'), CustomMessage('dotnetfx20lp_title'), CustomMessage('dotnetfx20lp_size'), CustomMessage('dotnetfx20lp_url')); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx20lp.iss
Inno Setup
gpl3
1,033
[CustomMessages] dotnetfx40_title=.NET Framework 4.0 Client Profile en.dotnetfx40_size=48.1 MB de.dotnetfx40_size=48,1 MB [Code] const dotnetfx40_url = 'http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe'; procedure dotnetfx40client(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Client', 'Install', version); if version <> 1 then if IntToStr(version) <> '1' then InstallPackage('dotnetfx40client', 'dotnetfx40client.exe', CustomMessage('dotnetfx40_title'), CustomMessage('dotnetfx40_size'), dotnetfx40_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx40client.iss
Inno Setup
gpl3
662
// requires Windows Server 2003 Service Pack 1, Windows Server 2008, Windows Vista, Windows XP Service Pack 2 // requires windows installer 3.1 // WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below // http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6 [CustomMessages] dotnetfx35_title=.NET Framework 3.5 en.dotnetfx35_size=3 MB - 197 MB de.dotnetfx35_size=3 MB - 197 MB [Run] Filename: "{ini:{tmp}{\}dep.ini,install,dotnetfx35}"; Description: "{cm:dotnetfx35_title}"; StatusMsg: "{cm:depinstall_status,{cm:dotnetfx35_title}}"; Parameters: "/lang:enu /quiet /norestart"; Flags: skipifdoesntexist [Code] const dotnetfx35_url = 'http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe'; procedure dotnetfx35(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', version); if IntToStr(version) <> '1' then InstallPackage('dotnetfx35', 'dotnetfx35.exe', CustomMessage('dotnetfx35_title'), CustomMessage('dotnetfx35_size'), dotnetfx35_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/old/products/dotnetfx35.iss
Inno Setup
gpl3
1,256
[Files] Source: "scripts\isxdl\isxdl.dll"; Flags: dontcopy [Code] procedure isxdl_AddFile(URL, Filename: PChar); external 'isxdl_AddFile@files:isxdl.dll stdcall'; function isxdl_DownloadFiles(hWnd: Integer): Integer; external 'isxdl_DownloadFiles@files:isxdl.dll stdcall'; function isxdl_SetOption(Option, Value: PChar): Integer; external 'isxdl_SetOption@files:isxdl.dll stdcall';
zzgaminginc-pointofssale
SambaSetup/scripts/old/isxdl/isxdl.iss
Inno Setup
gpl3
395
// http://support.microsoft.com/kb/239114 [CustomMessages] jet4sp8_title=Jet 4 en.jet4sp8_size=3.7 MB de.jet4sp8_size=3,7 MB [Code] const jet4sp8_url = 'http://download.microsoft.com/download/4/3/9/4393c9ac-e69e-458d-9f6d-2fe191c51469/Jet40SP8_9xNT.exe'; procedure jet4sp8(MinVersion: string); begin //check for Jet4 Service Pack 8 installation if fileversion(ExpandConstant('{sys}{\}msjet40.dll')) < MinVersion then AddProduct('jet4sp8.exe', '/q:a /c:"install /qb /l"', CustomMessage('jet4sp8_title'), CustomMessage('jet4sp8_size'), jet4sp8_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/jet4sp8.iss
Inno Setup
gpl3
596
[CustomMessages] wic_title=Windows Imaging Component en.wic_size=1.2 MB de.wic_size=1.2 MB [Code] const wic_url = 'http://download.microsoft.com/download/f/f/1/ff178bb1-da91-48ed-89e5-478a99387d4f/wic_x86_enu.exe'; procedure wic(); var installed: boolean; begin installed := FileExists(GetEnv('windir') + '\system32\windowscodecs.dll'); if not installed then begin AddProduct('wic_x86_enu.exe', '/q', CustomMessage('wic_title'), CustomMessage('wic_size'), wic_url, false, false); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/wic.iss
Inno Setup
gpl3
542
[CustomMessages] de.dotnetfx35sp1lp_title=.NET Framework 3.5 SP1 Sprachpaket: Deutsch de.dotnetfx35sp1lp_size=22 MB - 98 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx35sp1lp_lcid=1031 de.dotnetfx35sp1lp_url=http://download.microsoft.com/download/d/7/2/d728b7b9-454b-4b57-8270-45dac441b0ec/dotnetfx35langpack_x86de.exe [Code] procedure dotnetfx35sp1lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5\' + CustomMessage('dotnetfx35sp1lp_lcid'), 'SP', version); if version < 1 then AddProduct('dotnetfx35sp1_langpack.exe', '/lang:enu /qb /norestart', CustomMessage('dotnetfx35sp1lp_title'), CustomMessage('dotnetfx35sp1lp_size'), CustomMessage('dotnetfx35sp1lp_url')); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx35sp1lp.iss
Inno Setup
gpl3
860
//http://www.microsoft.com/downloads/details.aspx?FamilyID=1cc39ffe-a2aa-4548-91b3-855a2de99304 [CustomMessages] de.dotnetfx20sp1lp_title=.NET Framework 2.0 SP1 Sprachpaket: Deutsch de.dotnetfx20sp1lp_size=3,4 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx20sp1lp_lcid=1031 de.dotnetfx20sp1lp_url=http://download.microsoft.com/download/8/a/a/8aab7e6a-5e58-4e83-be99-f5fb49fe811e/NetFx20SP1_x86de.exe de.dotnetfx20sp1lp_url_x64=http://download.microsoft.com/download/1/4/2/1425872f-c564-4ab2-8c9e-344afdaecd44/NetFx20SP1_x64de.exe de.dotnetfx20sp1lp_url_ia64=http://download.microsoft.com/download/a/0/b/a0bef431-19d8-433c-9f42-6e2824a8cb90/NetFx20SP1_ia64de.exe [Code] procedure dotnetfx20sp1lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\' + CustomMessage('dotnetfx20sp1lp_lcid'), 'SP', version); if version < 1 then AddProduct(ExpandConstant('dotnetfx20sp1_langpack.exe'), '/q:a /c:"install /qb /l"', CustomMessage('dotnetfx20sp1lp_title'), CustomMessage('dotnetfx20sp1lp_size'), GetURL(CustomMessage('dotnetfx20sp1lp_url'), CustomMessage('dotnetfx20sp1lp_url_x64'), CustomMessage('dotnetfx20sp1lp_url_ia64'))); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20sp1lp.iss
Inno Setup
gpl3
1,323
[CustomMessages] ssce40x86_title=SQL Server Compact 4.0 for Windows Destkop (x86) ssce40x64_title=SQL Server Compact 4.0 for Windows Destkop (x64) ssce40_size=2.5 MB [Code] const ssce40x86_url = 'http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x86-ENU.exe'; ssce40x64_url = 'http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCERuntime_x64-ENU.exe'; procedure ssce40(); var version: cardinal; begin if not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0') then begin if (IsWin64) then begin AddProduct('SSCERuntime_x64-ENU.exe', '/i /quiet /norestart', CustomMessage('ssce40x64_title'), CustomMessage('ssce40_size'), ssce40x64_url,false,false); end else begin AddProduct('SSCERuntime_x86-ENU.exe', '/i /quiet /norestart', CustomMessage('ssce40x86_title'), CustomMessage('ssce40_size'), ssce40x86_url,false,false); end; end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/ssce40.iss
Inno Setup
gpl3
1,075
[CustomMessages] msi20_title=Windows Installer 2.0 en.msi20_size=1.7 MB de.msi20_size=1,7 MB [Code] const msi20_url = 'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe'; procedure msi20(MinVersion: string); begin // Check for required Windows Installer 2.0 on Windows 98 and ME if maxwinversion(4, 9) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then AddProduct('msi20.exe', '/q:a /c:"msiinst /delayrebootq"', CustomMessage('msi20_title'), CustomMessage('msi20_size'), msi20_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/msi20.iss
Inno Setup
gpl3
593
[CustomMessages] dotnetfx40_title=.NET Framework 4.0 en.dotnetfx40_size=48.1 MB de.dotnetfx40_size=48,1 MB [Code] const dotnetfx40_url = 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'; procedure dotnetfx40(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', version); if version <> 1 then AddProduct('dotNetFx40_Full_x86_x64.exe', '/q:a /t:' + ExpandConstant('{tmp}{\}') + 'dotNetFx40_Full_x86_x64.exe /c:"install /qb /l"', CustomMessage('dotnetfx40_title'), CustomMessage('dotnetfx40_size'), dotnetfx40_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx40.iss
Inno Setup
gpl3
693
[CustomMessages] iis_title=Internet Information Services (IIS) [Code] function iis(): boolean; begin if not RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\W3SVC\Security') then MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [CustomMessage('iis_title')]), mbError, MB_OK) else Result := true; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/iis.iss
Inno Setup
gpl3
330
[CustomMessages] de.dotnetfx11lp_title=.NET Framework 1.1 Sprachpaket: Deutsch de.dotnetfx11lp_size=1,4 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx11lp_lcid=1031 de.dotnetfx11lp_url=http://download.microsoft.com/download/6/8/2/6821e687-526a-4ef8-9a67-9a402ec5ac9e/langpack.exe [Code] procedure dotnetfx11lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322\' + CustomMessage('dotnetfx11lp_lcid'), 'Install', version); if version <> 1 then AddProduct(ExpandConstant('dotnetfx11_langpack.exe'), '/q:a /c:"inst.exe /qb /l"', CustomMessage('dotnetfx11lp_title'), CustomMessage('dotnetfx11lp_size'), CustomMessage('dotnetfx11lp_url')); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx11lp.iss
Inno Setup
gpl3
833
[Code] function GetFullVersion(VersionMS, VersionLS: cardinal): string; var version: string; begin version := IntToStr(word(VersionMS shr 16)); version := version + '.' + IntToStr(word(VersionMS and not $ffff0000)); version := version + '.' + IntToStr(word(VersionLS shr 16)); version := version + '.' + IntToStr(word(VersionLS and not $ffff0000)); Result := version; end; function fileversion(file: string): string; var versionMS, versionLS: cardinal; begin if GetVersionNumbers(file, versionMS, versionLS) then Result := GetFullVersion(versionMS, versionLS) else Result := '0'; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/fileversion.iss
Inno Setup
gpl3
624
// WARNING: Windows Update is better because there are different versions for different OS // (optional) critical security hotfix for .NET Framework 1.1 Service Pack 1 on Windows 2000/XP/2003 // http://support.microsoft.com/default.aspx?scid=kb;en-us;886903 // http://www.microsoft.com/downloads/details.aspx?familyid=8EC6FB8A-29EB-49CF-9DBC-1A0DC2273FF9 [CustomMessages] en.kb886903_title=.NET Framework 1.1 SP1 Security Update (KB886903) de.kb886903_title=.NET Framework 1.1 SP1 Sicherheitsupdate (KB886903) en.kb886903_size=1.5 MB de.kb886903_size=1,5 MB [Code] const kb886903_url = 'http://download.microsoft.com/download/e/1/4/e14c0c02-591b-4696-8552-eb710c26a3cd/NDP1.1sp1-KB886903-X86.exe'; procedure kb886903(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'SP', version); if version = 1 then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\Updates\.NETFramework\1.1\M886903', 'Installed', version); if version <> 1 then AddProduct('kb886903.exe', '/q', CustomMessage('kb886903_title'), CustomMessage('kb886903_size'), kb886903_url); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/kb886903.iss
Inno Setup
gpl3
1,183
[Code] var WindowsVersion: TWindowsVersion; procedure initwinversion(); begin GetWindowsVersionEx(WindowsVersion); end; function exactwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major = MajorVersion) and (WindowsVersion.Minor = MinorVersion); end; function minwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major > MajorVersion) or ((WindowsVersion.Major = MajorVersion) and (WindowsVersion.Minor >= MinorVersion)); end; function maxwinversion(MajorVersion, MinorVersion: integer): boolean; begin Result := (WindowsVersion.Major < MajorVersion) or ((WindowsVersion.Major = MajorVersion) and (WindowsVersion.Minor <= MinorVersion)); end; function exactwinspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if exactwinversion(MajorVersion, MinorVersion) then Result := WindowsVersion.ServicePackMajor = SpVersion else Result := true; end; function minwinspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if exactwinversion(MajorVersion, MinorVersion) then Result := WindowsVersion.ServicePackMajor >= SpVersion else Result := true; end; function maxwinspversion(MajorVersion, MinorVersion, SpVersion: integer): boolean; begin if exactwinversion(MajorVersion, MinorVersion) then Result := WindowsVersion.ServicePackMajor <= SpVersion else Result := true; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/winversion.iss
Inno Setup
gpl3
1,469
//http://www.microsoft.com/downloads/details.aspx?FamilyID=c69789e0-a4fa-4b2e-a6b5-3b3695825992 [CustomMessages] de.dotnetfx20sp2lp_title=.NET Framework 2.0 SP2 Sprachpaket: Deutsch de.dotnetfx20sp2lp_size=3,4 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx20sp2lp_lcid=1031 de.dotnetfx20sp2lp_url=http://download.microsoft.com/download/0/b/1/0b175c8e-34bd-46c0-bfcd-af8d33770c58/netfx20sp2_x86de.exe de.dotnetfx20sp2lp_url_x64=http://download.microsoft.com/download/4/e/c/4ec67a11-879d-4550-9c25-fd9ab4261b46/netfx20sp2_x64de.exe de.dotnetfx20sp2lp_url_ia64=http://download.microsoft.com/download/a/3/3/a3349a2d-36e4-4797-8297-4394e6fbd677/NetFx20SP2_ia64de.exe [Code] procedure dotnetfx20sp2lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\' + CustomMessage('dotnetfx20sp2lp_lcid'), 'SP', version); if version < 2 then AddProduct(ExpandConstant('dotnetfx20sp2_langpack.exe'), '/lang:enu /qb /norestart"', CustomMessage('dotnetfx20sp2lp_title'), CustomMessage('dotnetfx20sp2lp_size'), GetURL(CustomMessage('dotnetfx20sp2lp_url'), CustomMessage('dotnetfx20sp2lp_url_x64'), CustomMessage('dotnetfx20sp2lp_url_ia64'))); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20sp2lp.iss
Inno Setup
gpl3
1,324
//http://www.microsoft.com/downloads/details.aspx?familyid=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F [CustomMessages] dotnetfx20sp2_title=.NET Framework 2.0 Service Pack 2 en.dotnetfx20sp2_size=24 MB - 52 MB de.dotnetfx20sp2_size=24 MB - 52 MB [Code] const dotnetfx20sp2_url = 'http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_x86.exe'; dotnetfx20sp2_url_x64 = 'http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_x64.exe'; dotnetfx20sp2_url_ia64 = 'http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_ia64.exe'; procedure dotnetfx20sp2(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'SP', version); if version < 2 then AddProduct('dotnetfx20sp2.exe', '/lang:enu /qb /norestart', CustomMessage('dotnetfx20sp2_title'), CustomMessage('dotnetfx20sp2_size'), GetURL(dotnetfx20sp2_url, dotnetfx20sp2_url_x64, dotnetfx20sp2_url_ia64)); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20sp2.iss
Inno Setup
gpl3
1,074
// requires Windows 2000; Windows 98; Windows ME; Windows NT; Windows XP Service Pack 1 // WARNING: express setup (downloads and installs the components depending on your OS) // http://www.microsoft.com/downloads/details.aspx?familyid=1E1550CB-5E5D-48F5-B02B-20B602228DE6 [CustomMessages] ie6_title=Internet Explorer 6 en.ie6_size=1 MB - 77.5 MB de.ie6_size=1 MB - 77,5 MB [Code] const ie6_url = 'http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/ie6setup.exe'; procedure ie6(MinVersion: string); var version: string; begin RegQueryStringValue(HKLM, 'Software\Microsoft\Internet Explorer', 'Version', version); if version < MinVersion then AddProduct('ie6.exe', '/q:a /C:"setup /QNT"', CustomMessage('ie6_title'), CustomMessage('ie6_size'), ie6_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/ie6.iss
Inno Setup
gpl3
832
// requires Windows Server 2003 Service Pack 1, Windows Server 2008, Windows Vista, Windows XP Service Pack 2 // requires windows installer 3.1 // WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below // http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7 [CustomMessages] dotnetfx35sp1_title=.NET Framework 3.5 Service Pack 1 en.dotnetfx35sp1_size=3 MB - 232 MB de.dotnetfx35sp1_size=3 MB - 232 MB [Code] const dotnetfx35sp1_url = 'http://download.microsoft.com/download/0/6/1/061f001c-8752-4600-a198-53214c69b51f/dotnetfx35setup.exe'; procedure dotnetfx35sp1(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5', 'SP', version); if version < 1 then AddProduct('dotnetfx35sp1.exe', '/lang:enu /qb /norestart', CustomMessage('dotnetfx35sp1_title'), CustomMessage('dotnetfx35sp1_size'), dotnetfx35sp1_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx35sp1.iss
Inno Setup
gpl3
1,076
[CustomMessages] de.dotnetfx35lp_title=.NET Framework 3.5 Sprachpaket: Deutsch de.dotnetfx35lp_size=13 MB - 51 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx35lp_lcid=1031 de.dotnetfx35lp_url=http://download.microsoft.com/download/d/1/e/d1e617c3-c7f4-467e-a7de-af832450efd3/dotnetfx35langpack_x86de.exe [Code] procedure dotnetfx35lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5\' + CustomMessage('dotnetfx35lp_lcid'), 'Install', version); if version <> 1 then AddProduct('dotnetfx35_langpack.exe', '/lang:enu /qb /norestart', CustomMessage('dotnetfx35lp_title'), CustomMessage('dotnetfx35lp_size'), CustomMessage('dotnetfx35lp_url')); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx35lp.iss
Inno Setup
gpl3
834
[CustomMessages] mdac28_title=Microsoft Data Access Components 2.8 en.mdac28_size=5.4 MB de.mdac28_size=5,4 MB [Code] const mdac28_url = 'http://download.microsoft.com/download/c/d/f/cdfd58f1-3973-4c51-8851-49ae3777586f/MDAC_TYP.EXE'; procedure mdac28(MinVersion: string); var version: string; begin //check for MDAC installation RegQueryStringValue(HKLM, 'Software\Microsoft\DataAccess', 'FullInstallVer', version); if version < MinVersion then AddProduct('mdac28.exe', '/q:a /c:"install /qb /l"', CustomMessage('mdac28_title'), CustomMessage('mdac28_size'), mdac28_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/mdac28.iss
Inno Setup
gpl3
623
// required by .NET Framework 2.0 Service Pack 1 on Windows 2000 Service Pack 2-4 // http://www.microsoft.com/technet/security/bulletin/ms04-011.mspx // http://www.microsoft.com/downloads/details.aspx?FamilyId=0692C27E-F63A-414C-B3EB-D2342FBB6C00 [CustomMessages] en.kb835732_title=Windows 2000 Security Update (KB835732) de.kb835732_title=Windows 2000 Sicherheitsupdate (KB835732) en.kb835732_size=6.8 MB de.kb835732_size=6,8 MB [Code] const kb835732_url = 'http://download.microsoft.com/download/f/a/a/faa796aa-399d-437a-9284-c3536e9f2e6e/Windows2000-KB835732-x86-ENU.EXE'; procedure kb835732(); begin if (minwinspversion(5, 0, 2) and maxwinspversion(5, 0, 4)) then begin if not RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB835732\Filelist') then AddProduct('kb835732.exe', '/q:a /c:"install /q"', CustomMessage('kb835732_title'), CustomMessage('kb835732_size'), kb835732_url); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/kb835732.iss
Inno Setup
gpl3
967
// requires Windows 2000; Windows Server 2003 Service Pack 1 for Itanium-based Systems; Windows Server 2003 x64 editions; Windows Server 2008 Datacenter; Windows Server 2008 Enterprise; Windows Server 2008 for Itanium-based Systems; Windows Server 2008 Standard; Windows Vista Business; Windows Vista Enterprise; Windows Vista Home Basic; Windows Vista Home Premium; Windows Vista Starter; Windows Vista Ultimate; Windows XP; Windows XP Professional x64 Edition; Windows NT 4.0 Service Pack 6a // requires internet explorer 5.0.1 or higher // http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3 [CustomMessages] dotnetfx11_title=.NET Framework 1.1 en.dotnetfx11_size=23.1 MB de.dotnetfx11_size=23,1 MB [Code] const dotnetfx11_url = 'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe'; procedure dotnetfx11(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'Install', version); if version <> 1 then AddProduct('dotnetfx11.exe', '/q:a /c:"install /qb /l"', CustomMessage('dotnetfx11_title'), CustomMessage('dotnetfx11_size'), dotnetfx11_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx11.iss
Inno Setup
gpl3
1,247
// requires Windows 2000 Service Pack 4, Windows Server 2003, Windows XP Service Pack 2 // requires KB 835732 on Windows 2000 Service Pack 4 // http://www.microsoft.com/downloads/details.aspx?FamilyID=79bc3b77-e02c-4ad3-aacf-a7633f706ba5 [CustomMessages] dotnetfx20sp1_title=.NET Framework 2.0 Service Pack 1 en.dotnetfx20sp1_size=23.6 MB de.dotnetfx20sp1_size=23,6 MB [Code] const dotnetfx20sp1_url = 'http://download.microsoft.com/download/0/8/c/08c19fa4-4c4f-4ffb-9d6c-150906578c9e/NetFx20SP1_x86.exe'; dotnetfx20sp1_url_x64 = 'http://download.microsoft.com/download/9/8/6/98610406-c2b7-45a4-bdc3-9db1b1c5f7e2/NetFx20SP1_x64.exe'; dotnetfx20sp1_url_ia64 = 'http://download.microsoft.com/download/c/9/7/c97d534b-8a55-495d-ab06-ad56f4b7f155/NetFx20SP1_ia64.exe'; procedure dotnetfx20sp1(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'SP', version); if version < 1 then AddProduct('dotnetfx20sp1.exe', '/q:a /t:' + ExpandConstant('{tmp}{\}') + 'dotnetfx20sp1 /c:"install /qb /l /msipassthru MSI_PROP_BEGIN" REBOOT=Suppress "MSI_PROP_END"', CustomMessage('dotnetfx20sp1_title'), CustomMessage('dotnetfx20sp1_size'), GetURL(dotnetfx20sp1_url, dotnetfx20sp1_url_x64, dotnetfx20sp1_url_ia64)); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20sp1.iss
Inno Setup
gpl3
1,316
[CustomMessages] msi31_title=Windows Installer 3.1 en.msi31_size=2.5 MB de.msi31_size=2,5 MB [Code] const msi31_url = 'http://download.microsoft.com/download/1/4/7/147ded26-931c-4daf-9095-ec7baf996f46/WindowsInstaller-KB893803-v2-x86.exe'; procedure msi31(MinVersion: string); begin // Check for required Windows Installer 3.0 on Windows 2000 or higher if minwinversion(5, 0) and (fileversion(ExpandConstant('{sys}{\}msi.dll')) < MinVersion) then AddProduct('msi31.exe', '/qb /norestart', CustomMessage('msi31_title'), CustomMessage('msi31_size'), msi31_url,true,false); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/msi31.iss
Inno Setup
gpl3
618
// requires Windows 2000 Service Pack 3, Windows 98, Windows 98 Second Edition, Windows ME, Windows Server 2003, Windows XP Service Pack 2 // requires internet explorer 5.0.1 or higher // requires windows installer 2.0 on windows 98, ME // requires windows installer 3.1 on windows 2000 or higher // http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5 [CustomMessages] dotnetfx20_title=.NET Framework 2.0 en.dotnetfx20_size=23 MB de.dotnetfx20_size=23 MB [Code] const dotnetfx20_url = 'http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe'; dotnetfx20_url_x64 = 'http://download.microsoft.com/download/a/3/f/a3f1bf98-18f3-4036-9b68-8e6de530ce0a/NetFx64.exe'; dotnetfx20_url_ia64 = 'http://download.microsoft.com/download/f/8/6/f86148a4-e8f7-4d08-a484-b4107f238728/NetFx64.exe'; procedure dotnetfx20(); var version: cardinal; begin RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'Install', version); if version <> 1 then begin AddProduct('dotnetfx20.exe', '/q:a /t:' + ExpandConstant('{tmp}{\}') + 'dotnetfx20 /c:"install /qb /l"', CustomMessage('dotnetfx20_title'), CustomMessage('dotnetfx20_size'), GetURL(dotnetfx20_url, dotnetfx20_url_x64, dotnetfx20_url_ia64)); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20.iss
Inno Setup
gpl3
1,366
// requires Windows 2000 Service Pack 4, Windows Server 2003 Service Pack 1, Windows XP Service Pack 2 // SQL Express 2005 Service Pack 1+ should be installed for SQL Express 2005 to work on Vista // requires windows installer 3.1 // http://www.microsoft.com/downloads/details.aspx?FamilyID=220549b5-0b07-4448-8848-dcc397514b41 [CustomMessages] sql2005express_title=SQL Server 2005 Express en.sql2005express_size=57.7 MB de.sql2005express_size=57,7 MB [Code] const sql2005express_url = 'http://download.microsoft.com/download/f/1/0/f10c4f60-630e-4153-bd53-c3010e4c513b/SQLEXPR.EXE'; procedure sql2005express(); var version: cardinal; begin //CHECK NOT FINISHED YET //RTM: 9.00.1399.06 //Service Pack 1: 9.1.2047.00 //Service Pack 2: 9.2.3042.00 RegQueryDWordValue(HKLM, 'Software\Microsoft\Microsoft SQL Server\90\DTS\Setup', 'Install', version); if version <> 1 then AddProduct('sql2005express.exe', '/qb', CustomMessage('sql2005express_title'), CustomMessage('sql2005express_size'), sql2005express_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/sql2005express.iss
Inno Setup
gpl3
1,070
//http://www.microsoft.com/downloads/details.aspx?familyid=92E0E1CE-8693-4480-84FA-7D85EEF59016 [CustomMessages] de.dotnetfx20lp_title=.NET Framework 2.0 Sprachpaket: Deutsch de.dotnetfx20lp_size=1,8 MB ;http://www.microsoft.com/globaldev/reference/lcid-all.mspx de.dotnetfx20lp_lcid=1031 de.dotnetfx20lp_url=http://download.microsoft.com/download/2/9/7/29768238-56c3-4ea6-abba-4c5246f2bc81/langpack.exe de.dotnetfx20lp_url_x64=http://download.microsoft.com/download/2/e/f/2ef250ba-a868-4074-a4c9-249004866f87/langpack.exe de.dotnetfx20lp_url_ia64=http://download.microsoft.com/download/8/9/8/898c5670-5e74-41c4-82fc-68dd837af627/langpack.exe [Code] procedure dotnetfx20lp(); var version: cardinal; begin if ActiveLanguage() <> 'en' then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\' + CustomMessage('dotnetfx20lp_lcid'), 'Install', version); if version <> 1 then AddProduct(ExpandConstant('dotnetfx20_langpack.exe'), '/q:a /c:"install /qb /l"', CustomMessage('dotnetfx20lp_title'), CustomMessage('dotnetfx20lp_size'), GetURL(CustomMessage('dotnetfx20lp_url'), CustomMessage('dotnetfx20lp_url_x64'), CustomMessage('dotnetfx20lp_url_ia64'))); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx20lp.iss
Inno Setup
gpl3
1,258
[CustomMessages] dotnetfx40_title=.NET Framework 4.0 Client Profile en.dotnetfx40_size=48.1 MB de.dotnetfx40_size=48,1 MB [Code] const dotnetfx40_url = 'http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe'; procedure dotnetfx40client(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Client', 'Install', version); if version <> 1 then AddProduct('dotNetFx40_Client_x86_x64.exe', '/q:a /t:' + ExpandConstant('{tmp}{\}') + 'dotNetFx40_Client_x86_x64.exe /c:"install /qb /l"', CustomMessage('dotnetfx40_title'), CustomMessage('dotnetfx40_size'), dotnetfx40_url,true,true); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx40client.iss
Inno Setup
gpl3
735
// requires Windows Server 2003 Service Pack 1, Windows Server 2008, Windows Vista, Windows XP Service Pack 2 // requires windows installer 3.1 // WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below // http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6 [CustomMessages] dotnetfx35_title=.NET Framework 3.5 en.dotnetfx35_size=3 MB - 197 MB de.dotnetfx35_size=3 MB - 197 MB [Code] const dotnetfx35_url = 'http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe'; procedure dotnetfx35(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v3.5', 'Install', version); if version <> 1 then AddProduct('dotnetfx35.exe', '/lang:enu /qb /norestart', CustomMessage('dotnetfx35_title'), CustomMessage('dotnetfx35_size'), dotnetfx35_url); end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/dotnetfx35.iss
Inno Setup
gpl3
1,039
// WARNING: Windows Update is better because there are different versions for different OS // (optional) critical security hotfix for .NET Framework 1.1 Service Pack 1 on Windows 2000/XP // http://support.microsoft.com/?id=928366 // http://www.microsoft.com/downloads/details.aspx?familyid=281FB2CD-C715-4F05-A01F-0455D2D9EBFB [CustomMessages] en.kb928366_title=.NET Framework 1.1 SP1 Security Update (KB928366) de.kb928366_title=.NET Framework 1.1 SP1 Sicherheitsupdate (KB928366) en.kb928366_size=8.8 MB de.kb928366_size=8,8 MB [Code] const kb928366_url = 'http://download.microsoft.com/download/6/d/0/6d0e5797-91eb-401a-a61f-58b369302018/NDP1.1sp1-KB928366-X86.exe'; procedure kb928366(); var version: cardinal; begin RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v1.1.4322', 'SP', version); if version = 1 then begin RegQueryDWordValue(HKLM, 'Software\Microsoft\Updates\.NETFramework\1.1\M928366', 'Installed', version); if version <> 1 then AddProduct('kb928366.exe', '/q', CustomMessage('kb928366_title'), CustomMessage('kb928366_size'), kb928366_url); end; end;
zzgaminginc-pointofssale
SambaSetup/scripts/products/kb928366.iss
Inno Setup
gpl3
1,155
[Files] Source: "scripts\isxdl\isxdl.dll"; Flags: dontcopy [Code] procedure isxdl_AddFile(URL, Filename: PChar); external 'isxdl_AddFile@files:isxdl.dll stdcall'; function isxdl_DownloadFiles(hWnd: Integer): Integer; external 'isxdl_DownloadFiles@files:isxdl.dll stdcall'; function isxdl_SetOption(Option, Value: PChar): Integer; external 'isxdl_SetOption@files:isxdl.dll stdcall'; procedure isxdl_ClearFiles; external 'isxdl_ClearFiles@files:isxdl.dll stdcall';
zzgaminginc-pointofssale
SambaSetup/scripts/isxdl/isxdl.iss
Inno Setup
gpl3
480
' SambaPOS Training V3.3 ' ' Developed by John Sheather (aka JohnSCS) for SambaPOS ' 16-Feb-2012 ' ' Forum Support - http://forum2.sambapos.com/index.php/topic,184.0.html ' Web Site - http://www.sambapos.com/en ' ' strDelTrSQLCE = False ' Change this to True to automatically refresh the Training Database each time Training is run. Const ForReading = 1 Const ForWriting = 2 dim sampletext, objRegExp, SearchPattern, ReplacePattern, matches dim outputArray, inputText, message, strDS, strIS, intReturn Dim objFSO, objFile, match, strFileName, strE2CE1, strE2CE2, strE2CE3, strE2CE4 dim fso, oShell, strUserProfile, strSSLoc, strTrSQLLoc Dim sCurPath sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".") strSamba = strInDir & "Samba.Presentation.exe" sParentPath = "" sPath = split(sCurPath,"\") for i = 0 to UBound(sPath)-1 sParentPath = sParentPath & sPath(i) & "\" next Set fso = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("Wscript.Shell") strUserProfile = oShell.ExpandEnvironmentStrings("%USERPROFILE%") ' Check that Compact SQL is installed If (fso.FolderExists("C:\Program Files\Microsoft SQL Server Compact Edition")=False) Then message = "SambaPOS Training Requires Microsoft SQL Server Compact V4.0 to be installed." response = msgbox (message,16,"SambaPOS Training") Wscript.Quit End if ' Find SambaSettings.txt file If (fso.FileExists(strUserProfile&"\AppData\Roaming\Ozgu Tech\SambaPOS2\SambaSettings.txt")) Then strSSLoc = strUserProfile&"\AppData\Roaming\Ozgu Tech\SambaPOS2\SambaSettings.txt" strTrSQLLoc = strUserProfile&"\AppData\Roaming\Ozgu Tech\SambaPOS2\" Else if (fso.FileExists(strUserProfile&"\Application Data\Ozgu Tech\SambaPOS2\SambaSettings.txt")) Then strSSLoc = strUserProfile&"\Application Data\Ozgu Tech\SambaPOS2\SambaSettings.txt" strTrSQLLoc = strUserProfile&"\Application Data\Ozgu Tech\SambaPOS2\" Else if (fso.FileExists("C:\ProgramData\Ozgu Tech\SambaPOS2\SambaSettings.txt")) Then strSSLoc = "C:\ProgramData\Ozgu Tech\SambaPOS2\SambaSettings.txt" strTrSQLLoc = "C:\ProgramData\Ozgu Tech\SambaPOS2\" Else if (fso.FileExists("C:\Documents and Settings\All Users\Application Data\Ozgu Tech\SambaPOS2\SambaSettings.txt")) Then strSSLoc = "C:\Documents and Settings\All Users\Application Data\Ozgu Tech\SambaPOS2\SambaSettings.txt" strTrSQLLoc = "C:\Documents and Settings\All Users\Application Data\Ozgu Tech\SambaPOS2\" End If End If End If End If strTrSQLCE = strTrSQLLoc & "SambaTrain.sdf" ' Get data connection string Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(strSSLoc, ForReading) Do Until objFile.AtEndOfStream sampletext = objFile.ReadAll SearchPattern = "<ConnectionString>" SearchPattern = SearchPattern & "(.*?)([\s\S]*?)" SearchPattern = SearchPattern & "</ConnectionString>" Set objRegExp = New RegExp objRegExp.Pattern = SearchPattern ' apply the search pattern objRegExp.Global = True ' match all instances if the serach pattern objRegExp.IgnoreCase = True ' ignore case Set matches = objRegExp.execute(sampletext) If matches.Count > 0 Then For Each match in matches inputText=Split(Split(match.Value, ">")(1), "<")(0) Next Else ' there were no matches found wscript.echo objRegExp.Pattern & "was not found in the string" End If Loop Set objRegExp = Nothing ' Check if user is running TXT file database if Instr(1,inputText,".txt",vbTextCompare) > 0 then message = "-- SambaPOS Training Does Not Work With TXT Files --" & vbCRLF & vbCRLF & "Please install either" & vbCRLF & vbCRLF & "Microsoft SQL Server Compact 4.0 (Standalone POS)" & vbCRLF & "or" & vbCRLF & "Microsoft SQL Server 2008 Express (Networked POS)" response = msgbox (message,16,"SambaPOS Training") Wscript.Quit End if ' check for valid data connection string if Instr(1,inputText,"data source",vbTextCompare) > 0 then strDS = Replace(inputText, "data source=", "") if Instr(1,strDS,"password",vbTextCompare) > 0 then strIS = "False" Else strIS = "True" End if Else message = "SambaPOS Training can not find a" & vbCRLF & "valid Data Connection String" & vbCRLF & vbCRLF & "Please run SambaPOS, go to Manage -> Local Settings and click save." response = msgbox (message,16,"SambaPOS Training") Wscript.Quit End if ' Migrate Database if (fso.FileExists(strTrSQLCE)=False) Then if Instr(1,strDS,".sdf",vbTextCompare) > 0 then Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile strDS, strTrSQLCE, True Else Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = WScript.CreateObject("WScript.Shell") strE2CE1 = "Export2sqlce " & chr(34) & "Data Source=" & strDS & ";Initial Catalog=SambaData2;Integrated Security=" & strIS & ";" & chr(34) & " " & chr(34) & strTrSQLLoc & "SambaTrain.sqlce" & chr(34) strE2CE2 = "sqlcecmd40 -d " & chr(34) & "Data Source=" & strTrSQLLoc & "SambaTrain.sdf" & chr(34) & " -e create" strE2CE3 = "cmd /c sqlcecmd40 -d " & chr(34) & "Data Source=" & strTrSQLLoc & "SambaTrain.sdf" & chr(34) & " -i " & chr(34) & strTrSQLLoc & "SambaTrain.sqlce" & chr(34) & " > " & chr(34) & strTrSQLLoc & "log.txt" & chr(34) intReturn = WshShell.Run(strE2CE1, 2, TRUE) intReturn = WshShell.Run(strE2CE2, 2, TRUE) intReturn = WshShell.Run(strE2CE3, 2, TRUE) if (fso.FileExists(strTrSQLLoc & "log.txt")) Then fso.DeleteFile strTrSQLLoc & "log.txt", True End if if (fso.FileExists(strTrSQLLoc & "SambaTrain.sqlce")) Then fso.DeleteFile strTrSQLLoc & "SambaTrain.sqlce", True End if End if End If ' Backup SambaSettings.txt incase of an issue Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile strSSLoc, strSSLoc & ".bak", True ' Change SambaSettings.txt to SQLCE DB strFileName = strSSLoc strOldText = strDS strNewText = strTrSQLCE Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(strFileName, ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, strOldText, strNewText) Set objFile = objFSO.OpenTextFile(strFileName, ForWriting) objFile.WriteLine strNewText objFile.Close ' Run SambaPOS Set WshShell = WScript.CreateObject("WScript.Shell") intReturn = WshShell.Run(chr(34) & sParentPath & strSamba & chr(34) & " /Training", 3, TRUE) ' Change SambaSettings.txt to original setting strFileName = strSSLoc strNewText = strDS strOldText = strTrSQLCE Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(strFileName, ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, strOldText, strNewText) Set objFile = objFSO.OpenTextFile(strFileName, ForWriting) objFile.WriteLine strNewText objFile.Close ' Delete Training SQLCE File? if (strDelTrSQLCE) then Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile strTrSQLCE, True End if
zzgaminginc-pointofssale
SambaSetup/src/Training/Training.vbs
VBScript
gpl3
7,083
using System.Collections.Generic; using System.Linq; using Samba.Domain.Models.Menus; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class MenuItemGroupedPropertyViewModel : ObservableObject { public string Name { get; set; } public IEnumerable<MenuItemGroupedPropertyItemViewModel> Properties { get; set; } public int ColumnCount { get; set; } public int ButtonHeight { get; set; } public int TerminalColumnCount { get; set; } public int TerminalButtonHeight { get; set; } public MenuItemGroupedPropertyViewModel(TicketItemViewModel selectedItem, IGrouping<string, MenuItemPropertyGroup> menuItemPropertyGroups) { Name = menuItemPropertyGroups.Key; Properties = menuItemPropertyGroups.Select(x => new MenuItemGroupedPropertyItemViewModel(selectedItem, x)).ToList(); ColumnCount = menuItemPropertyGroups.First().ColumnCount; ButtonHeight = menuItemPropertyGroups.First().ButtonHeight; TerminalButtonHeight = menuItemPropertyGroups.First().TerminalButtonHeight; TerminalColumnCount = menuItemPropertyGroups.First().TerminalColumnCount; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/MenuItemGroupedPropertyViewModel.cs
C#
gpl3
1,262
using System; using System.Linq; using System.Windows.Input; namespace Samba.Presentation.ViewModels { public class ScreenSubCategoryButton { public string Name { get; set; } public string Caption { get { return GetCaption(); } } public string ButtonColor { get; set; } private string GetCaption() { return (BackButton ? "< " : "") + Name.Split(',').Last().Trim(); } public ICommand Command { get; set; } public int Height { get; set; } public bool BackButton { get; set; } public ScreenSubCategoryButton(string name, ICommand command, string buttonColor, int height, bool backButton = false) { Name = name; Command = command; Height = height; BackButton = backButton; ButtonColor = buttonColor; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/ScreenSubCategoryButton.cs
C#
gpl3
918
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; using Samba.Domain.Models.Settings; using Samba.Domain.Models.Tickets; namespace Samba.Presentation.ViewModels { public class PrintJobButton { public PrintJobButton(PrintJob model, Ticket ticket) { Model = model; Ticket = ticket; } public PrintJob Model { get; set; } public string Caption { get { return GetCaption(); } } public Ticket Ticket { get; set; } public string GetCaption() { var c = Model.ButtonText ?? Model.Name; var i = Ticket.GetPrintCount(Model.Id); return i > 0 ? string.Format("{0}-{1}", c, i) : c; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/PrintJobButton.cs
C#
gpl3
818
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Domain.Models.Tickets; namespace Samba.Presentation.ViewModels { public class TicketTagButton { private readonly TicketViewModel _ticket; public TicketTagButton(TicketTagGroup ticketTagGroup, TicketViewModel ticket) { Model = ticketTagGroup; Caption = Model.Name; _ticket = ticket; } public TicketTagGroup Model { get; set; } public string Caption { get; set; } public string ButtonColor { get { if (_ticket != null) return !string.IsNullOrEmpty(_ticket.Model.GetTagValue(Model.Name)) ? Model.ButtonColorWhenTagSelected : Model.ButtonColorWhenNoTagSelected; return "Gainsboro"; } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketTagButton.cs
C#
gpl3
980
using System; using System.ComponentModel; using System.Windows; using System.Windows.Input; using System.Windows.Media; using Samba.Domain.Models.Tables; using Samba.Localization; using Samba.Presentation.Common; using Samba.Presentation.Common.Services; using Samba.Services; namespace Samba.Presentation.ViewModels { public class TableScreenItemViewModel : ObservableObject, IDiagram { private readonly ICommand _actionCommand; public TableScreenItemViewModel(Table model, TableScreen screen) : this(model, screen, null) { } public TableScreenItemViewModel(Table model, TableScreen screen, ICommand actionCommand) { _actionCommand = actionCommand; _screen = screen; Model = model; } private readonly TableScreen _screen; private Table _model; [Browsable(false)] public Table Model { get { return _model; } set { _model = value; UpdateButtonColor(); } } [LocalizedDisplayName(ResourceStrings.Table)] public string Name { get { return Model.Name; } } private string _buttonColor; [Browsable(false)] public string ButtonColor { get { return _buttonColor; } set { if (_buttonColor != value) { _buttonColor = value; RaisePropertyChanged("ButtonColor"); } } } [Browsable(false)] public double ButtonHeight { get { return _screen.ButtonHeight > 0 ? _screen.ButtonHeight : double.NaN; } } [Browsable(false)] public ICommand Command { get { return _actionCommand; } } private bool _isEnabled; [Browsable(false)] public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; RaisePropertyChanged("IsEnabled"); } } [Browsable(false)] public string Caption { get { return Model.Name; } set { Model.Name = value; RaisePropertyChanged("Caption"); } } public int X { get { return Model.XLocation; } set { Model.XLocation = value; RaisePropertyChanged("X"); } } public int Y { get { return Model.YLocation; } set { Model.YLocation = value; RaisePropertyChanged("Y"); } } [LocalizedDisplayName(ResourceStrings.Height)] public int Height { get { return Model.Height; } set { Model.Height = value; RaisePropertyChanged("Height"); } } [LocalizedDisplayName(ResourceStrings.Width)] public int Width { get { return Model.Width; } set { Model.Width = value; RaisePropertyChanged("Width"); } } [Browsable(false)] public Transform RenderTransform { get { return new RotateTransform(Model.Angle); } set { Model.Angle = ((RotateTransform)value).Angle; } } public string HtmlContent { get { return Model.HtmlContent; } set { Model.HtmlContent = value; } } public bool AutoRefresh { get { return Model.AutoRefresh; } set { Model.AutoRefresh = value; } } private bool _isDetailsVisible; public bool IsDetailsVisible { get { return _isDetailsVisible; } set { _isDetailsVisible = value; RaisePropertyChanged("IsDetailsVisible"); } } [LocalizedDisplayName(ResourceStrings.Angle)] public double Angle { get { return Model.Angle; } set { Model.Angle = value; RaisePropertyChanged("Angle"); RaisePropertyChanged("RenderTransform"); } } [LocalizedDisplayName(ResourceStrings.CornerRadius)] public CornerRadius CornerRadius { get { return new CornerRadius(Model.CornerRadius); } set { Model.CornerRadius = Convert.ToInt32(value.BottomLeft); RaisePropertyChanged("CornerRadius"); } } public void EditProperties() { if (AppServices.CurrentLoggedInUser.UserRole.IsAdmin) InteractionService.UserIntraction.EditProperties(this); } public void UpdateButtonColor() { IsEnabled = true; if (AppServices.MainDataContext.SelectedTicket != null && Model.IsTicketLocked) IsEnabled = false; if (AppServices.MainDataContext.SelectedTicket != null && Model.TicketId > 0 && !AppServices.IsUserPermittedFor(PermissionNames.MergeTickets)) IsEnabled = false; ButtonColor = Model.TicketId == 0 ? _screen.TableEmptyColor : (Model.IsTicketLocked ? _screen.TableLockedColor : _screen.TableFullColor); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TableScreenItemViewModel.cs
C#
gpl3
5,356
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Infrastructure; using Samba.Localization.Properties; namespace Samba.Presentation.ViewModels { public class TicketTagFilterViewModel : IStringCompareable { public string ButtonDisplay { get { var result = Resources.Back; if (TagValue == "*") return Resources.All; if (TagValue == " ") result = Resources.Empty; if (!string.IsNullOrEmpty(TagValue.Trim())) { result = TagValue; } if (Count > 0) result += " [" + Count + "]"; return result; } } public string TagGroup { get; set; } public string TagValue { get; set; } public int Count { get; set; } public string ButtonColor { get; set; } public TicketTagFilterViewModel() { ButtonColor = "Gray"; } public string GetStringValue() { return TagValue; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketTagFilterViewModel.cs
C#
gpl3
1,139
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Windows.Input; using System.Windows.Media; using Samba.Domain.Models.Customers; using Samba.Domain.Models.Menus; using Samba.Domain.Models.Settings; using Samba.Domain.Models.Tickets; using Samba.Domain.Models.Users; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Presentation.Common.Services; using Samba.Services; using Samba.Infrastructure.Data.Serializer; namespace Samba.Presentation.ViewModels { public static class GenericRuleRegistator { private static bool _registered; public static void RegisterOnce() { Debug.Assert(_registered == false); RegisterActions(); RegisterRules(); RegisterParameterSources(); HandleEvents(); RegisterNotifiers(); _registered = true; } private static void RegisterActions() { RuleActionTypeRegistry.RegisterActionType("SendEmail", Resources.SendEmail, new { SMTPServer = "", SMTPUser = "", SMTPPassword = "", SMTPPort = 0, ToEMailAddress = "", Subject = "", FromEMailAddress = "", EMailMessage = "", FileName = "", DeleteFile = false, BypassSslErrors = false }); RuleActionTypeRegistry.RegisterActionType("AddTicketDiscount", Resources.AddTicketDiscount, new { DiscountPercentage = 0m }); RuleActionTypeRegistry.RegisterActionType("AddTicketItem", Resources.AddTicketItem, new { MenuItemName = "", PortionName = "", Quantity = 0, Gift = false, GiftReason = "", Tag = "" }); RuleActionTypeRegistry.RegisterActionType("GiftLastTicketItem", Resources.GiftLastTicketItem, new { GiftReason = "", Quantity = 0 }); RuleActionTypeRegistry.RegisterActionType("UpdateLastTicketItemPriceTag", Resources.UpdateLastTicketItemPriceTag, new { PriceTag = "" }); RuleActionTypeRegistry.RegisterActionType("UpdateTicketItemPriceTag", Resources.UpdateTicketItemPriceTag, new { PriceTag = "" }); RuleActionTypeRegistry.RegisterActionType("UpdateTicketItemTag", Resources.UpdateTicketItemTag, new { Tag = "" }); RuleActionTypeRegistry.RegisterActionType("VoidTicketItems", Resources.VoidTicketItems, new { MenuItemName = "", Tag = "" }); RuleActionTypeRegistry.RegisterActionType("RemoveLastModifier", Resources.RemoveLastModifier); RuleActionTypeRegistry.RegisterActionType("UpdateTicketTag", Resources.UpdateTicketTag, new { TagName = "", TagValue = "" }); RuleActionTypeRegistry.RegisterActionType("UpdatePriceTag", Resources.UpdatePriceTag, new { DepartmentName = "", PriceTag = "" }); RuleActionTypeRegistry.RegisterActionType("RefreshCache", Resources.RefreshCache); RuleActionTypeRegistry.RegisterActionType("SendMessage", Resources.BroadcastMessage, new { Command = "" }); RuleActionTypeRegistry.RegisterActionType("UpdateProgramSetting", Resources.UpdateProgramSetting, new { SettingName = "", SettingValue = "", UpdateType = Resources.Update, IsLocal = true }); RuleActionTypeRegistry.RegisterActionType("ExecuteTicketEvent", Resources.ExecuteTicketOperation, new { TicketOperationType = "" }); RuleActionTypeRegistry.RegisterActionType("UpdateTicketVat", Resources.UpdateTicketVat, new { VatTemplate = "" }); RuleActionTypeRegistry.RegisterActionType("RegenerateTicketVat", Resources.RegenerateTicketVat); RuleActionTypeRegistry.RegisterActionType("UpdateTicketTaxService", Resources.UpdateTicketTaxService, new { TaxServiceTemplate = "", Amount = 0m }); RuleActionTypeRegistry.RegisterActionType("UpdateTicketAccount", Resources.UpdateTicketAccount, new { AccountPhone = "", AccountName = "", Note = "" }); RuleActionTypeRegistry.RegisterActionType("ExecutePrintJob", Resources.ExecutePrintJob, new { PrintJobName = "", TicketItemTag = "" }); RuleActionTypeRegistry.RegisterActionType("UpdateApplicationSubTitle", "Update Application Subtitle", new { Title = "", Color = "White", FontSize = 12 }); } private static void RegisterRules() { RuleActionTypeRegistry.RegisterEvent(RuleEventNames.UserLoggedIn, Resources.UserLogin, new { UserName = "", RoleName = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.UserLoggedOut, Resources.UserLogout, new { UserName = "", RoleName = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.WorkPeriodStarts, Resources.WorkPeriodStarted, new { UserName = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.WorkPeriodEnds, Resources.WorkPeriodEnded, new { UserName = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TriggerExecuted, Resources.TriggerExecuted, new { TriggerName = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketCreated, Resources.TicketCreated); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLocationChanged, Resources.TicketLocationChanged, new { OldLocation = "", NewLocation = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketTagSelected, Resources.TicketTagSelected, new { TagName = "", TagValue = "", NumericValue = 0, TicketTag = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.CustomerSelectedForTicket, Resources.CustomerSelectedForTicket, new { CustomerId = 0, CustomerName = "", CustomerGroupCode = "", PhoneNumber = "", CustomerNote = "", LastOrderTotal = 0m, LastOrderDayCount = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketTotalChanged, Resources.TicketTotalChanged, new { TicketTotal = 0m, PreviousTotal = 0m, DiscountTotal = 0m, GiftTotal = 0m, DiscountAmount = 0m, TipAmount = 0m, CustomerName = "", CustomerGroupCode = "", CustomerId = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.MessageReceived, Resources.MessageReceived, new { Command = "" }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.PaymentReceived, Resources.PaymentReceived, new { PaymentType = "", Amount = 0, TicketTag = "", CustomerId = 0, CustomerName = "", CustomerGroupCode = "", SelectedLinesCount = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLineAdded, Resources.LineAddedToTicket, new { TicketId = 0m, TicketTag = "", MenuItemName = "", Quantity = 0m, MenuItemGroupCode = "", CustomerName = "", CustomerGroupCode = "", CustomerId = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketLineCancelled, Resources.TicketLineCancelled, new { TicketTag = "", MenuItemName = "", Quantity = 0m, MenuItemGroupCode = "", CustomerName = "", CustomerGroupCode = "", CustomerId = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.PortionSelected, Resources.PortionSelected, new { TicketTag = "", MenuItemName = "", PortionName = "", PortionPrice = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ModifierSelected, Resources.ModifierSelected, new { TicketTag = "", MenuItemName = "", ModifierGroupName = "", ModifierName = "", ModifierPrice = 0, ModifierQuantity = 0, IsRemoved = false, IsPriceAddedToParentPrice = false, TotalPropertyCount = 0, TotalModifierQuantity = 0m, TotalModifierPrice = 0m }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ChangeAmountChanged, Resources.ChangeAmountUpdated, new { TicketAmount = 0, ChangeAmount = 0, TenderedAmount = 0 }); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.TicketClosed, Resources.TicketClosed); RuleActionTypeRegistry.RegisterEvent(RuleEventNames.ApplicationStarted, Resources.ApplicationStarted, new { CommandLineArguments = "" }); } private static void RegisterParameterSources() { RuleActionTypeRegistry.RegisterParameterSoruce("UserName", () => AppServices.MainDataContext.Users.Select(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("DepartmentName", () => AppServices.MainDataContext.Departments.Select(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("TerminalName", () => AppServices.Terminals.Select(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("TriggerName", () => Dao.Select<Trigger, string>(yz => yz.Name, y => !string.IsNullOrEmpty(y.Expression))); RuleActionTypeRegistry.RegisterParameterSoruce("MenuItemName", () => Dao.Select<MenuItem, string>(yz => yz.Name, y => y.Id > 0)); RuleActionTypeRegistry.RegisterParameterSoruce("PriceTag", () => Dao.Select<MenuItemPriceDefinition, string>(x => x.PriceTag, x => x.Id > 0)); RuleActionTypeRegistry.RegisterParameterSoruce("Color", () => typeof(Colors).GetProperties(BindingFlags.Public | BindingFlags.Static).Select(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("VatTemplate", () => Dao.Select<VatTemplate, string>(x => x.Name, x => x.Id > 0)); RuleActionTypeRegistry.RegisterParameterSoruce("TaxServiceTemplate", () => Dao.Select<TaxServiceTemplate, string>(x => x.Name, x => x.Id > 0)); RuleActionTypeRegistry.RegisterParameterSoruce("TagName", () => Dao.Select<TicketTagGroup, string>(x => x.Name, x => x.Id > 0)); RuleActionTypeRegistry.RegisterParameterSoruce("PaymentType", () => new[] { Resources.Cash, Resources.CreditCard, Resources.Ticket }); RuleActionTypeRegistry.RegisterParameterSoruce("PrintJobName", () => Dao.Distinct<PrintJob>(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("CustomerGroupCode", () => Dao.Distinct<Customer>(x => x.GroupCode)); RuleActionTypeRegistry.RegisterParameterSoruce("MenuItemGroupCode", () => Dao.Distinct<MenuItem>(x => x.GroupCode)); RuleActionTypeRegistry.RegisterParameterSoruce("UpdateType", () => new[] { Resources.Update, Resources.Increase, Resources.Decrease, "Toggle", "Multiply" }); RuleActionTypeRegistry.RegisterParameterSoruce("GiftReason", () => Dao.Select<Reason, string>(x => x.Name, x => x.ReasonType == 1).Distinct()); RuleActionTypeRegistry.RegisterParameterSoruce("PortionName", () => Dao.Distinct<MenuItemPortion>(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("ModifierGroupName", () => Dao.Distinct<MenuItemPropertyGroup>(x => x.Name)); RuleActionTypeRegistry.RegisterParameterSoruce("TicketOperationType", () => new[] { Resources.Refresh, Resources.Close }); } private static void ResetCache() { TriggerService.UpdateCronObjects(); AppServices.ResetCache(); AppServices.MainDataContext.SelectedDepartment.PublishEvent(EventTopicNames.SelectedDepartmentChanged); CommandManager.InvalidateRequerySuggested(); } private static void HandleEvents() { EventServiceFactory.EventService.GetEvent<GenericEvent<ActionData>>().Subscribe(x => { if (x.Value.Action.ActionType == "UpdateApplicationSubTitle") { var title = x.Value.GetAsString("Title"); PresentationServices.SubTitle.ApplicationTitle = title; var fontSize = x.Value.GetAsInteger("FontSize"); if (fontSize > 0) PresentationServices.SubTitle.ApplicationTitleFontSize = fontSize; var fontColor = x.Value.GetAsString("Color"); if (!string.IsNullOrEmpty(fontColor)) PresentationServices.SubTitle.ApplicationTitleColor = fontColor; } if (x.Value.Action.ActionType == "RemoveLastModifier") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket == null) return; var ti = x.Value.GetDataValue<TicketItem>("TicketItem"); if (ti == null) return; if (ti.Properties.Count > 0) { var prop = ti.LastSelectedProperty ?? ti.Properties.Last(); prop.Quantity--; if (prop.Quantity < 1) ti.Properties.Remove(prop); } TicketViewModel.RecalculateTicket(ticket); } if (x.Value.Action.ActionType == "UpdateTicketItemPriceTag") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket == null) return; var ti = x.Value.GetDataValue<TicketItem>("TicketItem"); if (ti == null) return; var priceTag = x.Value.GetAsString("PriceTag"); var mi = AppServices.DataAccessService.GetMenuItem(ti.MenuItemId); if (mi == null) return; var portion = mi.Portions.SingleOrDefault(y => y.Name == ti.PortionName); if (portion == null) return; ti.UpdatePortion(portion, priceTag, null); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } if (x.Value.Action.ActionType == "UpdateTicketItemTag") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket == null) return; var ti = x.Value.GetDataValue<TicketItem>("TicketItem"); if (ti == null) return; var tag = x.Value.GetAsString("Tag"); ti.Tag = tag; decimal val; decimal.TryParse(tag, out val); } if (x.Value.Action.ActionType == "UpdateLastTicketItemPriceTag") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket == null) return; var ti = ticket.TicketItems.LastOrDefault(); if (ti == null) return; var priceTag = x.Value.GetAsString("PriceTag"); var mi = AppServices.DataAccessService.GetMenuItem(ti.MenuItemId); if (mi == null) return; var portion = mi.Portions.SingleOrDefault(y => y.Name == ti.PortionName); if (portion == null) return; ti.UpdatePortion(portion, priceTag, null); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } if (x.Value.Action.ActionType == "GiftLastTicketItem") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var ti = ticket.TicketItems.LastOrDefault(); if (ti != null) { decimal quantity; decimal.TryParse(x.Value.Action.GetParameter("Quantity"), out quantity); if (quantity > 0 && ti.Quantity > quantity) { ti.UpdateSelectedQuantity(quantity); ti = ticket.ExtractSelectedTicketItems(new List<TicketItem> { ti }).FirstOrDefault(); if (ti == null) return; AppServices.MainDataContext.AddItemToSelectedTicket(ti); } var reasonId = 0; var giftReason = x.Value.Action.GetParameter("GiftReason"); if (!string.IsNullOrEmpty(giftReason)) { var reason = Dao.SingleWithCache<Reason>(u => u.Name == giftReason); if (reason != null) reasonId = reason.Id; } ticket.GiftItem(ti, reasonId, AppServices.CurrentLoggedInUser.Id); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } } } if (x.Value.Action.ActionType == "UpdateTicketAccount") { Expression<Func<Customer, bool>> qFilter = null; var phoneNumber = x.Value.GetAsString("AccountPhone"); var accountName = x.Value.GetAsString("AccountName"); var note = x.Value.GetAsString("Note"); if (!string.IsNullOrEmpty(phoneNumber)) { qFilter = y => y.PhoneNumber == phoneNumber; } if (!string.IsNullOrEmpty(accountName)) { if (qFilter == null) qFilter = y => y.Name == accountName; else qFilter = qFilter.And(y => y.Name == accountName); } if (!string.IsNullOrEmpty(note)) { if (qFilter == null) qFilter = y => y.Note == note; else qFilter = qFilter.And(y => y.Note == note); } if (qFilter != null) { var customer = Dao.Query(qFilter).FirstOrDefault(); if (customer != null) AppServices.MainDataContext.AssignCustomerToSelectedTicket(customer); } else AppServices.MainDataContext.AssignCustomerToSelectedTicket(Customer.Null); } if (x.Value.Action.ActionType == "UpdateProgramSetting") { SettingAccessor.ResetCache(); var settingName = x.Value.GetAsString("SettingName"); var updateType = x.Value.GetAsString("UpdateType"); if (!string.IsNullOrEmpty(settingName)) { var isLocal = x.Value.GetAsBoolean("IsLocal"); var setting = isLocal ? AppServices.SettingService.ReadLocalSetting(settingName) : AppServices.SettingService.ReadGlobalSetting(settingName); if (updateType == Resources.Increase) { var settingValue = x.Value.GetAsInteger("SettingValue"); if (string.IsNullOrEmpty(setting.StringValue)) setting.IntegerValue = settingValue; else setting.IntegerValue = setting.IntegerValue + settingValue; } else if (updateType == Resources.Decrease) { var settingValue = x.Value.GetAsInteger("SettingValue"); if (string.IsNullOrEmpty(setting.StringValue)) setting.IntegerValue = settingValue; else setting.IntegerValue = setting.IntegerValue - settingValue; } else if (updateType == "Multiply") { if (string.IsNullOrEmpty(setting.StringValue)) setting.DecimalValue = 0; else setting.DecimalValue = setting.DecimalValue * x.Value.GetAsDecimal("SettingValue"); } else if (updateType == "Toggle") { var settingValue = x.Value.GetAsString("SettingValue"); var parts = settingValue.Split(','); if (string.IsNullOrEmpty(setting.StringValue)) { setting.StringValue = parts[0]; } else { for (var i = 0; i < parts.Length; i++) { if (parts[i] == setting.StringValue) { setting.StringValue = (i + 1) < parts.Length ? parts[i + 1] : parts[0]; break; } } } } else { var settingValue = x.Value.GetAsString("SettingValue"); setting.StringValue = settingValue; } if (!isLocal) AppServices.SettingService.SaveChanges(); } } if (x.Value.Action.ActionType == "RefreshCache") { MethodQueue.Queue("ResetCache", ResetCache); } if (x.Value.Action.ActionType == "SendMessage") { AppServices.MessagingService.SendMessage("ActionMessage", x.Value.GetAsString("Command")); } if (x.Value.Action.ActionType == "SendEmail") { EMailService.SendEMailAsync(x.Value.GetAsString("SMTPServer"), x.Value.GetAsString("SMTPUser"), x.Value.GetAsString("SMTPPassword"), x.Value.GetAsInteger("SMTPPort"), x.Value.GetAsString("ToEMailAddress"), x.Value.GetAsString("FromEMailAddress"), x.Value.GetAsString("Subject"), x.Value.GetAsString("EMailMessage"), x.Value.GetAsString("FileName"), x.Value.GetAsBoolean("DeleteFile"), x.Value.GetAsBoolean("BypassSslErrors")); } if (x.Value.Action.ActionType == "ExecuteTicketEvent") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var operationName = x.Value.GetAsString("TicketOperation"); if (operationName == Resources.Refresh) EventServiceFactory.EventService.PublishEvent(EventTopicNames.DisplayTicketView); if (operationName == Resources.Close) ticket.PublishEvent(EventTopicNames.PaymentSubmitted); } } if (x.Value.Action.ActionType == "UpdateTicketVat") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var vatTemplateName = x.Value.GetAsString("VatTemplate"); var vatTemplate = AppServices.MainDataContext.VatTemplates.FirstOrDefault(y => y.Name == vatTemplateName); if (vatTemplate != null) { ticket.UpdateVat(vatTemplate); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } } } if (x.Value.Action.ActionType == "UpdateTicketTaxService") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var taxServiceTemplateName = x.Value.GetAsString("TaxServiceTemplate"); var taxServiceTemplate = AppServices.MainDataContext.TaxServiceTemplates.FirstOrDefault( y => y.Name == taxServiceTemplateName); if (taxServiceTemplate != null) { var amount = x.Value.GetAsDecimal("Amount"); ticket.AddTaxService(taxServiceTemplate.Id, taxServiceTemplate.CalculationMethod, amount); TicketViewModel.RecalculateTicket(ticket); } } } if (x.Value.Action.ActionType == "RegenerateTicketVat") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { TicketViewModel.RegenerateVatRates(ticket); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } } if (x.Value.Action.ActionType == "AddTicketDiscount") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var percentValue = x.Value.GetAsDecimal("DiscountPercentage"); ticket.AddTicketDiscount(DiscountType.Percent, percentValue, AppServices.CurrentLoggedInUser.Id); TicketViewModel.RecalculateTicket(ticket); } } if (x.Value.Action.ActionType == "AddTicketItem") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var menuItemName = x.Value.GetAsString("MenuItemName"); var menuItem = AppServices.DataAccessService.GetMenuItemByName(menuItemName); var portionName = x.Value.GetAsString("PortionName"); var quantity = x.Value.GetAsDecimal("Quantity"); var gifted = x.Value.GetAsBoolean("Gift"); var giftReason = x.Value.GetAsString("GiftReason"); var tag = x.Value.GetAsString("Tag"); var departmentId = AppServices.CurrentTerminal.DepartmentId > 0 ? AppServices.MainDataContext.SelectedDepartment.Id : ticket.DepartmentId; var ti = ticket.AddTicketItem(AppServices.CurrentLoggedInUser.Id, departmentId, menuItem, portionName, AppServices.MainDataContext.SelectedDepartment.PriceTag, ""); ti.Quantity = quantity; ti.Gifted = gifted; if (gifted && !string.IsNullOrEmpty(giftReason)) { var reason = Dao.SingleWithCache<Reason>(u => u.Name == giftReason); if (reason != null) ti.ReasonId = reason.Id; } else { ti.ReasonId = 0; } ti.Tag = tag; TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } } if (x.Value.Action.ActionType == "VoidTicketItems") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var menuItemName = x.Value.GetAsString("MenuItemName"); var tag = x.Value.GetAsString("Tag"); if (!string.IsNullOrEmpty(menuItemName) && !string.IsNullOrEmpty(tag)) { var lines = ticket.TicketItems.Where(y => !y.Voided && (string.IsNullOrEmpty(menuItemName) || y.MenuItemName.Contains(menuItemName)) && (y.Tag.Contains(tag) || string.IsNullOrEmpty(tag))).ToList(); lines.ForEach(y => ticket.VoidItem(y, 0, AppServices.CurrentLoggedInUser.Id)); TicketViewModel.RecalculateTicket(ticket); EventServiceFactory.EventService.PublishEvent(EventTopicNames.RefreshSelectedTicket); } } } if (x.Value.Action.ActionType == "UpdateTicketTag") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); if (ticket != null) { var tagName = x.Value.GetAsString("TagName"); var tagValue = x.Value.GetAsString("TagValue"); if (tagValue.Contains(",")) { var ctag = ticket.GetTagValue(tagName); if (!string.IsNullOrEmpty(ctag)) { var nextTag = tagValue.Split(',').SkipWhile(y => y != ctag).Skip(1).FirstOrDefault(); if (string.IsNullOrEmpty(nextTag)) nextTag = tagValue.Split(',')[0]; tagValue = nextTag; } } ticket.SetTagValue(tagName, tagValue); var tagData = new TicketTagData { TagName = tagName, TagValue = tagValue }; tagData.PublishEvent(EventTopicNames.TagSelectedForSelectedTicket); } } if (x.Value.Action.ActionType == "UpdatePriceTag") { using (var workspace = WorkspaceFactory.Create()) { var priceTag = x.Value.GetAsString("PriceTag"); var departmentName = x.Value.GetAsString("DepartmentName"); var department = workspace.Single<Department>(y => y.Name == departmentName); if (department != null) { department.PriceTag = priceTag; workspace.CommitChanges(); MethodQueue.Queue("ResetCache", ResetCache); } } } if (x.Value.Action.ActionType == "ExecutePrintJob") { var ticket = x.Value.GetDataValue<Ticket>("Ticket"); var pjName = x.Value.GetAsString("PrintJobName"); var ticketItemTag = x.Value.GetAsString("TicketItemTag"); if (!string.IsNullOrEmpty(pjName)) { var j = AppServices.CurrentTerminal.PrintJobs.SingleOrDefault(y => y.Name == pjName); if (j != null) { if (ticket != null) { AppServices.MainDataContext.UpdateTicketNumber(ticket); if (j.LocksTicket) ticket.RequestLock(); var clonedTicket = ObjectCloner.Clone(ticket); clonedTicket.CopyPaidItemsCache(ticket); if (!string.IsNullOrEmpty(ticketItemTag)) clonedTicket.TicketItems = clonedTicket.TicketItems.Where(y => !string.IsNullOrEmpty(y.Tag) && y.Tag.ToLower().Contains(ticketItemTag.Trim().ToLower())).ToList(); AppServices.PrintService.ManualPrintTicket(clonedTicket, j); } else AppServices.PrintService.ExecutePrintJob(j); } } } }); } private static void RegisterNotifiers() { EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(x => { if (x.Topic == EventTopicNames.MessageReceivedEvent && x.Value.Command == "ActionMessage") { RuleExecutor.NotifyEvent(RuleEventNames.MessageReceived, new { Command = x.Value.Data }); } if (x.Topic == EventTopicNames.MessageReceivedEvent && x.Value.Command == "SHUTDOWN") { RuleExecutor.NotifyEvent(RuleEventNames.MessageReceived, new { Command = "SHUTDOWN" }); } }); EventServiceFactory.EventService.GetEvent<GenericEvent<User>>().Subscribe(x => { if (x.Topic == EventTopicNames.UserLoggedIn) { RuleExecutor.NotifyEvent(RuleEventNames.UserLoggedIn, new { User = x.Value, UserName = x.Value.Name, RoleName = x.Value.UserRole.Name }); } if (x.Topic == EventTopicNames.UserLoggedOut) { RuleExecutor.NotifyEvent(RuleEventNames.UserLoggedOut, new { User = x.Value, UserName = x.Value.Name, RoleName = x.Value.UserRole.Name }); } }); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/GenericRuleRegistator.cs
C#
gpl3
34,888
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Domain.Models.Tables; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class TerminalOpenTicketView : ObservableObject { public int Id { get; set; } public string LocationName { get; set; } public string CustomerName { get; set; } public string TicketNumber { get; set; } public bool IsLocked { get; set; } public string TicketTag { get; set; } public string Info { get; set; } public string ButtonColor { get { return IsLocked ? "Silver" : "White"; } } public string Title { get { var result = TicketNumber; if (!string.IsNullOrEmpty(Info)) return Info + "-" + result; if (!string.IsNullOrEmpty(LocationName)) return LocationName; return result; } } public string TitleTextColor { get { return !string.IsNullOrEmpty(Info) || !string.IsNullOrEmpty(LocationName) || !string.IsNullOrEmpty(CustomerName) ? "DarkBlue" : "Maroon"; } } public void Refresh() { RaisePropertyChanged("Title"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TerminalOpenTicketView.cs
C#
gpl3
1,310
using Samba.Domain.Foundation; using Samba.Domain.Models.Menus; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class MenuItemPortionViewModel : ObservableObject { public MenuItemPortion Model { get; set; } public MenuItemPortionViewModel(MenuItemPortion model) { Model = model; } public string Name { get { return Model.Name; } set { Model.Name = value; } } public Price Price { get { return Model.Price; } set { Model.Price = value; } } public void Refresh() { RaisePropertyChanged("Name"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/MenuItemPortionViewModel.cs
C#
gpl3
672
using Samba.Domain.Models.Tickets; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class TicketItemPropertyViewModel : ObservableObject { public TicketItemProperty Model { get; set; } public TicketItemPropertyViewModel(TicketItemProperty model) { Model = model; } public string DisplayString { get { if (Model.Quantity > 1) return Model.Name + " x " + Model.Quantity.ToString("#"); return Model.Name; } } public string PriceString { get { return Model.PropertyPrice.Amount != 0 && !Model.CalculateWithParentPrice ? ((Model.PropertyPrice.Amount + Model.VatAmount) * Model.Quantity).ToString("#,#0.00") : ""; } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketItemPropertyViewModel.cs
C#
gpl3
933
using System; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Media; using Microsoft.Practices.Prism.Commands; using Samba.Domain.Models.Menus; using Samba.Domain.Models.Tickets; using Samba.Localization.Properties; using Samba.Presentation.Common; using Samba.Presentation.Common.Services; using Samba.Services; namespace Samba.Presentation.ViewModels { public class TicketItemViewModel : ObservableObject { public bool IsSelectedQuantityModified { get; set; } public TicketItemViewModel(TicketItem model) { _model = model; ResetSelectedQuantity(); ItemSelectedCommand = new DelegateCommand<TicketItemViewModel>(OnItemSelected); Properties = new ObservableCollection<TicketItemPropertyViewModel>(model.Properties.Select(x => new TicketItemPropertyViewModel(x))); UpdateItemColor(); } public DelegateCommand<TicketItemViewModel> ItemSelectedCommand { get; set; } public string Description { get { string desc = _model.MenuItemName + _model.GetPortionDesc(); if (IsGifted) desc = Resources.Gift_ab + desc; if (IsVoided) desc = Resources.Void_ab + desc; if (IsSelectedQuantityModified) desc = string.Format("({0:#.##}) {1}", Model.SelectedQuantity, desc); return desc; } } private readonly TicketItem _model; public TicketItem Model { get { return _model; } } public decimal Quantity { get { return _model.Quantity; } set { _model.Quantity = value; RaisePropertyChanged("Quantity"); RaisePropertyChanged("TotalPrice"); ResetSelectedQuantity(); } } public decimal SelectedQuantity { get { return Model.SelectedQuantity; } } public void IncSelectedQuantity() { Model.IncSelectedQuantity(); IsSelectedQuantityModified = true; RefreshSelectedItem(); } public void DecSelectedQuantity() { Model.DecSelectedQuantity(); IsSelectedQuantityModified = true; RefreshSelectedItem(); } public void ResetSelectedQuantity() { Model.ResetSelectedQuantity(); IsLastSelected = false; IsSelectedQuantityModified = false; RefreshSelectedItem(); } private void RefreshSelectedItem() { RaisePropertyChanged("SelectedQuantity"); RaisePropertyChanged("Description"); RaisePropertyChanged("Background"); RaisePropertyChanged("Foreground"); RaisePropertyChanged("BorderThickness"); } public decimal Price { get { return Model.GetMenuItemPrice(); } } public decimal TotalPrice { get { return Price * Quantity; } } private bool _selected; public bool Selected { get { return _selected; } set { _selected = value; UpdateItemColor(); RaisePropertyChanged("Selected"); } } private Brush _background; public Brush Background { get { return _background; } set { _background = value; RaisePropertyChanged("Background"); } } private Brush _foreground; public Brush Foreground { get { return _foreground; } set { _foreground = value; RaisePropertyChanged("Foreground"); } } public int BorderThickness { get { return IsLastSelected ? 1 : 0; } } public string OrderNumber { get { return Model.OrderNumber > 0 ? string.Format(Resources.OrderNumber_f, Model.OrderNumber, CreatingUserName) : Resources.NewOrder; } } public object GroupObject { get { return new { OrderNumber, Time = Model.Id > 0 ? Model.CreatedDateTime.ToShortTimeString() : "" }; } } public string CreatingUserName { get { return AppServices.MainDataContext.GetUserName(Model.CreatingUserId); } } public string CustomPropertyName { get { return Model.GetCustomProperty() != null ? Model.GetCustomProperty().Name : ""; } set { Model.UpdateCustomProperty(value, CustomPropertyPrice, CustomPropertyQuantity); RefreshProperties(); } } public decimal CustomPropertyPrice { get { var prop = Model.GetCustomProperty(); if (prop != null) { return Model.VatIncluded ? prop.PropertyPrice.Amount + prop.VatAmount : prop.PropertyPrice.Amount; } return 0; } set { Model.UpdateCustomProperty(CustomPropertyName, value, CustomPropertyQuantity); RefreshProperties(); } } public decimal CustomPropertyQuantity { get { return Model.GetCustomProperty() != null ? Model.GetCustomProperty().Quantity : 1; } set { Model.UpdateCustomProperty(CustomPropertyName, CustomPropertyPrice, value); RefreshProperties(); } } public TextDecorationCollection TextDecoration { get { return Model.Voided ? TextDecorations.Strikethrough : null; } } public FontWeight FontWeight { get { return _model.Locked ? FontWeights.Bold : FontWeights.Normal; } } public string Reason { get { return Model.ReasonId > 0 ? AppServices.MainDataContext.GetReason(Model.ReasonId) : ""; } } public string PriceTag { get { return Model.PriceTag + (!string.IsNullOrEmpty(Model.Tag) ? string.Format(" [{0}]", Model.Tag) : ""); } } public ObservableCollection<TicketItemPropertyViewModel> Properties { get; private set; } public bool IsGifted { get { return Model.Gifted; } } public bool IsVoided { get { return Model.Voided; } } public bool IsLocked { get { return Model.Locked; } } private bool _isLastSelected; public bool IsLastSelected { get { return _isLastSelected; } set { _isLastSelected = value; RaisePropertyChanged("BorderThickness"); } } private void OnItemSelected(TicketItemViewModel obj) { if (Selected && !IsLocked) { var unselectedItem = AppServices.DataAccessService.GetUnselectedItem(obj.Model); if (unselectedItem != null) { InteractionService.UserIntraction.GiveFeedback(string.Format(Resources.SelectionRequired_f, unselectedItem.Name)); return; } } Selected = !Selected; if (!Selected) ResetSelectedQuantity(); this.PublishEvent(EventTopicNames.SelectedItemsChanged); } private void UpdateItemColor() { if (Selected) { Background = SystemColors.HighlightBrush; Foreground = SystemColors.HighlightTextBrush; } else { Background = null; Foreground = SystemColors.WindowTextBrush; if (IsLocked) Foreground = Brushes.DarkRed; if (IsVoided) Foreground = Brushes.Gray; if (IsGifted) Foreground = Brushes.DarkBlue; } } public void NotSelected() { if (_selected) { _selected = false; IsLastSelected = false; UpdateItemColor(); } } public void UpdatePortion(MenuItemPortion portion, string priceTag) { _model.UpdatePortion(portion, priceTag, AppServices.MainDataContext.GetVatTemplate(portion.MenuItemId)); RuleExecutor.NotifyEvent(RuleEventNames.PortionSelected, new { Ticket = AppServices.MainDataContext.SelectedTicket, TicketItem = Model, TicketTag = AppServices.MainDataContext.SelectedTicket.Tag, MenuItemName = _model.MenuItemName, PortionName = portion.Name, PortionPrice = _model.Price }); RaisePropertyChanged("Description"); RaisePropertyChanged("TotalPrice"); } public TicketItemProperty ToggleProperty(MenuItemPropertyGroup group, MenuItemProperty menuItemProperty) { var ti = _model.ToggleProperty(group, menuItemProperty); if (ti != null) { RuleExecutor.NotifyEvent(RuleEventNames.ModifierSelected, new { Ticket = AppServices.MainDataContext.SelectedTicket, TicketItem = Model, TicketTag = AppServices.MainDataContext.SelectedTicket.Tag, MenuItemName = _model.MenuItemName, ModifierGroupName = group.Name, ModifierName = menuItemProperty.Name, ModifierPrice = ti.PropertyPrice.Amount + ti.VatAmount, ModifierQuantity = ti.Quantity, IsRemoved = !_model.Properties.Contains(ti), IsPriceAddedToParentPrice = ti.CalculateWithParentPrice, TotalPropertyCount = Model.Properties.Count, TotalModifierQuantity = Model.Properties.Where(x => x.PropertyGroupId == group.Id).Sum(x => x.Quantity), TotalModifierPrice = Model.Properties.Where(x => x.PropertyGroupId == group.Id).Sum(x => x.PropertyPrice.Amount + x.VatAmount) }); } RefreshProperties(); RaisePropertyChanged("Properties"); RaisePropertyChanged("TotalPrice"); RaisePropertyChanged("Quantity"); return ti; } private void RefreshProperties() { Properties.Clear(); Properties.AddRange(Model.Properties.Select(x => new TicketItemPropertyViewModel(x))); } public void UpdatePrice(decimal value) { Model.UpdatePrice(value, AppServices.MainDataContext.SelectedDepartment.PriceTag); RaisePropertyChanged("Price"); RaisePropertyChanged("TotalPrice"); } public void RemoveProperty(MenuItemPropertyGroup mig, MenuItemProperty menuItemProperty) { var p = Model.Properties.Where(x => x.PropertyGroupId == mig.Id && x.Name == menuItemProperty.Name && (x.VatAmount + x.PropertyPrice.Amount) == menuItemProperty.Price.Amount).FirstOrDefault(); if (p != null) { Model.Properties.Remove(p); } RefreshProperties(); RaisePropertyChanged("Properties"); RaisePropertyChanged("TotalPrice"); RaisePropertyChanged("Quantity"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketItemViewModel.cs
C#
gpl3
12,368
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Samba.Presentation.ViewModels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Samba.Presentation.ViewModels")] [assembly: AssemblyCopyright("Copyright © 2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("82b889ee-feca-49d9-8802-100ec50ed598")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/Properties/AssemblyInfo.cs
C#
gpl3
1,470
using System; using System.Collections.Generic; using System.Linq; using Samba.Domain.Models.Customers; using Samba.Domain.Models.Tickets; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Services; namespace Samba.Presentation.ViewModels { public class CustomerViewModel : ObservableObject { public Customer Model { get; set; } public CustomerViewModel(Customer model) { Model = model; } public int Id { get { return Model.Id; } } public string Name { get { return Model.Name; } set { Model.Name = value.Trim(); RaisePropertyChanged("Name"); } } public string PhoneNumber { get { return Model.PhoneNumber; } set { Model.PhoneNumber = !string.IsNullOrEmpty(value) ? value.Trim() : ""; RaisePropertyChanged("PhoneNumber"); } } public string GroupCode { get { return Model.GroupCode; } set { Model.GroupCode = value; RaisePropertyChanged("GroupCode"); } } public string Address { get { return Model.Address; } set { Model.Address = value; RaisePropertyChanged("Address"); } } public string Note { get { return Model.Note; } set { Model.Note = value; RaisePropertyChanged("Note"); } } public string PhoneNumberText { get { return PhoneNumber != null ? FormatAsPhoneNumber(PhoneNumber) : PhoneNumber; } } public DateTime AccountOpeningDate { get { return Model.AccountOpeningDate; } set { Model.AccountOpeningDate = value; } } private IEnumerable<string> _groupCodes; public IEnumerable<string> GroupCodes { get { return _groupCodes ?? (_groupCodes = Dao.Distinct<Customer>(x => x.GroupCode)); } } public decimal AccountBalance { get; private set; } public Ticket LastTicket { get; private set; } public bool IsNotNew { get { return Model.Id > 0; } } private static string FormatAsPhoneNumber(string phoneNumber) { var phoneNumberInputMask = AppServices.SettingService.PhoneNumberInputMask; if (phoneNumber.Length == phoneNumberInputMask.Count(x => x == '#')) { decimal d; decimal.TryParse(phoneNumber, out d); return d.ToString(phoneNumberInputMask); } return phoneNumber; } public void UpdateDetailedInfo() { LastTicket = Dao.Last<Ticket>(x => x.CustomerId == Model.Id, x => x.TicketItems); TotalTicketAmount = Dao.Sum<Ticket>(x => x.TotalAmount, x => x.CustomerId == Model.Id); AccountBalance = CashService.GetAccountBalance(Model.Id); } public IEnumerable<TicketItemViewModel> LastTicketLines { get { return LastTicket != null ? LastTicket.TicketItems.Where(x => !x.Gifted || !x.Voided).Select(x => new TicketItemViewModel(x)) : null; } } public decimal TicketTotal { get { return LastTicket != null ? LastTicket.GetSum() : 0; } } public string LastTicketStateString { get { return LastTicket != null ? (LastTicket.IsPaid ? Resources.Paid : Resources.Open) : ""; } } public decimal TotalTicketAmount { get; private set; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/CustomerViewModel.cs
C#
gpl3
3,253
using System.Windows.Input; using Samba.Domain.Models.Menus; using Samba.Infrastructure.Settings; namespace Samba.Presentation.ViewModels { public class ScreenCategoryButton { private readonly ScreenMenuCategory _category; public ScreenCategoryButton(ScreenMenuCategory category, ICommand command) { _category = category; ButtonCommand = command; } public ScreenMenuCategory Category { get { return _category; } } public string Caption { get { return Category.Name.Replace("\\r", "\r"); } } public ICommand ButtonCommand { get; private set; } public string MButtonColor { get { return _category.MButtonColor; } } public double MButtonHeight { get { return _category.MButtonHeight > 0 ? _category.MButtonHeight : double.NaN; } } public string ImagePath { get { return !string.IsNullOrEmpty(Category.ImagePath) ? Category.ImagePath : LocalSettings.AppPath + "\\images\\empty.png"; } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/ScreenCategoryButton.cs
C#
gpl3
1,033
using System; using Samba.Domain; using Samba.Domain.Foundation; using Samba.Domain.Models.Tickets; using Samba.Localization.Properties; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class PaymentViewModel : ObservableObject { public Payment Model { get; set; } public PaymentViewModel(Payment model) { Model = model; } public decimal Amount { get { return Model.Amount; } set { Model.Amount = value; RaisePropertyChanged("Amount"); } } public PaymentType PaymentType { get { return (PaymentType)Model.PaymentType; } set { Model.PaymentType = (int)value; } } public DateTime Date { get { return Model.Date; } set { Model.Date = value; } } public string DateDisplay { get { return Date.ToString("ddMMyyyy") == DateTime.Now.ToString("ddMMyyyy") ? Date.ToShortTimeString() : Date.ToShortDateString() + " " + Date.ToShortTimeString(); } } public string PaymentTypeDisplay { get { switch (PaymentType) { case PaymentType.Ticket: return Resources.Voucher; case PaymentType.Cash: return Resources.Cash; case PaymentType.CreditCard: return Resources.CreditCard; case PaymentType.Account: return Resources.AccountBalance; } return Resources.UndefinedPaymentType; } } public string AmountDisplay { get { return Amount.ToString("#,#0.00"); } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/PaymentViewModel.cs
C#
gpl3
1,921
using System; using System.Collections.Generic; using System.Windows.Input; using Samba.Domain.Models.Menus; using Samba.Infrastructure.Settings; namespace Samba.Presentation.ViewModels { public class ScreenMenuItemButton { private readonly ICommand _command; private readonly ScreenMenuCategory _category; private readonly ScreenMenuItem _screenMenuItem; public ScreenMenuItemButton(ScreenMenuItem screenMenuItem, ICommand command, ScreenMenuCategory category) { _screenMenuItem = screenMenuItem; _command = command; _category = category; var color = screenMenuItem.ButtonColor; if (string.IsNullOrEmpty(color)) color = category != null ? category.ButtonColor : "Green"; ButtonColor = color; } public ScreenMenuItem ScreenMenuItem { get { return _screenMenuItem; } } public string Caption { get { if (Category.WrapText) { if (!_screenMenuItem.Name.Contains("\r")) return _screenMenuItem.Name.Replace(' ', '\r'); } return _screenMenuItem.Name.Replace("\\r", "\r"); } } public ICommand Command { get { return _command; } } public ScreenMenuCategory Category { get { return _category; } } public double ButtonHeight { get { return Category.ButtonHeight > 0 ? Category.ButtonHeight : double.NaN; } } public string ButtonColor { get; private set; } public bool IsImageOnly { get { return ScreenMenuItem.IsImageOnly; } } public string ImagePath { get { return !string.IsNullOrEmpty(ScreenMenuItem.ImagePath) ? ScreenMenuItem.ImagePath : LocalSettings.AppPath + "\\images\\empty.png"; } } public int UsageCount { get { return ScreenMenuItem.UsageCount; } set { ScreenMenuItem.UsageCount = value; } } public int FindOrder(string t) { if (Caption.ToLower().StartsWith(t.ToLower())) return -99 + Caption.Length; return t.Length == 1 ? Caption.Length : Distance(Caption, t); } public static int Distance(string s, string t) { var n = s.Length; var m = t.Length; var d = new int[n + 1, m + 1]; if (n == 0) return m; if (m == 0) return n; for (var i = 0; i <= n; d[i, 0] = i++) { } for (var j = 0; j <= m; d[0, j] = j++) { } for (var i = 1; i <= n; i++) { for (var j = 1; j <= m; j++) { var cost = (t[j - 1] == s[i - 1]) ? 0 : 1; d[i, j] = Math.Min(Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1), d[i - 1, j - 1] + cost); } } return d[n, m]; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/ScreenMenuItemButton.cs
C#
gpl3
3,123
namespace Samba.Presentation.ViewModels { public class TicketTagData { public string TagName { get; set; } private string _tagValue; public string TagValue { get { return _tagValue ?? string.Empty; } set { _tagValue = value; } } public int Action { get; set; } public decimal NumericValue { get; set; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketTagData.cs
C#
gpl3
419
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Samba.Presentation.ViewModels { public class LocationData { public int LocationId { get; set; } public int TicketId { get; set; } public string LocationName { get; set; } public string Caption { get; set; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/LocationData.cs
C#
gpl3
370
using System; using System.Collections.Generic; using System.Linq; using System.Collections.ObjectModel; using System.Windows.Data; using Samba.Domain; using Samba.Domain.Models.Customers; using Samba.Domain.Models.Tickets; using Samba.Infrastructure.Settings; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Services; namespace Samba.Presentation.ViewModels { public class TicketViewModel : ObservableObject { private readonly Ticket _model; private readonly bool _forcePayment; public TicketViewModel(Ticket model, bool forcePayment) { _forcePayment = forcePayment; _model = model; _items = new ObservableCollection<TicketItemViewModel>(model.TicketItems.Select(x => new TicketItemViewModel(x)).OrderBy(x => x.Model.CreatedDateTime)); _payments = new ObservableCollection<PaymentViewModel>(model.Payments.Select(x => new PaymentViewModel(x))); _discounts = new ObservableCollection<DiscountViewModel>(model.Discounts.Select(x => new DiscountViewModel(x))); _itemsViewSource = new CollectionViewSource { Source = _items }; _itemsViewSource.GroupDescriptions.Add(new PropertyGroupDescription("GroupObject")); PrintJobButtons = AppServices.CurrentTerminal.PrintJobs .Where(x => (!string.IsNullOrEmpty(x.ButtonText)) && (x.PrinterMaps.Count(y => y.Department == null || y.Department.Id == AppServices.MainDataContext.SelectedDepartment.Id) > 0)) .OrderBy(x => x.Order) .Select(x => new PrintJobButton(x, Model)); if (PrintJobButtons.Count(x => x.Model.UseForPaidTickets) > 0) { PrintJobButtons = IsPaid ? PrintJobButtons.Where(x => x.Model.UseForPaidTickets) : PrintJobButtons.Where(x => !x.Model.UseForPaidTickets); } } public Ticket Model { get { return _model; } } private readonly ObservableCollection<TicketItemViewModel> _items; public ObservableCollection<TicketItemViewModel> Items { get { return _items; } } private CollectionViewSource _itemsViewSource; public CollectionViewSource ItemsViewSource { get { return _itemsViewSource; } set { _itemsViewSource = value; } } private readonly ObservableCollection<PaymentViewModel> _payments; public ObservableCollection<PaymentViewModel> Payments { get { return _payments; } } private readonly ObservableCollection<DiscountViewModel> _discounts; public ObservableCollection<DiscountViewModel> Discounts { get { return _discounts; } } public ObservableCollection<TicketItemViewModel> SelectedItems { get { return new ObservableCollection<TicketItemViewModel>(Items.Where(x => x.Selected)); } } public IEnumerable<PrintJobButton> PrintJobButtons { get; set; } public DateTime Date { get { return Model.Date; } set { Model.Date = value; } } public int Id { get { return Model.Id; } } public string Note { get { return Model.Note; } set { Model.Note = value; RaisePropertyChanged("Note"); } } public string TagDisplay { get { return Model.GetTagData().Split('\r').Select(x => !string.IsNullOrEmpty(x) && x.Contains(":") && x.Split(':')[0].Trim() == x.Split(':')[1].Trim() ? x.Split(':')[0] : x).Aggregate("", (c, v) => c + v + "\r").Trim('\r'); } } public bool IsTicketNoteVisible { get { return !string.IsNullOrEmpty(Note); } } public bool IsPaid { get { return Model.IsPaid; } } public decimal TicketTotalValue { get { return Model.GetSum(); } } public decimal TicketVatValue { get { return Model.CalculateTax(); } } public decimal TicketTaxServiceValue { get { return Model.GetTaxServicesTotal(); } } public decimal TicketPaymentValue { get { return Model.GetPaymentAmount(); } } public decimal TicketRemainingValue { get { return Model.GetRemainingAmount(); } } public decimal TicketPlainTotalValue { get { return Model.GetPlainSum(); } } public string TicketPlainTotalLabel { get { return TicketPlainTotalValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketTotalLabel { get { return TicketTotalValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public decimal TicketDiscountAmount { get { return Model.GetDiscountTotal(); } } public string TicketDiscountLabel { get { return TicketDiscountAmount.ToString(LocalSettings.DefaultCurrencyFormat); } } public decimal TicketRoundingAmount { get { return Model.GetRoundingTotal(); } } public string TicketRoundingLabel { get { return TicketRoundingAmount.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketVatLabel { get { return TicketVatValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketTaxServiceLabel { get { return TicketTaxServiceValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketPaymentLabel { get { return TicketPaymentValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketRemainingLabel { get { return TicketRemainingValue.ToString(LocalSettings.DefaultCurrencyFormat); } } public string TicketCreationDate { get { if (IsPaid) return Model.Date.ToString(); var time = new TimeSpan(DateTime.Now.Ticks - Model.Date.Ticks).TotalMinutes.ToString("#"); return !string.IsNullOrEmpty(time) ? string.Format(Resources.TicketTimeDisplay_f, Model.Date.ToShortTimeString(), time) : Model.Date.ToShortTimeString(); } } public string TicketLastOrderDate { get { if (IsPaid) return Model.LastOrderDate.ToString(); var time = new TimeSpan(DateTime.Now.Ticks - Model.LastOrderDate.Ticks).TotalMinutes.ToString("#"); return !string.IsNullOrEmpty(time) ? string.Format(Resources.TicketTimeDisplay_f, Model.LastOrderDate.ToShortTimeString(), time) : Model.LastOrderDate.ToShortTimeString(); } } public string TicketLastPaymentDate { get { if (!IsPaid) return Model.LastPaymentDate != Model.Date ? Model.LastPaymentDate.ToShortTimeString() : "-"; var time = new TimeSpan(Model.LastPaymentDate.Ticks - Model.Date.Ticks).TotalMinutes.ToString("#"); return !string.IsNullOrEmpty(time) ? string.Format(Resources.TicketTimeDisplay_f, Model.LastPaymentDate, time) : Model.LastPaymentDate.ToString(); } } public bool IsTicketTimeVisible { get { return Model.Id != 0; } } public bool IsLastPaymentDateVisible { get { return Model.Payments.Count > 0; } } public bool IsLastOrderDateVisible { get { return Model.TicketItems.Count > 1 && Model.TicketItems[Model.TicketItems.Count - 1].OrderNumber != 0 && Model.TicketItems[0].OrderNumber != Model.TicketItems[Model.TicketItems.Count - 1].OrderNumber; } } public void ClearSelectedItems() { LastSelectedTicketTag = null; foreach (var item in Items) item.NotSelected(); RefreshVisuals(); this.PublishEvent(EventTopicNames.SelectedItemsChanged); } public TicketItemViewModel AddNewItem(int menuItemId, decimal quantity, bool gift, string defaultProperties, string portionName) { if (!Model.CanSubmit) return null; ClearSelectedItems(); var menuItem = AppServices.DataAccessService.GetMenuItem(menuItemId); if (menuItem.Portions.Count == 0) return null; var portion = menuItem.Portions[0]; if (!string.IsNullOrEmpty(portionName) && menuItem.Portions.Count(x => x.Name == portionName) > 0) { portion = menuItem.Portions.First(x => x.Name == portionName); } var departmentId = AppServices.CurrentTerminal.DepartmentId > 0 ? AppServices.MainDataContext.SelectedDepartment.Id : Model.DepartmentId; var ti = Model.AddTicketItem(AppServices.CurrentLoggedInUser.Id, departmentId, menuItem, portion.Name, AppServices.MainDataContext.SelectedDepartment.PriceTag, defaultProperties); ti.Quantity = quantity > 9 ? decimal.Round(quantity / portion.Multiplier, LocalSettings.Decimals) : quantity; ti.Gifted = gift; var ticketItemViewModel = new TicketItemViewModel(ti); _items.Add(ticketItemViewModel); RecalculateTicket(); RuleExecutor.NotifyEvent(RuleEventNames.TicketLineAdded, new { Ticket = AppServices.MainDataContext.SelectedTicket, TicketItem = ti, TicketId = AppServices.MainDataContext.SelectedTicket.Id, TicketTag = AppServices.MainDataContext.SelectedTicket.Tag, Quantity = quantity, Model.CustomerId, Model.CustomerName, Model.CustomerGroupCode, MenuItemName = menuItem.Name, MenuItemGroupCode = menuItem.GroupCode }); ticketItemViewModel.PublishEvent(EventTopicNames.TicketItemAdded); return ticketItemViewModel; } private void RegenerateItemViewModels() { _items.Clear(); _items.AddRange(Model.TicketItems.Select(x => new TicketItemViewModel(x))); RecalculateTicket(); ClearSelectedItems(); } public void RefreshVisuals() { RaisePropertyChanged("TicketTotalLabel"); RaisePropertyChanged("TicketRemainingLabel"); RaisePropertyChanged("TicketDiscountLabel"); RaisePropertyChanged("TicketPlainTotalLabel"); RaisePropertyChanged("TicketTaxServiceLabel"); RaisePropertyChanged("TicketRoundingLabel"); RaisePropertyChanged("TicketVatLabel"); RaisePropertyChanged("IsTicketRemainingVisible"); RaisePropertyChanged("IsTicketPaymentVisible"); RaisePropertyChanged("IsTicketDiscountVisible"); RaisePropertyChanged("IsTicketTotalVisible"); RaisePropertyChanged("IsTicketVatTotalVisible"); RaisePropertyChanged("IsTicketRoundingVisible"); RaisePropertyChanged("IsTicketTaxServiceVisible"); RaisePropertyChanged("IsTagged"); } private void VoidItems(IEnumerable<TicketItemViewModel> ticketItems, int reasonId, int userId) { ticketItems.ToList().ForEach(x => Model.VoidItem(x.Model, reasonId, userId)); RegenerateItemViewModels(); } private void GiftItems(IEnumerable<TicketItemViewModel> ticketItems, int reasonId, int userId) { ticketItems.ToList().ForEach(x => Model.GiftItem(x.Model, reasonId, userId)); RegenerateItemViewModels(); } public void CancelItems(IEnumerable<TicketItemViewModel> ticketItems, int userId) { VoidItems(ticketItems, 0, userId); foreach (var ticketItemViewModel in ticketItems) { var mi = AppServices.DataAccessService.GetMenuItem(ticketItemViewModel.Model.MenuItemId); RuleExecutor.NotifyEvent(RuleEventNames.TicketLineCancelled, new { Ticket = AppServices.MainDataContext.SelectedTicket, TicketItem = ticketItemViewModel.Model, TicketTag = AppServices.MainDataContext.SelectedTicket.Tag, ticketItemViewModel.Quantity, Model.CustomerId, Model.CustomerName, Model.CustomerGroupCode, ticketItemViewModel.Model.MenuItemName, MenuItemGroupCode = mi.GroupCode }); } } public void CancelSelectedItems() { CancelItems(SelectedItems.ToArray(), AppServices.CurrentLoggedInUser.Id); } public void GiftSelectedItems(int reasonId) { FixSelectedItems(); GiftItems(SelectedItems.ToArray(), reasonId, AppServices.CurrentLoggedInUser.Id); } public void VoidSelectedItems(int reasonId) { FixSelectedItems(); VoidItems(SelectedItems.ToArray(), reasonId, AppServices.CurrentLoggedInUser.Id); } public bool CanVoidSelectedItems() { return Model.CanVoidSelectedItems(SelectedItems.Select(x => x.Model)); } public bool CanGiftSelectedItems() { return Model.CanGiftSelectedItems(SelectedItems.Select(x => x.Model)); } public bool CanCancelSelectedItems() { return Model.CanCancelSelectedItems(SelectedItems.Select(x => x.Model)); } public bool CanCloseTicket() { return !_forcePayment || Model.GetRemainingAmount() <= 0 || !string.IsNullOrEmpty(Location) || !string.IsNullOrEmpty(CustomerName) || IsTagged || Items.Count == 0; } public bool IsTicketTotalVisible { get { return TicketPaymentValue > 0 && TicketTotalValue > 0; } } public bool IsTicketPaymentVisible { get { return TicketPaymentValue > 0; } } public bool IsTicketRemainingVisible { get { return TicketRemainingValue > 0; } } public bool IsTicketVatTotalVisible { get { return TicketVatValue > 0; } } public bool IsPlainTotalVisible { get { return IsTicketDiscountVisible || IsTicketVatTotalVisible || IsTicketRoundingVisible || IsTicketTaxServiceVisible; } } public bool IsTicketDiscountVisible { get { return TicketDiscountAmount != 0; } } public bool IsTicketRoundingVisible { get { return TicketRoundingAmount != 0; } } public bool IsTicketTaxServiceVisible { get { return TicketTaxServiceValue > 0; } } public string Location { get { return Model.LocationName; } set { Model.LocationName = value; } } public int CustomerId { get { return Model.CustomerId; } set { Model.CustomerId = value; } } public string CustomerName { get { return Model.CustomerName; } set { Model.CustomerName = value; } } public bool IsLocked { get { return Model.Locked; } set { Model.Locked = value; } } public bool IsTagged { get { return !string.IsNullOrEmpty(Model.Tag); } } public void UpdatePaidItems(IEnumerable<PaidItem> paidItems) { Model.PaidItems.Clear(); foreach (var paidItem in paidItems) { Model.PaidItems.Add(paidItem); } } public void FixSelectedItems() { var selectedItems = SelectedItems.Where(x => x.SelectedQuantity > 0 && x.SelectedQuantity < x.Quantity).ToList(); var newItems = Model.ExtractSelectedTicketItems(selectedItems.Select(x => x.Model)); foreach (var newItem in newItems) { AppServices.MainDataContext.AddItemToSelectedTicket(newItem); _items.Add(new TicketItemViewModel(newItem) { Selected = true }); } selectedItems.ForEach(x => x.Selected = false); } public string Title { get { if (Model == null) return ""; string selectedTicketTitle; if (!string.IsNullOrEmpty(Location) && Model.Id == 0) selectedTicketTitle = string.Format(Resources.Table_f, Location); else if (!string.IsNullOrEmpty(CustomerName) && Model.Id == 0) selectedTicketTitle = string.Format(Resources.Account_f, CustomerName); else if (string.IsNullOrEmpty(CustomerName)) selectedTicketTitle = string.IsNullOrEmpty(Location) ? string.Format("# {0}", Model.TicketNumber) : string.Format(Resources.TicketNumberAndTable_f, Model.TicketNumber, Location); else if (string.IsNullOrEmpty(Location)) selectedTicketTitle = string.IsNullOrEmpty(CustomerName) ? string.Format("# {0}", Model.TicketNumber) : string.Format(Resources.TicketNumberAndAccount_f, Model.TicketNumber, CustomerName); else selectedTicketTitle = string.Format(Resources.AccountNameAndTableName_f, Model.TicketNumber, CustomerName, Location); return selectedTicketTitle; } } public string CustomPrintData { get { return Model.PrintJobData; } set { Model.PrintJobData = value; } } public TicketTagGroup LastSelectedTicketTag { get; set; } public void MergeLines() { Model.MergeLinesAndUpdateOrderNumbers(0); _items.Clear(); _items.AddRange(Model.TicketItems.Select(x => new TicketItemViewModel(x))); } public bool CanMoveSelectedItems() { if (IsLocked) return false; if (!Model.CanRemoveSelectedItems(SelectedItems.Select(x => x.Model))) return false; if (SelectedItems.Where(x => x.Model.Id == 0).Count() > 0) return false; if (SelectedItems.Where(x => x.IsLocked).Count() == 0 && AppServices.IsUserPermittedFor(PermissionNames.MoveUnlockedTicketItems)) return true; return AppServices.IsUserPermittedFor(PermissionNames.MoveTicketItems); } public bool CanChangeTable() { if (IsLocked || Items.Count == 0 || (Payments.Count > 0 && !string.IsNullOrEmpty(Location)) || !Model.CanSubmit) return false; return string.IsNullOrEmpty(Location) || AppServices.IsUserPermittedFor(PermissionNames.ChangeTable); } public string GetPrintError() { if (Items.Count(x => x.TotalPrice == 0 && !x.IsGifted && !x.IsVoided) > 0) return Resources.CantCompleteOperationWhenThereIsZeroPricedProduct; if (!IsPaid && Items.Count > 0) { var tg = AppServices.MainDataContext.SelectedDepartment.TicketTagGroups.FirstOrDefault( x => x.ForceValue && !IsTaggedWith(x.Name)); if (tg != null) return string.Format(Resources.TagCantBeEmpty_f, tg.Name); } return ""; } public void UpdateTag(TicketTagGroup tagGroup, TicketTag ticketTag) { Model.SetTagValue(tagGroup.Name, ticketTag.Name); if (tagGroup.Numerator != null) { Model.TicketNumber = ""; AppServices.MainDataContext.UpdateTicketNumber(Model, tagGroup.Numerator); } if (ticketTag.AccountId > 0) AppServices.MainDataContext.AssignCustomerToTicket(Model, Dao.SingleWithCache<Customer>(x => x.Id == ticketTag.AccountId)); ClearSelectedItems(); var tagData = new TicketTagData { Action = tagGroup.Action, TagName = tagGroup.Name, TagValue = ticketTag.Name, NumericValue = tagGroup.NumericTags || tagGroup.PriceTags ? Convert.ToDecimal(ticketTag.Name) : 0 }; RuleExecutor.NotifyEvent(RuleEventNames.TicketTagSelected, new { Ticket = Model, tagData.TagName, tagData.TagValue, tagData.NumericValue, TicketTag = Model.Tag }); tagData.PublishEvent(EventTopicNames.TagSelectedForSelectedTicket); } public bool IsTaggedWith(string tagGroup) { return !string.IsNullOrEmpty(Model.GetTagValue(tagGroup)); } public void RecalculateTicket() { RecalculateTicket(Model); } public static void RecalculateTicket(Ticket ticket) { var total = ticket.TotalAmount; AppServices.MainDataContext.Recalculate(ticket); if (total != ticket.TotalAmount) { RuleExecutor.NotifyEvent(RuleEventNames.TicketTotalChanged, new { Ticket = ticket, PreviousTotal = total, TicketTotal = ticket.GetSum(), DiscountTotal = ticket.GetDiscountAndRoundingTotal(), GiftTotal = ticket.GetTotalGiftAmount(), PaymentTotal = ticket.GetPaymentAmount(), ticket.CustomerName, ticket.CustomerId, ticket.CustomerGroupCode }); } } public static void CreateNewTicket() { AppServices.MainDataContext.CreateNewTicket(); RuleExecutor.NotifyEvent(RuleEventNames.TicketCreated, new { Ticket = AppServices.MainDataContext.SelectedTicket }); } public static void AddPaymentToSelectedTicket(decimal amount, PaymentType paymentType) { var ticket = AppServices.MainDataContext.SelectedTicket; var departmentId = AppServices.CurrentTerminal.DepartmentId > 0 ? AppServices.MainDataContext.SelectedDepartment.Id : ticket.DepartmentId; ticket.AddPayment(DateTime.Now, amount, paymentType, AppServices.CurrentLoggedInUser.Id, departmentId); string paymentName = Resources.Cash; if (paymentType == PaymentType.CreditCard) paymentName = Resources.CreditCard; if (paymentType == PaymentType.Ticket) paymentName = Resources.Voucher; RuleExecutor.NotifyEvent(RuleEventNames.PaymentReceived, new { Ticket = ticket, PaymentType = paymentName, Amount = amount, TicketTag = ticket.Tag, ticket.CustomerId, ticket.CustomerName, ticket.CustomerGroupCode, SelectedLinesCount = ticket.GetPaidItems().Count() }); } public static void PaySelectedTicket(PaymentType paymentType) { AddPaymentToSelectedTicket(AppServices.MainDataContext.SelectedTicket.GetRemainingAmount(), paymentType); } public static void AssignTableToSelectedTicket(int locationId) { var oldLocation = AppServices.MainDataContext.SelectedTicket != null ? AppServices.MainDataContext.SelectedTicket.LocationName : ""; AppServices.MainDataContext.AssignTableToSelectedTicket(locationId); RuleExecutor.NotifyEvent(RuleEventNames.TicketLocationChanged, new { Ticket = AppServices.MainDataContext.SelectedTicket, OldLocation = oldLocation, NewLocation = AppServices.MainDataContext.SelectedTicket.LocationName }); } public static void RegenerateVatRates(Ticket ticket) { foreach (var ticketItem in ticket.TicketItems) { var mi = AppServices.DataAccessService.GetMenuItem(ticketItem.MenuItemId); if (mi == null) continue; var item = ticketItem; var portion = mi.Portions.FirstOrDefault(x => x.Name == item.PortionName); if (portion != null) ticketItem.UpdatePortion(portion, ticketItem.PriceTag, mi.VatTemplate); } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketViewModel.cs
C#
gpl3
25,628
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Samba.Domain.Models.Menus; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class MenuItemPropertyGroupViewModel : ObservableObject { public MenuItemPropertyGroup Model { get; set; } public MenuItemPropertyGroupViewModel(MenuItemPropertyGroup model) { Model = model; Properties = new List<MenuItemPropertyViewModel>(model.Properties.Select(x => new MenuItemPropertyViewModel(x))); } public string Name { get { return Model.Name; } set { Model.Name = value; } } public bool SingleSelection { get { return Model.SingleSelection; } set { Model.SingleSelection = value; } } public bool MultipleSelection { get { return Model.MultipleSelection; } set { Model.MultipleSelection = value; } } public int ButtonHeight { get { return Model.ButtonHeight; } set { Model.ButtonHeight = value; } } public int ColumnCount { get { return Model.ColumnCount; } set { Model.ColumnCount = value; } } public int TerminalButtonHeight { get { return Model.TerminalButtonHeight; } set { Model.TerminalButtonHeight = value; } } public int TerminalColumnCount { get { return Model.TerminalColumnCount; } set { Model.TerminalColumnCount = value; } } public IList<MenuItemPropertyViewModel> Properties { get; set; } public void Refresh(ObservableCollection<TicketItemPropertyViewModel> properties) { foreach (var model in Properties) { var m = model; var tiv = properties.SingleOrDefault(x => x.Model.Name == m.Name); model.TicketItemProperty = tiv != null ? tiv.Model : null; model.Refresh(); } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/MenuItemPropertyGroupViewModel.cs
C#
gpl3
1,908
using System; using Samba.Infrastructure.Settings; using Samba.Localization.Properties; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class OpenTicketViewModel : ObservableObject { public int Id { get; set; } public string LocationName { get; set; } public string CustomerName { get; set; } public decimal RemainingAmount { get; set; } public string TicketNumber { get; set; } public DateTime Date { get; set; } public DateTime LastOrderDate { get; set; } public bool WrapText { get; set; } public string TicketTag { get; set; } public string Info { get; set; } public string TicketTime { get { var difference = Convert.ToInt32(new TimeSpan(DateTime.Now.Ticks - LastOrderDate.Ticks).TotalMinutes); if (difference == 0) return "-"; return string.Format(Resources.OpenTicketButtonDuration, difference.ToString("#")); } } public string Title { get { var result = !string.IsNullOrEmpty(LocationName) ? LocationName : TicketNumber; result = result + " "; result = WrapText ? result.Replace(" ", "\r") : result; if (!string.IsNullOrEmpty(Info)) result += Info; else if (!string.IsNullOrEmpty(CustomerName)) result += CustomerName; return result.TrimEnd('\r'); } } public string TitleTextColor { get { return !string.IsNullOrEmpty(LocationName) || !string.IsNullOrEmpty(CustomerName) ? "DarkBlue" : "Maroon"; } } public string Total { get { return RemainingAmount > 0 ? RemainingAmount.ToString(LocalSettings.DefaultCurrencyFormat) : ""; } } public void Refresh() { RaisePropertyChanged("TicketTime"); RaisePropertyChanged("Title"); RaisePropertyChanged("Total"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/OpenTicketViewModel.cs
C#
gpl3
2,159
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; using Samba.Domain.Models.Settings; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class CommandButtonViewModel : ObservableObject { public ICaptionCommand Command { get; set; } private string _caption; public string Caption { get { return _caption; } set { _caption = value; RaisePropertyChanged("Caption"); } } public PrintJob Parameter { get; set; } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/CommandButtonViewModel.cs
C#
gpl3
620
using System.Linq; using Samba.Domain.Models.Menus; using Samba.Domain.Models.Tickets; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class MenuItemGroupedPropertyItemViewModel : ObservableObject { public MenuItemGroupedPropertyItemViewModel(TicketItemViewModel selectedItem, MenuItemPropertyGroup menuItemPropertyGroup) { _selectedItem = selectedItem; MenuItemPropertyGroup = menuItemPropertyGroup; UpdateNextProperty(null); } public void UpdateNextProperty(MenuItemProperty current) { CurrentProperty = current; if (CurrentProperty != null && CurrentProperty.Name.ToLower() == "x") CurrentProperty = null; NextProperty = MenuItemPropertyGroup.Properties.First(); var selected = _selectedItem.Properties.FirstOrDefault(x => x.Model.PropertyGroupId == MenuItemPropertyGroup.Id); var selectedPropertyName = selected != null ? selected.Model.Name : ""; if (!string.IsNullOrEmpty(selectedPropertyName)) { CurrentProperty = MenuItemPropertyGroup.Properties.FirstOrDefault(x => x.Name == selectedPropertyName); var nProp = MenuItemPropertyGroup.Properties.SkipWhile(x => x.Name != selectedPropertyName).Skip(1).FirstOrDefault(); if (nProp != null) NextProperty = nProp; } Name = CurrentProperty != null ? CurrentProperty.Name : MenuItemPropertyGroup.Name; } public MenuItemPropertyGroup MenuItemPropertyGroup { get; set; } public MenuItemProperty NextProperty { get; set; } public MenuItemProperty CurrentProperty { get; set; } private TicketItemProperty _ticketItemProperty; public TicketItemProperty TicketItemProperty { get { return _ticketItemProperty; } set { _ticketItemProperty = value; RaisePropertyChanged("TicketItemProperty"); } } private readonly TicketItemViewModel _selectedItem; private string _name; public string Name { get { return _name; } set { _name = value; RaisePropertyChanged("Name"); } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/MenuItemGroupedPropertyItemViewModel.cs
C#
gpl3
2,445
using Samba.Domain.Models.Tickets; using Samba.Infrastructure.Settings; using Samba.Localization.Properties; namespace Samba.Presentation.ViewModels { public class DiscountViewModel { public Discount Model { get; set; } public DiscountViewModel(Discount model) { Model = model; } public string DiscountTypeDisplay { get { return Model.DiscountType == (int)DiscountType.Percent ? "%" : ""; } } public string AmountDisplay { get { switch (Model.DiscountType) { case (int)DiscountType.Percent: return Model.Amount.ToString(); case (int)DiscountType.Auto: return Resources.AutoFlatten_ab; default: return Model.Amount > 0 ? Resources.Rounding : Resources.Flattening; } } } public string DiscountAmountDisplay { get { return Model.DiscountAmount.ToString(LocalSettings.DefaultCurrencyFormat); } } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/DiscountViewModel.cs
C#
gpl3
1,300
using System; using System.Collections.Generic; using Samba.Domain.Models.Customers; using Samba.Domain.Models.Tickets; using Samba.Persistance.Data; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class TicketTagViewModel : ObservableObject { public TicketTagViewModel(TicketTag model) { Model = model; } public TicketTag Model { get; set; } public string Name { get { return Model.Name; } set { Model.Name = value; } } public int AccountId { get { return Model.AccountId; } set { Model.AccountId = value; } } public string AccountName { get { return Model.AccountName; } set { Model.AccountName = value; AccountId = value != null ? Dao.SingleWithCache<Customer>(x => x.Name == Model.AccountName).Id : 0; } } private IEnumerable<string> _accountNames; public IEnumerable<string> AccountNames { get { return _accountNames ?? (_accountNames = Dao.Select<Customer, string>(x => x.Name, x => x.InternalAccount)); } } public string Display { get { return Model.Display; } } public void Refresh() { RaisePropertyChanged("Name"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/TicketTagViewModel.cs
C#
gpl3
1,537
using System; using Samba.Domain.Foundation; using Samba.Domain.Models.Menus; using Samba.Domain.Models.Tickets; using Samba.Presentation.Common; namespace Samba.Presentation.ViewModels { public class MenuItemPropertyViewModel : ObservableObject { public MenuItemProperty Model { get; set; } public MenuItemPropertyViewModel(MenuItemProperty model) { Model = model; } public string Name { get { return Model.Name; } set { Model.Name = value; } } public Price Price { get { return Model.Price; } set { Model.Price = value; } } public string Display { get { return TicketItemProperty != null ? GetTicketItemPropertyDisplayName(TicketItemProperty) : Name; } } private static string GetTicketItemPropertyDisplayName(TicketItemProperty ticketItemProperty) { return ticketItemProperty.Quantity > 1 ? ticketItemProperty.Quantity + " " + ticketItemProperty.Name : ticketItemProperty.Name; } public TicketItemProperty TicketItemProperty { get; set; } public void Refresh() { RaisePropertyChanged("TicketItemProperty"); RaisePropertyChanged("Display"); } } }
zzgaminginc-pointofssale
Samba.Presentation.ViewModels/MenuItemPropertyViewModel.cs
C#
gpl3
1,299
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Domain.Models.Menus; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { class MenuItemPriceDefinitionViewModel : EntityViewModelBase<MenuItemPriceDefinition> { public MenuItemPriceDefinitionViewModel(MenuItemPriceDefinition model) : base(model) { } public string PriceTag { get { return Model.PriceTag; } set { Model.PriceTag = value; } } public override Type GetViewType() { return typeof(MenuItemPriceDefinitionView); } public override string GetModelTypeString() { return Resources.PriceDefinition; } protected override string GetSaveErrorMessage() { if (Model.Id == 0 && Dao.Count<MenuItemPriceDefinition>(x => x.PriceTag.ToLower() == Model.PriceTag.ToLower()) > 0) { return string.Format(Resources.ThereIsAnotherPriceDefinition_f, Model.PriceTag); } var mip = Dao.Single<MenuItemPriceDefinition>(x => x.PriceTag == Model.PriceTag); return mip != null && mip.Id != Model.Id ? string.Format(Resources.ThereIsAnotherPriceDefinition_f, Model.PriceTag) : base.GetSaveErrorMessage(); } protected override void OnSave(string value) { if (Model.Id > 0) { var mip = Dao.Single<MenuItemPriceDefinition>(x => x.Id == Model.Id); if (mip.PriceTag != Model.PriceTag) { using (var workspace = WorkspaceFactory.Create()) { workspace.All<MenuItemPrice>(x => x.PriceTag == mip.PriceTag) .ToList() .ForEach(x => x.PriceTag = Model.PriceTag); workspace.CommitChanges(); } } } base.OnSave(value); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemPriceDefinitionViewModel.cs
C#
gpl3
2,178
using System; using System.ComponentModel.Composition; using Microsoft.Practices.Prism.MefExtensions.Modularity; using Samba.Localization.Properties; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; using Samba.Services; namespace Samba.Modules.MenuModule { [ModuleExport(typeof(MenuModule))] public class MenuModule : ModuleBase { private MenuItemListViewModel _menuItemListViewModel; private ScreenMenuListViewModel _screenMenuListViewModel; private DepartmentListViewModel _departmentListViewModel; private MenuItemPropertyGroupListViewModel _menuItemPropertyGroupListViewModel; private PriceListViewModel _priceListViewModel; private TicketTagGroupListViewModel _ticketTagGroupListViewModel; private MenuItemPriceDefinitionListViewModel _menuItemPriceDefinitionListViewModel; private VatTemplateListViewModel _vatTemplateListViewModel; private TaxServiceTemplateListViewModel _taxServiceTemplateListViewModel; public ICategoryCommand ListMenuItemsCommand { get; set; } public ICategoryCommand ListScreenMenusCommand { get; set; } public ICategoryCommand ListDepartmentsCommand { get; set; } public ICategoryCommand ListMenuItemPropertyGroupsCommand { get; set; } public ICategoryCommand ListPricesCommand { get; set; } public ICategoryCommand ListTicketTagGroupsCommand { get; set; } public ICategoryCommand ListMenuItemPriceDefinitionsCommand { get; set; } public ICategoryCommand ListVatTemplatesCommand { get; set; } public ICategoryCommand ListTaxServiceTemplates { get; set; } protected override void OnPostInitialization() { CommonEventPublisher.PublishDashboardCommandEvent(ListDepartmentsCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListMenuItemsCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListScreenMenusCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListMenuItemPropertyGroupsCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListPricesCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListTicketTagGroupsCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListMenuItemPriceDefinitionsCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListVatTemplatesCommand); CommonEventPublisher.PublishDashboardCommandEvent(ListTaxServiceTemplates); } [ImportingConstructor] public MenuModule() { ListDepartmentsCommand = new CategoryCommand<string>(Resources.Departments, Resources.Settings, OnListDepartments); ListMenuItemsCommand = new CategoryCommand<string>(Resources.ProductList, Resources.Products, OnListMenuItems); ListScreenMenusCommand = new CategoryCommand<string>(Resources.MenuList, Resources.Products, OnListScreenMenus); ListMenuItemPropertyGroupsCommand = new CategoryCommand<string>(Resources.ModifierGroups, Resources.Products, OnListMenuItemPropertyGroupsCommand); ListPricesCommand = new CategoryCommand<string>(Resources.BatchPriceList, Resources.Products, OnListPrices); ListTicketTagGroupsCommand = new CategoryCommand<string>(Resources.TicketTags, Resources.Settings, OnListTicketTags) { Order = 10 }; ListMenuItemPriceDefinitionsCommand = new CategoryCommand<string>(Resources.PriceDefinitions, Resources.Products, OnListMenuItemPriceDefinitions); ListVatTemplatesCommand = new CategoryCommand<string>(Resources.VatTemplates, Resources.Products, OnListVatTemplates); ListTaxServiceTemplates = new CategoryCommand<string>(Resources.TaxServiceTemplates, Resources.Products, OnListTaxServiceTemplates); PermissionRegistry.RegisterPermission(PermissionNames.ChangeDepartment, PermissionCategories.Department, Resources.CanChangeDepartment); foreach (var department in AppServices.MainDataContext.Departments) { PermissionRegistry.RegisterPermission(PermissionNames.UseDepartment + department.Id, PermissionCategories.Department, department.Name); } EventServiceFactory.EventService.GetEvent<GenericEvent<VisibleViewModelBase>>().Subscribe(s => { if (s.Topic == EventTopicNames.ViewClosed) { if (s.Value == _menuItemListViewModel) _menuItemListViewModel = null; if (s.Value == _screenMenuListViewModel) _screenMenuListViewModel = null; if (s.Value == _departmentListViewModel) _departmentListViewModel = null; if (s.Value == _menuItemPropertyGroupListViewModel) _menuItemPropertyGroupListViewModel = null; if (s.Value == _priceListViewModel) _priceListViewModel = null; if (s.Value == _ticketTagGroupListViewModel) _ticketTagGroupListViewModel = null; if (s.Value == _menuItemPriceDefinitionListViewModel) _menuItemPriceDefinitionListViewModel = null; if (s.Value == _vatTemplateListViewModel) _vatTemplateListViewModel = null; if (s.Value == _taxServiceTemplateListViewModel) _taxServiceTemplateListViewModel = null; } }); } private void OnListTaxServiceTemplates(string obj) { if (_taxServiceTemplateListViewModel == null) _taxServiceTemplateListViewModel = new TaxServiceTemplateListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_taxServiceTemplateListViewModel); } private void OnListVatTemplates(string obj) { if (_vatTemplateListViewModel == null) _vatTemplateListViewModel = new VatTemplateListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_vatTemplateListViewModel); } private void OnListMenuItemPriceDefinitions(string obj) { if (_menuItemPriceDefinitionListViewModel == null) _menuItemPriceDefinitionListViewModel = new MenuItemPriceDefinitionListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_menuItemPriceDefinitionListViewModel); } private void OnListTicketTags(string obj) { if (_ticketTagGroupListViewModel == null) _ticketTagGroupListViewModel = new TicketTagGroupListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_ticketTagGroupListViewModel); } private void OnListPrices(string obj) { if (_priceListViewModel == null) _priceListViewModel = new PriceListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_priceListViewModel); } private void OnListMenuItemPropertyGroupsCommand(string obj) { if (_menuItemPropertyGroupListViewModel == null) _menuItemPropertyGroupListViewModel = new MenuItemPropertyGroupListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_menuItemPropertyGroupListViewModel); } private void OnListDepartments(string obj) { if (_departmentListViewModel == null) _departmentListViewModel = new DepartmentListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_departmentListViewModel); } public void OnListMenuItems(string value) { if (_menuItemListViewModel == null) _menuItemListViewModel = new MenuItemListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_menuItemListViewModel); } public void OnListScreenMenus(string value) { if (_screenMenuListViewModel == null) _screenMenuListViewModel = new ScreenMenuListViewModel(); CommonEventPublisher.PublishViewAddedEvent(_screenMenuListViewModel); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuModule.cs
C#
gpl3
8,474
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Samba.Domain.Models.Settings; using Samba.Domain.Models.Tickets; using Samba.Infrastructure.Data; using Samba.Localization.Properties; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; using Samba.Presentation.ViewModels; namespace Samba.Modules.MenuModule { public class TicketTagGroupViewModel : EntityViewModelBase<TicketTagGroup> { private IWorkspace _workspace; private readonly IList<string> _actions = new[] { Resources.Refresh, Resources.CloseTicket, Resources.GetPayment }; public IList<string> Actions { get { return _actions; } } private readonly IList<string> _tagTypes = new[] { Resources.AlphaNumeric, Resources.Numeric, Resources.Price }; public IList<string> TagTypes { get { return _tagTypes; } } private IEnumerable<Numerator> _numerators; public IEnumerable<Numerator> Numerators { get { return _numerators ?? (_numerators = _workspace.All<Numerator>()); } } private readonly ObservableCollection<TicketTagViewModel> _ticketTags; public ObservableCollection<TicketTagViewModel> TicketTags { get { return _ticketTags; } } public TicketTagViewModel SelectedTicketTag { get; set; } public ICaptionCommand AddTicketTagCommand { get; set; } public ICaptionCommand DeleteTicketTagCommand { get; set; } public string Action { get { return Actions[Model.Action]; } set { Model.Action = Actions.IndexOf(value); } } public Numerator Numerator { get { return Model.Numerator; } set { Model.Numerator = value; } } public bool FreeTagging { get { return Model.FreeTagging; } set { Model.FreeTagging = value; } } public bool SaveFreeTags { get { return Model.SaveFreeTags; } set { Model.SaveFreeTags = value; } } public bool ForceValue { get { return Model.ForceValue; } set { Model.ForceValue = value; } } public bool NumericTags { get { return Model.NumericTags; } set { Model.NumericTags = value; } } public bool PriceTags { get { return Model.PriceTags; } set { Model.PriceTags = value; } } public string ButtonColorWhenTagSelected { get { return Model.ButtonColorWhenTagSelected; } set { Model.ButtonColorWhenTagSelected = value; } } public string ButtonColorWhenNoTagSelected { get { return Model.ButtonColorWhenNoTagSelected; } set { Model.ButtonColorWhenNoTagSelected = value; } } public bool ActiveOnPosClient { get { return Model.ActiveOnPosClient; } set { Model.ActiveOnPosClient = value; } } public bool ActiveOnTerminalClient { get { return Model.ActiveOnTerminalClient; } set { Model.ActiveOnTerminalClient = value; } } public bool ExcludeInReports { get { return Model.ExcludeInReports; } set { Model.ExcludeInReports = value; } } public string TaggingType { get { return TagTypes[SelectedTaggingType]; } set { SelectedTaggingType = TagTypes.IndexOf(value); } } public int SelectedTaggingType { get { if (NumericTags && !PriceTags) return 1; if (!NumericTags && PriceTags) return 2; return 0; } set { if (value == 1) { NumericTags = true; PriceTags = false; } else if (value == 2) { NumericTags = false; PriceTags = true; } else { NumericTags = false; PriceTags = false; } } } public TicketTagGroupViewModel(TicketTagGroup model) : base(model) { _ticketTags = new ObservableCollection<TicketTagViewModel>(GetTicketTags(model)); AddTicketTagCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.Tag), OnAddTicketTagExecuted); DeleteTicketTagCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.Tag), OnDeleteTicketTagExecuted, CanDeleteTicketTag); } private static IEnumerable<TicketTagViewModel> GetTicketTags(TicketTagGroup ticketTagGroup) { return ticketTagGroup.TicketTags.Select(item => new TicketTagViewModel(item)); } public override string GetModelTypeString() { return Resources.TicketTag; } protected override void Initialize(IWorkspace workspace) { _workspace = workspace; } public override Type GetViewType() { return typeof(TicketTagGroupView); } private bool CanDeleteTicketTag(string arg) { return SelectedTicketTag != null; } private void OnDeleteTicketTagExecuted(string obj) { if (SelectedTicketTag == null) return; if (SelectedTicketTag.Model.Id > 0) _workspace.Delete(SelectedTicketTag.Model); Model.TicketTags.Remove(SelectedTicketTag.Model); TicketTags.Remove(SelectedTicketTag); } private void OnAddTicketTagExecuted(string obj) { var ti = new TicketTag { Name = Resources.NewTag }; _workspace.Add(ti); Model.TicketTags.Add(ti); TicketTags.Add(new TicketTagViewModel(ti)); } protected override string GetSaveErrorMessage() { if (PriceTags) { foreach (var ticketTag in TicketTags) { try { var dec = Convert.ToDecimal(ticketTag.Model.Name); if (dec.ToString() != ticketTag.Model.Name) return Resources.NumericTagsShouldBeNumbersErrorMessage; } catch (Exception) { return Resources.NumericTagsShouldBeNumbersErrorMessage; } } } if (NumericTags) { foreach (var ticketTag in TicketTags) { try { var dec = Convert.ToInt32(ticketTag.Model.Name); if (dec.ToString() != ticketTag.Model.Name) return Resources.NumericTagsShouldBeNumbersErrorMessage; } catch (Exception) { return Resources.NumericTagsShouldBeNumbersErrorMessage; } } } return base.GetSaveErrorMessage(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/TicketTagGroupViewModel.cs
C#
gpl3
7,092
using System.ComponentModel; using System.Windows.Media; using Samba.Domain.Models.Menus; using Samba.Localization; using Samba.Persistance.Data; using Samba.Presentation.Common; namespace Samba.Modules.MenuModule { public class ScreenMenuItemViewModel : ObservableObject { public ScreenMenuItemViewModel(ScreenMenuItem model) { Model = model; } [Browsable(false)] public ScreenMenuItem Model { get; private set; } private string _menuItemDisplayString; [LocalizedDisplayName(ResourceStrings.Product)] public string MenuItemDisplayString { get { return _menuItemDisplayString ?? (_menuItemDisplayString = Dao.SingleWithCache<MenuItem>(x => x.Id == Model.MenuItemId).Name); } } [LocalizedDisplayName(ResourceStrings.SortOrder)] public int Order { get { return Model.Order; } set { Model.Order = value; RaisePropertyChanged("Order"); } } [LocalizedDisplayName(ResourceStrings.AutoSelect)] public bool AutoSelect { get { return Model.AutoSelect; } set { Model.AutoSelect = value; RaisePropertyChanged("AutoSelect"); } } [LocalizedDisplayName(ResourceStrings.Color)] public SolidColorBrush ButtonColor { get { if (!string.IsNullOrEmpty(Model.ButtonColor)) return new SolidColorBrush((Color)ColorConverter.ConvertFromString(Model.ButtonColor)); return Brushes.Transparent; } set { Model.ButtonColor = value != Brushes.Transparent ? value.ToString() : string.Empty; RaisePropertyChanged("ButtonColor"); } } [LocalizedDisplayName(ResourceStrings.ImagePath)] public string ImagePath { get { return Model.ImagePath ?? ""; } set { Model.ImagePath = value; RaisePropertyChanged("ImagePath"); } } [LocalizedDisplayName(ResourceStrings.ImageOnly)] public bool IsImageOnly { get { return Model.IsImageOnly; } set { Model.IsImageOnly = value; } } [LocalizedDisplayName(ResourceStrings.Header)] public string Name { get { return Model.Name; } set { Model.Name = value; RaisePropertyChanged("Name"); } } [LocalizedDisplayName(ResourceStrings.Quantity)] public int Quantity { get { return Model.Quantity; } set { Model.Quantity = value; RaisePropertyChanged("Quantity"); } } [LocalizedDisplayName(ResourceStrings.Gift)] public bool Gift { get { return Model.Gift; } set { Model.Gift = value; RaisePropertyChanged("Gift"); } } [LocalizedDisplayName(ResourceStrings.DefaultProperties)] public string DefaultProperties { get { return Model.DefaultProperties; } set { Model.DefaultProperties = value; RaisePropertyChanged("DefaultProperties"); } } [LocalizedDisplayName(ResourceStrings.Tag)] public string Tag { get { return Model.Tag; } set { Model.Tag = value; RaisePropertyChanged("Tag"); } } [LocalizedDisplayName(ResourceStrings.Portion)] public string Portion { get { return Model.ItemPortion; } set { Model.ItemPortion = value; RaisePropertyChanged("Portion"); } } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/ScreenMenuItemViewModel.cs
C#
gpl3
3,560
using System.Windows.Controls; namespace Samba.Modules.MenuModule { /// <summary> /// Interaction logic for DepartmentView.xaml /// </summary> public partial class DepartmentView : UserControl { public DepartmentView() { InitializeComponent(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/DepartmentView.xaml.cs
C#
gpl3
329
using System; using System.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; using Samba.Domain.Models.Menus; using Samba.Domain.Models.Settings; using Samba.Domain.Models.Tables; using Samba.Domain.Models.Tickets; using Samba.Infrastructure.Data; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; using Samba.Presentation.Common.Services; using Samba.Services; namespace Samba.Modules.MenuModule { public class DepartmentViewModel : EntityViewModelBase<Department> { private IWorkspace _workspace; private IEnumerable<ScreenMenu> _screenMenus; public IEnumerable<ScreenMenu> ScreenMenus { get { return _screenMenus ?? (_screenMenus = Dao.Query<ScreenMenu>()); } set { _screenMenus = value; } } private IEnumerable<TableScreen> _tableScreens; public IEnumerable<TableScreen> TableScreens { get { return _tableScreens ?? (_tableScreens = Dao.Query<TableScreen>()); } set { _tableScreens = value; } } private ObservableCollection<TicketTagGroupViewModel> _ticketTagGroups; public ObservableCollection<TicketTagGroupViewModel> TicketTagGroups { get { return _ticketTagGroups ?? (_ticketTagGroups = new ObservableCollection<TicketTagGroupViewModel>(GetTicketTags(Model))); } } private ObservableCollection<TaxServiceTemplateViewModel> _taxServiceTemplates; public ObservableCollection<TaxServiceTemplateViewModel> TaxServiceTemplates { get { return _taxServiceTemplates ?? (_taxServiceTemplates = new ObservableCollection<TaxServiceTemplateViewModel>(GetTaxServiceTemplates(Model))); } } private IEnumerable<Numerator> _numerators; public IEnumerable<Numerator> Numerators { get { return _numerators ?? (_numerators = _workspace.All<Numerator>()); } set { _numerators = value; } } public int ScreenMenuId { get { return Model.ScreenMenuId; } set { Model.ScreenMenuId = value; } } public int TerminalScreenMenuId { get { return Model.TerminalScreenMenuId; } set { Model.TerminalScreenMenuId = value; } } public Numerator TicketNumerator { get { return Model.TicketNumerator; } set { Model.TicketNumerator = value; } } public Numerator OrderNumerator { get { return Model.OrderNumerator; } set { Model.OrderNumerator = value; } } public int? TableScreenId { get { return Model.TableScreenId; } set { Model.TableScreenId = value.GetValueOrDefault(0); } } public int? TerminalTableScreenId { get { return Model.TerminalTableScreenId; } set { Model.TerminalTableScreenId = value.GetValueOrDefault(0); } } public int OpenTicketViewColumnCount { get { return Model.OpenTicketViewColumnCount; } set { Model.OpenTicketViewColumnCount = value; } } public string DefaultTag { get { return Model.DefaultTag; } set { Model.DefaultTag = value; } } public string TerminalDefaultTag { get { return Model.TerminalDefaultTag; } set { Model.TerminalDefaultTag = value; } } public bool IsFastFood { get { return Model.IsFastFood; } set { Model.IsFastFood = value; } } public bool IsAlaCarte { get { return Model.IsAlaCarte; } set { Model.IsAlaCarte = value; } } public bool IsTakeAway { get { return Model.IsTakeAway; } set { Model.IsTakeAway = value; } } public IEnumerable<string> PriceTags { get { return Dao.Select<MenuItemPriceDefinition, string>(x => x.PriceTag, x => x.Id > 0); } } public string PriceTag { get { return Model.PriceTag; } set { Model.PriceTag = value; } } public TicketTagGroupViewModel SelectedTicketTag { get; set; } public TaxServiceTemplateViewModel SelectedTaxServiceTemplate { get; set; } public ICaptionCommand AddTicketTagGroupCommand { get; set; } public ICaptionCommand DeleteTicketTagGroupCommand { get; set; } public ICaptionCommand AddTaxServiceTemplateCommand { get; set; } public ICaptionCommand DeleteTaxServiceTemplateCommand { get; set; } public DepartmentViewModel(Department model) : base(model) { AddTicketTagGroupCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.TagGroup), OnAddTicketTagGroup); DeleteTicketTagGroupCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.TagGroup), OnDeleteTicketTagGroup, CanDeleteTicketTagGroup); AddTaxServiceTemplateCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.TaxServiceTemplate), OnAddTaxServiceTemplate); DeleteTaxServiceTemplateCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.TaxServiceTemplate), OnDeleteTaxServiceTempalte, CanDeleteTaxServiceTemplate); } private bool CanDeleteTaxServiceTemplate(string arg) { return SelectedTaxServiceTemplate != null; } private void OnDeleteTaxServiceTempalte(string obj) { Model.TaxServiceTemplates.Remove(SelectedTaxServiceTemplate.Model); TaxServiceTemplates.Remove(SelectedTaxServiceTemplate); } private void OnAddTaxServiceTemplate(string obj) { var selectedValues = InteractionService.UserIntraction.ChooseValuesFrom(_workspace.All<TaxServiceTemplate>().ToList<IOrderable>(), Model.TaxServiceTemplates.ToList<IOrderable>(), Resources.TaxServiceTemplates, string.Format(Resources.ChooseTaxServicesForDepartmentHint_f, Model.Name), Resources.TaxServiceTemplate, Resources.TaxServiceTemplates); foreach (TaxServiceTemplate selectedValue in selectedValues) { if (!Model.TaxServiceTemplates.Contains(selectedValue)) Model.TaxServiceTemplates.Add(selectedValue); } _taxServiceTemplates = new ObservableCollection<TaxServiceTemplateViewModel>(GetTaxServiceTemplates(Model)); RaisePropertyChanged("TaxServiceTemplates"); } private bool CanDeleteTicketTagGroup(string arg) { return SelectedTicketTag != null; } private void OnDeleteTicketTagGroup(string obj) { Model.TicketTagGroups.Remove(SelectedTicketTag.Model); TicketTagGroups.Remove(SelectedTicketTag); } private void OnAddTicketTagGroup(string obj) { var selectedValues = InteractionService.UserIntraction.ChooseValuesFrom(_workspace.All<TicketTagGroup>().ToList<IOrderable>(), Model.TicketTagGroups.ToList<IOrderable>(), Resources.TicketTags, string.Format(Resources.ChooseTagsForDepartmentHint, Model.Name), Resources.TicketTag, Resources.TicketTags); foreach (TicketTagGroup selectedValue in selectedValues) { if (!Model.TicketTagGroups.Contains(selectedValue)) Model.TicketTagGroups.Add(selectedValue); } _ticketTagGroups = new ObservableCollection<TicketTagGroupViewModel>(GetTicketTags(Model)); RaisePropertyChanged("TicketTagGroups"); } private static IEnumerable<TaxServiceTemplateViewModel> GetTaxServiceTemplates(Department model) { return model.TaxServiceTemplates.OrderBy(x => x.Order).Select(x => new TaxServiceTemplateViewModel(x)); } private static IEnumerable<TicketTagGroupViewModel> GetTicketTags(Department model) { return model.TicketTagGroups.OrderBy(x => x.Order).Select(x => new TicketTagGroupViewModel(x)); } public override Type GetViewType() { return typeof(DepartmentView); } public override string GetModelTypeString() { return Resources.Department; } protected override void Initialize(IWorkspace workspace) { _workspace = workspace; } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/DepartmentViewModel.cs
C#
gpl3
8,578
using System.Windows.Controls; namespace Samba.Modules.MenuModule { /// <summary> /// Interaction logic for MenuItemView.xaml /// </summary> public partial class MenuItemView : UserControl { public MenuItemView() { InitializeComponent(); } private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.EditingElement is TextBox) { ((TextBox)e.EditingElement).Text = ((TextBox)e.EditingElement).Text.Replace("\b", ""); } } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemView.xaml.cs
C#
gpl3
623
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Domain.Models.Menus; using Samba.Persistance.Data; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { class MenuItemPriceDefinitionListViewModel : EntityCollectionViewModelBase<MenuItemPriceDefinitionViewModel, MenuItemPriceDefinition> { protected override MenuItemPriceDefinitionViewModel CreateNewViewModel(MenuItemPriceDefinition model) { return new MenuItemPriceDefinitionViewModel(model); } protected override MenuItemPriceDefinition CreateNewModel() { return new MenuItemPriceDefinition(); } protected override void BeforeDeleteItem(MenuItemPriceDefinition item) { using (var workspace = WorkspaceFactory.Create()) { workspace.Delete<MenuItemPrice>(x => x.PriceTag == item.PriceTag); workspace.CommitChanges(); } } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemPriceDefinitionListViewModel.cs
C#
gpl3
1,066
using System; using System.Collections.Generic; using System.Linq; using System.Collections.ObjectModel; using Samba.Domain.Models.Inventory; using Samba.Domain.Models.Menus; using Samba.Infrastructure.Data; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; using Samba.Presentation.Common.Services; namespace Samba.Modules.MenuModule { public class MenuItemViewModel : EntityViewModelBase<MenuItem> { private IWorkspace _workspace; private IEnumerable<string> _groupCodes; public IEnumerable<string> GroupCodes { get { return _groupCodes ?? (_groupCodes = Dao.Distinct<MenuItem>(x => x.GroupCode)); } } private IEnumerable<string> _tags; public IEnumerable<string> Tags { get { return _tags ?? (_tags = Dao.Distinct<MenuItem>(x => x.Tag)); } } private ObservableCollection<PortionViewModel> _portions; public ObservableCollection<PortionViewModel> Portions { get { return _portions ?? (_portions = new ObservableCollection<PortionViewModel>(GetPortions(Model))); } } private ObservableCollection<MenuItemPropertyGroupViewModel> _propertyGroups; public ObservableCollection<MenuItemPropertyGroupViewModel> PropertyGroups { get { return _propertyGroups ?? (_propertyGroups = new ObservableCollection<MenuItemPropertyGroupViewModel>(GetProperties(Model))); } } private IEnumerable<VatTemplateViewModel> _vatTemplates; public IEnumerable<VatTemplateViewModel> VatTemplates { get { return _vatTemplates ?? (_vatTemplates = _workspace.All<VatTemplate>().Select(x => new VatTemplateViewModel(x))); } } public VatTemplate VatTemplate { get { return Model.VatTemplate; } set { Model.VatTemplate = value; } } public PortionViewModel SelectedPortion { get; set; } public ICaptionCommand AddPortionCommand { get; set; } public ICaptionCommand DeletePortionCommand { get; set; } public MenuItemPropertyGroupViewModel SelectedProperty { get; set; } public ICaptionCommand AddPropertyGroupCommand { get; set; } public ICaptionCommand DeletePropertyGroupCommand { get; set; } public string GroupCode { get { return Model.GroupCode ?? ""; } set { Model.GroupCode = value; } } public string Tag { get { return Model.Tag ?? ""; } set { Model.Tag = value; } } public string Barcode { get { return Model.Barcode ?? ""; } set { Model.Barcode = value; } } public MenuItemViewModel(MenuItem model) : base(model) { AddPortionCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.Portion), OnAddPortion); DeletePortionCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.Portion), OnDeletePortion, CanDeletePortion); AddPropertyGroupCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.PropertyGroup), OnAddPropertyGroup); DeletePropertyGroupCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.PropertyGroup), OnDeletePropertyGroup, CanDeletePropertyGroup); } private bool CanDeletePropertyGroup(string arg) { return SelectedProperty != null; } private void OnDeletePropertyGroup(string obj) { Model.PropertyGroups.Remove(SelectedProperty.Model); PropertyGroups.Remove(SelectedProperty); } private void OnAddPropertyGroup(string obj) { var selectedValues = InteractionService.UserIntraction.ChooseValuesFrom(_workspace.All<MenuItemPropertyGroup>().ToList<IOrderable>(), Model.PropertyGroups.ToList<IOrderable>(), Resources.PropertyGroups, string.Format(Resources.SelectPropertyGroupsHint_f, Model.Name), Resources.PropertyGroup, Resources.PropertyGroups); foreach (MenuItemPropertyGroup selectedValue in selectedValues) { if (!Model.PropertyGroups.Contains(selectedValue)) Model.PropertyGroups.Add(selectedValue); } _propertyGroups = new ObservableCollection<MenuItemPropertyGroupViewModel>(GetProperties(Model)); RaisePropertyChanged("PropertyGroups"); } public string GroupValue { get { return Model.GroupCode; } } private void OnAddPortion(string value) { var portion = MenuItem.AddDefaultMenuPortion(Model); Portions.Add(new PortionViewModel(portion)); } private void OnDeletePortion(string value) { if (SelectedPortion != null) { var c = Dao.Count<Recipe>(x => x.Portion.Id == SelectedPortion.Model.Id); if (c == 0) { if (SelectedPortion.Model.Id > 0 && Model.Id > 0) _workspace.Delete(SelectedPortion.Model); Model.Portions.Remove(SelectedPortion.Model); Portions.Remove(SelectedPortion); } } } private bool CanDeletePortion(string value) { return SelectedPortion != null; } public override string GetModelTypeString() { return Resources.Product; } protected override void Initialize(IWorkspace workspace) { _workspace = workspace; } public override Type GetViewType() { return typeof(MenuItemView); } private static IEnumerable<PortionViewModel> GetPortions(MenuItem baseModel) { return baseModel.Portions.Select(item => new PortionViewModel(item)); } private static IEnumerable<MenuItemPropertyGroupViewModel> GetProperties(MenuItem model) { return model.PropertyGroups.Select(item => new MenuItemPropertyGroupViewModel(item)); } protected override string GetSaveErrorMessage() { return base.GetSaveErrorMessage(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemViewModel.cs
C#
gpl3
6,559
using System; using System.Collections.Generic; using System.Linq; using System.Collections.ObjectModel; using System.Windows; using Samba.Domain.Models.Menus; using Samba.Infrastructure.Data; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; using Samba.Presentation.Common.Services; namespace Samba.Modules.MenuModule { public class ScreenMenuViewModel : EntityViewModelBase<ScreenMenu> { private IWorkspace _workspace; public ScreenMenuViewModel(ScreenMenu model) : base(model) { AddCategoryCommand = new CaptionCommand<string>(string.Format(Resources.Add_f, Resources.Category), OnAddCategory); EditCategoryCommand = new CaptionCommand<string>(string.Format(Resources.Edit_f, Resources.Category), OnEditCategory, CanEditCategory); DeleteCategoryCommand = new CaptionCommand<string>(string.Format(Resources.Delete_f, Resources.Category), OnDeleteCategory, CanEditCategory); EditCategoryItemsCommand = new CaptionCommand<string>(string.Format(Resources.Edit_f, Resources.CategoryProducts), OnEditCategoryItems, CanEditCategory); SortCategoryItemsCommand = new CaptionCommand<string>(string.Format(Resources.SortCategoryProducts), OnSortCategoryItems, CanEditCategory); SortCategoriesCommand = new CaptionCommand<string>(string.Format(Resources.SortCategories), OnSortCategories, CanSortCategories); EditCategoryItemPropertiesCommand = new CaptionCommand<string>(string.Format(Resources.Edit_f, Resources.ProductProperties), OnEditCategoryItemProperties, CanEditCategory); EditAllCategoriesCommand = new CaptionCommand<string>(string.Format(Resources.Edit_f, Resources.AllCategories), OnEditAllCategories); } public ICaptionCommand AddCategoryCommand { get; set; } public ICaptionCommand EditCategoryCommand { get; set; } public ICaptionCommand EditAllCategoriesCommand { get; set; } public ICaptionCommand EditCategoryItemsCommand { get; set; } public ICaptionCommand DeleteCategoryCommand { get; set; } public ICaptionCommand SortCategoryItemsCommand { get; set; } public ICaptionCommand SortCategoriesCommand { get; set; } public ICaptionCommand EditCategoryItemPropertiesCommand { get; set; } public ObservableCollection<ScreenMenuCategoryViewModel> Categories { get; set; } public ScreenMenuCategoryViewModel SelectedCategory { get; set; } public override string GetModelTypeString() { return Resources.Menu; } protected override void Initialize(IWorkspace workspace) { _workspace = workspace; Categories = new ObservableCollection<ScreenMenuCategoryViewModel>(GetCategories(Model)); } public override Type GetViewType() { return typeof(ScreenMenuView); } private static IEnumerable<ScreenMenuCategoryViewModel> GetCategories(ScreenMenu baseModel) { return baseModel.Categories.Select(item => new ScreenMenuCategoryViewModel(item)).OrderBy(x => x.Model.Order).ToList(); } private void OnAddCategory(string value) { string[] values = InteractionService.UserIntraction.GetStringFromUser(Resources.Categories, Resources.AddCategoryHint); foreach (string val in values) { Categories.Add(new ScreenMenuCategoryViewModel(Model.AddCategory(val))); } if (values.Count() > 0) { bool answer = InteractionService.UserIntraction.AskQuestion( Resources.AutoSelectProductsQuestion); if (answer) { foreach (var val in values) { //TODO EF ile çalışırken tolist yapmazsak count sql sorgusu üretiyor mu kontrol et. var menuItems = GetMenuItemsByGroupCode(val).ToList(); if (menuItems.Count > 0) { Model.AddItemsToCategory(val, menuItems); } } } } } private IEnumerable<MenuItem> GetMenuItemsByGroupCode(string groupCode) { return _workspace.All<MenuItem>(x => x.GroupCode == groupCode); } private bool CanEditCategory(string value) { return SelectedCategory != null; } private void OnEditAllCategories(string obj) { InteractionService.UserIntraction.EditProperties(Categories); } private void OnEditCategory(string obj) { InteractionService.UserIntraction.EditProperties(SelectedCategory); } private void OnEditCategoryItemProperties(string obj) { InteractionService.UserIntraction.EditProperties(SelectedCategory.ScreenMenuItems.Select(x => new ScreenMenuItemViewModel(x)).ToList()); } private void OnEditCategoryItems(string value) { if (SelectedCategory != null) { IList<IOrderable> values = new List<IOrderable>(_workspace.All<MenuItem>().OrderBy(x => x.GroupCode + x.Name) .Where(x => !SelectedCategory.ContainsMenuItem(x)) .Select(x => new ScreenMenuItem { MenuItemId = x.Id, Name = x.Name, MenuItem = x })); SelectedCategory.ScreenMenuItems.ToList().ForEach(x=>x.MenuItem = Dao.SingleWithCache<MenuItem>(y=>y.Id == x.MenuItemId)); IList<IOrderable> selectedValues = new List<IOrderable>(SelectedCategory.ScreenMenuItems); var choosenValues = InteractionService.UserIntraction.ChooseValuesFrom(values, selectedValues, Resources.ProductList, string.Format(Resources.AddProductsToCategoryHint_f, SelectedCategory.Name), Resources.Product, Resources.Products); foreach (var screenMenuItem in SelectedCategory.ScreenMenuItems.ToList()) { if (!choosenValues.Contains(screenMenuItem) && screenMenuItem.Id > 0) _workspace.Delete(screenMenuItem); } SelectedCategory.ScreenMenuItems.Clear(); foreach (ScreenMenuItem item in choosenValues) { SelectedCategory.ScreenMenuItems.Add(item); } SelectedCategory.UpdateDisplay(); } } private void OnDeleteCategory(string value) { if (MessageBox.Show(Resources.DeleteSelectedCategoryQuestion, Resources.Confirmation, MessageBoxButton.YesNo) == MessageBoxResult.Yes && SelectedCategory != null) { if(SelectedCategory.Model.Id > 0) _workspace.Delete(SelectedCategory.Model); Model.Categories.Remove(SelectedCategory.Model); Categories.Remove(SelectedCategory); } } private void OnSortCategoryItems(string obj) { InteractionService.UserIntraction.SortItems(SelectedCategory.ScreenMenuItems.OrderBy(x => x.Order), Resources.SortCategoryProducts, string.Format(Resources.SortCategoryProductsDialogHint_f, SelectedCategory.Name)); } private void OnSortCategories(string obj) { InteractionService.UserIntraction.SortItems(Model.Categories, Resources.SortCategories, string.Format(Resources.SortCategoriesDialogHint_f, Model.Name)); Categories = new ObservableCollection<ScreenMenuCategoryViewModel>(Categories.OrderBy(x => x.Model.Order)); RaisePropertyChanged("Categories"); } private bool CanSortCategories(string arg) { return Categories.Count > 1; } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/ScreenMenuViewModel.cs
C#
gpl3
8,229
using System; using Samba.Domain.Models.Menus; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { class VatTemplateListViewModel : EntityCollectionViewModelBase<VatTemplateViewModel, VatTemplate> { protected override VatTemplateViewModel CreateNewViewModel(VatTemplate model) { return new VatTemplateViewModel(model); } protected override VatTemplate CreateNewModel() { return new VatTemplate(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/VatTemplateListViewModel.cs
C#
gpl3
539
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Samba.Modules.MenuModule { /// <summary> /// Interaction logic for MenuItemPriceDefinitionView.xaml /// </summary> public partial class MenuItemPriceDefinitionView : UserControl { public MenuItemPriceDefinitionView() { InitializeComponent(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemPriceDefinitionView.xaml.cs
C#
gpl3
701
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using DataGridFilterLibrary; namespace Samba.Modules.MenuModule { /// <summary> /// Interaction logic for PriceListView.xaml /// </summary> public partial class PriceListView : UserControl { public PriceListView() { InitializeComponent(); DataContextChanged += new DependencyPropertyChangedEventHandler(PriceListView_DataContextChanged); } void PriceListView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { var d = DataContext as PriceListViewModel; if (d != null) { var i = 0; foreach (var priceTag in d.PriceTags) { DataGridColumn dgtc = new DataGridTextColumn() { Header = priceTag, Binding = new Binding("[" + i + "]") { StringFormat = "#,#0.00;-#,#0.00;-" }, MinWidth = 60, CellStyle = (Style)FindResource("RightAlignedCellStyle") }; DataGridColumnExtensions.SetDoNotGenerateFilterControl(dgtc, true); DataGrid.Columns.Add(dgtc); i++; } } } private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.EditingElement is TextBox) { ((TextBox)e.EditingElement).Text = ((TextBox)e.EditingElement).Text.Replace("\b", ""); } } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/PriceListView.xaml.cs
C#
gpl3
2,102
using System; using Samba.Domain.Models.Menus; using Samba.Localization.Properties; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class VatTemplateViewModel : EntityViewModelBase<VatTemplate> { public VatTemplateViewModel(VatTemplate model) : base(model) { } public string DisplayName { get { return string.Format("{0} - {1}", Name, (VatIncluded ? Resources.Included : Resources.Excluded)); } } public decimal Rate { get { return Model.Rate; } set { Model.Rate = value; } } public bool VatIncluded { get { return Model.VatIncluded; } set { Model.VatIncluded = value; } } public override Type GetViewType() { return typeof(VatTemplateView); } public override string GetModelTypeString() { return Resources.VatTemplate; } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/VatTemplateViewModel.cs
C#
gpl3
1,023
using Samba.Domain.Models.Menus; using Samba.Domain.Models.Tickets; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { class TaxServiceTemplateListViewModel : EntityCollectionViewModelBase<TaxServiceTemplateViewModel, TaxServiceTemplate> { protected override TaxServiceTemplateViewModel CreateNewViewModel(TaxServiceTemplate model) { return new TaxServiceTemplateViewModel(model); } protected override TaxServiceTemplate CreateNewModel() { return new TaxServiceTemplate(); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/TaxServiceTemplateListViewModel.cs
C#
gpl3
616
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Samba.Domain.Models.Menus; using Samba.Infrastructure.Data; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class PriceListViewModel : VisibleViewModelBase { private readonly IWorkspace _workspace = WorkspaceFactory.Create(); public ICaptionCommand SaveCommand { get; set; } private ObservableCollection<PriceViewModel> _items; public ObservableCollection<PriceViewModel> Items { get { return _items ?? (_items = CreateItems()); } } public PriceListViewModel() { SaveCommand = new CaptionCommand<string>(Resources.Save, OnSave); } private void OnSave(object obj) { _workspace.CommitChanges(); foreach (var priceViewModel in Items) { priceViewModel.IsChanged = false; } } public IEnumerable<string> PriceTags { get { return Items.SelectMany(x => x.Model.Prices.Select(y => y.PriceTag)).Distinct(); } } private ObservableCollection<PriceViewModel> CreateItems() { var tags = Dao.Select<MenuItemPriceDefinition, string>(x => x.PriceTag, x => x.Id > 0).Distinct().ToArray(); var result = new ObservableCollection<PriceViewModel>( _workspace.All<MenuItem>(x => x.Portions.Select(y => y.Prices)) .SelectMany(y => y.Portions, (mi, pt) => new PriceViewModel(pt, mi.Name, tags))); foreach (var tag in tags) { var portions = result.Where(x => !x.Model.Prices.Select(y => y.PriceTag).Contains(tag)).ToList(); portions.ForEach(x => x.AddPrice(tag)); } return result; } protected override string GetHeaderInfo() { return Resources.BatchPriceList; } public override Type GetViewType() { return typeof(PriceListView); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/PriceListViewModel.cs
C#
gpl3
2,299
using System.Linq; using Samba.Domain.Models.Menus; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class MenuItemPropertyGroupListViewModel : EntityCollectionViewModelBase<MenuItemPropertyGroupViewModel, MenuItemPropertyGroup> { protected override MenuItemPropertyGroupViewModel CreateNewViewModel(MenuItemPropertyGroup model) { return new MenuItemPropertyGroupViewModel(model); } protected override MenuItemPropertyGroup CreateNewModel() { return new MenuItemPropertyGroup(); } protected override string CanDeleteItem(MenuItemPropertyGroup model) { var count = Dao.Query<MenuItem>(x => x.PropertyGroups.Select(y => y.Id).Contains(model.Id), x => x.PropertyGroups).Count(); if (count > 0) return Resources.DeleteErrorProductPropertyUsedInProduct; return base.CanDeleteItem(model); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemPropertyGroupListViewModel.cs
C#
gpl3
1,072
using System.Linq; using Samba.Domain.Models.Tickets; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class TicketTagGroupListViewModel : EntityCollectionViewModelBase<TicketTagGroupViewModel, TicketTagGroup> { protected override TicketTagGroupViewModel CreateNewViewModel(TicketTagGroup model) { return new TicketTagGroupViewModel(model); } protected override TicketTagGroup CreateNewModel() { return new TicketTagGroup(); } protected override string CanDeleteItem(TicketTagGroup model) { var count = Dao.Query<Department>(x => x.TicketTagGroups.Select(y => y.Id).Contains(model.Id), x => x.TicketTagGroups).Count(); if (count > 0) return Resources.DeleteErrorTagUsedInDepartment; return base.CanDeleteItem(model); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/TicketTagGroupListViewModel.cs
C#
gpl3
1,006
using System; using Samba.Domain.Models.Menus; using Samba.Localization.Properties; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class TaxServiceTemplateViewModel : EntityViewModelBase<TaxServiceTemplate> { public TaxServiceTemplateViewModel(TaxServiceTemplate model) : base(model) { } private string[] _calculationMethods; public string[] CalculationMethods { get { return _calculationMethods ?? (_calculationMethods = new[] { Resources.RateFromTicketAmount,Resources.RateFromVatIncludedTicketAmount, Resources.RateFromPreviousTemplate, Resources.FixedAmount }); } } public string SelectedCalculationMethod { get { return CalculationMethods[CalculationMethod]; } set { CalculationMethod = Array.IndexOf(CalculationMethods, value); } } public int CalculationMethod { get { return Model.CalculationMethod; } set { Model.CalculationMethod = value; } } public decimal Amount { get { return Model.Amount; } set { Model.Amount = value; } } public override Type GetViewType() { return typeof(TaxServiceTemplateView); } public override string GetModelTypeString() { return Resources.TaxServiceTemplate; } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/TaxServiceTemplateViewModel.cs
C#
gpl3
1,377
using System.Windows.Controls; using System.Windows.Input; namespace Samba.Modules.MenuModule { /// <summary> /// Interaction logic for ScreenMenuView.xaml /// </summary> public partial class ScreenMenuView : UserControl { public ScreenMenuView() { InitializeComponent(); } private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if ((DataContext as ScreenMenuViewModel).SelectedCategory != null) (DataContext as ScreenMenuViewModel).EditCategoryItemsCommand.Execute(null); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/ScreenMenuView.xaml.cs
C#
gpl3
645
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Samba.Domain.Models.Menus; namespace Samba.Modules.MenuModule { public class MenuItemPriceViewModel { public MenuItemPrice Model { get; set; } public MenuItemPriceViewModel(MenuItemPrice model) { Model = model; } public int Id { get { return Model.Id; } set { Model.Id = value; } } public int MenuItemPortionId { get { return Model.MenuItemPortionId; } set { Model.MenuItemPortionId = value; } } public string PriceTag { get { return Model.PriceTag; } set { Model.PriceTag = value; } } public decimal Price { get { return Model.Price; } set { Model.Price = value; } } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/MenuItemPriceViewModel.cs
C#
gpl3
781
using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Windows.Media; using Samba.Domain.Models.Menus; using Samba.Localization; using Samba.Presentation.Common; namespace Samba.Modules.MenuModule { public enum NumeratorType { [LocalizedDescription(ResourceStrings.None)] None, [LocalizedDescription(ResourceStrings.Small)] Small, [LocalizedDescription(ResourceStrings.Big)] Big } public enum SortType { Order, TopItems } public class ScreenMenuCategoryViewModel : ObservableObject { public ScreenMenuCategoryViewModel(ScreenMenuCategory model) { Model = model; } [Browsable(false)] public ScreenMenuCategory Model { get; private set; } [Browsable(false)] public string CategoryListDisplay { get { return ScreenMenuItems.Count > 0 ? string.Format("{0} ({1})", Name, ScreenMenuItems.Count) : Name; } } [Browsable(false)] public IList<ScreenMenuItem> ScreenMenuItems { get { return Model.ScreenMenuItems; } } [LocalizedDisplayName(ResourceStrings.CategoryName), LocalizedCategory(ResourceStrings.CategoryProperties)] public string Name { get { return Model.Name; } set { Model.Name = value; RaisePropertyChanged("Name"); } } [LocalizedDisplayName(ResourceStrings.FastMenu), LocalizedCategory(ResourceStrings.CategoryProperties)] public bool MostUsedItemsCategory { get { return Model.MostUsedItemsCategory; } set { Model.MostUsedItemsCategory = value; RaisePropertyChanged("MostUsedItemsCategory"); } } [LocalizedDisplayName(ResourceStrings.ButtonHeight), LocalizedCategory(ResourceStrings.CategoryProperties)] public int MainButtonHeight { get { return Model.MButtonHeight; } set { Model.MButtonHeight = value; RaisePropertyChanged("MainButtonHeight"); } } [LocalizedDisplayName(ResourceStrings.ButtonColor), LocalizedCategory(ResourceStrings.CategoryProperties)] public SolidColorBrush MainButtonColor { get { return new SolidColorBrush((Color)ColorConverter.ConvertFromString(Model.MButtonColor)); } set { Model.MButtonColor = value != Brushes.Transparent ? value.ToString() : string.Empty; RaisePropertyChanged("MainButtonColor"); } } [LocalizedDisplayName(ResourceStrings.SubButtonHeight), LocalizedCategory(ResourceStrings.CategoryProperties)] public int SubButtonHeight { get { return Model.SubButtonHeight; } set { Model.SubButtonHeight = value; RaisePropertyChanged("SubButtonHeight"); } } [LocalizedDisplayName(ResourceStrings.ImagePath), LocalizedCategory(ResourceStrings.CategoryProperties)] public string ImagePath { get { return Model.ImagePath ?? ""; } set { Model.ImagePath = value; RaisePropertyChanged("ImagePath"); } } [LocalizedDisplayName(ResourceStrings.ColumnCount), LocalizedCategory(ResourceStrings.MenuProperties)] public int ColumnCount { get { return Model.ColumnCount; } set { Model.ColumnCount = value; RaisePropertyChanged("ColumnCount"); } } [LocalizedDisplayName(ResourceStrings.ButtonHeight), LocalizedCategory(ResourceStrings.MenuProperties)] public int ButtonHeight { get { return Model.ButtonHeight; } set { Model.ButtonHeight = value; RaisePropertyChanged("ButtonHeight"); } } [LocalizedDisplayName(ResourceStrings.PageCount), LocalizedCategory(ResourceStrings.MenuProperties)] public int PageCount { get { return Model.PageCount; } set { Model.PageCount = value; RaisePropertyChanged("PageCount"); } } [LocalizedDisplayName(ResourceStrings.WrapText), LocalizedCategory(ResourceStrings.MenuProperties)] public bool WrapText { get { return Model.WrapText; } set { Model.WrapText = value; RaisePropertyChanged("WrapText"); } } [LocalizedDisplayName(ResourceStrings.ButtonColor), LocalizedCategory(ResourceStrings.MenuProperties)] public SolidColorBrush ButtonColor { get { return new SolidColorBrush((Color)ColorConverter.ConvertFromString(Model.ButtonColor)); } set { Model.ButtonColor = value != Brushes.Transparent ? value.ToString() : string.Empty; RaisePropertyChanged("ButtonColor"); } } [LocalizedDisplayName(ResourceStrings.MaxItems), LocalizedCategory(ResourceStrings.MenuProperties)] public int MaxItems { get { return Model.MaxItems; } set { Model.MaxItems = value; RaisePropertyChanged("MaxItems"); } } [LocalizedDisplayName(ResourceStrings.SortType), LocalizedCategory(ResourceStrings.MenuProperties)] public SortType SortType { get { return (SortType)Model.SortType; } set { Model.SortType = (int)value; RaisePropertyChanged("SortType"); } } [LocalizedDisplayName(ResourceStrings.NumeratorType), LocalizedCategory(ResourceStrings.NumeratorProperties)] public NumeratorType NumeratorType { get { return (NumeratorType)Model.NumeratorType; } set { Model.NumeratorType = (int)value; RaisePropertyChanged("NumeratorType"); } } [LocalizedDisplayName(ResourceStrings.NumeratorValue), LocalizedCategory(ResourceStrings.NumeratorProperties)] public string NumeratorValues { get { return Model.NumeratorValues; } set { Model.NumeratorValues = value; RaisePropertyChanged("NumeratorValues"); } } [LocalizedDisplayName(ResourceStrings.AlphanumericButtonValues), LocalizedCategory(ResourceStrings.NumeratorProperties)] public string AlphaButtonValues { get { return Model.AlphaButtonValues; } set { Model.AlphaButtonValues = value; RaisePropertyChanged("AlphaButtonValues"); } } internal void UpdateDisplay() { RaisePropertyChanged("CategoryListDisplay"); } public bool ContainsMenuItem(MenuItem item) { return ScreenMenuItems.Where(x => x.MenuItemId == item.Id).Count() > 0; } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/ScreenMenuCategoryViewModel.cs
C#
gpl3
6,294
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Samba.Modules.MenuModule")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Samba.Modules.MenuModule")] [assembly: AssemblyCopyright("Copyright © 2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("d56e5339-eb5b-4650-bece-8049ed454c0f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
zzgaminginc-pointofssale
Samba.Modules.MenuModule/Properties/AssemblyInfo.cs
C#
gpl3
1,460
using Samba.Domain.Models.Settings; using Samba.Domain.Models.Tickets; using Samba.Domain.Models.Users; using Samba.Localization.Properties; using Samba.Persistance.Data; using Samba.Presentation.Common.ModelBase; namespace Samba.Modules.MenuModule { public class DepartmentListViewModel : EntityCollectionViewModelBase<DepartmentViewModel, Department> { protected override DepartmentViewModel CreateNewViewModel(Department model) { return new DepartmentViewModel(model); } protected override Department CreateNewModel() { return new Department(); } protected override string CanDeleteItem(Department model) { var count = Dao.Count<UserRole>(x => x.DepartmentId == model.Id); if (count > 0) return Resources.DeleteErrorDepartmentUsedInRole; count = Dao.Count<PrinterMap>(x => x.Department.Id == model.Id); if (count > 0) return "Can't Delete"; return base.CanDeleteItem(model); } } }
zzgaminginc-pointofssale
Samba.Modules.MenuModule/DepartmentListViewModel.cs
C#
gpl3
1,089