예제 #1
0
        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);
        }
예제 #2
0
        protected void btnSave_Click1(object sender, EventArgs e)
        {
            VoyageId = GeneralFunctions.DecryptQueryString(Request.QueryString["id"]);
            bool isedit = VoyageId != "-1" ? true : false;

            Entity.VoyageEntity voyage = AssignVoyageProp(VoyageId);
            if (ddlLoc.SelectedIndex == 0)
            {
                GeneralFunctions.RegisterAlertScript(this, "Please select any location");
                return;
            }
            if (voyage.fk_LPortID == 0)
            {
                GeneralFunctions.RegisterAlertScript(this, "Please provide Last_Port_Called");
                return;
            }

            if (voyage.fk_Pod == 0)
            {
                GeneralFunctions.RegisterAlertScript(this, "Please provide PoD");
                return;
            }

            //if (isedit && OldLandingDate!=txtdtLand.Text && OldLandingDate != System.Convert.DBNull)
            //{

            //    //GeneralFunctions.RegisterAlertScript(this, "All Container transaction will be deleted");

            //    //  "javascript:return confirm('All Containers of the voyage will be deleted. Confirm with Yes');";

            //    //if (retval!="yes") return;

            //}

            if (txtdtLand.Text != "")
            {
                string msg = EMS.BLL.VoyageBLL.CheckVoyageEntryAbilty(voyage.fk_VesselID, txtVoyageNo.Text.Trim(), voyage.fk_Pod, voyage.LandingDate, voyage.ImpXChangeRate, isedit);
                //int c = dbinteract.PopulateDDLDS("trnVoyage", "fk_VesselID", "VoyageNo", "where fk_VesselID=" + ddlVessel.SelectedValue + " and VoyageNo='" + txtVoyageNo.Text.Trim() + "'").Tables[0].Rows.Count;
                if (msg != "" && msg.ToLower() != "true")
                {
                    GeneralFunctions.RegisterAlertScript(this, msg);
                    return;
                }
            }

            int result  = dbinteract.AddEditVoyage(_userId, isedit, voyage);
            int result1 = EMS.BLL.VoyageBLL.VoyageLandingDateEntry(voyage.fk_VesselID, Convert.ToInt32(VoyageId), voyage.fk_Pod, voyage.LandingDate, voyage.OLandingDate, _userId);

            if (result > 0)
            {
                //if (!isedit)
                Response.Redirect("~/MasterModule/MangeVoyage.aspx?p=" + Request.QueryString["p"]);

                //else if (result1 > 0)
                //    Response.Redirect("~/MasterModule/MangeVoyage.aspx");
                //else
                //{
                //    GeneralFunctions.RegisterAlertScript(this, "Error Occured");
                //}
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }