Exemplo n.º 1
0
        // Method from dialogue trigger
        public void SetAvailable(string[] parameters)
        {
            LocationList location       = (LocationList)Enum.Parse(typeof(LocationList), parameters[0]);
            bool         newIsAvailable = bool.Parse(parameters[1]);

            SetAvailable(location, newIsAvailable);
        }
        public void LocationListTest()
        {
            LocationList location = new LocationList(new DataRepository());

            Assert.IsNotNull(location.Locations[0].Name);
            Assert.IsNotNull(location.Locations[0].Id);
        }
Exemplo n.º 3
0
        private void LoadRepositories(ICollection <string> collection)
        {
            LocationTree.ItemsSource = new List <IRepoControl>();
            LocationList.Clear();

            foreach (string url in collection)
            {
                string[] parts = url.Split(urlSplitChars, StringSplitOptions.RemoveEmptyEntries);

                if (parts.Length == 0)
                {
                    return;
                }

                RepositoryFolder currentNode = LocationTree;
                for (int i = 0; i < parts.Length - 1; i++)
                {
                    currentNode = currentNode.GetOrAddChildFolder(parts[i]);
                }

                LocationList.Add(currentNode.AddChildRepository(parts[parts.Length - 1], url, NewItem_Checked));
            }

            LocationList.Sort((c1, c2) => c1.Content.ToString().CompareTo(c2.Content.ToString()));
        }
Exemplo n.º 4
0
 public void SetDistanceRemaining(LocationList location)
 {
     if (locationLookup.ContainsKey(location))
     {
         distanceRemaining = locationLookup[location].distance;
     }
 }
        public void Update()
        {
            LocationList locations = new LocationList();

            locations.Load();
            Location location          = locations.FirstOrDefault(l => l.Description == "SLTEST");
            Location retrievedLocation = new Location();

            if (location != null)
            {
                retrievedLocation.Id = location.Id;

                location.Description = "SLTEST1";

                //Act
                HttpClient client = InitializeClient();
                //Serialize a question object that we're trying to insert
                string serializedLocation = JsonConvert.SerializeObject(location);
                var    content            = new StringContent(serializedLocation);
                content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                HttpResponseMessage response = client.PutAsync("Location/" + location.Id, content).Result;

                retrievedLocation.LoadById();
            }
            //Assert
            Assert.AreEqual(location.Description, retrievedLocation.Description);
        }
        private void AddNewLookupLocation(LocationList location)
        {
            var feedeeLocationTable = new Dictionary <string, FeedeeEntry>();

            nodeFeedeeLookup = new Dictionary <TownNodeList, SaveableClone>();
            saveableClones   = new List <SaveableClone>();

            foreach (TownNodeList townNode in nodeManager.GetLocationMainNodes(location))
            {
                for (int i = 0; i < nodeManager.GetNodeMenuCount(location, townNode); i++)
                {
                    if (nodeManager.HasNPCSpawn(location, townNode, i))
                    {
                        TownNodeList  feedeeNode     = nodeManager.GetConnectedNode(location, townNode, i);
                        FeedeeClass   newFeedeeClass = ChooseFeedeeClass(feedeeNode);
                        FeedeeEntry   newFeedee      = CreateNewFeedee(newFeedeeClass, feedeeNode);
                        SaveableClone feedeeSaveable = feedeeSpawner.SpawnNewNPC(newFeedee.feedeeClass, newFeedee.identifier);

                        NPCInfo info = feedeeSaveable.GetComponent <NPCInfo>();
                        info.SetCharacterInfo("name", newFeedee.name);
                        info.SetCharacterInfo("rank", newFeedeeClass.ToString());

                        saveableClones.Add(feedeeSaveable);
                        feedeeLocationTable[newFeedee.identifier] = newFeedee;
                        AssignNPCToNode(feedeeSaveable, feedeeNode);
                    }
                }
                feedeeLookup[location] = feedeeLocationTable;
            }
        }
Exemplo n.º 7
0
        private void AddToBuffer(string server, string location, string message)
        {
            if (location == null)
            {
                location = " --Server-- ";
            }
            BufferLock.EnterWriteLock();
            if (!BufferList.Exists(buf => buf.Server == server && buf.Location == location))
            {
                BufferInfo newBuffer = new BufferInfo();
                newBuffer.Server   = server;
                newBuffer.Location = location;
                BufferList.Add(newBuffer);
            }
            BufferLock.ExitWriteLock();
            if (SelectedServer == server && !LocationList.Contains(location))
            {
                Application.Current.Dispatcher.Invoke((Action)(() => LocationList.Add(location)));
            }
            BufferLock.EnterWriteLock();
            BufferInfo buffer = BufferList.Find(buf => buf.Server == server && buf.Location == location);

            if (buffer.Buffer.Count >= 500)
            {
                buffer.Buffer.RemoveAt(0);
            }
            buffer.Buffer.Add(message);
            BufferLock.ExitWriteLock();
            ChangeBuffer();
        }
Exemplo n.º 8
0
        private void ExecuteRemoveLocation()
        {
            if (SelectedLocation != " --Server-- ")
            {
                string location = SelectedLocation;

                if (location.StartsWith("#") || location.StartsWith("&"))
                {
                    Bot botInstance = Controller.Instance.GetBot(SelectedServer);
                    if (botInstance.IRC.Channels.Exists(chan => chan.Name == location))
                    {
                        botInstance.IRC.Command.SendPart(location);
                    }
                }
                if (LocationList.Contains(location))
                {
                    Application.Current.Dispatcher.Invoke((Action)(() => LocationList.Remove(location)));
                }
                BufferLock.EnterWriteLock();
                if (BufferList.Exists(buf => buf.Server == SelectedServer && buf.Location == location))
                {
                    BufferList.RemoveAll(buf => buf.Server == SelectedServer && buf.Location == location);
                }
                BufferLock.ExitWriteLock();
            }
        }
        public void Insert()
        {
            //Setup
            Location location = new Location
            {
                Description = "SLTEST"
            };
            LocationList locations = new LocationList();

            locations.Load();
            int originalCount = locations.Count();



            //Act
            HttpClient client = InitializeClient();
            //Serialize a location object that we're trying to insert
            string serializedLocation = JsonConvert.SerializeObject(location);
            var    content            = new StringContent(serializedLocation);

            content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = client.PostAsync("Location", content).Result;

            //Assert
            locations.Clear();
            locations.Load();
            Assert.AreEqual(originalCount + 1, locations.Count);
        }
Exemplo n.º 10
0
            public static bool Do(HlGraph Graph)
            {
                DataFlow <LocationList> .Result DfResult = DoDF(Graph);

                List <Location> DeadDefinitionList = new List <Location>();

                bool Changed = false;

                foreach (BasicBlock BasicBlock in Graph.BasicBlocks)
                {
                    DeadDefinitionList.Clear();

                    LocationList List = DfResult.ExitState[BasicBlock];
                    if (List == null)
                    {
                        System.Diagnostics.Debug.Assert(BasicBlock == Graph.CanonicalExitBlock);
                    }
                    else
                    {
                        DeadDefinitionList.AddRange(List);
                    }

                    Changed |= ForBlock(BasicBlock, ref DeadDefinitionList);
                }
                return(Changed);
            }
Exemplo n.º 11
0
 public EditSchedule()
 {
     InitializeComponent();
     schedules = new ScheduleList();
     locations = new LocationList();
     sections  = new SectionList();
 }
Exemplo n.º 12
0
        private void Menu_EditItem_Click(object sender, RoutedEventArgs e)
        {
            LocationList items = (LocationList)Resources["LocationList"];

            int index = items.CurrentIndex;

            try
            {
                //create Window to prompt user for data.
                var editItemWindow = new EditWindow(items[index]);

                //if 'OK' pressed
                if (editItemWindow.ShowDialog() == true)
                {
                    //Get data from create-window.
                    string Name            = editItemWindow.Name;
                    string Street          = editItemWindow.Street;
                    int    StreetNum       = editItemWindow.StreetNum;
                    int    ZipCode         = editItemWindow.ZipCode;
                    string City            = editItemWindow.City;
                    string TreeMonitorList = editItemWindow.TreeMonitorList;

                    //Create new item with data.
                    Location item = new Location(Name, Street, StreetNum, ZipCode, City, TreeMonitorList);

                    //Replace item with edited item.
                    items[index] = item;
                }
            }
            catch
            {
                MessageBox.Show("Please choose an item from the List to edit.");
            }
        }
Exemplo n.º 13
0
        // GET: api/Locaiton
        public IEnumerable <Location> Get()
        {
            LocationList locations = new LocationList();

            locations.Load();
            return(locations);
        }
Exemplo n.º 14
0
        public async Task <LocationList> GetStops()
        {
            using (var client = new HttpClient())
            {
                try
                {
                    // AuthenticationHeaderValue
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                    var response = client.GetAsync(new Uri("https://api.vasttrafik.se/bin/rest.exe/v2/location.name?input=Chalmers&format=json")).Result;
                    Debug.WriteLine("Response: {0}", response.StatusCode);
                    if (!response.IsSuccessStatusCode)
                    {
                        throw new HttpRequestException(string.Format("Couln't get url. Failed with status code {1}", response.StatusCode));
                    }
                    var json = await response.Content.ReadAsStringAsync();

                    Debug.WriteLine("***: {0}", json);

                    LocationList list = JsonConvert.DeserializeObject <LocationList>(json);

                    return(list);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Exception: " + ex.Message);
                    return(null);
                }
            }
        }
Exemplo n.º 15
0
        public AddEmployeeViewModel(AddEmployee addEmployeeOpen)
        {
            eventObject = new EventClass();

            SelectedMenager = new ManagerDto();


            employee    = new tblEmployee();
            addEmployee = addEmployeeOpen;

            locationService = new LocationService();
            employeeService = new EmployeeService();

            sectorService = new SectorService();

            locationsInDb = locationService.GetAllLocations().ToList();

            LocationList    = ConvertLocationDtoList(locationsInDb);
            selctedLocation = LocationList.FirstOrDefault();
            LocationList.OrderByDescending(x => x.Location);
            LocationList.Reverse();



            managersInDb = employeeService.GetAllPotentialMenagers();

            PotentialMenagers = ConvertManagerListToDto(managersInDb);


            eventObject.ActionPerformed += ActionPerformed;
        }
Exemplo n.º 16
0
        private async Task ExecuteRefresh()
        {
            try
            {
                LocationViewModel sl = SelectedLocation;
                var plcs             = await _warehouse.DBService.GetPlaceIDs();

                LocationList.Clear();
                foreach (var p in plcs)
                {
                    LocationList.Add(new LocationViewModel {
                        ID = p.ID, Size = p.Size, Blocked = p.Blocked, Reserved = p.Reserved
                    });
                }
                foreach (var l in LocationList)
                {
                    l.Initialize(_warehouse);
                }
                if (sl != null)
                {
                    SelectedLocation = LocationList.FirstOrDefault(p => p.ID == sl.ID);
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
Exemplo n.º 17
0
            public override bool Equals(object obj)
            {
                if (!(obj is LocationList))
                {
                    return(false);
                }
                else if (object.ReferenceEquals(obj, this))
                {
                    return(true);
                }
                LocationList Other = (LocationList)obj;

                if (this.Count != Other.Count)
                {
                    return(false);
                }
                foreach (Location Entry in this)
                {
                    if (!Other.Contains(Entry))
                    {
                        return(false);
                    }
                }
                return(true);
            }
Exemplo n.º 18
0
        static async Task Main(string[] args)
        {
            HttpClient httpClient = new HttpClient(new SocketsHttpHandler
            {
                // Potentially add a proxy like this
                // Proxy = new WebProxy("http://127.0.0.1:8888")
            });

            RejseplanenClient client = new RejseplanenClient(httpClient);

            // Perform queries
            MBW.Clients.Rejseplanen.Schema.RestLocation.LocationList locationLookup = await client.GetLocationAsync("Vestergade");

            Console.WriteLine("Locations search: " + string.Join(", ", locationLookup.CoordLocation.Select(s => s.Name).Concat(locationLookup.StopLocation.Select(p => p.Name))));

            WGS84Coordinate loc = new WGS84Coordinate
            {
                X = 55.650000,
                Y = 12.560000
            };
            LocationList locationsNearby = await client.GetStopsNearbyAsync(loc);

            Console.WriteLine("Stops nearby: " + locationsNearby.StopLocation.Count);

            DepartureBoard departureBoard = await client.GetDepartureBoardAsync(8600626);

            Console.WriteLine("Coming departures: " + departureBoard.Departure.Count);
        }
        public ActionResult <ItemResponse <object> > GetTypes()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                LocationList locationList = new LocationList();

                locationList.LocationType = _lookUpService.GetEntity("location");
                locationList.State        = _service.GetStates();

                if (locationList == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Application Resource not found.");
                }
                else
                {
                    response = new ItemResponse <object> {
                        Item = locationList
                    };
                }
            }
            catch (Exception error)
            {
                code = 500;
                base.Logger.LogError(error.ToString());
                response = new ErrorResponse(error.Message);
            }
            return(StatusCode(code, response));
        }
Exemplo n.º 20
0
        protected override void PerformOperation(IServiceManagement channel)
        {
            Console.WriteLine("Listing Locations");
            LocationList list = channel.ListLocations(SubscriptionId);

            Utility.LogObject(list);
        }
 public IEnumerable <TownNodeList> GetLocationMainNodes(LocationList locationQuery)
 {
     foreach (TownNodeList node in locationMenuDB.GetMainNodes(locationQuery))
     {
         yield return(node);
     }
 }
        public void MakeMainMenu(LocationList location)
        {
            currentLocation = location;
            int nodeMenuCount = locationMenuDB.GetMenuCount(location, TownNodeList.Main);

            SetupMenuSlots(nodeMenuCount);
        }
Exemplo n.º 23
0
        public HttpResponseMessage getCity(string state)
        {
            if (string.IsNullOrWhiteSpace(state))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            LocationList location = new LocationList();

            var list = location.Cities.Where(x => x.Key.ToLower() == state.ToLower().Trim());

            if (list.Count() == 0 && !location.Cities.FirstOrDefault(x => x.Key.ToLower() == state.ToLower().Trim()).Equals(null))
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }

            else if (list.Count() == 0)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }


            var listStripped = list.Select(x => x.Value).ToArray().FirstOrDefault();

            return(Request.CreateResponse(HttpStatusCode.OK, listStripped));
        }
Exemplo n.º 24
0
        private void CheckQuestTriggers()
        {
            Debug.Log("Checking quest triggers!!");
            LocationList curLocation = locationManager.GetCurrentLocation();
            int          i           = 0;

            foreach (var check in questActionChecks)
            {
                if (!check.hasTriggered && check.location == curLocation && questList.HasQuest(check.quest) &&
                    questList.HasObjectiveCompleted(check.quest, check.objective) == check.isOnCompletion)
                {
                    if (check.buttonTrigger != null)
                    {
                        QuestTrigger trigger = check.buttonTrigger.gameObject.AddComponent <QuestTrigger>();
                        trigger.SetQuest(check.quest);
                        trigger.SetObjectiveIndex(check.objective);
                        int index = i;
                        check.buttonTrigger.onClick.AddListener(() => {
                            trigger.CompleteObjective();
                            MarkAsTriggered(index);
                        });
                    }
                    else
                    {
                        conversant.StartDialogue(check.dialogue);
                        activeCheck = check;
                    }
                }
                i++;
            }
        }
Exemplo n.º 25
0
        public void TestChangeOfView()
        {
            string actual = null;


            ObservableCollection <LocationListModel> locations = new ObservableCollection <LocationListModel>();

            locations.Add(new LocationListModel(1, "testowa lokacja"));


            LocationList locationList = new LocationList(locations);



            locationList.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                actual = e.PropertyName;
            };

            Assert.IsNull(actual);


            locationList.Locations = null;

            Assert.IsNotNull(actual);
            Assert.AreEqual("Locations", actual);
        }
Exemplo n.º 26
0
        public EditEmployeeViewModel(EditEmployee editEmployeeOpen, vwEmployee employeeEdit)
        {
            eventObject     = new EventClass();
            editEmployee    = editEmployeeOpen;
            selectedMenager = new vwMenager();
            employee        = employeeEdit;

            selctedLocation = new vwLOCATION();
            selectedMenager = new vwMenager();
            //selectedMenager.Menager = employee.MenagerName;
            StartDate = (DateTime)employee.DateOfBirth;
            Sector    = employee.SectorName;

            locationService = new LocationService();
            employeeService = new EmployeeService();
            genderService   = new GenderService();
            sectorService   = new SectorService();

            LocationList = locationService.GetAllLocations().ToList();
            LocationList.OrderByDescending(x => x.Location);
            LocationList.Reverse();

            PotentialMenagers = employeeService.GetAllPotentialMenagersForEditWindow(employeeEdit.EmployeeID);

            eventObject.ActionPerformed += ActionPerformed;

            oldEmployee           = new vwEmployee();
            oldEmployee.FirstName = employee.FirstName;
            oldEmployee.LastName  = employee.LastName;
            oldEmployee.JMBG      = employee.JMBG;
        }
Exemplo n.º 27
0
        private void Rebind()
        {
            switch (screenmode)
            {
            case ScreenMode.Location:
                locations = new LocationList();
                locations.Load();

                // Bind to the datagrid
                cboAttribute.ItemsSource = null;
                cboAttribute.ItemsSource = locations;
                break;

            case ScreenMode.Gender:

                genders = new GenderList();
                genders.Load();
                cboAttribute.ItemsSource = null;
                cboAttribute.ItemsSource = genders;
                break;

            case ScreenMode.Race:

                races = new RaceList();
                races.Load();
                cboAttribute.ItemsSource = null;
                cboAttribute.ItemsSource = races;
                break;
            }

            cboAttribute.DisplayMemberPath = "Description";
            cboAttribute.SelectedValuePath = "Id";
        }
    private void Populate()
    {
        LocationList.DataSource = ThermostatMonitorLib.Locations.LoadLocationsByUserId(AppUser.Current.UserData.Id);
        LocationList.DataBind();

        LocationList.SelectedValue = thermostat.LocationId.ToString();
        DisplayNameText.Text       = thermostat.DisplayName;
        IpAddressText.Text         = thermostat.IpAddress;
        TonsText.Text           = thermostat.ACTons.ToString();
        SeerText.Text           = thermostat.ACSeer.ToString();
        KilowattsLabel.Text     = thermostat.ACKilowatts.ToString() + "kw";
        BrandList.SelectedValue = thermostat.Brand;
        HeatBtuPerHourText.Text = thermostat.HeatBtuPerHour.ToString("###,###,###,###,###.##");
        FanKilowattsText.Text   = thermostat.FanKilowatts.ToString();

        if (thermostat.Id == 0)
        {
            DeleteButton.Visible = false;
        }
        else
        {
            DeleteButton.Attributes.Add("onclick", "return confirm('Are you sure you wish to permanently delete this thermostat?  All data will be lost.');");
        }
        ToggleNotes();
    }
Exemplo n.º 29
0
        /// <summary>
        /// Handles the ItemDeleted event of the gvLocations control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridCommandEventArgs"/> instance containing the event data.</param>
        protected void gvLocations_ItemDeleted(object sender, GridCommandEventArgs e)
        {
            if (!PageBase.StopProcessing)
            {
                //Get the GridDataItem of the RadGrid
                GridDataItem item = (GridDataItem)e.Item;
                //ProjectID = 0 means, there is no project being created.So we only deal with the EventList item list in viewstate.
                if (ProjectID == 0)
                {
                    LocationList.RemoveAt(item.ItemIndex);
                }
                else
                {
                    //Get the primary key value using the DataKeyValue.
                    int projectLocationId = (int)item.OwnerTableView.DataKeyValues[item.ItemIndex]["ProjectLocationId"];

                    #region Project Notification

                    DataContext.Notifications.AddObject(CreateNotification(Support.GetCodeIdByCodeValue("OperationType", "DELETE"), string.Format("{0} deleted a Project Location.", Support.UserFullName)));

                    #endregion Project Notification

                    DataContext.DeleteObject(DataContext.ProjectLocations.First(pl => pl.ProjectLocationId == projectLocationId));
                    DataContext.SaveChanges();
                }
            }
        }
Exemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string        sqlConnString = ConfigurationManager.ConnectionStrings["ConnString"].ToString();
                SqlConnection sqlConn       = new SqlConnection(sqlConnString);
                sqlConn.Open();

                SqlCommand     sqlCmd = new SqlCommand("select distinct provider_city from ambulance_provider order by provider_city", sqlConn);
                SqlDataAdapter da     = new SqlDataAdapter(sqlCmd);
                DataSet        ds     = new DataSet();
                da.Fill(ds);
                LocationList.DataTextField  = ds.Tables[0].Columns["provider_city"].ToString();
                LocationList.DataValueField = ds.Tables[0].Columns["provider_city"].ToString();
                LocationList.DataSource     = ds.Tables[0];
                LocationList.DataBind();
                //LocationList.SelectedIndex = 1;

                SqlCommand     sqlCmd2 = new SqlCommand("select * from ambulance_provider order by provider_name", sqlConn);
                SqlDataAdapter da2     = new SqlDataAdapter(sqlCmd2);
                DataSet        ds2     = new DataSet();
                da2.Fill(ds2);
                ProviderList.DataTextField  = ds2.Tables[0].Columns["provider_name"].ToString();
                ProviderList.DataValueField = ds2.Tables[0].Columns["provider_id"].ToString();
                ProviderList.DataSource     = ds2.Tables[0];
                ProviderList.DataBind();
                sqlConn.Close();
            }
        }
Exemplo n.º 31
0
    public static LocationList GetCategories()
    {
        LocationList lstCat = new LocationList();
        using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;"))
        {
            using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_CATEGORIES, Conn))
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Conn.Open();
                using (SqlDataReader dr = Cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        LocationsBO ObjCat = new LocationsBO();
                        ObjCat.CategoryID = Convert.ToInt32(dr["CategoryID"]);
                        ObjCat.CategoryName = Convert.ToString(dr["CategoryName"]);
                        lstCat.Add(ObjCat);
                    }

                }
            }
        }
        return lstCat;
    }
Exemplo n.º 32
0
	public void RebuildLocationsMenu(LocationList locs)
	{
			Menu emenu = locs.BuildLocationlMenu();
			(LocationsMenu.Proxies[0] as MenuItem).Submenu = emenu;
	}
Exemplo n.º 33
0
    public static LocationList GetLocationsByCatID(int CategoryID)
    {
        LocationList lstCat = new LocationList();
        using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;"))
        {
            using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_LOCATIONS_BY_CATEGORYID, Conn))
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Value = CategoryID;
                Conn.Open();
                using (SqlDataReader dr = Cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        LocationsBO ObjCat = new LocationsBO();
                        ObjCat.LocationID = Convert.ToInt32(dr["LocationID"]);
                        ObjCat.LocationName = Convert.ToString(dr["LocationName"]);
                        lstCat.Add(ObjCat);
                    }

                }
            }
        }
        return lstCat;
    }
Exemplo n.º 34
0
    public static LocationList GetLocations(int LocationID, DateTime AvailabiltyDateTime)
    {
        LocationList lstCat = new LocationList();
        using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;"))
        {
            using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_LOCATIONS_BY_CATEGORYIDANDAVAILDTTIME, Conn))
            {
                Cmd.CommandType = CommandType.StoredProcedure;
                Cmd.Parameters.Add("@LocationID", SqlDbType.Int).Value = LocationID;
                // Cmd.Parameters.Add("@AvailabilityDate", SqlDbType.DateTime).Value = AvailabiltyDateTime;
                Conn.Open();
                using (SqlDataReader dr = Cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        LocationsBO ObjCat = new LocationsBO();

                        ObjCat.CatLocationID = Convert.ToInt32(dr["CatLocationID"]);
                        ObjCat.LocationID = Convert.ToInt32(dr["LocationID"]);
                        ObjCat.LocationName = Convert.ToString(dr["LocationName"]);
                        ObjCat.Price = Convert.ToDecimal(dr["Price"]);
                        ObjCat.Tax = Convert.ToDecimal(dr["tax"]);
                        ObjCat.ParkType = Convert.ToString(dr["ParkType"]);
                        ObjCat.ParkTypeID = Convert.ToInt32(dr["ParkTypeID"]);
                        ObjCat.Description = Convert.ToString(dr["Description"]);
                        lstCat.Add(ObjCat);
                    }

                }
            }
        }
        return lstCat;
    }
Exemplo n.º 35
0
                LogObject(item);
            }
        }

        internal static void LogObject(CertificateList certificateList)
        {
            if (certificateList == null)
                return;

            Console.WriteLine("CertificateList contains {0} item(s).", certificateList.Count);
            foreach (var item in certificateList)
            {
                LogObject(item);
Exemplo n.º 36
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Start frmStart = new Start();
            frmStart.ShowDialog();
            if (frmStart.DialogResult != DialogResult.OK) return;

            #region *** Localtion ***
            FileInfo fileLocation_sys = new FileInfo(Program.strLocationr_FileName_sys);

            //string[] arrDLL = Directory.GetFiles(@"C:\Windows\System32\", "*.ini", SearchOption.TopDirectoryOnly);

            StreamReader srLocation;
            string temp;

            if (fileLocation_sys.Exists)
            {
                srLocation = new StreamReader(strLocationr_FileName_sys);
                temp = srLocation.ReadLine();
            }
            else
            {
                FileInfo fileLocation = new FileInfo(Program.strLocationr_FileName);
                if (fileLocation.Exists)
                {
                    srLocation = new StreamReader(strLocationr_FileName);
                    temp = srLocation.ReadLine();
                }
                else
                {
                    MessageBox.Show("Location Setting  file is not exist in " + Program.strLocationr_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (temp != null)
            {
                if (temp == "1") Location = LocationList.SH_1;
                if (temp == "2") Location = LocationList.SH_2;
                if (temp == "3") Location = LocationList.SH_3;
                if (temp == "4") Location = LocationList.SH_4;
                if (temp == "4") Location = LocationList.SH_4;

                if (temp == "11") Location = LocationList.BJ_1;
                if (temp == "12") Location = LocationList.BJ_2;
                if (temp == "99") Location = LocationList.Simulation;
            }
            #endregion Localtion

            // check which program to start
            if (frmStart.DialogResult == DialogResult.OK && tp == Mipi)
            {
                debug_mipi = true;
                Application.Run(new Mipi());
            }
            else if (frmStart.DialogResult == DialogResult.OK && tp == SweepTest)
            {
                debug_mipi = false;

                #region *** Variable Define
                string line;
                double tmpFreq;
                string[] content;
                /////////////////////////////////////////////////////////////
                //// 2015012015 add Linear GMSK LB/HB, that is 4
                int ParameterIndentify = 17 + 5 + 4 + 4;

                #endregion *** Variable Define ***

                #region *** Read Parameter Setting & Build Frequence List ***
                FileInfo fileParameter = new FileInfo(Program.strSweepParameter_FileName);

                //for LB filter verify
                TestSetting.LOSS_SRC_ROLL.Add(997.6, 0.0);
                TestSetting.LOSS_MSR_FILTER_LB.Add(997.6, 0.0);
                //for HB filter verify
                TestSetting.LOSS_SRC_ROLL.Add(1806.7, 0.0);
                TestSetting.LOSS_MSR_FILTER_HB.Add(1806.7, 0.0);
                //for harmonic which up 6GHz
                TestSetting.LOSS_SRC_ROLL.Add(6000, 0.0);
                TestSetting.LOSS_MSR_FILTER_LB.Add(6000, 0.0);
                TestSetting.LOSS_MSR_FILTER_HB.Add(6000, 0.0);

                if (!fileParameter.Exists)
                {
                    MessageBox.Show("Parameter Setting  file is not exist in " + Program.strSweepParameter_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                StreamReader srParameter = new StreamReader(strSweepParameter_FileName);
                line = srParameter.ReadLine();

                while (line != null)
                {
                    if (line.Contains("--- Setting ---"))
                    {
                        line = srParameter.ReadLine();
                        ParameterIndentify--;
                    }

                    #region  GMSK_LB Setting
                    if (line.Contains("--- GMSK_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_GMSK_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  GMSK Setting

                    #region  GMSK_HB Setting
                    if (line.Contains("--- GMSK_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_GMSK_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  GMSK Setting

                    #region  EDGE_LB Setting
                    if (line.Contains("--- EDGE_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EDGE_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EDGE_LB Setting

                    #region  EDGE_HB Setting
                    if (line.Contains("--- EDGE_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EDGE_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EDGE_HB Setting

                    #region  TDSCDMA Setting
                    if (line.Contains("--- TDSCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_TDSCDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  TDSCDMA Setting

                    #region  WCDMA Setting
                    if (line.Contains("--- WCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_WCDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  WCDMA Setting

                    #region  LTETDD_B38 Setting
                    if (line.Contains("--- LTETDD_B38 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTETDD_B38.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTETDD_B38 Setting

                    #region  LTETDD_B40 Setting
                    if (line.Contains("--- LTETDD_B40 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTETDD_B40.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTETDD_B40 Setting

                    #region  LTEFDD_LB Setting
                    if (line.Contains("--- LTEFDD_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTEFDD_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTEFDD_LB Setting

                    #region  LTEFDD_HB Setting
                    if (line.Contains("--- LTEFDD_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LTEFDD_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  LTEFDD_HB Setting

                    #region  CDMA Setting
                    if (line.Contains("--- CDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_CDMA.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  CDMA Setting

                    #region  EVDO Setting
                    if (line.Contains("--- EVDO ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_EVDO.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  EVDO Setting

                    #region  Linear_GMSK_LB Setting
                    if (line.Contains("--- Linear_GMSK_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LGMSK_LB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion  Linear GMSK Setting

                    #region  Linear GMSK_HB Setting
                    if (line.Contains("--- Linear_GMSK_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            content = line.Split(',');
                            TestSetting.SETTING_LGMSK_HB.Add(content[0], double.Parse(content[1]));
                        }
                        ParameterIndentify--;
                    }
                    #endregion Linear GMSK Setting

                    if (line.Contains("--- Frequency List ---"))
                    {
                        line = srParameter.ReadLine();
                        ParameterIndentify--;
                    }

                    #region CW LB Frequency list
                    if (line.Contains("--- CW LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CW_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_CW_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 6; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_LB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_LB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region CW HB Frequency list
                    if (line.Contains("--- CW HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CW_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_CW_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 3; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_HB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_HB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EDGE LB Frequency list
                    if (line.Contains("--- EDGE LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EDGE_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_EDGE_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EDGE HB Frequency list
                    if (line.Contains("--- EDGE HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EDGE_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_EDGE_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region TDSCDMA Frequency list
                    if (line.Contains("--- TDSCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_TDSCDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_TDSCDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region WCDMA Frequency list
                    if (line.Contains("--- WCDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_WCDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_WCDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE TDD_B38 Frequency list
                    if (line.Contains("--- LTETDD_B38 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTETDD_B38.ContainsKey(tmpFreq)) TestSetting.FREQ_LTETDD_B38.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE TDD_B40 Frequency list
                    if (line.Contains("--- LTETDD_B40 ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTETDD_B40.ContainsKey(tmpFreq)) TestSetting.FREQ_LTETDD_B40.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE FDD LB Frequency list
                    if (line.Contains("--- LTEFDD_LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTEFDD_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_LTEFDD_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LTE FDD HB Frequency list
                    if (line.Contains("--- LTEFDD_HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LTEFDD_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_LTEFDD_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region CDMA Frequency list
                    if (line.Contains("--- CDMA ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_CDMA.ContainsKey(tmpFreq)) TestSetting.FREQ_CDMA.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region EVDO Frequency list
                    if (line.Contains("--- EVDO ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_EVDO.ContainsKey(tmpFreq)) TestSetting.FREQ_EVDO.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LCW LB Frequency list
                    if (line.Contains("--- LCW LB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LCW_LB.ContainsKey(tmpFreq)) TestSetting.FREQ_LCW_LB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 6; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_LB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_LB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    #region LCW HB Frequency list
                    if (line.Contains("--- LCW HB ---"))
                    {
                        while (!(line = srParameter.ReadLine()).Contains("---"))
                        {
                            tmpFreq = double.Parse(line);
                            if (!TestSetting.FREQ_LCW_HB.ContainsKey(tmpFreq)) TestSetting.FREQ_LCW_HB.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_POUT.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_POUT.Add(tmpFreq, 0.0);
                            if (!TestSetting.LOSS_MSR_THROUGH.ContainsKey(tmpFreq)) TestSetting.LOSS_MSR_THROUGH.Add(tmpFreq, 0.0);
                            //Harmonic
                            for (int i = 2; i <= 3; i++)
                            {
                                if (!TestSetting.LOSS_SRC_ROLL.ContainsKey(tmpFreq * i)) TestSetting.LOSS_SRC_ROLL.Add(tmpFreq * i, 0.0);
                                if (!TestSetting.LOSS_MSR_FILTER_HB.ContainsKey(tmpFreq * i)) TestSetting.LOSS_MSR_FILTER_HB.Add(tmpFreq * i, 0.0);
                            }
                        }
                        ParameterIndentify--;
                    }
                    #endregion

                    if (!line.Contains("---"))
                        line = srParameter.ReadLine();
                    else if (line.Contains("--- The End ---"))
                        break;

                }

                srParameter.Close();

                if (ParameterIndentify != 0)
                {
                    MessageBox.Show("Parameter Setting  file is interrupt in " + Program.strSweepParameter_FileName
                                        + " \r\nPlease contact the developer",
                                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                #endregion *** Read Parameter Setting & Build Frequence List ***

                #region *** Start Test Program ***
                // everything is ready, start the test program
                if (MessageBox.Show("Perform Loss Comp?", "Loss Comp", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    NewLossComp frmNewLossComp = new NewLossComp();
                    frmNewLossComp.ShowDialog();
                    if (frmNewLossComp.DialogResult == DialogResult.OK)        //if Losscomp form closed, start Benchtest from
                        Application.Run(new SweepTest());
                }
                else
                    Application.Run(new SweepTest());

                #endregion *** Start Test Program ***
            }
            // if read configuration file fail, abort load the test program.
            else if (frmStart.DialogResult == DialogResult.OK)
            {
                debug_mipi = false;

                #region *** Check tp Configuration file ***
                strFilePath_Testcfg = strFilePath + tp + ".csv";
                if (!File.Exists(strFilePath_Testcfg))
                {
                    MessageBox.Show("Read " + tp + " configuration file fail.\r\nThere is no configuration file '"
                                        + tp + ".csv' in cfg folder", "oops!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                #endregion *** Check tp Configuration file ***

                #region *** Get program configuration information ***
                int i = 1;
                string line;
                string[] content;
                ProductTest = new Vanchip.Common.ProductTest[TestSetting.MaxTestItem];

                StreamReader srProduct = new StreamReader(strFilePath_Testcfg);
                //Last Cal Date
                line = srProduct.ReadLine();
                content = line.Split(',');
                lastCalDate = content[0];
                //csv Header
                csvHeader = srProduct.ReadLine();
                while ((line = srProduct.ReadLine()) != null)
                {
                    if (line == "") break;
                    content = line.Split(',');
                    ProductTest[i].Item = Convert.ToInt32(content[0]);
                    ProductTest[i].TestItem = content[1];
                    ProductTest[i].Description = content[2];
                    ProductTest[i].Units = content[3];
                    ProductTest[i].LowLimit = Convert.ToDouble(content[4]);
                    ProductTest[i].HighLimit = Convert.ToDouble(content[5]);
                    ProductTest[i].VCC = Convert.ToDouble(content[6]);

                    if (content[7] == "0")
                        ProductTest[i].VBAT = 0.01;
                    else
                        ProductTest[i].VBAT = Convert.ToDouble(content[7]);

                    if (content[8] == "0")
                        ProductTest[i].Vramp = 0.01;
                    else
                        ProductTest[i].Vramp = Convert.ToDouble(content[8]);

                    if (content[9] == "0")
                        ProductTest[i].Txen_Ven = 0.01;
                    else
                        ProductTest[i].Txen_Ven = Convert.ToDouble(content[9]);

                    if (content[10] == "0")
                        ProductTest[i].Gpctrl0_Vmode0 = 0.01;
                    else
                        ProductTest[i].Gpctrl0_Vmode0 = Convert.ToDouble(content[10]);

                    if (content[11] == "0")
                        ProductTest[i].Gpctrl1_Vmode1 = 0.01;
                    else
                        ProductTest[i].Gpctrl1_Vmode1 = Convert.ToDouble(content[11]);

                    if (content[12] == "0")
                        ProductTest[i].Gpctrl2_Vmode2 = 0.01;
                    else
                        ProductTest[i].Gpctrl2_Vmode2 = Convert.ToDouble(content[12]);

                    ProductTest[i].Pin = Convert.ToDouble(content[13]);
                    ProductTest[i].Pout = Convert.ToDouble(content[14]);
                    ProductTest[i].FreqIn = Convert.ToDouble(content[15]);
                    ProductTest[i].FreqOut = Convert.ToDouble(content[16]);
                    ProductTest[i].LossIn = Convert.ToDouble(content[17]);
                    ProductTest[i].LossOut = Convert.ToDouble(content[18]);
                    ProductTest[i].SocketOffset = Convert.ToDouble(content[19]);

                    i++;
                }
                srProduct.Close();
                #endregion Get program configuration information

                #region *** Start Test Program ***
                // everything is ready, start the test program
                if (MessageBox.Show("Perform Loss Comp?", "Loss Comp", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    LossComp frmLoss = new LossComp();
                    frmLoss.ShowDialog();
                    if (frmLoss.DialogResult == DialogResult.OK)        //if Losscomp form closed, start Benchtest from
                        Application.Run(new BenchTest());
                }
                else
                    Application.Run(new BenchTest());

                #endregion *** Start Test Program ***
            }
        }
        static void Main(string[] args)
        {
            List<ACL> lstAcl = new List<ACL>();
            using (SqlConnection con = new SqlConnection("Data Source=Cl1025;Initial Catalog=StagingMove;Integrated Security=True"))
            {
                con.Open();
                using (SqlCommand command = new SqlCommand("SELECT [ECMClass],[EddieAcl] FROM [StagingMove].[dbo].[SetAcl] where Run = 1", con))
                {
                    //DataTable dt = new DataTable();
                    //SqlDataAdapter da = new SqlDataAdapter();
                    //da.SelectCommand = command;
                    //da.Fill(dt);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            ACL acl = new ACL();
                            acl.EcmClass = reader.GetString(0).Trim();
                            acl.RMlocation = reader.GetString(1).Trim();
                            lstAcl.Add(acl);
                        }
                    }
                }
            }

            Console.WriteLine("What is the origin uri?");
            int iOuri = Convert.ToInt32(Console.ReadLine());

            foreach (ACL acl in lstAcl)
            {
                try
                {

                    using (Database db = new Database())
                    {
                        //Console.WriteLine("Enter ECM class name");
                        TrimMainObjectSearch sObj = new TrimMainObjectSearch(db, BaseObjectTypes.Record);
                        //ECMSTDClassName:"Confidential Transition" and type:16
                        //string str = @""+Console.ReadLine()+"";
                        //sObj.SetSearchString("ECMSTDClassName:\"" + acl.EcmClass + "\" and type:16 and updated>9/03/2016");
                        sObj.SetSearchString("ECMSTDClassName:\"" + acl.EcmClass + "\" and type:16 and originRun:"+iOuri);
                        Console.WriteLine(sObj.SearchString);
                        Console.WriteLine("Record count: " + sObj.FastCount.ToString());
                        
                        if (sObj.FastCount > 0)
                        {
                            FieldDefinition fdDocDate = new FieldDefinition(db, 85);
                            LocationList lstLoc = new LocationList();
                            Location l = new Location(db, acl.RMlocation);
                            lstLoc.Add(l);
                            foreach (Record r in sObj)
                            {
                                if(r.DateRegistered<=r.DateReceived)
                                {
                                    DateTime tdtDateReceived = r.DateReceived;
                                    r.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1);
                                }
                                r.Save();
                                //TrimDateTime rmDt = (TrimDateTime)r.GetFieldValue(fdDocDate).ToDotNetObject();
                                
                                //r.DateReceived = rmDt;
                                //r.DateCreated = rmDt;
                                //r.Save();

                                //
                                TrimAccessControlList lstacl = r.AccessControlList;
                                lstacl.set_AccessLocations((int)RecordAccess.ViewRecord, lstLoc);
                                lstacl.set_AccessLocations((int)RecordAccess.ViewDocument, lstLoc);
                                r.AccessControlList = lstacl;
                                try
                                {
                                    r.Save();
                                    Console.WriteLine("ACL applied to " + r.Number);
                                }
                                catch (Exception exp)
                                {
                                    Console.WriteLine("ACL failed, Error: " + exp.Message.ToString());
                                }
                            }
                        }
                    }
                }
                catch (Exception exp)
                {
                    Console.WriteLine("Error: " + exp.Message.ToString());
                }


            }









            Console.ReadLine();
        }
        private void drawCircle2(double lat, double lng, double radius)
        {
            // globals
            //drawing the circle with the latitude and longitude
            var d2r = Math.PI / 180;   // degrees to radians
            var r2d = 180 / Math.PI;   // radians to degrees
            var earthsradius = 3963; // 3963 is the radius of the earth in miles
            var points = 32;
            //var radius = 10;
            double rlat = ((double)radius / earthsradius) * r2d;
            double rlng = rlat / Math.Cos(lat * d2r);
            List<GLatLng> extp = new List<GLatLng>();
            for (var i = 0; i < points + 1; i++)
            {
                double theta = Math.PI * (i / (double)(points / 2));
                double ex = lng + (rlng * Math.Cos(theta));
                double ey = lat + (rlat * Math.Sin(theta));
                extp.Add(new GLatLng(ey, ex));
            }

            GIcon icon1 = new GIcon();
            icon1.image = "/images/urhere2.png";
            //icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon1.iconSize = new GSize(30, 30);
            icon1.shadowSize = new GSize(22, 20);
            icon1.iconAnchor = new GPoint(6, 20);
            icon1.infoWindowAnchor = new GPoint(5, 1);
            GMarkerOptions mOpts1 = new GMarkerOptions();
            mOpts1.clickable = false;
            mOpts1.icon = icon1;
            GMarker marker1 = new GMarker(latlong, mOpts1);

            this.GMap11.addPolygon(new GPolygon(extp, "##FF0000", 0.3));
            GMap11.addGMarker(marker1);

            //end of code for drawing circle with given lat long and radius
            //code for XML Retrieval

            using (reader1 = XmlReader.Create("C:/Users/Dheeraj Rampally/Desktop/dheeraj/SEM 2 ebooks/Query Processing/Project/yumi_web/yumi/xml/XMLFile1.xml"))
            {
                while (reader1.Read() && i1 <= l && j < l && k < l)
                {
                    if (reader1.IsStartElement())
                    {
                        switch (reader1.Name)
                        {
                            case "dictionary": break;
                            case "item": break;
                            case "key": break;
                            case "string": if (reader1.Read())
                                {
                                    if (reader1.Value.Trim().Contains("Metromix"))
                                    {
                                        nn[k] = reader1.Value.Trim();
                                        //Label1.Text = Label1.Text + reader.Value.Trim() + " "+"<br/>";
                                        k++;
                                    }
                                }
                                break;
                            case "value": break;
                            case "ArrayOfPoint": break;
                            case "Point": break;
                            case "x": if (reader1.Read())
                                {
                                    xcoordinates[i1] = reader1.Value.Trim();
                                    //Label2.Text += "xcoordinates[" + i1 + "]=" + reader.Value.Trim() + " " +"<br/>";
                                    i1++;
                                }
                                break;
                            case "y": if (reader1.Read())
                                {
                                    ycoordinates[j] = reader1.Value.Trim();
                                    //Label3.Text += "ycoordinates[" + j + "]=" + reader.Value.Trim() + " " + "<br/>";
                                    j++;
                                }
                                break;
                        }
                    }
                }
            }//end of code for the retrieval of XML coordinates

            //code snippet to draw a rectangle
            for (int z = 0; z <= 422; z=z+2)//looping through all the neighborhoods <=452
            {
                for (int j2 = 0; j2 < 4; j2++)//looping through all the edges within a neighborhood
                {
                    d2r = Math.PI / 180D;
                    if (j2 == 0)
                    {
                        //Haversine's Formula
                        dlong = (lng-double.Parse(xcoordinates[z])) * d2r;
                        dlat = (lat-double.Parse(ycoordinates[z])) * d2r;
                        a = Math.Pow(Math.Sin(dlat / 2.0), 2) + Math.Cos(lat * d2r) * Math.Cos(double.Parse(ycoordinates[z]) * d2r) * Math.Pow(Math.Sin(dlong / 2.0), 2);
                        c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
                        d = 3956 * c;//3956 is radius of earth in miles
                    }
                    else if (j2 == 1)
                    {
                        //Haversine's Formula
                        dlong = (lng-double.Parse(xcoordinates[z + 1])) * d2r;
                        dlat = (lat-double.Parse(ycoordinates[z])) * d2r;
                        a = Math.Pow(Math.Sin(dlat / 2.0), 2) + Math.Cos(lat * d2r) * Math.Cos(double.Parse(ycoordinates[z]) * d2r) * Math.Pow(Math.Sin(dlong / 2.0), 2);
                        c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
                        d = 3956 * c;
                    }
                    else if (j2 == 2)
                    {
                        //Haversine's Formula
                        dlong = (lng-double.Parse(xcoordinates[z])) * d2r;
                        dlat = (lat-double.Parse(ycoordinates[z+1])) * d2r;
                        a = Math.Pow(Math.Sin(dlat / 2.0), 2) + Math.Cos(lat * d2r) * Math.Cos(double.Parse(ycoordinates[z]) * d2r) * Math.Pow(Math.Sin(dlong / 2.0), 2);
                        c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
                        d = 3956 * c;
                    }
                    else if (j2 == 3)
                    {
                        //Haversine's Formula
                        dlong = (lng-double.Parse(xcoordinates[z+1])) * d2r;
                        dlat = (lat-double.Parse(ycoordinates[z + 1])) * d2r;
                        a = Math.Pow(Math.Sin(dlat / 2.0), 2) + Math.Cos(lat * d2r) * Math.Cos(double.Parse(ycoordinates[z]) * d2r) * Math.Pow(Math.Sin(dlong / 2.0), 2);
                        c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
                        d = 3956 * c;
                    }
                    distance[j2] = d;
                    //Label1.Text += distance[j2].ToString()+"<br/>";
                }
                maxElement = distance[0];//code for retriving the min element in an array
                for (int i3 = 0; i3 < 4; i3++)
                {
                    if (distance[i3] <maxElement)
                    {
                        maxElement = distance[i3];
                        //Label1.Text += "The minimum element is in loop" + x1 + "<br/>";
                    }
                }
                //x1 y2 x2 y1

                x1 = double.Parse(ycoordinates[z]);
                //Label1.Text += x1+" ";
                x3=lat;
                //Label1.Text += x2+" ";
                x2 = double.Parse(ycoordinates[z + 1]);
                //Label1.Text += x3 + "<br/>";
                if(x2<x3&&x3<x1)
                {
                    c1=true;
                  //  Label1.Text+="c1";
                }
                y1=(double.Parse(xcoordinates[z]));
                //Label1.Text += c2l + " ";
                y3=lng;
                //Label1.Text += c2m + " ";
                y2=(double.Parse(xcoordinates[z+1]));
                //Label1.Text += c2r +"<br/>";
                if((y1>y3)&&(y3>y2))
                {
                    c2=true;
                //    Label1.Text += "c2";
                }

                //vertex falling under circle

                if (radius >= maxElement)
                {
                        //code snippet to draw a rectangle
                    if (z == 0)
                    {
                        //Label1.Text += nn[0];
                        neighborhood[0] = nn[0];
                    }
                    else
                    {
                        //Label1.Text += nn[z / 2];
                        neighborhood[z / 2] = nn[z / 2];
                    }
                        GPolygon rectangle = new GPolygon();
                        List<GLatLng> rectanglePts = new List<GLatLng>();
                        rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z + 1])));
                        rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z])));
                        rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z])));
                        rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z + 1])));
                        rectangle = new GPolygon(rectanglePts, "0000CD", 2, 2, "FCD116", 0.3);
                        rectangle.clickable = true;
                        rectangle.close();
                        GMap11.Add(rectangle);
                        continue;
                }

                //circle lying inside neighborhood

                else if ((x2 < x3 && x3 < x1) && (y1 > y3 && y3 > y2))
                {
                    if (z == 0)
                    {
                        //Label1.Text += nn[0];
                        neighborhood[0] = nn[0];
                    }
                    else
                    {
                        //Label1.Text += nn[z / 2];
                        neighborhood[z / 2] = nn[z / 2];
                    }
                    GPolygon rectangle = new GPolygon();
                    List<GLatLng> rectanglePts = new List<GLatLng>();

                    rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z + 1])));
                    rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z])));
                    rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z])));
                    rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z + 1])));
                    rectangle = new GPolygon(rectanglePts, "0000CD", 2, 2, "FCD116", 0.3);
                    rectangle.clickable = true;
                    rectangle.close();
                    GMap11.Add(rectangle);
                    continue;
                }

                // the circle and line intersection with vertex lying outside circle
                    for (int j3 = 0; j3 < 4; j3++)
                    {
                        if (j3 == 0)
                        {
                            x4 = double.Parse(ycoordinates[z]);
                            y4 = double.Parse(xcoordinates[z]);
                            x5 = double.Parse(ycoordinates[z + 1]);
                            y5 = double.Parse(xcoordinates[z]);
                        }
                        if (j3 == 1)
                        {
                            x4 = double.Parse(ycoordinates[z + 1]);
                            y4 = double.Parse(xcoordinates[z]);
                            x5 = double.Parse(ycoordinates[z + 1]);
                            y5 = double.Parse(xcoordinates[z + 1]);
                        }
                        if (j3 == 2)
                        {
                            x4 = double.Parse(ycoordinates[z + 1]);
                            y4 = double.Parse(xcoordinates[z + 1]);
                            x5 = double.Parse(ycoordinates[z]);
                            y5 = double.Parse(xcoordinates[z + 1]);
                        }
                        if (j3 == 3)
                        {
                            x4 = double.Parse(ycoordinates[z]);
                            y4 = double.Parse(xcoordinates[z + 1]);
                            x5 = double.Parse(ycoordinates[z]);
                            y5 = double.Parse(xcoordinates[z]);
                        }
                        dx = x5 - x4;
                        dy = y5 - y4;
                        A = dx * dx + dy * dy;
                        B = 2 * (dx * (x4 - lat) + dy * (y4 - lng));
                        C = (x4 - lat) * (x4 - lat) + (y4 - lng) * (y4 - lng) - Math.Pow(0.014513788,2)*radius * radius;
                        det = B * B - 4 * A * C;

                        double t, ix1, iy1,ix2,iy2;
                        if ((A <= 0.0000001) || (det < 0))
                        {

                        }
                        else if(det==0)
                        {
                            t = -B / (2 * A);
                            ix1 = x4 + t * dx;
                            iy1 = y4 + t * dy;
                            if ((x4 >= ix1 && ix1 >= x5) && (y4 <= iy1 && iy1 <= y5) || (x4 <= ix1 && ix1 <= x5) && (y4 >= iy1 && iy1 >= y5))
                            {
                                if (z == 0)
                                {
                                    //Label1.Text += nn[0];
                                    neighborhood[0] = nn[0];
                                }
                                else
                                {
                                    //Label1.Text += nn[z / 2];
                                    neighborhood[z / 2] = nn[z / 2];
                                }
                                GPolygon rectangle = new GPolygon();
                                List<GLatLng> rectanglePts = new List<GLatLng>();
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z + 1])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z + 1])));
                                rectangle = new GPolygon(rectanglePts, "0000CD", 2, 2, "FCD116", 0.3);
                                rectangle.clickable = true;
                                rectangle.close();
                                GMap11.Add(rectangle);
                            }
                        }
                        else
                        {
                            t = (-B + Math.Sqrt(det)) / (2 * A);
                            ix1 = x4 + t * dx;
                            iy1 = y4 + t * dy;
                            t = (-B - Math.Sqrt(det)) / (2 * A);
                            ix2 = x4 + t * dx;
                            iy2 = y4 + t * dy;
                            if((x4>=ix1&&ix1>=x5)&&(y4<=iy1&&iy1<=y5)&&(x4>=ix2&&ix2>=x5)&&(y4<=iy2&&iy2<=y5)||
                                (x4 <= ix1 && ix1 <= x5) && (y4 >= iy1 && iy1 >= y5) && (x4 <= ix2 && ix2 <= x5) && (y4 >= iy2 && iy2 >= y5))
                            {
                                if (z == 0)
                                {
                                    //Label1.Text += nn[0];
                                    neighborhood[0] = nn[0];
                                }
                                else
                                {
                                    //Label1.Text += nn[z / 2];
                                    neighborhood[z / 2] = nn[z / 2];
                                }
                                GPolygon rectangle = new GPolygon();
                                List<GLatLng> rectanglePts = new List<GLatLng>();
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z + 1])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z]), double.Parse(xcoordinates[z])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z])));
                                rectanglePts.Add(new GLatLng(double.Parse(ycoordinates[z + 1]), double.Parse(xcoordinates[z + 1])));
                                rectangle = new GPolygon(rectanglePts, "0000CD", 2, 2, "FCD116", 0.3);
                                rectangle.clickable = true;
                                rectangle.close();
                                GMap11.Add(rectangle);
                            }
                        }
                    }

            }

            for (int i = 0, x = 0; i < neighborhood.Length; i++)
            {
                if (neighborhood[i] == null)
                    continue;
                else
                {
                    shortListednn[x] = neighborhood[i];
                    shortListednn[x] = shortListednn[x].Substring(9);
                    //Label1.Text += "ShortlistedNN " + x + "=" + shortListednn[x];
                    x++;
                }
            }

            for (int i = 0; i < Globals.hoods.Count(); i++)
            {
                for (int j = 0; j < shortListednn.Length; j++)
                {
                    if (Globals.hoods[i].getName() == shortListednn[j])
                    {
                        LocationList newHood = new LocationList(shortListednn[j]);
                        newHood = Globals.hoods[i];
                        Globals.shortListedNeighborHoods.Add(newHood);
                    }
                }

            }
            /*
            for (int i = 1; i < Globals.baba.Length; i++)
            {
                Globals.baba[i] = null;
            }

            for (int i = 0; i < Globals.shortListedNeighborHoods.Count(); i++)
            {
                for (int j = 0; j < Globals.shortListedNeighborHoods[i].getLocationsCount(); j++)
                {
                    if (Globals.baba[Globals.shortListedNeighborHoods[i].getSearchEngineCodeForMapping(j)] == null)
                    {
                        Globals.baba[Globals.shortListedNeighborHoods[i].getSearchEngineCodeForMapping(j)] = Globals.shortListedNeighborHoods[i].getNeighborhood(j);
                        continue;
                    }
                    Globals.baba[Globals.shortListedNeighborHoods[i].getSearchEngineCodeForMapping(j)]=Globals.baba[Globals.shortListedNeighborHoods[i].getSearchEngineCodeForMapping(j)]+","+Globals.shortListedNeighborHoods[i].getNeighborhood(j);
                }
            }

            */

            for (int i = 0; i < Globals.shortListedNeighborHoods.Count(); i++)
            {
                for (int j = 0; j < Globals.shortListedNeighborHoods[i].getLocationsCount(); j++)
                {
                    int k = Globals.shortListedNeighborHoods[i].getSearchEngineCodeForMapping(j);
                    s1 += Globals.shortListedNeighborHoods[i].getNeighborhood(j) + k.ToString() + ",";
                    //Label1.Text+= Globals.shortListedNeighborHoods[i].getNeighborhood(j) + k.ToString() +"<br/>";

                }

                //Label1.Text += "<------------Next Set of Neighborhoods for new neighborhood--------->"+"<br/>";
            }
            //Label1.Text = s1;

            char[] seps = { ',' };
            childList = s1.Split(seps);

            //for (int i = 0; i < childList.Length - 1; i++)
            //{
            //    Label1.Text += childList[i] + "<br/>";
            //}

            for (int i = 0; i < childList.Length - 1; i++)
            {
                //Label1.Text += childList[i]+"<br/>";
                length = childList[i].Length;
                if ((childList[i].Substring(length - 1)) == "1")
                {
                    Globals.metromixList[m] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "Metromix" +Globals.metromixList[m] + " " + "<br/>";
                    m++;
                }
                else if ((childList[i].Substring(length - 1)) == "2")
                {
                    Globals.dexknowsList[d1] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "dexknows"+Globals.dexknowsList[d1] + " " + "<br/>";
                    d1++;
                }
                else if ((childList[i].Substring(length - 1)) == "3")
                {
                    Globals.yelpList[y] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "yelp"+Globals.yelpList[y] + " " + "<br/>";
                    y++;
                }
                else if ((childList[i].Substring(length - 1)) == "4")
                {
                    Globals.chicagoList[ch] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "chicagoreader"+Globals.chicagoList[ch] + " " + "<br/>";
                    ch++;
                }
                else if ((childList[i].Substring(length - 1)) == "5")
                {
                    Globals.menuList[me] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "menu"+Globals.menuList[me] + " " + "<br/>";
                    me++;
                }
                else if ((childList[i].Substring(length - 1)) == "6")
                {
                    Globals.menuPagesList[mp] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "menupages"+Globals.menuPagesList[mp] + " " + "<br/>";
                    mp++;
                }
                else if ((childList[i].Substring(length - 1)) == "7")
                {
                    Globals.yahooList[ya] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "yahoo"+Globals.yahooList[ya] + " " + "<br/>";
                    ya++;
                }
                else if ((childList[i].Substring(length - 1)) == "8")
                {
                    Globals.yellowList[ye] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "yellow"+Globals.yellowList[ye] + " " + "<br/>";
                    ye++;
                }
                else if ((childList[i].Substring(length - 1)) == "9")
                {
                    Globals.cityList[ci] = childList[i].Substring(0, length - 1);
                    //Label1.Text += "city"+Globals.cityList[ci] + " " + "<br/>";
                    ci++;
                }
                else if ((childList[i].Substring(length - 2)) == "10")
                {
                    Globals.zagatList[za] = childList[i].Substring(0, length - 2);
                    //Label1.Text += "zagat"+Globals.zagatList[za] + " " + "<br/>";
                    za++;
                }
            }

            Array.Resize(ref Globals.metromixList, m);
            Array.Resize(ref Globals.zagatList, za);
            Array.Resize(ref Globals.yellowList,ye);
            Array.Resize(ref Globals.yahooList, ya);
            Array.Resize(ref Globals.menuPagesList, mp);
            Array.Resize(ref Globals.menuList, me);
            Array.Resize(ref Globals.chicagoList, ch);
            Array.Resize(ref Globals.yelpList, y);
            Array.Resize(ref Globals.dexknowsList, d1);
            Array.Resize(ref Globals.cityList, ci);

            //for (int i = 0; i < Globals.dexknowsList.Length; i++)
            //{
            //    Label1.Text += Globals.dexknowsList[i];
            //}
        }
Exemplo n.º 39
0
        /// <summary>
        /// Load the SOS locations of the user being tracked.
        /// </summary>
        /// <returns>The list of all the SOS locations</returns>
        private async Task<LocationList<Pushpin>> LoadSOSLocations(CancellationToken tk, GeoPosition<GeoCoordinate> reference)
        {
            var sosLocation = from request in ParseObject.GetQuery(ParseContract.SOSRequestTable.TABLE_NAME).Include(ParseContract.SOSRequestTable.SENT_LOCATION)
                              where request.Get<ParseUser>(ParseContract.SOSRequestTable.SENDER) == App.trackItemModel.user
                              where request.Get<bool>(ParseContract.SOSRequestTable.RESOLVED) == false
                              select request;

            IEnumerable<ParseObject> results = await sosLocation.FindAsync(tk);
            LocationList<Pushpin> list = new LocationList<Pushpin>(AppResources.Map_SOSLocation);
            for (int i = 0; i < results.Count(); i++)
            {
                ParseObject request = results.ElementAt(i);
                ParseObject location = request.Get<ParseObject>(ParseContract.SOSRequestTable.SENT_LOCATION);
                GeoPosition<GeoCoordinate> l = ParseContract.LocationTable.ParseObjectToGeoPosition(location);
                list.Add(new Pushpin(l, Pushpin.TYPE.KNOWN_SOS_LOCATION, reference, (sender, s) => SOSPushpin_Click(sender, s, request)));
            }
            list.Sort((x, y) => y.position.Timestamp.DateTime.CompareTo(x.position.Timestamp.DateTime));
            return list;
        }
        private static void ProcessMergeFile(List<LocationList> hoods, string file)
        {
            int defaultSearchEngine = 0;
            //String mergeFile = "merge/mergedHierarchyAnalysis.csv";
            //StreamReader reader = new StreamReader(mergeFile);
            StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath(file));

            String line = reader.ReadLine();
            char[] seps = { ',' };
            char[] hoodSeps = { ';' };

            while (line != null)
            {
                while (line.Equals(""))
                {
                    line = reader.ReadLine();
                }

                String[] lineParts = line.Split(seps, 4);
                defaultSearchEngine = findSearchEngine(lineParts[1]);
                string defaultSearchEngineHood = lineParts[0];
                if (lineParts[0].IndexOf('(') > 0)
                {
                    defaultSearchEngineHood = lineParts[0].Substring(0, lineParts[0].IndexOf('(')).Trim();
                }

                LocationList newHood = new LocationList(defaultSearchEngineHood);
                Console.WriteLine("Working on " + defaultSearchEngineHood);
                newHood.addLocation(defaultSearchEngine, defaultSearchEngineHood);
                if (lineParts[2].Equals("0"))
                    newHood.Level = 0;
                else
                    newHood.Level = 1;

                if (lineParts.Count() > 3)
                {
                    String[] locationMatches = lineParts[3].Split(hoodSeps);
                    for (int i = 0; i < locationMatches.Length; i++)
                    {
                        if (locationMatches[i].Length > 0)
                        {
                            String name = locationMatches[i].Substring(0, locationMatches[i].IndexOf(':'));
                            if (name.IndexOf('(') > 0 && !name.Equals("Chicago (O'Hare Area)"))
                            {
                                name = name.Substring(0, name.IndexOf('('));
                            }

                            String se = locationMatches[i].Substring(locationMatches[i].IndexOf(':') + 1, locationMatches[i].Length - locationMatches[i].IndexOf(':') - 1);
                            int seNum = findSearchEngine(se);

                            newHood.addLocation(seNum, name);
                        }
                    }
                }
                hoods.Add(newHood);
                line = reader.ReadLine();
            }

            reader.Close();
        }
Exemplo n.º 41
0
        //private Pushpin GetTestPushpin(double x, double y, DateTime d, GeoPosition<GeoCoordinate> my)
        //{
        //    return new Pushpin(new GeoPosition<GeoCoordinate>(d, new GeoCoordinate(x, y)), Pushpin.TYPE.TRACKED_LOCATION, my);
        //}

        /// <summary>
        /// Initialize and load data into lastLocations.
        /// </summary>
        /// <returns></returns>
        private async Task<LocationList<Pushpin>> LoadLastLocations(CancellationToken tk, GeoPosition<GeoCoordinate> reference)
        {
            //Initialize the locationList.
            LocationList<Pushpin> Locations = new LocationList<Pushpin>(Pushpin.TYPE.TRACKED_LOCATION);
            //DateTime d = DateTime.Now;
            //d = d.Subtract(new TimeSpan(0, 20, 0));
            //Locations.Add(GetTestPushpin(39.6393, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 55, 0));
            //Locations.Add(GetTestPushpin(39.6394, -086.8627, d, reference));
            //d = d.Subtract(new TimeSpan(0, 60, 0));
            //Locations.Add(GetTestPushpin(39.6392, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 58, 0));
            //Locations.Add(GetTestPushpin(39.6392, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 63, 0));
            //Locations.Add(GetTestPushpin(39.6392, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 53, 0));
            //Locations.Add(GetTestPushpin(39.6393, -086.8629, d, reference));
            //d = d.Subtract(new TimeSpan(0, 61, 0));
            //Locations.Add(GetTestPushpin(39.6394, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 55, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8627, d, reference));
            //d = d.Subtract(new TimeSpan(0, 60, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8628, d, reference));
            //d = d.Subtract(new TimeSpan(0, 61, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8648, d, reference));
            //d = d.Subtract(new TimeSpan(0, 59, 0));
            //Locations.Add(GetTestPushpin(39.6343, -086.8658, d, reference));
            //d = d.Subtract(new TimeSpan(0, 50, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8658, d, reference));
            //d = d.Subtract(new TimeSpan(0, 60, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8668, d, reference));
            //d = d.Subtract(new TimeSpan(0, 61, 0));
            //Locations.Add(GetTestPushpin(39.6353, -086.8668, d, reference));


            //Get the position of the first location data(oldest one).
            int locationSize = App.trackItemModel.user.Get<int>(ParseContract.UserTable.LOCATION_DATA_SIZE);
            int startPoint = App.trackItemModel.user.Get<int>(ParseContract.UserTable.LAST_LOCATION_INDEX);

            for (int i = 0; i < locationSize; i++)
            {
                //if (Locations.Count == LOCATION_SIZE_LIMIT)
                //    break;
                int current = startPoint - i;
                if (current < 0)
                    current += locationSize;

                if (App.trackItemModel.user.ContainsKey(ParseContract.UserTable.LOCATION(current)))
                {
                    ParseObject location = App.trackItemModel.user.Get<ParseObject>(ParseContract.UserTable.LOCATION(current));
                    await location.FetchIfNeededAsync(tk);
                    //Debug.WriteLine("line " + i + " : " + location.ObjectId + " " + location.Get<DateTime>(ParseContract.LocationTable.TIME_STAMP));
                    GeoPosition<GeoCoordinate> gp = ParseContract.LocationTable.ParseObjectToGeoPosition(location);
                    Locations.Add(new Pushpin(gp, Pushpin.TYPE.TRACKED_LOCATION, reference));
                }
            }

            //Sort to make sure the GeoPositions are in sorted order.
            //This is just making sure, the GeoPositions should be sorted already at this point.
            Locations.Sort((x, y) => y.position.Timestamp.DateTime.CompareTo(x.position.Timestamp.DateTime));
            return Locations;
        }
Exemplo n.º 42
0
        /// <summary>
        /// Load sos locations, either loads the past ones or the unresolved ones depending on the
        /// parameters passed to this page.
        /// </summary>
        /// <param name="tk"></param>
        /// <param name="reference"></param>
        /// <returns></returns>
        private async Task<LocationList<Pushpin>> LoadSOSLocations(bool isResolved, CancellationToken tk, GeoPosition<GeoCoordinate> reference)
        {
            ParseGeoPoint userL = new ParseGeoPoint(reference.Location.Latitude, reference.Location.Longitude);

            var nearLocations = from l in ParseObject.GetQuery(ParseContract.LocationTable.TABLE_NAME).Limit(1000)
                                where l.Get<bool>(ParseContract.LocationTable.IS_SOS_REQUEST) == true
                                select l;

            nearLocations = nearLocations.WhereWithinDistance(ParseContract.LocationTable.LOCATION, userL, ParseGeoDistance.FromMiles(areaRadius));

            var sosLocation = from request in ParseObject.GetQuery(ParseContract.SOSRequestTable.TABLE_NAME).Include(ParseContract.SOSRequestTable.SENT_LOCATION)
                              where request.Get<bool>(ParseContract.SOSRequestTable.RESOLVED) == isResolved
                              where request.Get<bool>(ParseContract.SOSRequestTable.SHARE_REQUEST) == true
                              select request;
            sosLocation = from r in sosLocation
                          join location in nearLocations on r[ParseContract.SOSRequestTable.SENT_LOCATION] equals location
                          select r;


            //var sosLocation = from request in ParseObject.GetQuery(ParseContract.SOSRequestTable.TABLE_NAME)
            //                  where request.Get<bool>(ParseContract.SOSRequestTable.RESOLVED) == isResolved
            //                  where request.Get<bool>(ParseContract.SOSRequestTable.SHARE_REQUEST) == true
            //                  join location in ParseObject.GetQuery(ParseContract.LocationTable.TABLE_NAME) on request[ParseContract.SOSRequestTable.SENT_LOCATION] equals location
            //                  select request;

            IEnumerable<ParseObject> results = await sosLocation.FindAsync(tk);

            LocationList<Pushpin> list = new LocationList<Pushpin>(AppResources.Map_SOSLocation);
            for (int i = 0; i < results.Count(); i++)
            {
                ParseObject request = results.ElementAt(i);
                ParseObject location = request.Get<ParseObject>(ParseContract.SOSRequestTable.SENT_LOCATION);
                //await location.FetchIfNeededAsync(tk);
                GeoPosition<GeoCoordinate> l = ParseContract.LocationTable.ParseObjectToGeoPosition(location);
                list.Add(new Pushpin(l, Pushpin.TYPE.UNKNOWN_SOS_LOCATION, reference, (sender, s) => SOSPushpin_Click(sender, s, request)));
            }
            list.Sort((x, y) => y.position.Timestamp.DateTime.CompareTo(x.position.Timestamp.DateTime));
            return list;
        }