Пример #1
0
        /// <summary>
        /// Created By:     Josephine Gad
        /// Date Created:   04/Apr/2013
        /// description     Load Port List
        /// </summary>
        private void BindPortList()
        {
            List <PortNotExistList> list = new List <PortNotExistList>();

            try
            {
                PortBLL.GetPortForNotInTM("", "", GlobalCode.Field2DateTime(uoHiddenFieldDate.Value));

                list = (List <PortNotExistList>)Session["PortNotExistList"];

                uoDropDownListPort.Items.Clear();
                ListItem item = new ListItem("--SELECT PORT--", "0");
                uoDropDownListPort.Items.Add(item);
                if (list.Count > 0)
                {
                    uoDropDownListPort.DataSource     = list;
                    uoDropDownListPort.DataTextField  = "PortName";
                    uoDropDownListPort.DataValueField = "PortCode";
                    uoDropDownListPort.DataBind();

                    if (GlobalCode.Field2String(Session["Port"]) != "")
                    {
                        if (uoDropDownListPort.Items.FindByValue(GlobalCode.Field2String(Session["Port"])) != null)
                        {
                            uoDropDownListPort.SelectedValue = GlobalCode.Field2String(Session["Port"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
            }
        }
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 07/12/2011
        /// Description: Load hotel branch with no contracts
        /// </summary>
        protected void LoadHotelBranch()
        {
            DataTable vendorBranchDatatable = null;
            ListItem  item;

            try
            {
                vendorBranchDatatable = PortBLL.getVendorBranchbyVendorBrand(uoDropDownListHotelBrand.SelectedValue, Request.QueryString["vTypeCode"],
                                                                             Request.QueryString["contractBranchId"], Request.QueryString["cId"]);

                item = new ListItem("--Select Hotel Branch--", "0");
                uoDropDownListHotelBranch.Items.Clear();
                uoDropDownListHotelBranch.Items.Add(item);
                uoDropDownListHotelBranch.DataSource     = vendorBranchDatatable;
                uoDropDownListHotelBranch.DataTextField  = "colVendorBranchNameVarchar";
                uoDropDownListHotelBranch.DataValueField = "colBranchIDInt";
                uoDropDownListHotelBranch.DataBind();
                uoHiddenFieldCountryId.Value = vendorBranchDatatable.Rows[0]["colCountryIDInt"].ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (vendorBranchDatatable != null)
                {
                    vendorBranchDatatable.Dispose();
                }
            }
        }
        /// <summary>
        /// Date Created:   06/07/2012
        /// Created By:     Josephine Gad
        /// (description)   Load Port List
        /// </summary>
        private void BindPortList()
        {
            List <PortList> list = new List <PortList>();

            try
            {
                list = PortBLL.GetPortListByRegionCountry(GlobalCode.Field2String(Session["UserName"]), uoDropDownListRegion.SelectedValue, "0", "");

                uoDropDownListPortPerRegion.Items.Clear();
                ListItem item = new ListItem("--SELECT PORT--", "0");
                uoDropDownListPortPerRegion.Items.Add(item);
                if (list.Count > 0)
                {
                    uoDropDownListPortPerRegion.DataSource     = list;
                    uoDropDownListPortPerRegion.DataTextField  = "PORTName";
                    uoDropDownListPortPerRegion.DataValueField = "PORTID";
                    uoDropDownListPortPerRegion.DataBind();

                    if (GlobalCode.Field2String(Session["Port"]) != "")
                    {
                        if (uoDropDownListPortPerRegion.Items.FindByValue(GlobalCode.Field2String(Session["Port"])) != null)
                        {
                            uoDropDownListPortPerRegion.SelectedValue = GlobalCode.Field2String(Session["Port"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        /// <summary>
        /// Date Created: 26/07/2011
        /// Created By: Josephine Gad
        /// (description) Get Port List
        /// </summary>
        private void GetPortList()
        {
            DataTable PortListDataTable = null;

            try
            {
                PortListDataTable = PortBLL.GetPortList();
                uoDropDownListPort.Items.Clear();
                ListItem item = new ListItem("--Select Port--", "");
                uoDropDownListPort.Items.Add(item);
                uoDropDownListPort.DataSource = PortListDataTable.DefaultView;
                uoDropDownListPort.DataBind();
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
            }
            finally
            {
                if (PortListDataTable != null)
                {
                    PortListDataTable.Dispose();
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Author:         Josephine Gad
        /// Date Created:   15/08/2012
        /// Description:    Bind Seaport
        /// </summary>
        private void BindSeaport()
        {
            List <PortList> port = new List <PortList>();

            port = PortBLL.GetPortListByRegionCountry(GlobalCode.Field2String(Session["UserName"]), "0", "0", uoHiddenFieldRole.Value);

            uoDropDownListPort.Items.Clear();
            if (port.Count > 0)
            {
                uoDropDownListPort.DataSource     = port;
                uoDropDownListPort.DataTextField  = "PortName";
                uoDropDownListPort.DataValueField = "PortId";
            }
            uoDropDownListPort.DataBind();
            if (port.Count == 1)
            {
                if (uoDropDownListPort.Items.FindByValue(GlobalCode.Field2String(port[0].PortId)) != null)
                {
                    uoDropDownListPort.SelectedValue = GlobalCode.Field2String(port[0].PortId);
                }
            }
            if (GlobalCode.Field2String(Session["Port"]) != "")
            {
                if (uoDropDownListPort.Items.FindByValue(GlobalCode.Field2String(Session["Port"])) != null)
                {
                    uoDropDownListPort.SelectedValue = GlobalCode.Field2String(Session["Port"]);
                }
            }
            uoDropDownListPort.Items.Insert(0, new ListItem("--Select Seaport--", "0"));
            Session["Port"] = uoDropDownListPort.SelectedValue;
        }
        /// <summary>
        /// Date Created: 24/08/2011
        /// Created By: Marco Abejar
        /// (description) Save new port company
        /// </summary>
        protected void uoButtonSave_Click(object sender, EventArgs e)
        {
            string strLogDescription;
            string strFunction;

            Int32 PortAgentCompanyID = PortBLL.AddNewPortCompany(Convert.ToInt32(Request.QueryString["cmId"].ToString()), uoTextBoxCompanyName.Text, uoTextBoxAddress.Text, Convert.ToInt32(uoDropDownListCountry.SelectedValue),
                                                                 uoTextBoxPerson.Text, uoTextBoxContactNo.Text, GlobalCode.Field2String(Session["UserName"]));

            if (Request.QueryString["cmId"] == "0")
            {
                //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
                strLogDescription = "Port vendor added.";
                strFunction       = "uoButtonSave_Click";

                DateTime currentDate = CommonFunctions.GetCurrentDateTime();

                BLL.AuditTrailBLL.InsertLogAuditTrail(PortAgentCompanyID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                      CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));
            }
            else
            {
                //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
                strLogDescription = "Port vendor updated.";
                strFunction       = "uoButtonSave_Click";

                DateTime currentDate = CommonFunctions.GetCurrentDateTime();

                BLL.AuditTrailBLL.InsertLogAuditTrail(PortAgentCompanyID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                      CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));
            }

            OpenParentPage();
        }
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 07/12/2011
        /// Description: Load hotel vendor with no contracts
        /// </summary>
        private void LoadHotelBrand()
        {
            DataTable VendorBrandDatatable = null;
            ListItem  item;

            try
            {
                VendorBrandDatatable = PortBLL.getVendorBrandByPort(Request.QueryString["pId"], Request.QueryString["vTypeCode"], Request.QueryString["cId"],
                                                                    Request.QueryString["contractBranchId"]);

                item = new ListItem("--Select Hotel Brand--", "0");
                uoDropDownListHotelBrand.Items.Clear();
                uoDropDownListHotelBrand.Items.Add(item);
                uoDropDownListHotelBrand.DataSource     = VendorBrandDatatable;
                uoDropDownListHotelBrand.DataTextField  = "colVendorNameVarchar";
                uoDropDownListHotelBrand.DataValueField = "colVendorIdInt";
                uoDropDownListHotelBrand.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (VendorBrandDatatable != null)
                {
                    VendorBrandDatatable.Dispose();
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Date Created:   28/09/2011
        /// Created By:     Josephine Gad
        /// (description)   Get port by user and city
        /// ---------------------------------------------------------------------------
        /// </summary>
        private void BindPort()
        {
            DataTable PortDataTable = null;

            try
            {
                PortDataTable = PortBLL.GetPortListByCity(GlobalCode.Field2String(Session["UserName"]), uoDropDownListCity.SelectedValue);
                uoDropDownListPort.Items.Clear();
                ListItem item = new ListItem("--Select Port--", "0");
                uoDropDownListPort.Items.Add(item);
                uoDropDownListPort.DataSource     = PortDataTable;
                uoDropDownListPort.DataTextField  = "PORT";
                uoDropDownListPort.DataValueField = "PORTID";
                uoDropDownListPort.DataBind();

                if (GlobalCode.Field2String(Session["Port"]) != "")
                {
                    if (uoDropDownListPort.Items.FindByValue(GlobalCode.Field2String(Session["Port"])) != null)
                    {
                        uoDropDownListPort.SelectedValue = GlobalCode.Field2String(Session["Port"]);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (PortDataTable != null)
                {
                    PortDataTable.Dispose();
                }
            }
        }
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 09/11/2011
        /// Description: load vehicle branch
        /// </summary>
        protected void LoadVehicleBranch()
        {
            DataTable vendorBranchDatatable = null;
            ListItem  item;

            try
            {
                vendorBranchDatatable = PortBLL.getVendorBranchbyVendorBrand(uoDropDownListVehicleBrandName.SelectedValue, Request.QueryString["vType"],
                                                                             Request.QueryString["ServiceId"], Request.QueryString["cId"]);

                item = new ListItem("--Select Vehicle Branch--", "0");
                uoDropDownListVehicleBranch.Items.Clear();
                uoDropDownListVehicleBranch.Items.Add(item);
                uoDropDownListVehicleBranch.DataSource     = vendorBranchDatatable;
                uoDropDownListVehicleBranch.DataTextField  = "colVendorBranchNameVarchar";
                uoDropDownListVehicleBranch.DataValueField = "colBranchIDInt";
                uoDropDownListVehicleBranch.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (vendorBranchDatatable != null)
                {
                    vendorBranchDatatable.Dispose();
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Date Created:   05/10/2011
        /// Created By:     Josephine Gad
        /// (description)   Get Service Provider list by Port ID
        /// ---------------------------------------------
        /// </summary>
        /// <param name="vesselID"></param>
        private void GetPortAgent()
        {
            List <PortAgentDTO> portAgentList = null;

            try
            {
                if (uoHiddenFieldRole.Value == TravelMartVariable.RolePortSpecialist)
                {
                    portAgentList = PortBLL.GetPortAgentByPortID(uoHiddenFieldPortID.Value, GlobalCode.Field2String(Session["UserBranchID"]));
                }
                else
                {
                    portAgentList = PortBLL.GetPortAgentByPortID(uoHiddenFieldPortID.Value, "0");
                }
                var listPortAgent = (from a in portAgentList
                                     select new
                {
                    PortAgenName = a.PortAgentName,
                    PortAgentID = a.PortAgentID
                }).ToList();

                uoDropDownListPortAgent.Items.Clear();
                uoDropDownListPortAgent.Items.Add(new ListItem("--SELECT Service Provider--", "0"));
                uoDropDownListPortAgent.Items.Add(new ListItem("Other", "1"));

                uoDropDownListPortAgent.DataSource     = listPortAgent;
                uoDropDownListPortAgent.DataTextField  = "PortAgenName";
                uoDropDownListPortAgent.DataValueField = "PortAgentID";
                uoDropDownListPortAgent.DataBind();

                if (listPortAgent.Count == 1)
                {
                    uoDropDownListPortAgent.SelectedIndex = 1;
                }
                else if (listPortAgent.Count > 0)
                {
                    if (uoHiddenFieldRole.Value == TravelMartVariable.RolePortSpecialist)
                    {
                        if (uoDropDownListPortAgent.Items.FindByValue(GlobalCode.Field2String(Session["UserBranchID"])) != null)
                        {
                            uoDropDownListPortAgent.SelectedValue = GlobalCode.Field2String(Session["UserBranchID"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (portAgentList != null)
                {
                    portAgentList = null;
                }
            }
        }
Пример #11
0
        public bool Insert(PortBLL p, SqlConnection conn)
        {
            //set bool var
            bool isSuccess = false;



            try
            {
                //sql Query
                string sql = "INSERT INTO Porturi(Port, Baudrate, Parity, Databits, Stopbits) VALUES (@Port, @Baudrate, @Parity, @Databits, @Stopbits)";

                //sql comand
                SqlCommand cmd = new SqlCommand(sql, conn);

                //param to get value
                cmd.Parameters.AddWithValue("@Port", p.Port);
                cmd.Parameters.AddWithValue("@Baudrate", p.Baudrate);
                cmd.Parameters.AddWithValue("@Parity", p.Parity);
                cmd.Parameters.AddWithValue("@Stopbits", p.Stopbits);
                cmd.Parameters.AddWithValue("@Databits", p.Databits);



                //open conection
                conn.Open();

                //var to hold value after quer executed
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                //eror
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }



            return(isSuccess);
        }
Пример #12
0
        private void PortCompanyLoad()
        {
            /// <summary>
            /// Date Created: 24/08/2011
            /// Created By: Marco Abejar
            /// (description) Select all port company
            /// </summary>

            uoDropDownListPort.DataSource     = PortBLL.GetPortCompanyList();
            uoDropDownListPort.DataTextField  = "colCompanyNameVarchar";
            uoDropDownListPort.DataValueField = "colPortAgentCompanyIdInt";
            uoDropDownListPort.DataBind();
        }
Пример #13
0
        protected void uobuttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                //string PortAgentTransId = (Request.QueryString["pId"] == null) ? "" : Request.QueryString["pId"].ToString();
                //string SFRecLoc = (Request.QueryString["recloc"] == null) ? "" : Request.QueryString["recloc"].ToString();
                string PortAgentTransId = uoHiddenFieldPortTransID.Value;
                string TravelReqId      = uoHiddenFieldTravelRequestID.Value;
                //string RecordLocator = uoHiddenFieldRecordLocator.Value;
                string ManualRequestID = uoHiddenFieldManualRequestID.Value;

                string sfID        = uoHiddenFieldSeafarerID.Value.Trim();
                string PortAgentID = "1";
                string SFStatus    = Request.QueryString["st"].ToString();

                string PortTransStatus = uoDropdownListPortTravelStatus.SelectedValue;
                string PortTransDate   = uoTextBoxDropOffDate.Text;

                string PortID = uoHiddenFieldPortID.Value;

                if (uoHiddenFieldPortID.Value.Length == 0)
                {
                    PortID = uoDropDownListPort.SelectedValue;
                }
                bool transCompleted = PortBLL.InsertUpdatePortStatus(PortAgentTransId, TravelReqId,
                                                                     ManualRequestID, sfID, PortAgentID, PortID, PortTransStatus,
                                                                     GlobalCode.Field2String(Session["UserName"]), SFStatus, PortTransDate, uoHiddenFieldContractId.Value);
                if (transCompleted && (ViewState["Status"].ToString() != PortTransStatus || ViewState["date"].ToString() != PortTransDate))
                {
                    string status   = null;
                    string Contract = null;
                    if (ViewState["Status"].ToString() != "0")
                    {
                        status = ViewState["Status"].ToString();
                    }
                    if (uoHiddenFieldContractId.Value != "")
                    {
                        Contract = uoHiddenFieldContractId.Value;
                    }
                    //PortBLL.InsertPortStatusHistory(PortAgentTransId, TravelReqId, ManualRequestID, sfID,
                    //    PortAgentID, PortID, status, Session["UserName"].ToString(), SFStatus,
                    //    ViewState["date"].ToString(), Contract);
                }
                //PortBLL.InsertSFPortDetails(sfID, PortTransStatus, PortTransDate, SFStatus, PortID, SFPID, SFRecLoc);
                OpenParentPage();
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
            }
        }
 /// <summary>
 /// Date Created: 24/08/2011
 /// Created By: Marco Abejar
 /// (decription) Loads company information
 /// ------------------------------------------
 /// Date Modified: 28/11/2011
 /// Modified By:   Charlene Remotigue
 /// (description)  optimization (use datareader instead of datatable
 /// </summary>
 private void CompanyInfoLoad()
 {
     if (Request.QueryString["cmId"].ToString() != "0")
     {
         IDataReader dr = PortBLL.GetPortCompanyToEdit(Int32.Parse(Request.QueryString["cmId"].ToString()));
         if (dr.Read())
         {
             uoTextBoxCompanyName.Text           = dr["company"].ToString();
             uoTextBoxAddress.Text               = dr["address"].ToString();
             uoDropDownListCountry.SelectedValue = dr["colCountryIDInt"].ToString();
             uoTextBoxContactNo.Text             = dr["colMainContactNumberVarchar"].ToString();
             uoTextBoxPerson.Text = dr["colContactPerson"].ToString();
         }
     }
 }
Пример #15
0
        public bool Delete(PortBLL b, SqlConnection conn)
        {
            //set bool var
            bool isSuccess = false;



            try
            {
                //sql Query
                string sql = "DELETE FROM Porturi  ";

                //sql comand
                SqlCommand cmd = new SqlCommand(sql, conn);

                //param to get value



                //open conection
                conn.Open();

                //var to hold value after quer executed
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                //eror
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }



            return(isSuccess);
        }
Пример #16
0
        /// <summary>
        /// Date Created:   17/Jul/2014
        /// Created By:     Josephine Monteza
        /// (description)   Bind Seaport
        /// </summary>
        private void BindSeaport(Int16 iLoadType)
        {
            List <SeaportDTO> list = new List <SeaportDTO>();

            if (iLoadType == 0)
            {
                if (Session["VehicleVendor_Seaport"] != null)
                {
                    list = (List <SeaportDTO>)Session["VehicleVendor_Seaport"];
                }
            }
            else
            {
                List <PortList> listSeaport = new List <PortList>();

                string sRegion = GlobalCode.Field2Int(uoDropDownListRegion.SelectedValue).ToString();
                listSeaport = PortBLL.GetPortListByRegion(uoHiddenFieldUser.Value, uoDropDownListRegion.SelectedValue, "", "");

                list = (from a in listSeaport
                        select new SeaportDTO
                {
                    SeaportIDString = a.PortId.ToString(),
                    SeaportNameString = a.PortName
                }).ToList();
            }
            uoDropDownListSeaport.Items.Clear();
            ListItem item = new ListItem("--Select Seaport--", "0");

            uoDropDownListSeaport.Items.Add(item);

            uoDropDownListSeaport.DataSource     = list;
            uoDropDownListSeaport.DataTextField  = "SeaportNameString";
            uoDropDownListSeaport.DataValueField = "SeaportIDString";
            uoDropDownListSeaport.DataBind();

            string sSeaport = GlobalCode.Field2String(Session["SeaportID"]);

            if (uoDropDownListSeaport.Items.FindByValue(sSeaport) != null)
            {
                uoDropDownListSeaport.SelectedValue = sSeaport;
            }
        }
Пример #17
0
 /// <summary>
 /// Date Created:   01/08/2011
 /// Created By:     Marco Abejar
 /// (description)   Load port to edit
 /// ---------------------------------------------------
 /// Date Edited:    18/07/2012
 /// Created By:     Jefferson Bermundo
 /// (description)   Remove PortCityLoad
 /// </summary>
 private void LoadPort()
 {
     if (Request.QueryString["vmId"].ToString() != "0")
     {
         Session["vendorPrimaryId"] = Request.QueryString["vmId"];
         IDataReader dtSFInfo = PortBLL.GetPortToEdit(Int32.Parse(Session["vendorPrimaryId"].ToString()));
         if (dtSFInfo.Read())
         {
             uoTextBoxPortCode.Text = dtSFInfo["colPortCodeVarchar"].ToString();
             uoTextBoxPortName.Text = dtSFInfo["colPortNameVarchar"].ToString();
             uoDropDownListCountry.SelectedValue = dtSFInfo["colCountryIDInt"].ToString();
             if (uoDropDownListCountry.SelectedIndex > 1)
             {
                 //PortCityLoad(Convert.ToInt32(uoDropDownListCountry.SelectedValue));
                 //uoDropDownListCity.SelectedValue = dtSFInfo["colCityIDInt"].ToString();
             }
             //ChangeToUpperCase(uoDropDownListCountry);
             //ChangeToUpperCase(uoDropDownListCity);
         }
     }
 }
Пример #18
0
        /// <summary>
        /// Date Created:   28/09/2011
        /// Created By:     Josephine Gad
        /// (description)   Get port by user and city
        /// ---------------------------------------------------------------------------
        /// Date Modified:   06/07/2012
        /// Modified By:     Josephine Gad
        /// (description)    Change DataTable to List and use session
        /// </summary>
        private void BindPort()
        {
            List <PortList> list = new List <PortList>();

            try
            {
                //PortDataTable = PortBLL.GetPortListByCity(Session["UserName"].ToString(), uoDropDownListCity.SelectedValue); GetPortListByRegion
                //PortDataTable = PortBLL.GetPortListByCity(TravelMartVariable.TreadUserID, uoDropDownListCity.SelectedValue);
                //list = PortBLL.GetPortListByRegionCountry(GlobalCode.Field2String(Session["UserName"]), uoDropDownListRegion.SelectedValue, uoDropDownListCountry.SelectedValue);

                list = PortBLL.GetPortListByRegionCountry(GlobalCode.Field2String(Session["UserName"]), uoDropDownListRegion.SelectedValue, "0", "");

                uoDropDownListPort.Items.Clear();
                ListItem item = new ListItem("--Select Port--", "0");
                uoDropDownListPort.Items.Add(item);
                if (list.Count > 0)
                {
                    uoDropDownListPort.DataSource     = list;
                    uoDropDownListPort.DataTextField  = "PORTName";
                    uoDropDownListPort.DataValueField = "PORTID";
                    uoDropDownListPort.DataBind();

                    if (GlobalCode.Field2String(Session["Port"]) != "")
                    {
                        if (uoDropDownListPort.Items.FindByValue(GlobalCode.Field2String(Session["Port"])) != null)
                        {
                            uoDropDownListPort.SelectedValue = GlobalCode.Field2String(Session["Port"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #19
0
 public static bool CheckPortCode(string portCode, string portId)
 {
     return(PortBLL.CheckPortCode(portCode, Convert.ToInt32(portId)));
 }
Пример #20
0
        /// <summary>
        /// Date Created:   01/08/2011
        /// Created By:     Marco Abejar
        /// (description)   Save new port
        /// --------------------------------
        /// Date Modified:  07/03/2012
        /// Modified By:    Josephine Gad
        /// (description)   Add saving of Airport to Seaport
        /// --------------------------------
        /// Date Modified:  18/07/2012
        /// Modified By:    Jefferson Bermundo
        /// (description)   Update uoHiddenFieldPortID to the value of the the new pPortId
        /// </summary>
        protected void uoButtonSave_Click(object sender, EventArgs e)
        {
            string   strLogDescription;
            string   strFunction;
            DateTime currentDate = CommonFunctions.GetCurrentDateTime();
            DateTime GMTDate     = CommonFunctions.GetDateTimeGMT(currentDate);
            string   sPageName   = Path.GetFileName(Request.Path);

            try
            {
                //PortBLL.CheckPortCode(uoTextBoxPortCode.Text, Convert.ToInt32(uoHiddenFieldPortID.Value));
                Int32 pPortID = PortBLL.AddNewPort(uoTextBoxPortName.Text, null,
                                                   Convert.ToInt32(uoDropDownListCountry.SelectedValue),
                                                   GlobalCode.Field2String(Session["UserName"]), Int32.Parse(Session["vendorPrimaryId"].ToString()),
                                                   uoTextBoxPortCode.Text);

                uoHiddenFieldPortID.Value = pPortID.ToString();

                List <Airport> AirportList      = new List <Airport>();
                List <Airport> AirportNotInList = new List <Airport>();

                AirportList      = AirportInSeaport(false);
                AirportNotInList = AirportNotInSeaport(false);

                for (int i = 0; i < AirportList.Count; i++)
                {
                    if (AirportList[i].AirportSeaportID == 0)
                    {
                        strLogDescription = "Airport In Seaport added.";
                        strFunction       = "uoButtonSave_Click";

                        BLL.MaintenanceViewBLL.InsertAirportInSeaport(uoHiddenFieldUser.Value, AirportList[i].AirportID,
                                                                      uoHiddenFieldPortID.Value, strLogDescription, strFunction, sPageName);
                    }
                }

                if (Request.QueryString["vmId"] == "0" || Request.QueryString["vmId"] == null)
                {
                    //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
                    strLogDescription = "Port added.";
                    strFunction       = "uoButtonSave_Click";

                    BLL.AuditTrailBLL.InsertLogAuditTrail(pPortID, "", strLogDescription, strFunction, sPageName,
                                                          GMTDate, currentDate, uoHiddenFieldUser.Value);
                }
                else
                {
                    //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
                    strLogDescription = "Service Provider seaport updated.";
                    strFunction       = "uoButtonSave_Click";

                    //DateTime currentDate = CommonFunctions.GetCurrentDateTime();

                    BLL.AuditTrailBLL.InsertLogAuditTrail(pPortID, "", strLogDescription, strFunction, sPageName,
                                                          GMTDate, currentDate, uoHiddenFieldUser.Value);
                }

                OpenParentPage();
            }
            catch (Exception ex)
            {
                AlertMessage(ex.Message);
            }
        }
Пример #21
0
        /// <summary>
        /// Date Created:   08/07/2011
        /// Created By:     Marco Abejar
        /// (description)   Get and show seafarer personal and port transaction details
        /// -------------------------------------------
        /// Date Modified:  09/08/2011
        /// Modified By:    Josephine Gad
        /// (description)   Close DataTable
        /// -----------------------------------
        /// Date Modified: 28/11/2011
        /// Modified By:   Charlene Remotigue
        /// (description)  optimization (use datareader instead of datatable
        /// </summary>
        private void GetSeafarerInfo(string sfCode)
        {
            IDataReader dtSFInfo = null;

            try
            {
                string sfPID    = null;
                string sfStatus = null;

                sfPID    = uoHiddenFieldPortTransID.Value;
                sfStatus = uoHiddenFieldStatus.Value.Trim();
                dtSFInfo = PortBLL.GetSFPortTransDetails(sfCode, sfPID, sfStatus,
                                                         uoHiddenFieldTravelRequestID.Value, uoHiddenFieldManualRequestID.Value);
                if (dtSFInfo.Read())
                {
                    uotextboxSFName.Text        = dtSFInfo["Name"].ToString();
                    uotextboxSFNationality.Text = dtSFInfo["Nationality"].ToString();
                    uotextboxSFRank.Text        = dtSFInfo["Rank"].ToString();
                    uotextboxSFVessel.Text      = dtSFInfo["Vessel"].ToString();
                    uoTextboxSFPort.Text        = dtSFInfo["Port"].ToString();
                    uoHiddenFieldPortID.Value   = dtSFInfo["PortId"].ToString();
                    if (dtSFInfo["colContractIdInt"] == null)
                    {
                        uoHiddenFieldContractId.Value = null;
                    }
                    else if (dtSFInfo["colContractIdInt"].ToString() == "")
                    {
                        uoHiddenFieldContractId.Value = null;
                    }
                    else
                    {
                        uoHiddenFieldContractId.Value = dtSFInfo["colContractIdInt"].ToString();
                    }
                    //show hide portdropdownlist
                    if (uoHiddenFieldPortID.Value.Length > 0)
                    {
                        uoTextboxSFPort.Visible              = true;
                        uoDropDownListPort.Visible           = false;
                        uoRequiredFieldValidatorPort.Enabled = false;
                    }
                    else
                    {
                        uoTextboxSFPort.Visible              = false;
                        uoDropDownListPort.Visible           = true;
                        uoRequiredFieldValidatorPort.Enabled = true;
                        GetPortList();
                    }
                    uoRequiredFieldValidatorPort.Enabled = uoDropDownListPort.Visible = uoHiddenFieldPortID.Value.Length == 0;
                    string strStatus = dtSFInfo["Status"].ToString();
                    if (strStatus.Length > 0)
                    {
                        uoDropdownListPortTravelStatus.SelectedValue = Convert.ToString(uoDropdownListPortTravelStatus.Items.FindByText(strStatus).Value);
                    }
                    ViewState["Status"] = uoDropdownListPortTravelStatus.SelectedValue;

                    DateTime dtTrans = (dtSFInfo["TransDate"].ToString().Length > 0)
                        ? Convert.ToDateTime(dtSFInfo["TransDate"].ToString())
                        : DateTime.Now;
                    string TransDate = String.Format("{0:MM/dd/yyyy HH:mm}", dtTrans);
                    uoTextBoxDropOffDate.Text = TransDate;
                    ViewState["date"]         = uoTextBoxDropOffDate.Text;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dtSFInfo != null)
                {
                    dtSFInfo.Dispose();
                }
            }
        }