Skip to content

Commit a39ddba

Browse files
authored
Merge pull request AccountGo#19 from AccountGo/master
pull
2 parents 9a020e1 + 37931fd commit a39ddba

7 files changed

Lines changed: 260 additions & 203 deletions

File tree

accountgo.sln

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "src\Core\Core.cspro
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Services", "src\Services\Services.csproj", "{C02DECC9-2A82-42C0-8F26-D0AE6559AC5E}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "src\Web\Web.csproj", "{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3}"
11-
EndProject
12-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logging", "src\NLog\Logging.csproj", "{6151D6CF-F2D3-44D4-B1FC-B873ABB87145}"
13-
EndProject
1410
Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SQL.AccountGo", "database\SQL.AccountGo\SQL.AccountGo.sqlproj", "{F0360E8D-C07F-4442-BB61-FB7C4C495BDD}"
1511
EndProject
1612
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{0295DFAC-BF6E-46C0-A63D-FBE9AF3C04E5}"
@@ -41,14 +37,6 @@ Global
4137
{C02DECC9-2A82-42C0-8F26-D0AE6559AC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
4238
{C02DECC9-2A82-42C0-8F26-D0AE6559AC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
4339
{C02DECC9-2A82-42C0-8F26-D0AE6559AC5E}.Release|Any CPU.Build.0 = Release|Any CPU
44-
{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45-
{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
46-
{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
47-
{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3}.Release|Any CPU.Build.0 = Release|Any CPU
48-
{6151D6CF-F2D3-44D4-B1FC-B873ABB87145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49-
{6151D6CF-F2D3-44D4-B1FC-B873ABB87145}.Debug|Any CPU.Build.0 = Debug|Any CPU
50-
{6151D6CF-F2D3-44D4-B1FC-B873ABB87145}.Release|Any CPU.ActiveCfg = Release|Any CPU
51-
{6151D6CF-F2D3-44D4-B1FC-B873ABB87145}.Release|Any CPU.Build.0 = Release|Any CPU
5240
{F0360E8D-C07F-4442-BB61-FB7C4C495BDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5341
{F0360E8D-C07F-4442-BB61-FB7C4C495BDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
5442
{F0360E8D-C07F-4442-BB61-FB7C4C495BDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -73,8 +61,6 @@ Global
7361
GlobalSection(NestedProjects) = preSolution
7462
{9B652491-4E9C-45E0-BE5B-EA6AF892F380} = {B4CE3CD4-74AA-4A22-B514-BC9B380AAFD7}
7563
{C02DECC9-2A82-42C0-8F26-D0AE6559AC5E} = {B4CE3CD4-74AA-4A22-B514-BC9B380AAFD7}
76-
{9D9B64A3-FF65-4DA7-A6B9-0AE8091543B3} = {0295DFAC-BF6E-46C0-A63D-FBE9AF3C04E5}
77-
{6151D6CF-F2D3-44D4-B1FC-B873ABB87145} = {B5D35D0C-387C-44FA-9A70-6FE24DAE5728}
7864
{F0360E8D-C07F-4442-BB61-FB7C4C495BDD} = {34EEC2A7-F6F1-4D08-A685-9C39E1466B21}
7965
{09096FEC-DA29-4914-B046-CD280220C52A} = {0295DFAC-BF6E-46C0-A63D-FBE9AF3C04E5}
8066
{9CA13D2D-D6E2-4201-946C-81D1E6093404} = {0295DFAC-BF6E-46C0-A63D-FBE9AF3C04E5}
Lines changed: 122 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using AccountGoWeb.Models.Financial;
2-
using Dto.Administration;
1+
using Dto.Administration;
32
using Dto.Security;
43
using Microsoft.AspNetCore.Mvc;
54
using Microsoft.Extensions.Configuration;
@@ -8,138 +7,142 @@
87

98
namespace AccountGoWeb.Controllers
109
{
11-
[Microsoft.AspNetCore.Authorization.Authorize]
12-
public class AdministrationController : BaseController
10+
[Microsoft.AspNetCore.Authorization.Authorize]
11+
public class AdministrationController : BaseController
12+
{
13+
public AdministrationController(IConfiguration config)
1314
{
14-
public AdministrationController(IConfiguration config) {
15-
_baseConfig = config;
16-
Models.SelectListItemHelper._config = config;
17-
}
18-
19-
public IActionResult Company()
20-
{
21-
ViewBag.PageContentHeader = "Company";
22-
var model = GetAsync<Company>("administration/company").Result;
23-
if (model == null)
24-
model = new Dto.Administration.Company();
25-
return View(model);
26-
}
27-
28-
[HttpPost]
29-
public IActionResult Company(Company model)
30-
{
31-
ViewBag.PageContentHeader = "Company";
32-
if (ModelState.IsValid)
33-
{
34-
var serialize = Newtonsoft.Json.JsonConvert.SerializeObject(model);
35-
var content = new StringContent(serialize);
36-
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
15+
_baseConfig = config;
16+
Models.SelectListItemHelper._config = config;
17+
}
3718

38-
var response = PostAsync("administration/savecompany", content);
19+
public IActionResult Company()
20+
{
21+
ViewBag.PageContentHeader = "Company";
22+
var model = GetAsync<Company>("administration/company").Result;
23+
if (model == null)
24+
model = new Company();
25+
return View(model);
26+
}
3927

40-
return View(model);
41-
}
42-
return View(model);
43-
}
28+
[HttpPost]
29+
public IActionResult Company(Company model)
30+
{
31+
ViewBag.PageContentHeader = "Company";
32+
if (ModelState.IsValid)
33+
{
34+
var serialize = Newtonsoft.Json.JsonConvert.SerializeObject(model);
35+
var content = new StringContent(serialize);
36+
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
37+
38+
var response = PostAsync("administration/savecompany", content);
39+
40+
return View(model);
41+
}
42+
return View(model);
43+
}
4444

45-
public IActionResult Settings()
46-
{
47-
ViewBag.PageContentHeader = "Setup and Configuration";
48-
ViewBag.Accounts = Models.SelectListItemHelper.Accounts();
49-
return View();
50-
}
45+
public IActionResult Settings()
46+
{
47+
ViewBag.PageContentHeader = "Setup and Configuration";
48+
ViewBag.Accounts = Models.SelectListItemHelper.Accounts();
49+
var model = GetAsync<GeneralLedgerSetting>("administration/settings").Result;
50+
if (model == null)
51+
model = new GeneralLedgerSetting();
52+
return View(model);
53+
}
5154

52-
[HttpPost]
53-
public IActionResult SaveSettings(GeneralLedgerSetting model)
54-
{
55-
if(ModelState.IsValid)
56-
{
55+
[HttpPost]
56+
public IActionResult SaveSettings(Models.Financial.GeneralLedgerSetting model)
57+
{
58+
if (ModelState.IsValid)
59+
{
5760

58-
}
59-
ViewBag.Accounts = Models.SelectListItemHelper.Accounts();
60-
ViewBag.PageContentHeader = "Setup and Configuration";
61-
return RedirectToAction(nameof(AdministrationController.Settings));
62-
}
61+
}
62+
ViewBag.Accounts = Models.SelectListItemHelper.Accounts();
63+
ViewBag.PageContentHeader = "Setup and Configuration";
64+
return RedirectToAction(nameof(AdministrationController.Settings));
65+
}
6366

64-
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
65-
public async System.Threading.Tasks.Task<IActionResult> Users()
66-
{
67-
var users = await GetAsync<System.Collections.Generic.IEnumerable<User>>("administration/users");
68-
ViewBag.PageContentHeader = "Users";
69-
return View(users);
70-
}
67+
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
68+
public async System.Threading.Tasks.Task<IActionResult> Users()
69+
{
70+
var users = await GetAsync<System.Collections.Generic.IEnumerable<User>>("administration/users");
71+
ViewBag.PageContentHeader = "Users";
72+
return View(users);
73+
}
7174

72-
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
73-
public async System.Threading.Tasks.Task<IActionResult> Roles()
74-
{
75-
var roles = await GetAsync<System.Collections.Generic.IEnumerable<Role>>("administration/roles");
76-
ViewBag.PageContentHeader = "Security Roles";
77-
return View(roles);
78-
}
75+
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
76+
public async System.Threading.Tasks.Task<IActionResult> Roles()
77+
{
78+
var roles = await GetAsync<System.Collections.Generic.IEnumerable<Role>>("administration/roles");
79+
ViewBag.PageContentHeader = "Security Roles";
80+
return View(roles);
81+
}
7982

80-
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
81-
public async System.Threading.Tasks.Task<IActionResult> Groups()
82-
{
83-
var groups = await GetAsync<System.Collections.Generic.IEnumerable<Group>>("administration/groups");
84-
ViewBag.PageContentHeader = "Security Groups";
85-
return View(groups);
86-
}
83+
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
84+
public async System.Threading.Tasks.Task<IActionResult> Groups()
85+
{
86+
var groups = await GetAsync<System.Collections.Generic.IEnumerable<Group>>("administration/groups");
87+
ViewBag.PageContentHeader = "Security Groups";
88+
return View(groups);
89+
}
8790

88-
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
89-
public async System.Threading.Tasks.Task<IActionResult> AuditLogs()
90-
{
91-
var auditLogs = await GetAsync<System.Collections.Generic.IEnumerable<AuditLog>>("administration/auditlogs");
91+
[Microsoft.AspNetCore.Authorization.Authorize(Roles = "SystemAdministrators")]
92+
public async System.Threading.Tasks.Task<IActionResult> AuditLogs()
93+
{
94+
var auditLogs = await GetAsync<System.Collections.Generic.IEnumerable<AuditLog>>("administration/auditlogs");
9295

93-
ViewBag.PageContentHeader = "Audit Logs";
94-
return View(model:auditLogs);
95-
}
96+
ViewBag.PageContentHeader = "Audit Logs";
97+
return View(model: auditLogs);
98+
}
9699

97-
[HttpGet]
98-
public new IActionResult User(int id = 0)
99-
{
100-
if(id != 0)
101-
{
102-
ViewBag.PageContentHeader = "User";
103-
}
104-
else
105-
{
106-
ViewBag.PageContentHeader = "New User";
107-
}
108-
109-
return View(new Models.Account.RegisterViewModel());
110-
}
100+
[HttpGet]
101+
public new IActionResult User(int id = 0)
102+
{
103+
if (id != 0)
104+
{
105+
ViewBag.PageContentHeader = "User";
106+
}
107+
else
108+
{
109+
ViewBag.PageContentHeader = "New User";
110+
}
111+
112+
return View(new Models.Account.RegisterViewModel());
113+
}
111114

112-
[HttpPost]
113-
public new IActionResult User(Models.Account.RegisterViewModel model)
115+
[HttpPost]
116+
public new IActionResult User(Models.Account.RegisterViewModel model)
117+
{
118+
try
119+
{
120+
if (ModelState.IsValid)
114121
{
115-
try
116-
{
117-
if (ModelState.IsValid)
118-
{
119-
var serialize = Newtonsoft.Json.JsonConvert.SerializeObject(model);
120-
var content = new StringContent(serialize);
121-
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
122-
HttpResponseMessage responseAddNewUser = Post("account/addnewuser", content);
123-
Newtonsoft.Json.Linq.JObject resultAddNewUser = Newtonsoft.Json.Linq.JObject.Parse(responseAddNewUser.Content.ReadAsStringAsync().Result);
124-
125-
if ((bool)resultAddNewUser["succeeded"])
126-
{
127-
return RedirectToAction(nameof(AdministrationController.Users), "Administration");
128-
}
129-
else
130-
{
131-
ModelState.AddModelError(string.Empty, resultAddNewUser["errors"][0]["description"].ToString());
132-
return View(model);
133-
}
134-
}
135-
}
136-
catch (Exception ex)
137-
{
138-
ModelState.AddModelError(string.Empty, "Please check if your database is ready/published." + ": " + ex.Message);
139-
return View(model);
140-
}
141-
ViewBag.PageContentHeader = "New User";
122+
var serialize = Newtonsoft.Json.JsonConvert.SerializeObject(model);
123+
var content = new StringContent(serialize);
124+
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
125+
HttpResponseMessage responseAddNewUser = Post("account/addnewuser", content);
126+
Newtonsoft.Json.Linq.JObject resultAddNewUser = Newtonsoft.Json.Linq.JObject.Parse(responseAddNewUser.Content.ReadAsStringAsync().Result);
127+
128+
if ((bool)resultAddNewUser["succeeded"])
129+
{
130+
return RedirectToAction(nameof(AdministrationController.Users), "Administration");
131+
}
132+
else
133+
{
134+
ModelState.AddModelError(string.Empty, resultAddNewUser["errors"][0]["description"].ToString());
142135
return View(model);
136+
}
143137
}
138+
}
139+
catch (Exception ex)
140+
{
141+
ModelState.AddModelError(string.Empty, "Please check if your database is ready/published." + ": " + ex.Message);
142+
return View(model);
143+
}
144+
ViewBag.PageContentHeader = "New User";
145+
return View(model);
144146
}
147+
}
145148
}

src/AccountGoWeb/Scripts/Quotations/SalesQuotation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class SaveQuotationButton extends React.Component<any, {}>{
5151
render() {
5252
return (
5353
<input type="button" value="Save" onClick={this.saveNewSalesQuotation.bind(this) }
54-
className={(store.salesQuotation.statusId == 0 || store.salesQuotation.statusId == undefined) && store.editMode
54+
className={(store.salesQuotation.statusId == 0 || store.salesQuotation.statusId == undefined) && !store.editMode
5555
? "btn btn-sm btn-primary btn-flat pull-left"
5656
: "btn btn-sm btn-primary btn-flat pull-left inactiveLink"}
5757
/>

0 commit comments

Comments
 (0)