public ActionResult SubmitRegistration(RegisterModel model, string returnUrl) { if (ModelState.IsValid) { if (!Ultil.IsMemberExist(model.Email)) { IMember newMember = Current.Services.MemberService.CreateMember(model.Email, model.Email, model.Name, "Member"); try { Current.Services.MemberService.Save(newMember); Current.Services.MemberService.SavePassword(newMember, model.Password); Current.Services.MemberService.AssignRole(newMember.Id, "IPE Group"); if (newMember.Id > 0) { return(Redirect("/Login")); } else { return(CurrentUmbracoPage()); } } catch (Exception ex) { } } } return(CurrentUmbracoPage()); }
private void OnServerCommandInvoke(object obj) { Transaction transaction = new Transaction(_document); try { if (IsSynch) { Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); } IsPushAllow = false; OnPropertyChanged(nameof(IsPushAllow)); IsPullAllow = true; OnPropertyChanged(nameof(IsPullAllow)); SelectedObj = null; Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, false); PreviewVisibility = false; OnPropertyChanged(nameof(PreviewVisibility)); IsSynch = false; IsOther = true; IsOnServer = true; OnPropertyChanged(nameof(IsSynch)); OnPropertyChanged(nameof(IsOther)); OnPropertyChanged(nameof(IsOnServer)); Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); setCurentList(ListObjOnStack); SetColorButton(false, false, true); OnPropertyChanged(nameof(Visible)); } catch { UserView.Dispose(); transaction.RollBack(); } }
private void CurentPreviewInvoke(object obj) { Transaction transaction = new Transaction(_document); try { Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); Ultil.HightLight(transaction, _document, CurentView.Id, RevitElementId, true); } catch { UserView.Dispose(); transaction.RollBack(); } }
public async Task <IEnumerable <SensorModel> > TakeHistorysBySensor(string Sensor) { var hisfiltrado = his.OrderBy(a => a.recvTime).Where(a => a.attrName == Sensor).ToList(); var result = from a in hisfiltrado select new SensorModel { Sensor = a.attrName, Valor = Ultil.AjustaDouble(a.attrValue), Data = a.recvTime }; return(result); }
public async Task <ActionResult <List <StatusAtualResponse> > > LoadData() { double maxima = 0; var service = new StatusAtualService(); var result = await service.LoadData(); foreach (StatusAtualResponse sar in result) { maxima = Ultil.AchaLuminosidadeMaxima(maxima, sar.luminosidade.value); sar.pH.value = Ultil.AjustaPH(sar.pH.value); sar.humidSolo.value = Ultil.AjustaUmidadeDoSolo(sar.humidSolo.value); } foreach (StatusAtualResponse sar in result) { sar.luminosidade.value = Ultil.AjustaLuminnosidade(sar.luminosidade.value, maxima); } return(Ok(result)); }
private void LastestPreviewInvoke(object obj) { Transaction transaction = new Transaction(_document); try { Ultil.HightLight(transaction, _document, CurentView.Id, RevitElementId, false); Ultil.VisibilityElement(_document, CurentView, RevitElementId, true); Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); Obj selectedObject = SelectedObj as Obj; _stateUniquId = Ultil.CreateOpening(transaction, _document, _catergoryName, selectedObject); if (_stateUniquId == "") { MessageBox.Show("Can't create this opening. Maybe this opening is not intersect with Wall"); } Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, true); } catch { UserView.Dispose(); transaction.RollBack(); } //RevitElementId }
private void SynchCommandInvoke(object obj) { Transaction transaction = new Transaction(_document); try { transaction.Start("Synch"); if (IsSynch) { Ultil.VisibilityElement(_document, CurentView, RevitElementId, false); } IsPushAllow = true; IsPullAllow = true; SelectedIndex = -1; SelectedObj = null; Ultil.HightLight(transaction, _document, CurentView.Id, _stateUniquId, false); PreviewVisibility = true; OnPropertyChanged(nameof(PreviewVisibility)); IsSynch = true; IsOther = false; IsOnServer = false; Ultil.ClearUniqueIdState(transaction, _document, ref _stateUniquId); setCurentList(ListObjHasSynch); SetColorButton(true, false, false); OnPropertyChanged(nameof(ListObjHasSynch)); Visible = System.Windows.Visibility.Collapsed; OnPropertyChanged(nameof(Visible)); OnPropertyChanged(nameof(IsSynch)); OnPropertyChanged(nameof(IsOther)); OnPropertyChanged(nameof(IsOnServer)); OnPropertyChanged(nameof(IsPushAllow)); OnPropertyChanged(nameof(IsPullAllow)); transaction.Commit(); } catch { UserView.Dispose(); transaction.RollBack(); } }
public async Task <StatusHistoryRsponse> AjusteHistorys(string agrupamento) { StatusHistoryRsponse STR = new StatusHistoryRsponse(); StatusAtualResponse statusAtualResponse = new StatusAtualResponse(); DateTime data = his.First().recvTime; double[] dadosAgroup = new double[6]; int[] contadores = new int[6]; bool[] NotNull = new bool[6]; double luminosidadeMaxima = 0; string dataFormat = agrupamento == "Dia" ? "{0:dd/MM/yy}" : agrupamento == "Mes" ? "{0:MMM/yy}" : agrupamento == "Ano" ? "{0:yyyy}" : "{0:d/M HH}"; if (data != null) { STR.Data = new List <string>(); STR.Data.Add(String.Format(dataFormat, data)); STR.pH = new List <double?>(); STR.humidAmbiente = new List <double?>(); STR.humidSolo = new List <double?>(); STR.luminosidade = new List <double?>(); STR.tempAmbiente = new List <double?>(); STR.tempSolo = new List <double?>(); zeraVetores(dadosAgroup, contadores, NotNull); } foreach (HistoryStatus hs in his) { if (hs.attrName == "luminosidade") { luminosidadeMaxima = Ultil.AchaLuminosidadeMaxima(luminosidadeMaxima, Ultil.AjustaDouble(hs.attrValue)); } } foreach (HistoryStatus hs in his) { if (agrupamento == "Dia") { if (hs.recvTime.Day != data.Day || hs.recvTime.Month != data.Month || hs.recvTime.Year != data.Year) { agrupaPorPeriodo(hs, STR, ref data, dadosAgroup, contadores, NotNull, dataFormat); } else { switch (hs.attrName) { case "pH": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[0]++; dadosAgroup[0] += Ultil.AjustaPH(Ultil.AjustaDouble(hs.attrValue)); NotNull[0] = false; } break; case "luminosidade": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[1]++; dadosAgroup[1] += Ultil.AjustaLuminnosidade(Ultil.AjustaDouble(hs.attrValue), luminosidadeMaxima); NotNull[1] = false; } break; case "tempSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[2]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[2] += Ultil.AjustaDouble(hs.attrValue); NotNull[2] = false; } break; case "tempAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[3]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[3] += Ultil.AjustaDouble(hs.attrValue); NotNull[3] = false; } break; case "humidSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[4]++; dadosAgroup[4] += Ultil.AjustaUmidadeDoSolo(Ultil.AjustaDouble(hs.attrValue)); NotNull[4] = false; } break; case "humidAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[5]++; dadosAgroup[5] += Ultil.AjustaDouble(hs.attrValue); NotNull[5] = false; } break; } } } if (agrupamento == "Mes") { if (hs.recvTime.Month != data.Month || hs.recvTime.Year != data.Year) { agrupaPorPeriodo(hs, STR, ref data, dadosAgroup, contadores, NotNull, dataFormat); } else { switch (hs.attrName) { case "pH": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[0]++; dadosAgroup[0] += Ultil.AjustaPH(Ultil.AjustaDouble(hs.attrValue)); NotNull[0] = false; } break; case "luminosidade": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[1]++; dadosAgroup[1] += Ultil.AjustaLuminnosidade(Ultil.AjustaDouble(hs.attrValue), luminosidadeMaxima); NotNull[1] = false; } break; case "tempSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[2]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[2] += Ultil.AjustaDouble(hs.attrValue); NotNull[2] = false; } break; case "tempAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[3]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[3] += Ultil.AjustaDouble(hs.attrValue); NotNull[3] = false; } break; case "humidSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[4]++; dadosAgroup[4] += Ultil.AjustaUmidadeDoSolo(Ultil.AjustaDouble(hs.attrValue)); NotNull[4] = false; } break; case "humidAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[5]++; dadosAgroup[5] += Ultil.AjustaDouble(hs.attrValue); NotNull[5] = false; } break; } } } if (agrupamento == "Ano") { if (hs.recvTime.Year != data.Year) { agrupaPorPeriodo(hs, STR, ref data, dadosAgroup, contadores, NotNull, dataFormat); } else { switch (hs.attrName) { case "pH": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[0]++; dadosAgroup[0] += Ultil.AjustaPH(Ultil.AjustaDouble(hs.attrValue)); NotNull[0] = false; } break; case "luminosidade": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[1]++; dadosAgroup[1] += Ultil.AjustaLuminnosidade(Ultil.AjustaDouble(hs.attrValue), luminosidadeMaxima); NotNull[1] = false; } break; case "tempSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[2]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[2] += Ultil.AjustaDouble(hs.attrValue); NotNull[2] = false; } break; case "tempAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[3]++; var a = Ultil.AjustaDouble(hs.attrValue); dadosAgroup[3] += Ultil.AjustaDouble(hs.attrValue); NotNull[3] = false; } break; case "humidSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[4]++; dadosAgroup[4] += Ultil.AjustaUmidadeDoSolo(Ultil.AjustaDouble(hs.attrValue)); NotNull[4] = false; } break; case "humidAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[5]++; dadosAgroup[5] += Ultil.AjustaDouble(hs.attrValue); NotNull[5] = false; } break; } } } if (agrupamento == "Hora") { if (hs.recvTime.Hour != data.Hour || hs.recvTime.Day != data.Day || hs.recvTime.Month != data.Month || hs.recvTime.Year != data.Year) { agrupaPorPeriodo(hs, STR, ref data, dadosAgroup, contadores, NotNull, dataFormat); } else { switch (hs.attrName) { case "pH": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[0]++; dadosAgroup[0] += Ultil.AjustaPH(Ultil.AjustaDouble(hs.attrValue)); NotNull[0] = false; } break; case "luminosidade": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[1]++; dadosAgroup[1] += Ultil.AjustaLuminnosidade(Ultil.AjustaDouble(hs.attrValue), luminosidadeMaxima); NotNull[1] = false; } break; case "tempSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[2]++; dadosAgroup[2] += Ultil.AjustaDouble(hs.attrValue); NotNull[2] = false; } break; case "tempAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[3]++; dadosAgroup[3] += Ultil.AjustaDouble(hs.attrValue); NotNull[3] = false; } break; case "humidSolo": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[4]++; dadosAgroup[4] += Ultil.AjustaUmidadeDoSolo(Ultil.AjustaDouble(hs.attrValue)); NotNull[4] = false; } break; case "humidAmbiente": if (!String.IsNullOrEmpty(hs.attrValue)) { contadores[5]++; dadosAgroup[5] += Ultil.AjustaDouble(hs.attrValue); NotNull[5] = false; } break; } } } } return(STR); }