Ejemplo n.º 1
0
        private void SaveData(string portId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            bool isedit = portId != "-1" ? true : false;

            if (!isedit)
            {
                // if (dbinteract.GetPort(-1, txtPortCode.Text.Trim(), "").Tables[0].Rows.Count > 0)
                if (!dbinteract.IsUnique("DSR.dbo.mstPort", "PortCode", txtPortCode.Text.Trim()))
                {
                    GeneralFunctions.RegisterAlertScript(this, "Port Code must be unique. The given code has already been used for another port. Please try with another one.");
                    return;
                }
            }
            int result = dbinteract.AddEditPort(_userId, Convert.ToInt32(portId), txtPortName.Text.Trim().ToUpper(), txtPortCode.Text.Trim().ToUpper(), ddlICD.SelectedIndex == 0 ? false : true, txtPortAddressee.Text.ToUpper(), txtAdd1.Text.ToUpper(), txtAdd2.Text.ToUpper(), txtExportPort.Text.ToUpper(), isedit);


            if (result > 0)
            {
                Response.Redirect("~/MasterModule/ManagePort.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
        private void SaveData(string NVOCCId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            bool isedit = NVOCCId != "-1" ? true : false;

            if (!isedit)
            {
                if (!dbinteract.IsUnique("exp.mstSlotOperator", "SlotOperatorName", txtSlotOperatorName.Text.Trim()))
                {
                    GeneralFunctions.RegisterAlertScript(this, "Operator Name must be unique. The given name has already been used for another Line. Please try with another one.");
                    return;
                }
            }

            int result = dbinteract.AddEditSlotOperator(_userId, Convert.ToInt32(NVOCCId), txtSlotOperatorName.Text.Trim(), isedit);


            if (result > 0)
            {
                Response.Redirect("~/Export/ManageSlotOperator.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
Ejemplo n.º 3
0
        private void SaveCountry(string countryId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            bool isedit = countryId != "-1" ? true : false;
            bool s      = dbinteract.IsUnique("mstCountry", "CountryAbbr", txtAbbr.Text.Trim());

            if (!dbinteract.IsUnique("mstCountry", "CountryAbbr", txtAbbr.Text.Trim()) && !isedit)
            {
                GeneralFunctions.RegisterAlertScript(this, "Country Abbr Must Be unique");
                return;
            }
            int result = dbinteract.AddEditCountry(_userId, Convert.ToInt32(countryId), txtCountryName.Text.Trim().ToUpper(), txtAbbr.Text.Trim().ToUpper(),
                                                   txtGMT.Text.ToUpper(), txtISD.Text.ToUpper(), txtSector.Text.ToUpper(), isedit);


            if (result > 0)
            {
                Response.Redirect("~/MasterModule/ManageCountry.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
Ejemplo n.º 4
0
        private void SaveData(string NVOCCId)
        {
            BLL.DBInteraction dbinteract = new BLL.DBInteraction();
            bool isedit = NVOCCId != "-1" ? true : false;


            if (!isedit)
            {
                if (!dbinteract.IsUnique("mstNVOCC", "NVOCCName", txtLineName.Text.Trim()))
                {
                    GeneralFunctions.RegisterAlertScript(this, "Line Name must be unique. The given name has already been used for another Line. Please try with another one.");
                    return;
                }
            }

            if (fuLogo.HasFile)
            {
                hdnLogo.Value = "~/MasterModule/Image/" + fuLogo.GetImageFileName();
                fuLogo.PostedFile.SaveAs(Server.MapPath(hdnLogo.Value));
            }
            else
            {
                hdnLogo.Value = "";
            }
            decimal impComm = 0; decimal rBuffer = 0;

            decimal.TryParse(txtImpCommsn.Text, out impComm);
            decimal.TryParse(txtRBuffer.Text, out rBuffer);
            decimal expCommsn = 0;

            decimal.TryParse(txtExportCommission.Text, out expCommsn);
            char ExpBook = ddlExpBook.SelectedValue == "y"?'1':'0';
            int  result  = dbinteract.AddEditLine(_userId, Convert.ToInt32(NVOCCId), txtLineName.Text.Trim(), string.IsNullOrEmpty(txtFreeDays.Text) ? -1 :  Convert.ToInt32(txtFreeDays.Text), txtContact.Text, impComm, expCommsn, ExpBook, rBuffer, hdnLogo.Value, isedit);


            if (result > 0)
            {
                Response.Redirect("~/MasterModule/ManageLine.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
Ejemplo n.º 5
0
        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");
            }
        }