Exemple #1
0
        public void BindData(BindType bindType)
        {
            if (bindType == BindType.Form)
            {
                var queryargument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    Key          = CountryId,
                    filter1      = Constants.CountryType,
                    BindType     = bindType,
                    QueryType    = Constants.TableMCatHeader,
                    SubFilterKey = Constants.TableMCatDetls
                };
                var countries = _controlPanel.GetCountry(queryargument);

                if (countries == null)
                {
                    return;
                }
                var country = countries.FirstOrDefault();
                if (country != null)
                {
                    CountryId      = country.CountryId;
                    CountryName    = country.CountryName.Trim();
                    CurrencyCode   = country.CurrencyCode.Trim();
                    CurrencyName   = country.CurrencyName.Trim();
                    CurrencySymbol = country.CurrencySymbol.Trim();
                    Denomination   = country.Denomination.Trim();
                }
                lnkSubmit.Visible = hidAction.Value != Constants.ViewAction;

                var state = country.States;
                GridViewState.DataSource = state;
                if (_newPageIndex >= 0)
                {
                    GridViewState.PageIndex = _newPageIndex;
                }
                GridViewState.DataBind();
                uplForm.Update();
            }
            else
            {
                var queryargument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    Key       = CountryId,
                    filter1   = Constants.CountryType,
                    BindType  = bindType,
                    QueryType = Constants.TableMCatHeader
                };
                var countries = _controlPanel.GetCountry(queryargument);

                GridViewTable.DataSource = countries;
                if (_newPageIndex >= 0)
                {
                    GridViewTable.PageIndex = _newPageIndex;
                }
                GridViewTable.DataBind();
                uplView.Update();
            }
        }