public void GenerateChartOfAccountChildCode()
        {
            CodeGenerationViewModel obj = new CodeGenerationViewModel();
            obj.ParentCode = "101010101";
            obj.ChildCode = "";
            obj.Level = 5;

            string code = controller.GenerateChartOfAccountChildCode(obj);

            //Assert.IsNotNull(json);
            //Assert.IsInstanceOf(typeof(IEnumerable<PaymentVoucherAccountNameAndCode>), json.Data, "Wrong View Model");
            //List<PaymentVoucherAccountNameAndCode> list = new List<PaymentVoucherAccountNameAndCode>();
            //list = json.Data as List<PaymentVoucherAccountNameAndCode>;
            Assert.IsNotEmpty(code);
            Assert.AreEqual("101010101001", code);
        }
        public String GenerateChartOfAccountChildCode(CodeGenerationViewModel codeGenerationViewModel)
        {
            string result = String.Empty;
            string childcode;
            if (ModelState.IsValid)
            {

                childcode = codeGenerationViewModel.ChildCode != null ? codeGenerationViewModel.ChildCode : "";

                result = _AnFChartOfAccountService.GenerateChartOfAccountChildCode(codeGenerationViewModel.ParentCode,
                                                                                   childcode,
                                                                                   codeGenerationViewModel.Level + 1,
                                                                                   codeGenerationViewModel.IsLastNode);
            }

            return result;
        }