private void LoadData(string VoyageId)
        {
            int intVoyageId = 0;

            if (VoyageId == "" || !Int32.TryParse(VoyageId, out intVoyageId))
            {
                return;
            }
            BLL.DBInteraction   dbinteract = new BLL.DBInteraction();
            System.Data.DataSet ds         = dbinteract.GetVoyage(Convert.ToInt32(VoyageId), "a", "", "", "", 0);

            if (!ReferenceEquals(ds, null) && ds.Tables[0].Rows.Count > 0)
            {
                ddlLoc.SelectedValue = ds.Tables[0].Rows[0]["pk_LocID"].ToString();

                GeneralFunctions.PopulateDropDownList(ddlTerminalID, dbinteract.PopulateDDLDS("mstTerminal", "pk_TerminalID", "TerminalName] + '-' + [terminal", "Where fk_LocationID=" + ddlLoc.SelectedValue));
                ddlTerminalID.SelectedValue = ds.Tables[0].Rows[0]["fl_TerminalID"].ToString();
                txtAltLGNo.Text             = ds.Tables[0].Rows[0]["AltLGNo"].ToString();
                txtCargoDesc.Text           = ds.Tables[0].Rows[0]["CargoDesc"].ToString();
                txtExcRate.Text             = ds.Tables[0].Rows[0]["ImpXChangeRate"].ToString();
                txtIGMNo.Text = ds.Tables[0].Rows[0]["IGMNo"].ToString();
                //txtCallSign.Text = ds.Tables[0].Rows[0]["CallSign"].ToString();
                txtLGNo.Text                        = ds.Tables[0].Rows[0]["LGNo"].ToString();
                txtLightHouse.Text                  = ds.Tables[0].Rows[0]["LightHouseDue"].ToString();
                txtMotherDaughter.Text              = ds.Tables[0].Rows[0]["MotherDaughterDtl"].ToString();
                txtPCCNo.Text                       = ds.Tables[0].Rows[0]["PCCNo"].ToString();
                txtTime.Text                        = ds.Tables[0].Rows[0]["ETATime"].ToString();
                txtTotLine.Text                     = ds.Tables[0].Rows[0]["TotalLines"].ToString();
                txtVCN.Text                         = ds.Tables[0].Rows[0]["VCN"].ToString();
                ddlVessel.SelectedValue             = ds.Tables[0].Rows[0]["fk_VesselID"].ToString();
                txtVIA.Text                         = ds.Tables[0].Rows[0]["VIANo"].ToString();
                txtVoyageNo.Text                    = ds.Tables[0].Rows[0]["VoyageNo"].ToString();
                ddlCrewEffList.SelectedValue        = ds.Tables[0].Rows[0]["CrewEffectList"].ToString();
                ddlCrewList.SelectedValue           = ds.Tables[0].Rows[0]["CrewList"].ToString();
                ddlMaritime.SelectedValue           = ds.Tables[0].Rows[0]["MaritimeList"].ToString();
                ddlPessengerList.SelectedValue      = ds.Tables[0].Rows[0]["PassengerList"].ToString();
                ddlSameButton.SelectedValue         = ds.Tables[0].Rows[0]["SameButtonCargo"].ToString();
                ddlShipStoreSubmitted.SelectedValue = ds.Tables[0].Rows[0]["ShipStoreSubmitted"].ToString();
                ddlTerminalID.SelectedValue         = ds.Tables[0].Rows[0]["fl_TerminalID"].ToString();

                txtdtETA.Text         = ds.Tables[0].Rows[0]["ETADate"].ToString().Split(' ')[0];
                txtdtLand.Text        = ds.Tables[0].Rows[0]["AddLandingDate"].ToString().Split(' ')[0];
                txtDtIGM.Text         = ds.Tables[0].Rows[0]["IGMDate"].ToString().Split(' ')[0];
                txtdtLand.Text        = ds.Tables[0].Rows[0]["LandingDate"].ToString().Split(' ')[0];
                hdnLandingDT.Value    = ds.Tables[0].Rows[0]["LandingDate"].ToString().Split(' ')[0]; //Rajen
                hdnOldLandingDT.Value = ds.Tables[0].Rows[0]["LandingDate"].ToString().Split(' ')[0];
                txtdtPCC.Text         = ds.Tables[0].Rows[0]["PCCDate"].ToString().Split(' ')[0];
                //txtdtAddLand.Text = ds.Tables[0].Rows[0]["__"].ToString();
                ((TextBox)AutoCompletepPort1.FindControl("txtPort")).Text = ds.Tables[0].Rows[0]["lastport"].ToString();
                ((TextBox)AutoCompletepPort2.FindControl("txtPort")).Text = ds.Tables[0].Rows[0]["lastport1"].ToString();
                ((TextBox)AutoCompletepPort3.FindControl("txtPort")).Text = ds.Tables[0].Rows[0]["lastport2"].ToString();
                ((TextBox)AutoCompletepPort4.FindControl("txtPort")).Text = ds.Tables[0].Rows[0]["portDischarge"].ToString();
            }
        }
        private void LoadData(string SortExp, string direction)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            string            voyageType = ddlVoyageType.SelectedValue;
            string            VesselName = string.IsNullOrEmpty(txtVesselName.Text) ? "" : txtVesselName.Text.Trim();
            string            voyageNo   = string.IsNullOrEmpty(txtVoyageNo.Text) ? "" : txtVoyageNo.Text.Trim();
            string            igmNo      = string.IsNullOrEmpty(txtIGMNo.Text) ? "" : txtIGMNo.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;
                    }
                    try
                    {
                        System.Data.DataSet  ds = dbinteract.GetVoyage(-1, voyageType, VesselName, voyageNo, igmNo, _userLocation);
                        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();
                }
            }
        }