Ejemplo n.º 1
0
        private void LoadData(string SortExp, string direction)
        {
            lblErrorMsg.Text = "";
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);


                    gvwLoc.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwLoc.PageSize = searchCriteria.PageSize;
                    }

                    BLL.DBInteraction dbinteract = new BLL.DBInteraction();
                    //int countryId = string.IsNullOrEmpty(txtCountryAbbr.Text) ? -1 :Convert.ToInt32(txtCountryAbbr.Text);
                    string countryName = string.IsNullOrEmpty(txtLocationName.Text) ? "" : txtLocationName.Text;
                    string countryAbbr = string.IsNullOrEmpty(txtCountryAbbr.Text) ? "" : txtCountryAbbr.Text;
                    try
                    {
                        System.Data.DataSet  ds = dbinteract.GetCountry(-1, countryName, countryAbbr);
                        System.Data.DataView dv = new System.Data.DataView(ds.Tables[0]);
                        if (!string.IsNullOrEmpty(SortExp) && !string.IsNullOrEmpty(direction))
                        {
                            dv.Sort = SortExp + " " + direction;
                        }
                        gvwLoc.DataSource = dv;
                    }
                    catch (Exception ex)
                    {
                        gvwLoc.DataSource = null;
                        lblErrorMsg.Text  = "Error Occured.Please try again.";
                    }

                    gvwLoc.DataBind();
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadData(string countryID)
        {
            ClearText();
            int intCountryId = 0;

            if (countryID == "" || !Int32.TryParse(countryID, out intCountryId))
            {
                return;
            }
            BLL.DBInteraction   dbinteract = new BLL.DBInteraction();
            System.Data.DataSet ds         = dbinteract.GetCountry(Convert.ToInt32(countryID), "", "");//country

            if (!ReferenceEquals(ds, null) && ds.Tables[0].Rows.Count > 0)
            {
                txtCountryName.Text = ds.Tables[0].Rows[0]["CountryName"].ToString();
                txtAbbr.Text        = ds.Tables[0].Rows[0]["CountryAbbr"].ToString();
                txtGMT.Text         = ds.Tables[0].Rows[0]["GMT"].ToString();
                txtISD.Text         = ds.Tables[0].Rows[0]["ISDCode"].ToString();
                txtSector.Text      = ds.Tables[0].Rows[0]["Sector"].ToString();
            }
        }