private Entity.VoyageEntity AssignVoyageProp(string voyageID)
        {
            Entity.VoyageEntity voyage = new Entity.VoyageEntity();
            voyage.pk_VoyageID    = Convert.ToInt32(voyageID);
            voyage.AltLGNo        = txtAltLGNo.Text.ToUpper();
            voyage.CargoDesc      = txtCargoDesc.Text.ToUpper();
            voyage.ImpXChangeRate = txtExcRate.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtExcRate.Text.Trim());
            voyage.IGMNo          = txtIGMNo.Text.ToUpper();
            //voyage.CallSign = txtCallSign.Text.ToUpper();
            voyage.LGNo              = txtLGNo.Text.ToUpper();
            voyage.LightHouseDue     = txtLightHouse.Text.Trim() == "" ? 0 : Convert.ToInt32(txtLightHouse.Text.Trim());
            voyage.MotherDaughterDtl = txtMotherDaughter.Text.ToUpper();
            voyage.PCCNo             = txtPCCNo.Text.ToUpper();
            voyage.ETATime           = txtTime.Text.ToUpper();
            voyage.TotalLines        = txtTotLine.Text.ToUpper();
            voyage.VCN                = txtVCN.Text.ToUpper();
            voyage.fk_VesselID        = Convert.ToInt32(ddlVessel.SelectedValue);
            voyage.VIANo              = txtVIA.Text.ToUpper();
            voyage.VoyageNo           = txtVoyageNo.Text.ToUpper();
            voyage.CrewEffectList     = ddlCrewEffList.SelectedValue;
            voyage.CrewList           = ddlCrewList.SelectedValue;
            voyage.MaritimeList       = ddlMaritime.SelectedValue;
            voyage.PassengerList      = ddlPessengerList.SelectedValue;
            voyage.SameButtonCargo    = ddlSameButton.SelectedValue;
            voyage.ShipStoreSubmitted = ddlShipStoreSubmitted.SelectedValue;
            voyage.fl_TerminalID      = Convert.ToInt32(ddlTerminalID.SelectedValue);
            voyage.VesselType         = ddlVesselType.SelectedValue;
            voyage.AddLandingDate     = string.IsNullOrEmpty(txtdtAddLand.Text.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(txtdtAddLand.Text);
            voyage.ETADate            = string.IsNullOrEmpty(txtdtETA.Text.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(txtdtETA.Text);
            voyage.IGMDate            = string.IsNullOrEmpty(txtDtIGM.Text.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(txtDtIGM.Text);
            //voyage.OLandingDate = Convert.ToDateTime(hdnOldLandingDT.Value);
            voyage.OLandingDate = string.IsNullOrEmpty(hdnOldLandingDT.Value.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(hdnOldLandingDT.Value);
            voyage.LandingDate  = string.IsNullOrEmpty(txtdtLand.Text.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(txtdtLand.Text);
            voyage.PCCDate      = string.IsNullOrEmpty(txtdtPCC.Text.Trim()) ? (Nullable <DateTime>)null : Convert.ToDateTime(txtdtPCC.Text);
            voyage.locid        = Convert.ToInt32(ddlLoc.SelectedValue);
            string port = ((TextBox)AutoCompletepPort1.FindControl("txtPort")).Text;

            port = port.Contains(',') && port.Split(',').Length >= 1 ? port.Split(',')[1].Trim() : "";
            voyage.fk_LPortID = dbinteract.GetId("Port", port);
            if (port != "HALDIA,INHAL1")
            {
                voyage.AddLandingDate = null;
            }

            port = ((TextBox)AutoCompletepPort2.FindControl("txtPort")).Text;
            port = port.Contains(',') && port.Split(',').Length >= 1 ? port.Split(',')[1].Trim() : "";
            voyage.fk_LPortID1 = dbinteract.GetId("Port", port);

            port = ((TextBox)AutoCompletepPort3.FindControl("txtPort")).Text;
            port = port.Contains(',') && port.Split(',').Length >= 1 ? port.Split(',')[1].Trim() : "";
            voyage.fk_LPortID2 = dbinteract.GetId("Port", port);

            port          = ((TextBox)AutoCompletepPort4.FindControl("txtPort")).Text;
            port          = port.Contains(',') && port.Split(',').Length >= 1 ? port.Split(',')[1].Trim() : "";
            voyage.fk_Pod = dbinteract.GetId("Port", port);

            return(voyage);
        }
        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();
            }
        }