コード例 #1
0
        public JsonResult GetLocation(int id)
        {
            var            name = "";
            LatLng         ll   = new LatLng();
            LocationRecord lr   = new LocationRecord();

            if (Session["Ctx"] != null)
            {
                var       ctx = Session["ctx"] as Ctx;
                MLocation loc = MLocation.Get(ctx, id, null);

                if (loc == null)
                {
                    return(Json(lr, JsonRequestBehavior.AllowGet));
                }

                name = loc.ToString();

                ll.Longitude = loc.GetLongitude();
                ll.Latitude  = loc.GetLatitude();
            }
            lr.LocItem   = new KeyNamePair(id, name);
            lr.LocLatLng = ll;

            return(Json(lr, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        /// <summary>
        /// Get Location List
        /// </summary>
        /// <param name="ctx">client context</param>
        /// <returns>keyname pair dictionary</returns>
        internal static Dictionary <int, KeyNamePair> GetAllLocations(VAdvantage.Utility.Ctx ctx)
        {
            IDataReader dr       = null;
            int         MAX_ROWS = 10000;
            Dictionary <int, KeyNamePair> locs = new Dictionary <int, KeyNamePair>();

            try
            {
                dr = VAdvantage.DataBase.DB.ExecuteReader("SELECT * FROM C_Location");
                while (dr.Read())
                {
                    if (MAX_ROWS > 10000)
                    {
                        break;
                    }
                    MLocation loc = MLocation.Get(ctx, Convert.ToInt32(dr["C_Location_ID"]), null);
                    locs[loc.Get_ID()] = new KeyNamePair(loc.Get_ID(), loc.ToString());
                }
                dr.Close();
            }
            catch
            {
                if (dr != null)
                {
                    dr.Close();
                    dr = null;
                }
            }
            return(locs);
        }
コード例 #3
0
        public JsonResult GetLocation(int id)
        {
            var name = "";

            if (Session["Ctx"] != null)
            {
                var       ctx = Session["ctx"] as Ctx;
                MLocation loc = MLocation.Get(ctx, id, null);
                name = loc.ToString();
            }
            var item = new KeyNamePair(id, name);

            return(Json(item, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        /// <summary>
        /// Get Location List
        /// </summary>
        /// <param name="ctx">client context</param>
        /// <returns>keyname pair dictionary</returns>
        internal static LocationData GetAllLocations(VAdvantage.Utility.Ctx ctx)
        {
            IDataReader  dr      = null;
            LocationData locData = new LocationData();


            int MAX_ROWS = 10000;
            int count    = 0;
            Dictionary <int, KeyNamePair> locs      = new Dictionary <int, KeyNamePair>();
            Dictionary <int, LatLng>      lstLatLng = new Dictionary <int, LatLng>();

            try
            {
                dr = VAdvantage.DataBase.DB.ExecuteReader("SELECT * FROM C_Location");
                while (dr.Read())
                {
                    if (count > MAX_ROWS)
                    {
                        break;
                    }
                    MLocation loc = MLocation.Get(ctx, Convert.ToInt32(dr["C_Location_ID"]), null);
                    locs[loc.Get_ID()] = new KeyNamePair(loc.Get_ID(), loc.ToString());

                    lstLatLng[loc.Get_ID()] = new LatLng()
                    {
                        Latitude = loc.GetLatitude(), Longitude = loc.GetLongitude()
                    };
                    count++;
                }
                dr.Close();
            }
            catch
            {
                if (dr != null)
                {
                    dr.Close();
                    dr = null;
                }
            }
            locData.LocLookup = locs;
            locData.LocLatLng = lstLatLng;
            return(locData);
        }
コード例 #5
0
        public LocationElement(Ctx ctx, int C_Location_ID, Font font, Color color) : base(10, 1)                //	max
        {
            SetGap(0, 0);
            MLocation ml = MLocation.Get(ctx, C_Location_ID, null);

            //	log.fine("C_Location_ID=" + C_Location_ID);
            if (ml != null)
            {
                int index = 0;
                if (ml.IsAddressLinesReverse())
                {
                    SetData(index++, 0, ml.GetCountry(true), font, color);
                    //String[] lines = java.util.regex.Pattern.compile("$", java.util.regex.Pattern.MULTILINE).split(ml.GetCityRegionPostal());
                    String[] lines = System.Text.RegularExpressions.Regex.Split(ml.GetCityRegionPostal(), "$", System.Text.RegularExpressions.RegexOptions.Multiline);
                    for (int i = 0; i < lines.Length; i++)
                    {
                        if (string.IsNullOrEmpty(lines[i]))
                        {
                            continue;
                        }
                        SetData(index++, 0, lines[i], font, color);
                    }
                    if (ml.GetAddress4() != null && ml.GetAddress4().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress4(), font, color);
                    }
                    if (ml.GetAddress3() != null && ml.GetAddress3().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress3(), font, color);
                    }
                    if (ml.GetAddress2() != null && ml.GetAddress2().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress2(), font, color);
                    }
                    if (ml.GetAddress1() != null && ml.GetAddress1().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress1(), font, color);
                    }
                }
                else
                {
                    if (ml.GetAddress1() != null && ml.GetAddress1().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress1(), font, color);
                    }
                    if (ml.GetAddress2() != null && ml.GetAddress2().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress2(), font, color);
                    }
                    if (ml.GetAddress3() != null && ml.GetAddress3().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress3(), font, color);
                    }
                    if (ml.GetAddress4() != null && ml.GetAddress4().Length > 0)
                    {
                        SetData(index++, 0, ml.GetAddress4(), font, color);
                    }
                    //String[] lines = java.util.regex.Pattern.compile("$", java.util.regex.Pattern.MULTILINE).split(ml.GetCityRegionPostal());
                    String[] lines = System.Text.RegularExpressions.Regex.Split(ml.GetCityRegionPostal(), "$", System.Text.RegularExpressions.RegexOptions.Multiline);
                    for (int i = 0; i < lines.Length; i++)
                    {
                        if (string.IsNullOrEmpty(lines[i]))
                        {
                            continue;
                        }
                        SetData(index++, 0, lines[i], font, color);
                    }
                    SetData(index++, 0, ml.GetCountry(true), font, color);
                }
            }
        }       //	LocationElement