protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var branches =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IBranchDb>().RetrieveAll();
                DropDownBranch.DataSource     = branches;
                DropDownBranch.DataValueField = "Id";
                DropDownBranch.DataTextField  = "BranchName";
                DropDownBranch.DataBind();

                var glCategory =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlCategoryDb>().RetrieveAll();
                DropDownGlCategory.DataSource     = glCategory;
                DropDownGlCategory.DataValueField = "Id";
                DropDownGlCategory.DataTextField  = "GlCategoryName";
                DropDownGlCategory.DataBind();
                if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
                {
                    int       id        = Convert.ToInt32(Request.QueryString["id"]);
                    GlAccount glAccount =
                        Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>()
                        .RetrieveById(id);
                    TextBoxNameGlAccountName.Value   = glAccount.GlAccountName;
                    DropDownBranch.SelectedValue     = glAccount.Branch.Id.ToString();
                    DropDownGlCategory.SelectedValue = glAccount.GlCategory.Id.ToString();
                    TextBoxId.Value = glAccount.Id.ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var glAccount =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>().RetrieveExpenseGLtypes();
                DropDownGlCategory.DataSource     = glAccount;
                DropDownGlCategory.DataValueField = "Id";
                DropDownGlCategory.DataTextField  = "GlAccountName";
                DropDownGlCategory.DataBind();

                var glAccounts =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>().RetrieveLiablilityGltypes();
                DropDownCurrentGL.DataSource     = glAccounts;
                DropDownCurrentGL.DataValueField = "Id";
                DropDownCurrentGL.DataTextField  = "GlAccountName";
                DropDownCurrentGL.DataBind();

                var glAccountsIncome =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IGlAccountDb>().RetrieveIncomeGltypes();
                DropDownCOTIncomeGL.DataSource     = glAccountsIncome;
                DropDownCOTIncomeGL.DataValueField = "Id";
                DropDownCOTIncomeGL.DataTextField  = "GlAccountName";
                DropDownCOTIncomeGL.DataBind();
                //if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
                //{
                //    int id = Convert.ToInt32(Request.QueryString["id"]);
                //    CurrentConfig currentConfig =
                //        Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<ICurrentConfigDb>()
                //            .RetrieveById(id);
                //    TextBoxNameCreditInterestRate.Value = currentConfig.creditInterestRate.ToString();
                //    TextBoxNameMinimumBalance.Value = currentConfig.minimumBalance.ToString();
                //    DropDownGlCategory.SelectedValue = currentConfig.InterestExpenseGlAccount.GlAccountName;
                //    DropDownCurrentGL.SelectedValue = currentConfig.currentAccountGL.GlAccountName;
                //    DropDownCOTIncomeGL.SelectedValue = currentConfig.coTIncomeGl.GlAccountName;
                //    TextBoxId.Value = currentConfig.Id.ToString();

                //}

                IList <CurrentConfig> currentConfig =
                    Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ICurrentConfigDb>()
                    .RetrieveAll();
                if (currentConfig[0] != null)
                {
                    TextBoxNameCreditInterestRate.Value = currentConfig[0].creditInterestRate.ToString();
                    TextBoxNameMinimumBalance.Value     = currentConfig[0].minimumBalance.ToString();
                    TextBoxNameCOT.Value              = currentConfig[0].coT.ToString();
                    DropDownGlCategory.SelectedValue  = currentConfig[0].InterestExpenseGlAccount.Id.ToString();
                    DropDownCurrentGL.SelectedValue   = currentConfig[0].currentAccountGL.Id.ToString();
                    DropDownCOTIncomeGL.SelectedValue = currentConfig[0].coTIncomeGl.Id.ToString();
                    TextBoxId.Value = currentConfig[0].Id.ToString();
                }
            }
        }