Exemple #1
0
        private void LoadData(string VesselId)
        {
            ClearText();

            int intVesselId = 0;

            if (VesselId == "" || !Int32.TryParse(VesselId, out intVesselId))
            {
                return;
            }
            BLL.DBInteraction   dbinteract = new BLL.DBInteraction();
            System.Data.DataSet ds         = dbinteract.GetVessel(Convert.ToInt32(VesselId), 0, "", 0);

            if (!ReferenceEquals(ds, null) && ds.Tables[0].Rows.Count > 0)
            {
                txtAgentCode.Text    = ds.Tables[0].Rows[0]["AgentCode"].ToString();
                txtIMO.Text          = ds.Tables[0].Rows[0]["IMONumber"].ToString();
                txtMasterCode.Text   = ds.Tables[0].Rows[0]["MasterName"].ToString();
                txtPan.Text          = ds.Tables[0].Rows[0]["PAN"].ToString();
                txtShipLineCode.Text = ds.Tables[0].Rows[0]["ShippingLineCode"].ToString();
                ((TextBox)AutoCompleteCountry1.FindControl("txtCountry")).Text = ds.Tables[0].Rows[0]["flag"].ToString();
                txtVesselName.Text            = ds.Tables[0].Rows[0]["VesselName"].ToString();
                TxtCallSign.Text              = ds.Tables[0].Rows[0]["CallSign"].ToString();
                ddlVesselPrefix.SelectedValue = ds.Tables[0].Rows[0]["fk_VesselPrefixID"].ToString();
                txtVesselAbbr.Text            = ds.Tables[0].Rows[0]["VesselAbbr"].ToString();
            }
        }
        private void LoadData(string SortExp, string direction)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            int    VesselPrefix          = Convert.ToInt32(ddlVesselPrefix.SelectedValue);
            string VesselName            = string.IsNullOrEmpty(txtVesselName.Text) ? "" : txtVesselName.Text.Trim();
            int    vesselFlag            = dbinteract.GetId("Country", ((TextBox)AutoCompleteCountry1.FindControl("txtCountry")).Text);

            // int countryId=Convert.ToInt32(ddlLocation.SelectedValue);

            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;
                    }



                    try
                    {
                        System.Data.DataSet  ds = dbinteract.GetVessel(-1, VesselPrefix, VesselName, vesselFlag);
                        System.Data.DataView dv = new System.Data.DataView(ds.Tables[0]);
                        if (!string.IsNullOrEmpty(SortExp) && !string.IsNullOrEmpty(direction) && SortExp != "Location")
                        {
                            dv.Sort = SortExp + " " + direction;
                        }
                        gvwLoc.DataSource = dv;
                    }
                    catch (Exception ex)
                    {
                        gvwLoc.DataSource = null;
                        lblErrorMsg.Text  = "Error Occured.Please try again.";
                    }

                    gvwLoc.DataBind();
                }
            }
        }