public async Task <IActionResult> ChartofAccount(ChartofAccountViewModel model) { var user = await _userManager.GetUserAsync(User); if (!ModelState.IsValid) { var branches = await _glService.GetBranchNamesByUser(user.UserName); ViewData["Branches"] = new SelectList(branches); ViewData["AccountHead"] = new SelectList(new[] { "ASSET", "LIABILITY", "INCOME", "EXPENSE" }); return(View(model)); } //If here, then its a new chart of account item model.ActionBy = user.UserName; Result = await _glService.CreateChartofAccountAsync(model); if (Result) { StatusMessage = _config.GetSection("Messages")["Success"]; return(RedirectToAction(nameof(ChartofAccount))); } StatusMessage = "Error: Unable to create account sub head"; return(View(model)); }
public async Task <IActionResult> CreateChartOfAccount(ChartofAccountViewModel model) { var result = await _glRepository.CreateChartofAccountAsync(model); if (result == "Successful") { return(Ok()); } return(BadRequest()); }
public async Task <IActionResult> ChartofAccount() { var user = await _userManager.GetUserAsync(User); var branches = await _glService.GetBranchNamesByUser(user.UserName); ViewData["Branches"] = new SelectList(branches); ViewData["AccountHead"] = new SelectList(new[] { "ASSET", "LIABILITY", "INCOME", "EXPENSE" }); var model = new ChartofAccountViewModel { StatusMessage = StatusMessage }; return(View(model)); }
public async Task <bool> UpdateChartofAccountAsync(ChartofAccountViewModel model) { var result = await ValidateChartofAccount(model); if (!result) { return(false); } string accountModel = JsonConvert.SerializeObject(model); var contentData = new StringContent(accountModel, System.Text.Encoding.UTF8, "application/json"); response = client.PutAsync("api.bankmodel/generalledger/create-gl-account", contentData).Result; return(response.StatusCode == System.Net.HttpStatusCode.OK ? true : false); }
public async Task <bool> ValidateChartofAccount(ChartofAccountViewModel model) { response = await client.GetAsync("api.bankmodel/generalledger/gl-account-exist/" + model); if (Convert.ToBoolean(response.Content.ReadAsStringAsync().Result) == true) { _validationDictionary.AddError("", string.Format(_config.GetSection("Messages")["ObjectExist"], "Chart item ")); } //If the account name contains TELLER, validate if the username is valid if (model.AccountName.ToUpper().Contains("TELLER")) { var username = GetUsernameFromAccountName(model.AccountName); response = await client.GetAsync("api.bankmodel/generalledger/username-exist/" + model.AccountName); if (Convert.ToBoolean(response.Content.ReadAsStringAsync().Result) == false) { _validationDictionary.AddError("", string.Format(_config.GetSection("Messages")["ObjectNotFound"], username, " as username ")); } } return(_validationDictionary.IsValid); }
public IActionResult ChartofAccountExist(ChartofAccountViewModel model) { return(Ok(_glRepository.ChartofAccountExist(model))); }
private void ChartofAccounts_OnClosing(object sender, CancelEventArgs e) { ChartofAccountViewModel.CleanUp(); }