Exemple #1
0
 public ActionResult Edit(LedgerAccount ledgerAccount)
 {
     ModelState.Clear();
     TryValidateModel(ledgerAccount);
     if (ModelState.IsValid)
     {
         ledgerRepository.SaveLedgerAccount(ledgerAccount);
         TempData["message"] = string.Format("{0} saved successfully", ledgerAccount.LedgerAccountName);
         CacheRepository.RefreshLedgerAccounts();
         return(RedirectToAction("Index"));
     }
     SetMetaDataForForm();
     return(View(ledgerAccount));
 }
Exemple #2
0
 private void CreateLedgerHead(SampleLedgerHead ledgerHeadStructure)
 {
     LedgerRepository.SaveLedgerHead(ledgerHeadStructure.ledgerHead);
     _ledgerHeadMap.Add(ledgerHeadStructure.ledgerHead.LedgerHeadName.ToLower(), ledgerHeadStructure.ledgerHead.LedgerHeadId);
     if (ledgerHeadStructure.SampleLedgerHeads != null && ledgerHeadStructure.SampleLedgerHeads.Count > 0)
     {
         foreach (var headStructure in ledgerHeadStructure.SampleLedgerHeads)
         {
             headStructure.ledgerHead.ParentLedgerTypeId = ledgerHeadStructure.ledgerHead.ParentLedgerTypeId;
             headStructure.ledgerHead.ParentLedgerHeadId = ledgerHeadStructure.ledgerHead.LedgerHeadId;
             CreateLedgerHead(headStructure);
         }
     }
     if (ledgerHeadStructure.SampleLedgerAccounts != null && ledgerHeadStructure.SampleLedgerAccounts.Count > 0)
     {
         foreach (var ledgerAccount in ledgerHeadStructure.SampleLedgerAccounts)
         {
             ledgerAccount.ParentLedgerHeadId = ledgerHeadStructure.ledgerHead.LedgerHeadId;
             LedgerRepository.SaveLedgerAccount(ledgerAccount);
             _ledgerAccountMap.Add(ledgerAccount.LedgerAccountName.ToLower(), ledgerAccount.LedgerAccountId);
         }
     }
 }