private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand) { Brush fill; Pen outline; switch (status) { case LandStatus.NotChecked: fill = new Brush { Color = Color.White }; outline = new Pen { Color = Color.Black, Width = 2 }; break; case LandStatus.Ok: fill = new Brush { Color = Color.Green }; outline = new Pen { Color = Color.Black, Width = 2 }; break; case LandStatus.Alert: fill = new Brush { Color = Color.Red }; outline = new Pen { Color = Color.Black, Width = 2 }; break; default: fill = new Brush { Color = Color.Orange }; outline = new Pen { Color = Color.Black, Width = 2 }; break; } if (isOwnLand) { outline = new Pen { Color = Color.Orange, Width = 4 }; } var vStyle = new VectorStyle { Fill = fill, Outline = outline, }; vStyle.SetOpacity(opacity); return(vStyle); }
public void GetLandByStatus(LandStatus status) { var request = new RestRequest("land/status=" + status, Method.GET); client.ExecuteAsync<List<Land>>(request, response => Deployment.Current.Dispatcher.BeginInvoke(() => LandByStatusReceived(response.Data, null) )); }
public void GetLandByStatus(LandStatus status) { var request = new RestRequest("land/status=" + status, Method.GET); client.ExecuteAsync <List <Land> >(request, response => Deployment.Current.Dispatcher.BeginInvoke(() => LandByStatusReceived(response.Data, null) )); }
public void AddHexagon(Zone zone, LandStatus landStatus, bool isOwnLand) { var sphericalCoordinates = ConvertHexCoordinates(zone.getHexCoords()); var polygon = new Polygon { ExteriorRing = new LinearRing(sphericalCoordinates) }; var feature = new Feature {Geometry = polygon}; feature["hexcode"] = zone.code; feature.Styles.Add(GetVectorStyle(landStatus, isOwnLand)); source.Features.Add(feature); }
public HttpResponseMessage <List <Land> > GetAllByStatus(LandStatus landStatus, HttpRequestMessage request) { var landCollection = landRepository.GetLandByStatus(landStatus); foreach (var land in landCollection) { LandLinks.AddLinks(land, request); } return(new HttpResponseMessage <List <Land> >(landCollection) { StatusCode = HttpStatusCode.OK }); }
public void UpdateStatus(int landId, LandStatus landStatus, string username, string password) { client.Authenticator = new HttpBasicAuthenticator(username, password); var land = new Land { Id = landId, LandStatus = landStatus }; var request = new RestRequest("land/" + landId.ToString(CultureInfo.InvariantCulture) + @"/updatestatus", Method.PUT); request.RequestFormat = DataFormat.Json; request.JsonSerializer = new JsonSerializer(); request.AddBody(land); client.ExecuteAsync(request, response => Deployment.Current.Dispatcher.BeginInvoke(() => StatusChanged(null, null) )); }
public void AddHexagon(Zone zone, LandStatus landStatus, bool isOwnLand) { var sphericalCoordinates = ConvertHexCoordinates(zone.getHexCoords()); var polygon = new Polygon { ExteriorRing = new LinearRing(sphericalCoordinates) }; var feature = new Feature { Geometry = polygon }; feature["hexcode"] = zone.code; feature.Styles.Add(GetVectorStyle(landStatus, isOwnLand)); source.Features.Add(feature); }
public void UpdateStatus(int landId, LandStatus landStatus, string username, string password) { client.Authenticator = new HttpBasicAuthenticator(username, password); var land = new Land { Id = landId, LandStatus = landStatus }; var request = new RestRequest("land/" + landId.ToString(CultureInfo.InvariantCulture) + @"/updatestatus", Method.PUT); request.RequestFormat = DataFormat.Json; request.JsonSerializer = new JsonSerializer(); request.AddBody(land); client.ExecuteAsync(request, response => Deployment.Current.Dispatcher.BeginInvoke(() => StatusChanged(null, null) )); }
/// <summary> /// Cambia el status de a parcela (Id) por el que fue pasado por parametro /// </summary> /// <param name="id"></param> /// <param name="landStatus"></param> public void UpdateLandStatus(int id, LandStatus landStatus) { try { connection.Open(); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "Land_UpdateLandStatus"; command.Parameters.Add(new SqlParameter("@StatusChangedDateTime", DateTime.UtcNow)); command.Parameters.Add(new SqlParameter("@LandStatus", landStatus)); command.Parameters.Add(new SqlParameter("@Id", id)); command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { connection.Close(); } }
public void ChangeHexagon(string hexcode, LandStatus landStatus) { var feature = GetFeatureByHex(hexcode); feature.Styles.Add(GetVectorStyle(landStatus, false)); }
//Action Clicks private void ReportButton_Click(object sender, RoutedEventArgs e) { if (Current.Instance.TutorialStarted) { reportWindow_Closed(null, null); //close the report window and excecute callback on mainpage return; } this.ValidateMessageText.Visibility = System.Windows.Visibility.Collapsed; if (Current.Instance.Earthwatcher.Lands != null) { //Si es tu propia Parcela if (Current.Instance.Earthwatcher.Lands.Any(x => x.Id == selectedLand.Id)) { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; int statusNumber = 0; if (this.AlertButton.BorderThickness.Left > 0) { statusNumber = 4; confirmationSort = ConfirmationSort.Deconfirm; //Alert } if (this.OkButton.BorderThickness.Left > 0) { statusNumber = 3; confirmationSort = ConfirmationSort.Confirm; //OK } if (statusNumber == 0) { statusNumber = 2; //Not Checked } status = (LandStatus)statusNumber; if (selectedLand.LandStatus != status) { //Cambio el color de la parcela, segun el reporte del usuario Current.Instance.Earthwatcher.Lands.Where(x => x.Id == selectedLand.Id).First().LandStatus = status; loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.Confirm(selectedLand, confirmationSort, Current.Instance.Username, Current.Instance.Password); landRequests.UpdateStatus(selectedLand.Id, status, Current.Instance.Username, Current.Instance.Password); } } else //Si es la parcela de otro usuario { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; bool hasAction = false; if (this.ConfirmButton.BorderThickness.Left > 0) { if (!selectedLand.OKs.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Confirm; hasAction = true; } } if (this.DeconfirmButton.BorderThickness.Left > 0) { if (!selectedLand.Alerts.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Deconfirm; hasAction = true; } } if (hasAction) { loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.Confirm(selectedLand, confirmationSort, Current.Instance.Username, Current.Instance.Password); } else { this.ValidateMessageText.Visibility = System.Windows.Visibility.Visible; } } } }
/// <summary> /// Llama al metodo GetLands y le pasa el status /// </summary> /// <param name="status"></param> /// <returns>Listado de lands con ese status</returns> public List<Land> GetLandByStatus(LandStatus status) { return GetLands(0, false, 0, string.Empty, string.Empty, "POLYGON EMPTY", (int)status); }
private void ReportButton_Click(object sender, RoutedEventArgs e) { bool closeWindow = true; if (Current.Instance.Earthwatcher.LandId.HasValue) { if (Current.Instance.Earthwatcher.LandId == selectedLand.Id) { int statusNumber = 0; if (this.AlertButton.BorderThickness.Left > 0) { statusNumber = 4; } if (this.OkButton.BorderThickness.Left > 0) { statusNumber = 3; } if (statusNumber == 0) { statusNumber = 2; //Not Checked } status = (LandStatus)statusNumber; if (selectedLand.LandStatus != status) { closeWindow = false; landRequests.StatusChanged += SetLandStatusStatusChanged; landRequests.UpdateStatus(selectedLand.Id, status, Current.Instance.Username, Current.Instance.Password); Current.Instance.EarthwatcherLand.LandStatus = status; } } else { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; bool hasAction = false; if (this.ConfirmButton.BorderThickness.Left > 0) { if (!selectedLand.DeforestationConfirmers.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Confirm; hasAction = true; } } if (this.DeconfirmButton.BorderThickness.Left > 0) { if (!selectedLand.DeforestationDeconfirmers.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Deconfirm; hasAction = true; } } if (hasAction) { closeWindow = false; landRequests.ConfirmationAdded += landRequests_ConfirmationAdded; landRequests.Confirm(selectedLand.Id, Current.Instance.Earthwatcher.Id, confirmationSort, Current.Instance.Username, Current.Instance.Password); } } } if (closeWindow) { this.Close(); } }
private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand, bool demandAuthorities, bool ischecked, bool isGreenpeaceUser, bool islockedOnly, bool denouncedByMe) { Brush fill = null; Pen outline = null; switch (status) { case LandStatus.NotChecked: //STATUS 2 SIN CHEQUEAR fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) }; outline = new Pen { Color = Color.Black, Width = 1 }; break; case LandStatus.Ok: //STATUS 3 SIN DESMONTES fill = new Brush { Color = Color.FromArgb(143, 121, 136, 35) }; outline = new Pen { Color = Color.FromArgb(255, 169, 183, 41), Width = 4 }; break; case LandStatus.Alert: //STATUS 4 CON DESMONTES fill = new Brush { Color = Color.FromArgb(143, 255, 236, 0) }; outline = new Pen { Color = Color.FromArgb(255, 255, 242, 0), Width = 4 }; break; default: //DEFAULT, IDEM SIN CHEQUEAR fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) }; outline = new Pen { Color = Color.Black, Width = 1 }; break; } if (ischecked && (status == LandStatus.Alert || status == LandStatus.Ok)) //VERIFICADA POR MI DESMONTADA O SIN DESMONTE { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } if (isOwnLand && (status != LandStatus.Alert && status != LandStatus.Ok)) //MI PROPIA LAND { outline = new Pen { Color = Color.White, Width = 4 }; } if (demandAuthorities) //LISTA PARA DEMANDAR { fill = new Brush { Color = Color.FromArgb(143, 167, 11, 10) }; outline = new Pen { Color = Color.FromArgb(255, 217, 7, 7), Width = 4 }; if (denouncedByMe) { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } } if (!demandAuthorities && islockedOnly) { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } var vStyle = new VectorStyle { Fill = fill, Outline = outline, }; if (opacity == 0) { vStyle.SetOpacity(0); } else { if (Current.Instance.MapControl.Viewport.Resolution > 2.4 || Current.Instance.MapControl.Viewport.Resolution == 0) { vStyle.SetOpacity(opacity); } else { vStyle.SetOpacity(0); } } return(vStyle); }
/// <summary> /// Llama al metodo GetLands y le pasa el status /// </summary> /// <param name="status"></param> /// <returns>Listado de lands con ese status</returns> public List <Land> GetLandByStatus(LandStatus status) { return(GetLands(0, false, 0, string.Empty, string.Empty, "POLYGON EMPTY", (int)status)); }
private void ReportButton_Click(object sender, RoutedEventArgs e) { this.ValidateMessageText.Visibility = System.Windows.Visibility.Collapsed; if (Current.Instance.Earthwatcher.Lands != null) { if (Current.Instance.Earthwatcher.Lands.Any(x => x.Id == selectedLand.Id)) { int statusNumber = 0; if (this.AlertButton.BorderThickness.Left > 0) { statusNumber = 4; } if (this.OkButton.BorderThickness.Left > 0) { statusNumber = 3; } if (statusNumber == 0) { statusNumber = 2; //Not Checked } status = (LandStatus)statusNumber; if (selectedLand.LandStatus != status) { loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.UpdateStatus(selectedLand.Id, status, Current.Instance.Username, Current.Instance.Password); Current.Instance.Earthwatcher.Lands.Where(x => x.Id == selectedLand.Id).First().LandStatus = status; } else { this.ValidateMessageText.Visibility = System.Windows.Visibility.Visible; } } else { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; bool hasAction = false; if (this.ConfirmButton.BorderThickness.Left > 0) { if (!selectedLand.OKs.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Confirm; hasAction = true; } } if (this.DeconfirmButton.BorderThickness.Left > 0) { if (!selectedLand.Alerts.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Deconfirm; hasAction = true; } } if (hasAction) { loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.Confirm(selectedLand, confirmationSort, Current.Instance.Username, Current.Instance.Password); } else { this.ValidateMessageText.Visibility = System.Windows.Visibility.Visible; } } } }
public void ChangeHexagon(string hexcode, LandStatus landStatus) { var feature = GetFeatureByHex(hexcode); feature.Styles.Add(GetVectorStyle(landStatus, false)); }
/// <summary> /// Cambia el status de a parcela (Id) por el que fue pasado por parametro /// </summary> /// <param name="id"></param> /// <param name="landStatus"></param> public void UpdateLandStatus(int id, LandStatus landStatus) { try { connection.Open(); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "Land_UpdateLandStatus"; command.Parameters.Add(new SqlParameter("@StatusChangedDateTime", DateTime.UtcNow)); command.Parameters.Add(new SqlParameter("@LandStatus", landStatus)); command.Parameters.Add(new SqlParameter("@Id", id)); command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { connection.Close(); } }
private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand, bool demandAuthorities, bool ischecked, bool isGreenpeaceUser, bool islockedOnly, bool denouncedByMe) { Brush fill = null; Pen outline = null; switch (status) { case LandStatus.NotChecked: //STATUS 2 SIN CHEQUEAR fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) }; outline = new Pen { Color = Color.Black, Width = 1 }; break; case LandStatus.Ok: //STATUS 3 SIN DESMONTES fill = new Brush { Color = Color.FromArgb(143, 121, 136, 35) }; outline = new Pen { Color = Color.FromArgb(255, 169, 183, 41), Width = 4 }; break; case LandStatus.Alert: //STATUS 4 CON DESMONTES fill = new Brush { Color = Color.FromArgb(143, 255, 236, 0) }; outline = new Pen { Color = Color.FromArgb(255, 255, 242, 0), Width = 4 }; break; default: //DEFAULT, IDEM SIN CHEQUEAR fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) }; outline = new Pen { Color = Color.Black, Width = 1 }; break; } if (ischecked && (status == LandStatus.Alert || status == LandStatus.Ok)) //VERIFICADA POR MI DESMONTADA O SIN DESMONTE { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } if (isOwnLand && (status != LandStatus.Alert && status != LandStatus.Ok)) //MI PROPIA LAND { outline = new Pen { Color = Color.White, Width = 4 }; } if (demandAuthorities) //LISTA PARA DEMANDAR { fill = new Brush { Color = Color.FromArgb(143, 167, 11, 10) }; outline = new Pen { Color = Color.FromArgb(255, 217, 7, 7), Width = 4 }; if (denouncedByMe) { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } } if (!demandAuthorities && islockedOnly) { outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 }; } var vStyle = new VectorStyle { Fill = fill, Outline = outline, }; if (opacity == 0) { vStyle.SetOpacity(0); } else { if (Current.Instance.MapControl.Viewport.Resolution > 2.4 || Current.Instance.MapControl.Viewport.Resolution == 0) { vStyle.SetOpacity(opacity); } else { vStyle.SetOpacity(0); } } return vStyle; }
public HttpResponseMessage<List<Land>> GetAllByStatus(LandStatus landStatus, HttpRequestMessage request) { var landCollection = landRepository.GetLandByStatus(landStatus); foreach (var land in landCollection) { LandLinks.AddLinks(land, request); } return new HttpResponseMessage<List<Land>>(landCollection) { StatusCode = HttpStatusCode.OK }; }
private void ReportButton_Click(object sender, RoutedEventArgs e) { bool closeWindow = true; if (Current.Instance.Earthwatcher.LandId.HasValue) { if (Current.Instance.Earthwatcher.LandId == selectedLand.Id) { int statusNumber = 0; if (this.AlertButton.BorderThickness.Left > 0) { statusNumber = 4; } if (this.OkButton.BorderThickness.Left > 0) { statusNumber = 3; } if (statusNumber == 0) { statusNumber = 2; //Not Checked } status = (LandStatus)statusNumber; if (selectedLand.LandStatus != status) { closeWindow = false; landRequests.StatusChanged += SetLandStatusStatusChanged; landRequests.UpdateStatus(selectedLand.Id, status, Current.Instance.Username, Current.Instance.Password); Current.Instance.EarthwatcherLand.LandStatus = status; } } else { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; bool hasAction = false; if (this.ConfirmButton.BorderThickness.Left > 0) { if (!selectedLand.DeforestationConfirmers.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Confirm; hasAction = true; } } if (this.DeconfirmButton.BorderThickness.Left > 0) { if (!selectedLand.DeforestationDeconfirmers.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Deconfirm; hasAction = true; } } if (hasAction) { closeWindow = false; landRequests.ConfirmationAdded += landRequests_ConfirmationAdded; landRequests.Confirm(selectedLand.Id, Current.Instance.Earthwatcher.Id, confirmationSort, Current.Instance.Username, Current.Instance.Password); } } } if (closeWindow) { this.Close(); } }
//Action Clicks private void ReportButton_Click(object sender, RoutedEventArgs e) { if (Current.Instance.TutorialStarted) { reportWindow_Closed(null, null); //close the report window and excecute callback on mainpage return; } this.ValidateMessageText.Visibility = System.Windows.Visibility.Collapsed; if (Current.Instance.Earthwatcher.Lands != null) { //Si es tu propia Parcela if (Current.Instance.Earthwatcher.Lands.Any(x => x.Id == selectedLand.Id)) { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; int statusNumber = 0; if (this.AlertButton.BorderThickness.Left > 0) { statusNumber = 4; confirmationSort = ConfirmationSort.Deconfirm; //Alert } if (this.OkButton.BorderThickness.Left > 0) { statusNumber = 3; confirmationSort = ConfirmationSort.Confirm; //OK } if (statusNumber == 0) { statusNumber = 2; //Not Checked } status = (LandStatus)statusNumber; if (selectedLand.LandStatus != status) { //Cambio el color de la parcela, segun el reporte del usuario Current.Instance.Earthwatcher.Lands.Where(x => x.Id == selectedLand.Id).First().LandStatus = status; loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.Confirm(selectedLand, confirmationSort, Current.Instance.Username, Current.Instance.Password); landRequests.UpdateStatus(selectedLand.Id, status, Current.Instance.Username, Current.Instance.Password); } } else //Si es la parcela de otro usuario { ConfirmationSort confirmationSort = ConfirmationSort.Confirm; bool hasAction = false; if (this.ConfirmButton.BorderThickness.Left > 0) { if (!selectedLand.OKs.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Confirm; hasAction = true; } } if (this.DeconfirmButton.BorderThickness.Left > 0) { if (!selectedLand.Alerts.Split(',').Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString()))) { confirmationSort = ConfirmationSort.Deconfirm; hasAction = true; } } if (hasAction) { loadinAnim.Visibility = System.Windows.Visibility.Visible; this.MainGrid.IsHitTestVisible = false; landRequests.Confirm(selectedLand, confirmationSort, Current.Instance.Username, Current.Instance.Password); } else { this.ValidateMessageText.Visibility = System.Windows.Visibility.Visible; } } } }
private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand) { Brush fill; Pen outline; switch (status) { case LandStatus.NotChecked: fill = new Brush { Color = Color.White }; outline = new Pen { Color = Color.Black, Width = 2 }; break; case LandStatus.Ok: fill = new Brush { Color = Color.Green }; outline = new Pen { Color = Color.Black, Width = 2 }; break; case LandStatus.Alert: fill = new Brush { Color = Color.Red }; outline = new Pen { Color = Color.Black, Width = 2 }; break; default: fill = new Brush { Color = Color.Orange }; outline = new Pen { Color = Color.Black, Width = 2 }; break; } if (isOwnLand) { outline = new Pen { Color = Color.Orange, Width = 4 }; } var vStyle = new VectorStyle { Fill = fill, Outline = outline, }; vStyle.SetOpacity(opacity); return vStyle; }
public void UpdateLandStatus(int id, LandStatus landStatus) //Cambia el status de a parcela (Id) por el que fue pasado por parametro { connection.Open(); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "Land_UpdateLandStatus"; command.Parameters.Add(new SqlParameter("@StatusChangedDateTime", DateTime.UtcNow)); command.Parameters.Add(new SqlParameter("@LandStatus", landStatus)); command.Parameters.Add(new SqlParameter("@Id", id)); command.ExecuteNonQuery(); connection.Close(); }