コード例 #1
0
        /// <summary>
        /// Author: Charlene Remotigue
        /// Date Created: 09/05/2012
        /// Description: Add seaport to region
        /// -------------------------------------------
        /// Date Modified:   01/06/2012
        /// Modified By:     Josephine Gad
        /// (description)    Use Session["RegionSeaportList"] instead of RegionClass.RegionSeaportList;
        ///                  Use Session["RegionSeaportToAdd"] instead of RegionSeaportNotExists.RegionSeaportToAdd
        /// -------------------------------------------
        /// </summary>
        /// <param name="source"></param>
        private void MoveSelectedItems(ListView source)
        {
            CheckBox    uoCheckBoxSelect;
            HiddenField uoHiddenFieldSeaport;

            List <RegionSeaportNotExists> RListToAdd = new List <RegionSeaportNotExists>();// RegionSeaportNotExists.RegionSeaportToAdd;

            if (Session["RegionSeaportToAdd"] != null)
            {
                RListToAdd = (List <RegionSeaportNotExists>)Session["RegionSeaportToAdd"];
            }

            List <RegionSeaport> rList = new List <RegionSeaport>();

            if (Session["RegionSeaportList"] != null)
            {
                rList = (List <RegionSeaport>)Session["RegionSeaportList"];//RegionClass.RegionSeaportList;
            }

            foreach (ListViewItem item in source.Items)
            {
                uoCheckBoxSelect = (CheckBox)item.FindControl("uoCheckBoxSelect");

                if (uoCheckBoxSelect.Checked)
                {
                    uoHiddenFieldSeaport = (HiddenField)item.FindControl("uoHiddenFieldSeaport");
                    var listToAdd = (from a in RListToAdd
                                     where a.SeaportID == GlobalCode.Field2Int(uoHiddenFieldSeaport.Value)
                                     select new
                    {
                        RegionSeaportID = a.RegionSeaportID,
                        SeaportID = a.SeaportID,
                        SeaportName = a.SeaportName,
                        CountryID = a.CountryID,
                    }).ToList();
                    //RegionSeaportNotExists.RegionSeaportToAdd.RemoveAll(a => a.SeaportID == GlobalCode.Field2Int(uoHiddenFieldSeaport.Value));
                    RListToAdd.RemoveAll(a => a.SeaportID == GlobalCode.Field2Int(uoHiddenFieldSeaport.Value));
                    RegionSeaport seaportItem = new RegionSeaport();
                    seaportItem.RegionSeaportID = listToAdd[0].RegionSeaportID;
                    seaportItem.RegionID        = GlobalCode.Field2Int(uoHiddenFieldRegion.Value);
                    seaportItem.SeaportID       = listToAdd[0].SeaportID;
                    seaportItem.SeaportName     = listToAdd[0].SeaportName;
                    seaportItem.CountryID       = listToAdd[0].CountryID;
                    rList.Insert(rList.Count, seaportItem);
                }
            }
            //RegionSeaport.RegionSeaportList = null;
            //RegionClass.RegionSeaportList = rList.OrderBy(a => a.SeaportName).ToList();
            Session["RegionSeaportList"] = rList.OrderBy(a => a.SeaportName).ToList();
            BindRegionSeaport(true);
            BindSeaportToAdd(false);
        }
コード例 #2
0
        /// <summary>
        /// Date Modified: 27/02/2012
        /// Modified By:   Gabriel Oquialda
        /// (description)  Create data table for seaport
        /// </summary>
        private void CreateDatatableRegionSeaport()
        {
            List <RegionSeaport> RegionSeaportList = null;
            RegionSeaport        RegionSeaportItem = null;

            try
            {
                if (RegionSeaport.RegionSeaportList == null)
                {
                    RegionSeaportList = new List <RegionSeaport>();

                    for (int i = 0; i < uoGridViewSeaport.Rows.Count; i++)
                    {
                        RegionSeaportItem = new RegionSeaport();

                        RegionSeaportItem.RegionSeaportID = GlobalCode.Field2Int(uoGridViewSeaport.Rows[i].Cells[0].Text);
                        RegionSeaportItem.RegionID        = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[i].Cells[1].Text);
                        RegionSeaportItem.SeaportID       = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[i].Cells[2].Text);
                        RegionSeaportItem.SeaportName     = uoGridViewSeaport.Rows[i].Cells[3].Text;

                        RegionSeaportList.Add(RegionSeaportItem);
                    }
                }
                else
                {
                    RegionSeaportList = RegionSeaport.RegionSeaportList;
                }

                RegionSeaportItem = new RegionSeaport();
                RegionSeaportItem.RegionSeaportID = 0;
                RegionSeaportItem.RegionID        = GlobalCode.Field2TinyInt(Session["RegionId"].ToString());
                RegionSeaportItem.SeaportID       = GlobalCode.Field2TinyInt(uoDropDownListSeaport.SelectedValue);
                RegionSeaportItem.SeaportName     = uoDropDownListSeaport.SelectedItem.Text;
                RegionSeaportList.Add(RegionSeaportItem);

                RegionSeaport.RegionSeaportList = RegionSeaportList;
                BindRegionSeaport(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
        }
コード例 #3
0
        /// <summary>
        /// Date Created: 27/02/2012
        /// Created By:   Gabriel Oquialda
        /// (description) Remove row of region seaport
        /// --------------------------------------------
        /// </summary>
        private void DeleteDataTableRegionSeaport()
        {
            string strLogDescription;
            string strFunction;

            List <RegionSeaport> RegionSeaportList = null;
            RegionSeaport        RegionSeaportItem = null;

            try
            {
                if (RegionSeaport.RegionSeaportList == null)
                {
                    RegionSeaportList = new List <RegionSeaport>();

                    for (int i = 0; i < uoGridViewSeaport.Rows.Count; i++)
                    {
                        RegionSeaportItem = new RegionSeaport();

                        RegionSeaportItem.RegionSeaportID = GlobalCode.Field2Int(uoGridViewSeaport.Rows[i].Cells[0].Text);
                        RegionSeaportItem.RegionID        = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[i].Cells[1].Text);
                        RegionSeaportItem.SeaportID       = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[i].Cells[2].Text);
                        RegionSeaportItem.SeaportName     = uoGridViewSeaport.Rows[i].Cells[3].Text;

                        RegionSeaportList.Add(RegionSeaportItem);
                    }
                }
                else
                {
                    RegionSeaportList = RegionSeaport.RegionSeaportList;
                }
                int    iIndex          = uoGridViewSeaport.SelectedIndex;
                int    RegionSeaportID = GlobalCode.Field2Int(uoGridViewSeaport.Rows[iIndex].Cells[0].Text);
                Int16  RegionID        = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[iIndex].Cells[1].Text);
                Int16  SeaportID       = GlobalCode.Field2TinyInt(uoGridViewSeaport.Rows[iIndex].Cells[2].Text);
                string SeaportName     = GlobalCode.Field2String(uoGridViewSeaport.Rows[iIndex].Cells[3].Text);

                if (RegionSeaportID != 0)
                {
                    RegionBLL.DeleteRegionSeaport(RegionSeaportID.ToString(), GlobalCode.Field2String(Session["UserName"]));

                    //Insert log audit trail (Gabriel Oquialda - 28/02/2012)
                    strLogDescription = "Region seaport deleted. (flagged as inactive)";
                    strFunction       = "DeleteDataTableRegionSeaport";

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

                RegionSeaportList.RemoveAll(a => a.SeaportID == SeaportID && a.SeaportName == SeaportName);
                BindRegionSeaport(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (RegionSeaportList != null)
                {
                    RegionSeaportList = null;
                }
                if (RegionSeaportItem != null)
                {
                    RegionSeaportItem = null;
                }
            }
        }