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 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(); } } }
public string COPRAR_TXT() { string rpd; int LocationId = Convert.ToInt32(ddlLoc.SelectedValue); int LineID = Convert.ToInt32(ddlLine.SelectedValue); int VesselID = Convert.ToInt32(ddlVessel.SelectedValue); int VoyageID = Convert.ToInt32(ddlVoyage.SelectedValue); //DateTime dt = DateTime.Now; string VCN; string CallSign; string IMONo; string VoyageNo; string Port; string Country; string Containers; string uniqueFileName = Guid.NewGuid().ToString(); //File.Create(Server.MapPath(@"~/Import/COPRARFILE/") + uniqueFileName + "_IMP_EDI.IGM"); string FileName = Server.MapPath(@"~/Import/EDIFile/") + uniqueFileName + "_COPRAR.TXT"; string PCSLogin = Convert.ToString(new DBInteraction().GetPCSLogin(LocationId).Tables[0].Rows[0]["PCSLoginID"]); string CurDate = DateTime.Now.ToString("ddMMyyyy") + "00000001"; string pod = ((TextBox)AutoCompletepPort1.FindControl("txtPort")).Text; pod = pod.Contains(',') ? pod.Split(',')[1] : ""; if (pod == "INCCU1") { rpd = "kopt001"; } else { rpd = "haldia001"; } int PortCode = dbinteract.GetId("Port", pod); StreamWriter writer = new StreamWriter(FileName); // ("myfile.txt") writer.WriteLine(("UNH" + ('' + ("COPRAR" + ('' + ("Advance Container List" + ('' + (CurDate + ('' + (CurDate + ('' + ("9" + ('' + (PCSLogin)))))))))))))); writer.WriteLine(("RPD" + ('' + (rpd)))); //System.Data.DataTable dt = EquipmentBLL.GetOMHinformation(LocationId, LineID, VesselID, VoyageID, PortCode); System.Data.DataSet ds = EquipmentBLL.GetOMHinformation(LocationId, LineID, VesselID, VoyageID, PortCode); //if (ds.Tables[0].Rows.Count > 0) //{ VCN = ds.Tables[0].Rows[0]["VCN"].ToString(); CallSign = ds.Tables[0].Rows[0]["CallSign"].ToString(); IMONo = ds.Tables[0].Rows[0]["IMONumber"].ToString(); VoyageNo = ds.Tables[0].Rows[0]["VoyageNo"].ToString(); Port = ds.Tables[0].Rows[0]["PortCode"].ToString(); Country = ds.Tables[0].Rows[0]["CountryAbbr"].ToString(); Containers = ds.Tables[0].Rows[0]["TotContainers"].ToString(); //} writer.WriteLine(("OMH" + ('' + (VCN + ('' + (CallSign + ('' + (IMONo + ('' + (VoyageNo + ('' + (Port + ('' + (Country + ('' + ("BLA" + ('' + ('' + ('' + ('' + ('' + (Containers)))))))))))))))))))))); DataSet DsContain = EquipmentBLL.GetCOPRARContainerInfo(VesselID, VoyageID, PortCode); //.GetCOPRARContainerInfo(Convert.ToInt32(ddlVessel.SelectedValue), Convert.ToInt32(ddlVoyage.SelectedValue)); // TextShippingCode.Text = Ds.Tables(0).Rows(0).Item("ShippingLineCode") DataTable DtContain = DsContain.Tables[0]; int Srl1 = 0; foreach (DataRow Dr in DtContain.Rows) { Srl1 = (Srl1 + 1); writer.WriteLine(("OMD" + ('' + ("3" + ('' + (Dr["ContainerNo"].ToString() + ('' + (Dr["cstatus"].ToString() + ('' + (Dr["ISOCode"].ToString() + ('' + (Dr["TareWeight"].ToString() + ('' + (Dr["CargoWtTon"].ToString() + ('' + ('' + (Dr["SealNo"].ToString() + ('' + (Dr["loadport"].ToString().Substring(0, 5) + "1" + ('' + (Dr["loadport"].ToString().Substring(0, 5) + "1" + ('' + ('' + (Dr["Commodity"].ToString() + ('' + (Dr["ImpLineBLNo"].ToString() + ('' + ('' + (Dr["ItemLineNo"].ToString() + ('' + ('' + ("12" + ('' + ("BLA" + ('' + ('' + ('' + ('' + (Dr["discport"].ToString() + ('' + (Dr["finalDestination"].ToString().Substring(0, 5) + "1" + ('' + (Dr["TMODE"].ToString() + ('' + (Dr["ICD"].ToString() + ('' + ("1" + ('' + ("" + ('' + ("" + ('' + ("" + ('' + ("" + ('' + ("" + ('' + ("" + ('' + ("" + ('' )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); } string dt = DateTime.Now.ToString("ddMMyyyyhhmmss"); writer.WriteLine(("UNT" + ('' + (dt)))); writer.Close(); writer.Dispose(); return(FileName); }
private void SaveData(string VesselId) { BLL.DBInteraction dbinteract = new BLL.DBInteraction(); bool isedit = VesselId != "-1" ? true : false; if (!isedit) { // if (dbinteract.GetPort(-1, txtPortCode.Text.Trim(), "").Tables[0].Rows.Count > 0) if (!dbinteract.IsUnique("trnVessel", "VesselName", txtVesselName.Text.Trim())) { GeneralFunctions.RegisterAlertScript(this, "Vessel Name must be unique. Please try with another one."); return; } } Entity.Vessel vessel = new Entity.Vessel(); vessel.VesselID = Convert.ToInt32(VesselId); vessel.AgentCode = txtAgentCode.Text.ToUpper(); //vessel.CallSign = txtCallSign.Text; vessel.IMONumber = txtIMO.Text.ToUpper(); //string port = ((TextBox)AutoCompletepPort1.FindControl("txtPort")).Text; //port = port.Contains(',') && port.Split(',').Length >= 1 ? port.Split(',')[1].Trim() : ""; //vessel.LastPortCalled = dbinteract.GetId("Port", port); vessel.MasterName = txtMasterCode.Text.ToUpper(); vessel.PANNo = txtPan.Text.ToUpper(); vessel.ShippingLineCode = txtShipLineCode.Text.ToUpper(); vessel.VesselFlag = dbinteract.GetId("Country", ((TextBox)AutoCompleteCountry1.FindControl("txtCountry")).Text); vessel.VesselName = txtVesselName.Text.ToUpper(); vessel.VesselPrefix = Convert.ToInt32(ddlVesselPrefix.SelectedValue); vessel.CallSign = TxtCallSign.Text.ToUpper(); vessel.VesselAbbr = txtVesselAbbr.Text.ToUpper(); //if (vessel.LastPortCalled == 0) //{ // GeneralFunctions.RegisterAlertScript(this, "Last_Port_Called is Invalid. Please rectify."); // return; //} if (vessel.VesselFlag == 0) { GeneralFunctions.RegisterAlertScript(this, "Vessel_Flag is Invalid. Please rectify."); return; } else if (ddlVesselPrefix.SelectedValue == "0") { GeneralFunctions.RegisterAlertScript(this, "Please Select a vessel prefix first"); return; } int result = dbinteract.AddEditVessel(_userId, isedit, vessel); if (result > 0) { Response.Redirect("~/MasterModule/ManageVessel.aspx"); } else { GeneralFunctions.RegisterAlertScript(this, "Error Occured"); } }