public void SelecionaEspecialidade(Select2 select2) { if (!Guid.TryParse(select2.Id, out Guid especialidadeId)) { return; } if (_usuarioViewModel.Especialidades.Any(_ => _.EspecialidadeId == especialidadeId)) { var index = _usuarioViewModel.Especialidades.FindIndex(_ => _.EspecialidadeId == especialidadeId); if (_usuarioViewModel.Especialidades[index].Id == Guid.Empty) { _usuarioViewModel.Especialidades.RemoveAt(index); } else { _usuarioViewModel.Especialidades[index].Ativo = !_usuarioViewModel.Especialidades[index].Ativo; } } else { _usuarioViewModel.Especialidades.Add(UsuarioViewModel.ControiMedicoEspecialidade(Guid.Empty, especialidadeId, true)); } }
//TODO: need implementation /*public PXAction<CR.OwnedFilter> ExportCalendar; * [PXUIField(DisplayName = Messages.ExportCalendar)] * [PXButton(Tooltip = Messages.ExportCalendarTooltip)] * public IEnumerable exportCalendar(PXAdapter adapter) * { * var events = Events.Select().RowCast<EPActivity>(); * var calendar = (vCalendarIcs)VCalendarProcessor.CreateVCalendar(events); * throw new EPIcsExportRedirectException(calendar); * } * * public PXAction<CR.OwnedFilter> ExportCard; * [PXUIField(DisplayName = Messages.ExportCard)] * [PXButton(Tooltip = Messages.ExportCardTooltip)] * public IEnumerable exportCard(PXAdapter adapter) * { * if (Events.Current == null) return adapter.Get(); * var card = VCalendarProcessor.CreateVEvent(Events.Current); * throw new EPIcsExportRedirectException(card); * }*/ #endregion #region Data Handlers protected virtual IEnumerable events() { BqlCommand command = new Select2 <EPActivity, LeftJoin <EPAttendee, On <EPAttendee.userID, Equal <Current <AccessInfo.userID> >, And <EPAttendee.eventID, Equal <EPActivity.taskID> > >, LeftJoin <EPView, On <EPView.noteID, Equal <EPActivity.noteID>, And <EPView.userID, Equal <Current <AccessInfo.userID> > > > > >, Where <EPActivity.classID, Equal <CRActivityClass.events> >, OrderBy <Desc <EPActivity.priority, Asc <EPActivity.startDate, Asc <EPActivity.endDate> > > > >(); var filter = Filter.Current; if (filter.OwnerID != null) { command = new Select2 <EPActivity, LeftJoin <EPAttendee, On <EPAttendee.userID, Equal <CurrentValue <CR.OwnedFilter.ownerID> >, And <EPAttendee.eventID, Equal <EPActivity.taskID> > >, LeftJoin <EPView, On <EPView.noteID, Equal <EPActivity.noteID>, And <EPView.userID, Equal <Current <AccessInfo.userID> > > > > >, Where2 <Where <EPActivity.createdByID, Equal <CurrentValue <CR.OwnedFilter.ownerID> >, Or <EPAttendee.userID, IsNotNull> >, And <Where <EPActivity.classID, Equal <CRActivityClass.events> > > >, OrderBy <Desc <EPActivity.priority, Asc <EPActivity.startDate, Asc <EPActivity.endDate> > > > >(); } var view = new PXView(this, true, command); var startRow = PXView.StartRow; int totalRows = 0; var list = view.Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows); PXView.StartRow = 0; return(list); }
/// <summary> /// Builds the object /// </summary> /// <param name="swal"></param> /// <returns></returns> private static string BuildSelect2(Select2 select2, string selector) { var start = "$(function(){"; var end = "});});"; var body = $"$('#{selector}').select2({{"; foreach (var prop in select2.GetType().GetProperties()) { var val = prop.GetValue(select2, null); if (prop.GetCustomAttributes(typeof(RenderAttribute), false).Length > 0 && val != null) { if (val.GetType() == typeof(bool)) { // bools are uppercase first late strings, so for JS convert to lower case string body += $"{prop.Name}: {val.ToString().ToLower()},"; } else { body += $"{prop.Name}: '{val}',"; } } } //// remove last comma from the body return(start + body.Substring(0, body.Length - 1) + end); }
public void OnUserRoleUnassign(Select2 <ProcessRole> select, string roleId) { RedoableCommands.Clear(); var unassignedRole = _userModelManager.GetProcessRoles().Where(r => r.Id == roleId).FirstOrDefault(); var unassignedCommand = new UnassignRoleCommand(_userModelManager, unassignedRole, select); UndoableCommands.Push(unassignedCommand); }
public void UserRoleUnassigned(Select2 <ProcessRole> select, string roleId) { Console.WriteLine("Unassigned user role"); RedoableCommands.Clear(); var unassignedRole = _contractManager.GetProcessRoles().Where(r => r.Id == roleId).FirstOrDefault(); var unassignedCommand = new UnassignRoleCommand(_contractManager, unassignedRole, select); UndoableCommands.Push(unassignedCommand); }
protected virtual IEnumerable balances() { BalanceFilter filter = Filter.Current; PXView view = new Select2 <FABookBalance, InnerJoin <FixedAsset, On <FixedAsset.assetID, Equal <FABookBalance.assetID> >, InnerJoin <FADetails, On <FADetails.assetID, Equal <FABookBalance.assetID> >, LeftJoin <Account, On <Account.accountID, Equal <FixedAsset.fAAccountID> > > > >, Where <FABookBalance.depreciate, Equal <True>, And <FABookBalance.status, Equal <FixedAssetStatus.active>, And <FADetails.status, Equal <FixedAssetStatus.active> > > > >() .CreateView(this, mergeCache: PXView.MaximumRows > 1); if (filter.BookID != null) { view.WhereAnd <Where <FABookBalance.bookID, Equal <Current <BalanceFilter.bookID> > > >(); } if (filter.ClassID != null) { view.WhereAnd <Where <FixedAsset.classID, Equal <Current <BalanceFilter.classID> > > >(); } if (PXAccess.FeatureInstalled <FeaturesSet.multipleCalendarsSupport>() || filter.OrgBAccountID != null) { view.WhereAnd <Where <FixedAsset.branchID, Inside <Current <BalanceFilter.orgBAccountID> > > >(); } if (!string.IsNullOrEmpty(filter.PeriodID)) { view.WhereAnd <Where <FABookBalance.currDeprPeriod, LessEqual <Current <BalanceFilter.periodID> > > >(); } if (filter.ParentAssetID != null) { view.WhereAnd <Where <FixedAsset.parentAssetID, Equal <Current <BalanceFilter.parentAssetID> > > >(); } int startRow = PXView.StartRow; int totalRows = 0; List <PXFilterRow> newFilters = new List <PXFilterRow>(); foreach (PXFilterRow f in PXView.Filters) { if (f.DataField.ToLower() == "status") { f.DataField = "FADetails__Status"; } newFilters.Add(f); } List <object> list = view.Select(PXView.Currents, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, newFilters.ToArray(), ref startRow, PXView.MaximumRows, ref totalRows); PXView.StartRow = 0; return(list); }
protected void Button7_Click(object sender, EventArgs e) { //Luego de seleccionar un job refrescar los label de "Sub service line " y "Gerente" antes del 19/09/2019 //Luego de seleccionar un job refrescar los label de "Sub service line " luego del 19/09/2019 //if (!IsPostBack) //string job = Select2.Value.ToString().Substring(0, 8); {//Actualizacion de Sub services line & Gerente //Subserviceline TextBox6.Text = "BTC"; //Manager dejado sin efecto //QueryString = "Select distinct Jobs.Manager_name from usuarios,Jobs,usuarios_job where Jobs.Estado=1 and usuarios.correo=usuarios_job.correo and usuarios_job.Number_engagement=Jobs.Number_engagement and usuarios.correo='" + UserName_ey + "' and Jobs.Number_engagement=" + job; //myCommand = new SqlDataAdapter(QueryString, myConnection); //ds = new DataSet(); //myCommand.Fill(ds); //command = new SqlCommand(QueryString, myConnection); //string Manager_name = Convert.ToString(command.ExecuteScalar()); //TextBox8.Text = Manager_name; /* * QueryString = "Select distinct Jobs.Number_engagement, CONCAT(Jobs.Number_engagement,' - ',Jobs.Client_engagement) as Job_ from Jobs where Jobs.Estado=1 and Jobs.Manager_name like '" + Select1.Value + "'"; * myCommand = new SqlDataAdapter(QueryString, myConnection); * ds = new DataSet(); * myCommand.Fill(ds); * * Select2.DataSource = ds; * Select2.DataTextField = "Job_"; * Select2.DataValueField = "Number_engagement"; * Select2.DataBind(); */ ServiceReference1.WSSoapClient wS = new ServiceReference1.WSSoapClient(); DataSet ds = new DataSet(); ds = wS.LLenarListaJob(Select1.Value); Select2.DataSource = ds; Select2.DataTextField = "Job_"; Select2.DataValueField = "Number_engagement"; Select2.DataBind(); } }
public void SelecionaMedicamento(Select2 select2) { if (!Guid.TryParse(select2.Id, out Guid medicamentoId)) { return; } if (_dto.Id != Guid.Empty && _dto.ReceitaMedicamentos.Any()) { _medicamentosSelecionados = _dto.ReceitaMedicamentos.Select(_ => _.Medicamento?.NomeFabrica).ToList(); } if (_dto.ReceitaMedicamentos.Any(_ => _.MedicamentoId == medicamentoId)) { var index = _dto.ReceitaMedicamentos.FindIndex(_ => _.MedicamentoId == medicamentoId); if (_dto.ReceitaMedicamentos[index].Id == Guid.Empty) { _dto.ReceitaMedicamentos.RemoveAt(index); _medicamentosSelecionados.Remove(select2.Text); } else { _dto.ReceitaMedicamentos[index].Ativo = !_dto.ReceitaMedicamentos[index].Ativo; var medicamentoInativo = _dto.ReceitaMedicamentos.Where(_ => !_.Ativo).Select(_ => _.Medicamento?.NomeFabrica).ToList(); foreach (var item in medicamentoInativo) { _medicamentosSelecionados.Remove(item); } } } else { _dto.ReceitaMedicamentos.Add(new ReceitaMedicamentoDTO { MedicamentoId = medicamentoId, Ativo = true }); _medicamentosSelecionados.Add(select2.Text); } ConstroiObservacao(); }
public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; output.Content.Clear(); string id = "fapselect"; if (Id.IsPresent()) { id = $"sel-{Id}"; } Select2 select2 = new Select2(_dataAccessor, id); if (Placeholder.IsPresent()) { select2.SetPlaceholder(Placeholder); } if (SourceList != null) { select2.SetDataSource(SourceList); } if (SelectModel != null) { select2.SetSelect2Mode(SelectModel); } if (IsMulti) { select2.SetMultiSelectAble(IsMulti); } if (DefaultValue.IsPresent()) { select2.SetDefaultValue(DefaultValue); } if (OnChange.IsPresent()) { select2.SetChangeEvent(OnChange); } if (Width > 0) { select2.SetWidth(Width); } output.Content.AppendHtml(select2.ToString()); }
public string GetClientes(string q) { Dictionary <long, string> clie = new Dictionary <long, string>(); List <object> cliente = new List <object>(); Select2 select; string json; if (q != "" && q != null) { var lista = _clienteDAO.SelectClientes().Where(pr => new Select2().DoesContain(q.ToLower().ToCharArray(), string.Format("{0} - {1}", pr.Cpf.ToLower(), pr.Nome.ToLower()))); foreach (var item in lista) { clie.Add(item.Id, string.Format("{0} - {1}", item.Cpf, item.Nome)); } foreach (var item in clie.ToList()) { select = new Select2(); select.id = item.Key; select.text = item.Value; cliente.Add(select); } } else { foreach (var item in _clienteDAO.SelectClientes().ToList()) { clie.Add(item.Id, string.Format("{0} - {1}", item.Cpf, item.Nome)); } foreach (var item in clie.ToList()) { select = new Select2(); select.id = item.Key; select.text = item.Value; cliente.Add(select); } } json = new Select2().Select2json <object>(cliente); return(json); }
public string GetProdutos(string q) { Dictionary <long, string> prod = new Dictionary <long, string>(); List <object> produto = new List <object>(); Select2 select; string json; if (q != "" && q != null) { var lista = _produtoDAO.SelectProdutos().Where(pr => new Select2().DoesContain(q.ToLower().ToCharArray(), string.Format("{0} - {1}", pr.Codigo, pr.Nome.ToLower()))); foreach (var item in lista) { prod.Add(item.Id, string.Format("{0} - {1}", item.Codigo, item.Nome)); } foreach (var item in prod.ToList()) { select = new Select2(); select.id = item.Key; select.text = item.Value; produto.Add(select); } } else { foreach (var item in _produtoDAO.SelectProdutos().ToList()) { prod.Add(item.Id, string.Format("{0} - {1}", item.Codigo, item.Nome)); } foreach (var item in prod.ToList()) { select = new Select2(); select.id = item.Key; select.text = item.Value; produto.Add(select); } } json = new Select2().Select2json <object>(produto); return(json); }
public UnassignRoleCommand(IUserModelManager userModelManager, ProcessRole assignedRole, Select2 <ProcessRole> roleSelect) : base(userModelManager) { AssignedRole = assignedRole; RoleSelect = roleSelect; }
void ReleaseDesignerOutlets() { if (AdvancedSearchBox != null) { AdvancedSearchBox.Dispose(); AdvancedSearchBox = null; } if (AngebotNr != null) { AngebotNr.Dispose(); AngebotNr = null; } if (ArchiveButton1 != null) { ArchiveButton1.Dispose(); ArchiveButton1 = null; } if (AufWunsch != null) { AufWunsch.Dispose(); AufWunsch = null; } if (AusstattungDo != null) { AusstattungDo.Dispose(); AusstattungDo = null; } if (AusstattungOd != null) { AusstattungOd.Dispose(); AusstattungOd = null; } if (Bezeichnung != null) { Bezeichnung.Dispose(); Bezeichnung = null; } if (Binderabstand != null) { Binderabstand.Dispose(); Binderabstand = null; } if (Binderabstand2 != null) { Binderabstand2.Dispose(); Binderabstand2 = null; } if (BinderabstandCa != null) { BinderabstandCa.Dispose(); BinderabstandCa = null; } if (Breite != null) { Breite.Dispose(); Breite = null; } if (Breite2 != null) { Breite2.Dispose(); Breite2 = null; } if (BreiteCa != null) { BreiteCa.Dispose(); BreiteCa = null; } if (BreiteN != null) { BreiteN.Dispose(); BreiteN = null; } if (Cena1 != null) { Cena1.Dispose(); Cena1 = null; } if (CenaMontaz != null) { CenaMontaz.Dispose(); CenaMontaz = null; } if (ComboBox1 != null) { ComboBox1.Dispose(); ComboBox1 = null; } if (ComboBox2 != null) { ComboBox2.Dispose(); ComboBox2 = null; } if (ComboBox5 != null) { ComboBox5.Dispose(); ComboBox5 = null; } if (ComboBoxRaport != null) { ComboBoxRaport.Dispose(); ComboBoxRaport = null; } if (Dach != null) { Dach.Dispose(); Dach = null; } if (Data != null) { Data.Dispose(); Data = null; } if (DataOferty != null) { DataOferty.Dispose(); DataOferty = null; } if (DataPotwierdzenia != null) { DataPotwierdzenia.Dispose(); DataPotwierdzenia = null; } if (DeleteButton0 != null) { DeleteButton0.Dispose(); DeleteButton0 = null; } if (DeleteButton1 != null) { DeleteButton1.Dispose(); DeleteButton1 = null; } if (DeleteButton2 != null) { DeleteButton2.Dispose(); DeleteButton2 = null; } if (DeleteButton3 != null) { DeleteButton3.Dispose(); DeleteButton3 = null; } if (DeleteButton5 != null) { DeleteButton5.Dispose(); DeleteButton5 = null; } if (Down1 != null) { Down1.Dispose(); Down1 = null; } if (Down2 != null) { Down2.Dispose(); Down2 = null; } if (Down3 != null) { Down3.Dispose(); Down3 = null; } if (Firma != null) { Firma.Dispose(); Firma = null; } if (Firsthohe != null) { Firsthohe.Dispose(); Firsthohe = null; } if (Firsthohe2 != null) { Firsthohe2.Dispose(); Firsthohe2 = null; } if (FirsthoheCa != null) { FirsthoheCa.Dispose(); FirsthoheCa = null; } if (FirsthoheN != null) { FirsthoheN.Dispose(); FirsthoheN = null; } if (Gesamtpreis != null) { Gesamtpreis.Dispose(); Gesamtpreis = null; } if (Gewicht != null) { Gewicht.Dispose(); Gewicht = null; } if (Gewicht2 != null) { Gewicht2.Dispose(); Gewicht2 = null; } if (Hauptprofil1 != null) { Hauptprofil1.Dispose(); Hauptprofil1 = null; } if (Hauptprofil2 != null) { Hauptprofil2.Dispose(); Hauptprofil2 = null; } if (Hauptprofil3 != null) { Hauptprofil3.Dispose(); Hauptprofil3 = null; } if (HauptProfilGewicht != null) { HauptProfilGewicht.Dispose(); HauptProfilGewicht = null; } if (Ilosc1 != null) { Ilosc1.Dispose(); Ilosc1 = null; } if (InfoLabel1 != null) { InfoLabel1.Dispose(); InfoLabel1 = null; } if (Kedernut != null) { Kedernut.Dispose(); Kedernut = null; } if (Komentarz != null) { Komentarz.Dispose(); Komentarz = null; } if (KWert1 != null) { KWert1.Dispose(); KWert1 = null; } if (LabelTest1 != null) { LabelTest1.Dispose(); LabelTest1 = null; } if (LabelTest2 != null) { LabelTest2.Dispose(); LabelTest2 = null; } if (Lange2 != null) { Lange2.Dispose(); Lange2 = null; } if (Lange3 != null) { Lange3.Dispose(); Lange3 = null; } if (LangeCa != null) { LangeCa.Dispose(); LangeCa = null; } if (LangeN != null) { LangeN.Dispose(); LangeN = null; } if (Leichbauhalle != null) { Leichbauhalle.Dispose(); Leichbauhalle = null; } if (Liefertermin != null) { Liefertermin.Dispose(); Liefertermin = null; } if (Lieferungskosten != null) { Lieferungskosten.Dispose(); Lieferungskosten = null; } if (Lieferzeit != null) { Lieferzeit.Dispose(); Lieferzeit = null; } if (ListaOferty != null) { ListaOferty.Dispose(); ListaOferty = null; } if (Mail != null) { Mail.Dispose(); Mail = null; } if (Mail_cena != null) { Mail_cena.Dispose(); Mail_cena = null; } if (Mail_miasto != null) { Mail_miasto.Dispose(); Mail_miasto = null; } if (Mail_mm != null) { Mail_mm.Dispose(); Mail_mm = null; } if (MontageAGB != null) { MontageAGB.Dispose(); MontageAGB = null; } if (MontageBox != null) { MontageBox.Dispose(); MontageBox = null; } if (MontageSwitch != null) { MontageSwitch.Dispose(); MontageSwitch = null; } if (Name != null) { Name.Dispose(); Name = null; } if (NHN != null) { NHN.Dispose(); NHN = null; } if (NrPotwierdzenia != null) { NrPotwierdzenia.Dispose(); NrPotwierdzenia = null; } if (OpenButton1 != null) { OpenButton1.Dispose(); OpenButton1 = null; } if (Plec != null) { Plec.Dispose(); Plec = null; } if (Postlietzahl != null) { Postlietzahl.Dispose(); Postlietzahl = null; } if (PriceText1 != null) { PriceText1.Dispose(); PriceText1 = null; } if (PriceText2 != null) { PriceText2.Dispose(); PriceText2 = null; } if (RaportType != null) { RaportType.Dispose(); RaportType = null; } if (ReadyButton1 != null) { ReadyButton1.Dispose(); ReadyButton1 = null; } if (SaveButton1 != null) { SaveButton1.Dispose(); SaveButton1 = null; } if (Schneelast != null) { Schneelast.Dispose(); Schneelast = null; } if (Schneelast2 != null) { Schneelast2.Dispose(); Schneelast2 = null; } if (SearchCheckBox != null) { SearchCheckBox.Dispose(); SearchCheckBox = null; } if (SearchDlugosc != null) { SearchDlugosc.Dispose(); SearchDlugosc = null; } if (SearchSchneelast != null) { SearchSchneelast.Dispose(); SearchSchneelast = null; } if (SearchSzerokosc != null) { SearchSzerokosc.Dispose(); SearchSzerokosc = null; } if (SearchText != null) { SearchText.Dispose(); SearchText = null; } if (SearchTextField != null) { SearchTextField.Dispose(); SearchTextField = null; } if (SearchTypHali != null) { SearchTypHali.Dispose(); SearchTypHali = null; } if (SearchWindlast != null) { SearchWindlast.Dispose(); SearchWindlast = null; } if (SearchWysokosc != null) { SearchWysokosc.Dispose(); SearchWysokosc = null; } if (Select2 != null) { Select2.Dispose(); Select2 = null; } if (Stadt != null) { Stadt.Dispose(); Stadt = null; } if (Stallhalle != null) { Stallhalle.Dispose(); Stallhalle = null; } if (Starke1 != null) { Starke1.Dispose(); Starke1 = null; } if (Starke2 != null) { Starke2.Dispose(); Starke2 = null; } if (StraBe != null) { StraBe.Dispose(); StraBe = null; } if (Suma1 != null) { Suma1.Dispose(); Suma1 = null; } if (Switch3 != null) { Switch3.Dispose(); Switch3 = null; } if (SwitchTab1 != null) { SwitchTab1.Dispose(); SwitchTab1 = null; } if (Tab0 != null) { Tab0.Dispose(); Tab0 = null; } if (Tab1 != null) { Tab1.Dispose(); Tab1 = null; } if (Tab2 != null) { Tab2.Dispose(); Tab2 = null; } if (Tab3 != null) { Tab3.Dispose(); Tab3 = null; } if (Tab4 != null) { Tab4.Dispose(); Tab4 = null; } if (Tab5 != null) { Tab5.Dispose(); Tab5 = null; } if (Tab6 != null) { Tab6.Dispose(); Tab6 = null; } if (Tab7 != null) { Tab7.Dispose(); Tab7 = null; } if (Tabela1 != null) { Tabela1.Dispose(); Tabela1 = null; } if (Tabela2 != null) { Tabela2.Dispose(); Tabela2 = null; } if (Tabela3 != null) { Tabela3.Dispose(); Tabela3 = null; } if (Tabela5 != null) { Tabela5.Dispose(); Tabela5 = null; } if (TabNavi != null) { TabNavi.Dispose(); TabNavi = null; } if (TechnischeDaten != null) { TechnischeDaten.Dispose(); TechnischeDaten = null; } if (Telefonnummer != null) { Telefonnummer.Dispose(); Telefonnummer = null; } if (ToreUndTuren != null) { ToreUndTuren.Dispose(); ToreUndTuren = null; } if (Traufhohe != null) { Traufhohe.Dispose(); Traufhohe = null; } if (Traufhohe2 != null) { Traufhohe2.Dispose(); Traufhohe2 = null; } if (TraufhoheCa != null) { TraufhoheCa.Dispose(); TraufhoheCa = null; } if (TraufhoheN != null) { TraufhoheN.Dispose(); TraufhoheN = null; } if (Unterlagen != null) { Unterlagen.Dispose(); Unterlagen = null; } if (UnterlagenBox != null) { UnterlagenBox.Dispose(); UnterlagenBox = null; } if (UnterlagenSwitch != null) { UnterlagenSwitch.Dispose(); UnterlagenSwitch = null; } if (Up1 != null) { Up1.Dispose(); Up1 = null; } if (Up2 != null) { Up2.Dispose(); Up2 = null; } if (Up3 != null) { Up3.Dispose(); Up3 = null; } if (UWert1 != null) { UWert1.Dispose(); UWert1 = null; } if (UWert2 != null) { UWert2.Dispose(); UWert2 = null; } if (Vat2 != null) { Vat2.Dispose(); Vat2 = null; } if (Vorname != null) { Vorname.Dispose(); Vorname = null; } if (Windlast != null) { Windlast.Dispose(); Windlast = null; } if (Windlast2 != null) { Windlast2.Dispose(); Windlast2 = null; } if (WypChange1 != null) { WypChange1.Dispose(); WypChange1 = null; } if (WypChange2 != null) { WypChange2.Dispose(); WypChange2 = null; } if (WypChange3 != null) { WypChange3.Dispose(); WypChange3 = null; } if (X1 != null) { X1.Dispose(); X1 = null; } if (Y1 != null) { Y1.Dispose(); Y1 = null; } if (Zugbandhohe != null) { Zugbandhohe.Dispose(); Zugbandhohe = null; } if (Zugbandhohe2 != null) { Zugbandhohe2.Dispose(); Zugbandhohe2 = null; } if (ZugbandhoheCa != null) { ZugbandhoheCa.Dispose(); ZugbandhoheCa = null; } if (SearchList != null) { SearchList.Dispose(); SearchList = null; } if (SearchEmail != null) { SearchEmail.Dispose(); SearchEmail = null; } }
public virtual IEnumerable serviceContracts() { BqlCommand commandFilter = null; switch (this.Filter.Current.ActionType) { case ID.ActionType_ProcessServiceContracts.STATUS: commandFilter = new Select <FSServiceContract, Where2 < Where <CurrentValue <ServiceContractFilter.customerID>, IsNull, Or <FSServiceContract.customerID, Equal <CurrentValue <ServiceContractFilter.customerID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.refNbr>, IsNull, Or <FSServiceContract.refNbr, Equal <CurrentValue <ServiceContractFilter.refNbr> > > >, And2 < Where <CurrentValue <ServiceContractFilter.customerLocationID>, IsNull, Or <FSServiceContract.customerLocationID, Equal <CurrentValue <ServiceContractFilter.customerLocationID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.branchID>, IsNull, Or <FSServiceContract.branchID, Equal <CurrentValue <ServiceContractFilter.branchID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.branchLocationID>, IsNull, Or <FSServiceContract.branchLocationID, Equal <CurrentValue <ServiceContractFilter.branchLocationID> > > >, And < FSServiceContract.upcomingStatus, IsNotNull, And < FSServiceContract.statusEffectiveUntilDate, LessEqual <Current <AccessInfo.businessDate> > > > > > > > >, OrderBy < Asc <FSServiceContract.customerID, Asc <FSServiceContract.refNbr> > > >(); break; case ID.ActionType_ProcessServiceContracts.PERIOD: commandFilter = new Select2 <FSServiceContract, LeftJoin <FSContractPeriod, On <FSContractPeriod.serviceContractID, Equal <FSServiceContract.serviceContractID>, And <FSContractPeriod.status, Equal <FSContractPeriod.status.Active> > > >, Where2 < Where <CurrentValue <ServiceContractFilter.customerID>, IsNull, Or <FSServiceContract.customerID, Equal <CurrentValue <ServiceContractFilter.customerID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.refNbr>, IsNull, Or <FSServiceContract.refNbr, Equal <CurrentValue <ServiceContractFilter.refNbr> > > >, And2 < Where <CurrentValue <ServiceContractFilter.customerLocationID>, IsNull, Or <FSServiceContract.customerLocationID, Equal <CurrentValue <ServiceContractFilter.customerLocationID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.branchID>, IsNull, Or <FSServiceContract.branchID, Equal <CurrentValue <ServiceContractFilter.branchID> > > >, And2 < Where <CurrentValue <ServiceContractFilter.branchLocationID>, IsNull, Or <FSServiceContract.branchLocationID, Equal <CurrentValue <ServiceContractFilter.branchLocationID> > > >, And < FSContractPeriod.contractPeriodID, IsNull, And < FSServiceContract.billingType, Equal <FSServiceContract.billingType.StandardizedBillings>, And < FSServiceContract.status, Equal <FSServiceContract.status.Active> > > > > > > > >, OrderBy < Asc <FSServiceContract.customerID, Asc <FSServiceContract.refNbr> > > >(); break; default: break; } PXView serviceContractView = new PXView(this, true, commandFilter); int startRow = PXView.StartRow; int totalRows = 0; var list = serviceContractView.Select(PXView.Currents, PXView.Parameters, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows); PXView.StartRow = 0; return(list); }
public UnassignRoleCommand(IContractManager contractManager, ProcessRole assignedRole, Select2 <ProcessRole> roleSelect) : base(contractManager) { AssignedRole = assignedRole; RoleSelect = roleSelect; }
public virtual void OptimizeRoutes(RoutesOptimizationProcess graph, FSAppointmentFilter filter, List <FSAppointmentFSServiceOrder> list, PXResultset <FSAppointmentStaffMember, CSCalendar> staffSelected) { RouteOptimizerClient client = new RouteOptimizerClient(); SingleDayOptimizationInput requestBody = new SingleDayOptimizationInput(); List <FSAppointment> processList = new List <FSAppointment>(); FSSetup fsSetupRow = graph.SetupRecord.Current; requestBody.balanced = true; requestBody.vehicles = new List <Vehicle>(); requestBody.waypoints = new List <Waypoint>(); string address = string.Empty; if (staffSelected != null && staffSelected.Count == 0) { throw new PXException(PXMessages.LocalizeFormatNoPrefix(TX.Error.SELECT_AT_LEAST_ONE_STAFF_MEMBER)); } //Origin end Route location FSAddress fsAddressRow = PXSelectJoin <FSAddress, InnerJoin <FSBranchLocation, On <FSBranchLocation.branchLocationAddressID, Equal <FSAddress.addressID> > >, Where < FSBranchLocation.branchLocationID, Equal <Required <FSBranchLocation.branchLocationID> > > > .Select(graph, list[0].BranchLocationID); address = SharedFunctions.GetAddressForGeolocation(fsAddressRow.PostalCode, fsAddressRow.AddressLine1, fsAddressRow.AddressLine2, fsAddressRow.City, fsAddressRow.State, fsAddressRow.CountryID); GLocation[] results = Geocoder.Geocode(address, fsSetupRow.MapApiKey); if (results.Length == 0) { throw new PXException(PXMessages.LocalizeFormatNoPrefix(TX.Error.MAPS_FAILED_REVERSE_ADRESS, TX.TableName.BRANCH_LOCATION)); } CSCalendar csVendorCalendarRow = PXSelect <CSCalendar, Where <CSCalendar.calendarID, Equal <Required <CSCalendar.calendarID> > > > .Select(graph, fsSetupRow.CalendarID); //Driver Logic foreach (PXResult <FSAppointmentStaffMember, CSCalendar> result in staffSelected) { FSAppointmentStaffMember staffRow = (FSAppointmentStaffMember)result; CSCalendar csCalendarRow = (CSCalendar)result; Vehicle vehicleRow = new Vehicle() { name = staffRow.BAccountID.ToString(), origin = new RouteLocation() { latitude = results[0].LatLng.Latitude, longitude = results[0].LatLng.Longitude }, destination = new RouteLocation() { latitude = results[0].LatLng.Latitude, longitude = results[0].LatLng.Longitude }, tags = new List <string>() { staffRow.BAccountID.ToString() } }; TimeWindow working = graph.GetWorkingTimeWindow(staffRow.EmployeeSDEnabled == true ? csCalendarRow : csVendorCalendarRow, filter.StartDate); Break lunchBreak = graph.GetBreakWindow(fsSetupRow); if (lunchBreak != null) { vehicleRow.breaks = new List <Break>() { lunchBreak }; } if (working != null) { vehicleRow.timeWindow = working; requestBody.vehicles.Add(vehicleRow); } } if (requestBody.vehicles.Count == 0) { for (int i = 0; i < list.Count; i++) { FSAppointment fsAppointmentRow = list[i]; UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.NOT_ABLE); graph.Appointments.Update(fsAppointmentRow); PXProcessing <FSAppointmentFSServiceOrder> .SetError(i, PXMessages.LocalizeFormatNoPrefix(TX.Error.APPOINTMENT_COULD_NOT_BE_REACH_SERVICED_NO_DRIVER_AVAILABLE)); } if (graph.Appointments.Cache.IsDirty == true) { graph.Appointments.Cache.Persist(PXDBOperation.Update); } return; } //Existing Appointment Logic if (filter.Type == ID.Type_ROOptimization.UNASSIGNED_APP && staffSelected.Count() > 0) { List <object> args = new List <object>(); BqlCommand fsAppointmentList = new Select2 <FSAppointment, InnerJoin <FSServiceOrder, On <FSServiceOrder.sOID, Equal <FSAppointment.sOID> >, InnerJoin <FSAddress, On <FSAddress.addressID, Equal <FSServiceOrder.serviceOrderAddressID> > > > >(); if (filter.BranchID != null) { fsAppointmentList = fsAppointmentList.WhereAnd(typeof(Where <FSServiceOrder.branchID, Equal <Required <FSServiceOrder.branchID> > >)); args.Add(filter.BranchID); } if (filter.BranchLocationID != null) { fsAppointmentList = fsAppointmentList.WhereAnd(typeof(Where <FSServiceOrder.branchLocationID, Equal <Required <FSServiceOrder.branchLocationID> > >)); args.Add(filter.BranchLocationID); } if (filter.StartDate != null) { fsAppointmentList = fsAppointmentList.WhereAnd(typeof(Where <FSAppointment.scheduledDateTimeBegin, GreaterEqual <Required <FSAppointment.scheduledDateTimeBegin> > >)); args.Add(filter.StartDateWithTime); } if (filter.EndDateWithTime != null) { fsAppointmentList = fsAppointmentList.WhereAnd(typeof(Where <FSAppointment.scheduledDateTimeEnd, LessEqual <Required <FSAppointment.scheduledDateTimeEnd> > >)); args.Add(filter.EndDateWithTime); } if (staffSelected != null && staffSelected.Count() > 0) { fsAppointmentList = fsAppointmentList.WhereAnd(typeof(Where <FSAppointment.primaryDriver, In <Required <FSAppointment.primaryDriver> > >)); int[] staffResult = StaffMemberFilter.Select() .RowCast <FSAppointmentStaffMember>() .Where(_ => _.Selected == true) .Select(_ => _.BAccountID) .Cast <int>() .ToArray(); args.Add(staffResult); } PXView appointmentView = new PXView(graph, true, fsAppointmentList); var fsAppointmentSet = appointmentView.SelectMulti(args.ToArray()); foreach (PXResult <FSAppointment, FSServiceOrder, FSAddress> row in fsAppointmentSet) { FSAppointment fsAppointmentRow = (FSAppointment)row; fsAddressRow = (FSAddress)row; address = SharedFunctions.GetAddressForGeolocation( fsAddressRow.PostalCode, fsAddressRow.AddressLine1, fsAddressRow.AddressLine2, fsAddressRow.City, fsAddressRow.State, fsAddressRow.CountryID); Waypoint wp = GetWaypointFromAppointment(fsSetupRow, fsAppointmentRow, address); if (wp != null) { requestBody.waypoints.Add(wp); processList.Add(fsAppointmentRow); } else { UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.ADDRESS_ERROR); graph.Appointments.Update(fsAppointmentRow); } } } //Appointment Logic for (int i = list.Count - 1; i >= 0; i--) { bool addressError = false; try { address = SharedFunctions.GetAddressForGeolocation( list[i].PostalCode, list[i].AddressLine1, list[i].AddressLine2, list[i].City, list[i].State, list[i].CountryID); Waypoint wp = GetWaypointFromAppointment(fsSetupRow, list[i], address); if (wp != null) { requestBody.waypoints.Add(wp); processList.Add(list[i]); } else { addressError = true; } } catch { addressError = true; } if (addressError == true) { addressError = false; FSAppointment fsAppointmentRow = list[i]; UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.ADDRESS_ERROR); graph.Appointments.Update(fsAppointmentRow); list.RemoveAt(i); PXProcessing <FSAppointmentFSServiceOrder> .SetError(i, PXMessages.LocalizeFormatNoPrefix(TX.Error.MAPS_FAILED_REVERSE_ADRESS, TX.TableName.APPOINTMENT)); } } if (graph.Appointments.Cache.IsDirty == true) { graph.Appointments.Cache.Persist(PXDBOperation.Update); } try { SingleDayOptimizationOutput responseObject = client.getSingleDayOptimization(fsSetupRow.ROWWApiEndPoint, fsSetupRow.ROWWLicensekey, requestBody); AppointmentEntry graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>(); for (int i = 0; i < responseObject.routes.Count; i++) { int assignedstaffID; int.TryParse(responseObject.routes[i].vehicle.name, out assignedstaffID); bool changeFlag = false; for (int j = 1; j < responseObject.routes[i].steps.Count - 1; j++) { RouteOtimizer.RouteStep currentAppointment = responseObject.routes[i].steps[j]; int appointmentID; int.TryParse(currentAppointment.waypoint.name, out appointmentID); FSAppointment fsAppointmentListRow = processList.Find(x => x.AppointmentID == appointmentID); var newBegin = convertSecToTime(currentAppointment.serviceStartTimeSec, fsAppointmentListRow.ScheduledDateTimeBegin); var newEnd = newBegin.AddSeconds(currentAppointment.departureTimeSec - currentAppointment.arrivalTimeSec); UpdateAppointmentHeader(fsAppointmentListRow, ID.Status_ROOptimization.OPTIMIZED, j, null, newBegin, newEnd); if (fsAppointmentListRow.PrimaryDriver != null) { graph.Appointments.Update(fsAppointmentListRow); changeFlag = true; } else { fsAppointmentListRow.PrimaryDriver = assignedstaffID; FSAppointment fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.refNbr>( fsAppointmentListRow.RefNbr, fsAppointmentListRow.SrvOrdType); UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.OPTIMIZED, j, assignedstaffID, newBegin, newEnd); graphAppointmentEntry.AppointmentRecords.Update(fsAppointmentRow); FSAppointmentEmployee fsAppointmentEmployeeRow_New = new FSAppointmentEmployee() { AppointmentID = fsAppointmentRow.AppointmentID, EmployeeID = assignedstaffID }; fsAppointmentEmployeeRow_New = graphAppointmentEntry.AppointmentServiceEmployees.Insert(fsAppointmentEmployeeRow_New); graphAppointmentEntry.Save.Press(); } } if (changeFlag == true) { graph.Appointments.Cache.Persist(PXDBOperation.Update); } } foreach (OutputWaypoint wp in responseObject.unreachableWaypoints.Concat(responseObject.unreachedWaypoints).GroupBy(p => p.name).Select(g => g.First()).ToList()) { int appointmentID; int.TryParse(wp.name, out appointmentID); FSAppointment fsAppointmentRow = list.Find(x => x.AppointmentID == appointmentID); if (fsAppointmentRow != null) { for (int i = 0; i < list.Count; i++) { if (fsAppointmentRow.AppointmentID == list[i].AppointmentID) { UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.NOT_ABLE); graph.Appointments.Update(fsAppointmentRow); PXProcessing <FSAppointmentFSServiceOrder> .SetError(i, PXMessages.LocalizeFormatNoPrefix(TX.Error.APPOINTMENT_COULD_NOT_BE_REACH_SERVICED)); } } } } graph.Appointments.Cache.Persist(PXDBOperation.Update); } catch (PXException e) { for (int i = 0; i < list.Count; i++) { FSAppointment fsAppointmentRow = list[i]; UpdateAppointmentHeader(fsAppointmentRow, ID.Status_ROOptimization.NOT_ABLE); graph.Appointments.Update(fsAppointmentRow); PXProcessing <FSAppointmentFSServiceOrder> .SetError(i, PXMessages.LocalizeFormatNoPrefix(e.Message)); } graph.Appointments.Cache.Persist(PXDBOperation.Update); } }
/// <summary> /// Renders a select2 list /// the value of the option will be the valProp, default ID /// the display text of the option will be the textProp, default ID /// @Html.Select2(Model, new Select2{}, textProp: nameof(Caption.Title)) /// </summary> /// <param name="list"></param> /// <param name="valProp"></param> /// /// <param name="textProp"></param> /// <returns></returns> public static IHtmlString Select2(this HtmlHelper htmlHelper, IEnumerable list, Select2 select2, string valProp = "ID", string textProp = "ID") { var urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext); var selector = Guid.NewGuid().ToString(); var select2Options = BuildSelect2Options(list, valProp, textProp); var select = new TagBuilder("select") { InnerHtml = select2Options }; select.Attributes.Add("id", selector); select.Attributes.Add("name", "id"); if (select2.multiple) { select.Attributes.Add("multiple", "multiple"); } // build the select2 script var script = new TagBuilder("script") { InnerHtml = BuildSelect2(select2, selector) }; return(new HelperResult(writer => { writer.Write(select.ToString(TagRenderMode.Normal)); writer.Write(script.ToString(TagRenderMode.Normal)); })); }
public virtual IEnumerable appointments() { var filter = Filter.Current; if (filter.CutOffDate == null) { return(new List <object>()); } List <object> args = new List <object>(); var commandFilter = new Select2 <FSAppointmentInventoryItem, InnerJoin <FSAppointment, On < FSAppointment.appointmentID, Equal <FSAppointmentInventoryItem.appointmentID> >, InnerJoin <FSServiceOrder, On < FSServiceOrder.sOID, Equal <FSAppointment.sOID> >, InnerJoin <Customer, On < Customer.bAccountID, Equal <FSServiceOrder.billCustomerID> >, InnerJoin <FSSrvOrdType, On < FSSrvOrdType.srvOrdType, Equal <FSAppointment.srvOrdType> >, InnerJoin <FSAppointmentDet, On < FSAppointmentDet.sODetID, Equal <FSAppointmentInventoryItem.sODetID>, And <FSAppointmentDet.appointmentID, Equal <FSAppointment.appointmentID> > >, LeftJoin <FSPostInfo, On < FSPostInfo.postID, Equal <FSAppointmentInventoryItem.postID> >, LeftJoin <FSGeoZonePostalCode, On < FSGeoZonePostalCode.postalCode, Equal <FSServiceOrder.postalCode> >, LeftJoin <FSGeoZone, On < FSGeoZone.geoZoneID, Equal <FSGeoZonePostalCode.geoZoneID> > > > > > > > > >, Where2 < Where < FSAppointmentInventoryItem.lineType, Equal <ListField_LineType_Pickup_Delivery.Pickup_Delivery>, And <FSAppointment.status, Equal <ListField_Status_Appointment.Closed>, And <FSAppointmentDet.lineType, Equal <ListField_LineType_ALL.Service> > > >, And < FSSrvOrdType.enableINPosting, Equal <True> > > >() as BqlCommand; commandFilter = commandFilter.WhereAnd(typeof(Where <FSPostInfo.postID, IsNull, Or <FSPostInfo.iNPosted, Equal <False> > >)); if (filter.CutOffDate != null) { commandFilter = commandFilter.WhereAnd(typeof(Where <FSAppointment.executionDate, LessEqual <Required <UpdateInventoryFilter.cutOffDate> > >)); args.Add(filter.CutOffDate); } if (filter.RouteDocumentID != null) { commandFilter = commandFilter.WhereAnd(typeof(Where <FSAppointment.routeDocumentID, Equal <Required <UpdateInventoryFilter.routeDocumentID> > >)); args.Add(filter.RouteDocumentID); } if (filter.AppointmentID != null) { commandFilter = commandFilter.WhereAnd(typeof(Where <FSAppointment.appointmentID, Equal <Required <UpdateInventoryFilter.appointmentID> > >)); args.Add(filter.AppointmentID); } var view = new PXView(this, true, commandFilter); var startRow = PXView.StartRow; int totalRows = 0; var results = view.Select( PXView.Currents, args.ToArray(), PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows); Appointments.Cache.IsDirty = false; return(results); }