private void LoadData(string SortExp, string direction)
        {
            string portCode = string.IsNullOrEmpty(txtPortCode.Text) ? "" : txtPortCode.Text.Trim();
            string portname = string.IsNullOrEmpty(txtPortName.Text) ? "" : txtPortName.Text.Trim();

            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();

                    try
                    {
                        System.Data.DataSet  ds = dbinteract.GetPort(-1, portCode, portname);
                        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();
                }
            }
        }
Beispiel #2
0
        private void LoadData(string portId)
        {
            ClearText();

            int intportId = 0;

            if (portId == "" || !Int32.TryParse(portId, out intportId))
            {
                return;
            }
            BLL.DBInteraction   dbinteract = new BLL.DBInteraction();
            System.Data.DataSet ds         = dbinteract.GetPort(Convert.ToInt32(portId), "", "");

            if (!ReferenceEquals(ds, null) && ds.Tables[0].Rows.Count > 0)
            {
                txtPortName.Text      = ds.Tables[0].Rows[0]["PortName"].ToString();
                txtPortCode.Text      = ds.Tables[0].Rows[0]["PortCode"].ToString();
                ddlICD.SelectedIndex  = Convert.ToInt32(ds.Tables[0].Rows[0]["ICDIndicator"]);
                txtPortAddressee.Text = ds.Tables[0].Rows[0]["PortAddressee"].ToString();
                txtAdd1.Text          = ds.Tables[0].Rows[0]["Address2"].ToString();
                txtAdd2.Text          = ds.Tables[0].Rows[0]["Address3"].ToString();
                txtExportPort.Text    = ds.Tables[0].Rows[0]["ExportPort"].ToString();
            }
        }