/// <summary> /// Carga y configuracion del grid de Personnel /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnPersonnel"></param> /// <param name="blnAllPersonnel"></param> /// <param name="program"></param> private async void LoadPersonnel(bool blnOnlyOneRegister, bool blnPersonnel, bool blnAllPersonnel, EnumProgram program) { if (!blnPersonnel) { pnlPersonnel.Visibility = Visibility.Collapsed; return; } grdPersonnel.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; List <LeadSourceByUser> listLeadSourceByUsers = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID, program); _lstPersonnel = await BRPersonnel.GetPersonnel(string.Join(",", listLeadSourceByUsers.Select(y => y.lsID)), roles : "PR", status : 0); grdPersonnel.ItemsSource = _lstPersonnel; chkAllPersonnel.IsChecked = blnAllPersonnel; chkAllPersonnel.IsEnabled = !blnOnlyOneRegister; if (!_frmIh._clsFilter.LstPersonnel.Any()) { return; } chkAllPersonnel.IsChecked = false; _frmIh._clsFilter.LstPersonnel.ForEach(c => grdPersonnel.SelectedItems.Add(_lstPersonnel.SingleOrDefault(x => x.peID == c))); if (grdPersonnel.SelectedItems.Count == grdPersonnel.Items.Count) { chkAllPersonnel.IsChecked = true; } }
/// <summary> /// Abre la ventana detalle en modo "detalle" o "edición" dependiendo de sus permisos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 10/06/2016 /// </history> private async void Cell_DoubleClick(object sender, RoutedEventArgs e) { PersonnelShort personnelShort = (PersonnelShort)dgrPersonnels.SelectedItem; Personnel personnel = BRPersonnel.GetPersonnelById(personnelShort.peID); frmPersonnelDetail frmPersonnelDetail = new frmPersonnelDetail(); frmPersonnelDetail.Owner = this; frmPersonnelDetail.enumMode = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly; frmPersonnelDetail.oldPersonnel = personnel; if (frmPersonnelDetail.ShowDialog() == true) { int nIndex = 0; List <PersonnelShort> lstPersonnel = (List <PersonnelShort>)dgrPersonnels.ItemsSource; var persons = await BRPersonnel.GetPersonnel(idPersonnel : frmPersonnelDetail.personnel.peID); if (persons.Count > 0) { PersonnelShort person = persons.FirstOrDefault(); ObjectHelper.CopyProperties(personnelShort, person); //Actualizamos los datos lstPersonnel.Sort((x, y) => string.Compare(x.peN, y.peN)); //Ordenamos la lista nIndex = lstPersonnel.IndexOf(personnelShort); //Obtenemos la posición del registro } else { lstPersonnel.Remove(personnelShort);//Quitamos el registro } btnDel.IsEnabled = (lstPersonnel.Count > 0) ? _blnDel : false; dgrPersonnels.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrPersonnels, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstPersonnel.Count + " Personnels."; //Actualizamos el contador } }
/// <summary> /// Llena el grid de personnels /// </summary> /// <param name="personnel">objeto a seleccionar</param> /// <history> /// [emoguel] created 10/06/2016 /// </history> private async void LoadPersonnel(PersonnelShort personnel = null) { try { status.Visibility = Visibility.Visible; int nIndex = 0; List <PersonnelShort> lstPersonnels = await BRPersonnel.GetPersonnel(_leadSource, _salesRoom, _roles, _status, _permission , _relationalOperator, _enumPermission, _dept); dgrPersonnels.ItemsSource = lstPersonnels; if (lstPersonnels.Count > 0) { if (personnel != null) { personnel = lstPersonnels.Where(pe => pe.peID == personnel.peID).FirstOrDefault(); nIndex = lstPersonnels.IndexOf(personnel); } GridHelper.SelectRow(dgrPersonnels, nIndex); } else { btnDel.IsEnabled = false; } StatusBarReg.Content = lstPersonnels.Count + " Personnels"; status.Visibility = Visibility.Collapsed; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga e incializa las variables /// </summary> /// <history> /// [jorcanche] 02/02/2016 Created /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// </history> private async void Window_Loaded(object sender, RoutedEventArgs e) { //Indicamos al statusbar que me muestre cierta informacion cuando oprimimos cierto teclado KeyboardHelper.CkeckKeysPress(StatusBarCap, Key.Capital); KeyboardHelper.CkeckKeysPress(StatusBarIns, Key.Insert); KeyboardHelper.CkeckKeysPress(StatusBarNum, Key.NumLock); //Cargamos los datos del huesped _guest = await BRGuests.GetGuest(_guestId); EnabledControls(true, true, false); //Cargamos los PR cbopnPR.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR"); // desplegamos los datos del huesped txtguID.Text = _guest.guID.ToString(); txtguLastName1.Text = _guest.guLastName1; txtguFirstName1.Text = _guest.guFirstName1; txtguCheckInD.Text = _guest.guCheckInD.ToString("dd/MM/yyyy"); txtguCheckOutD.Text = _guest.guCheckOutD.ToString("dd/MM/yyyy"); //Cargamos el datagrid _pRNoteViewSource = (CollectionViewSource)FindResource("pRNoteViewSource"); _pRNoteViewSource.Source = await BRNotes.GetNoteGuest(_guestId); //Si no tiene ninguna nota se inhabilita el control if (dgNotes.Items.Count < 1) { btnShowInfo.IsEnabled = false; } }
private async void LoadControls() { _guest = await BRGuests.GetGuest(_guestId); cboguum.ItemsSource = await BRUnavailableMotives.GetUnavailableMotives(1); cboguPRAvail.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR"); if (_guest.guPRAvail != null) { cboguPRAvail.SelectedValue = _guest.guPRAvail; } if (_guest.guum != 0) { cboguum.SelectedValue = _guest.guum; txtguum.Text = _guest.guum.ToString(); } chkguOriginAvail.IsChecked = _guest.guOriginAvail; chkguAvail.IsChecked = _guest.guAvail; chkguAvailBySystem.IsChecked = _guest.guAvailBySystem; txtguum.IsEnabled = cboguum.IsEnabled = cboguPRAvail.IsEnabled = btnCancel.IsEnabled = btnSave.IsEnabled = chkguOriginAvail.IsEnabled = chkguAvail.IsEnabled = txtguum.IsEnabled = cboguum.IsEnabled = false; btnEdit.IsEnabled = true; }
/// <summary> /// Carga el combobox de patrones /// </summary> /// <history> /// [emoguel] created 16/05/2016 /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// </history> private async void LoadBoss() { try { List <PersonnelShort> lstBoss = await BRPersonnel.GetPersonnel(roles : EnumToListHelper.GetEnumDescription(EnumRole.Boss)); cmblsBoss.ItemsSource = lstBoss; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Llena el combobox de Boss /// </summary> /// <history> /// [emoguel] created 22/04/2016 /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// </history> private async void LoadBoss() { try { List <PersonnelShort> lstPersonnel = await BRPersonnel.GetPersonnel(roles : "Boss"); cmbsrBoss.ItemsSource = lstPersonnel; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga los lideres de equipos /// </summary> /// <history> /// [vku] 11/Jul/2016 Created /// </history> public async void LoadPersonnelForLeader() { try { List <PersonnelShort> lstPersonnelForLeader = await BRPersonnel.GetPersonnel(status : 1); cbotgLeader.ItemsSource = lstPersonnelForLeader; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> ///Carga y configuracion del combo de Salesman /// </summary> /// <history> /// [ecanul] 14/06/2016 Created /// </history> private async void LoadSalesman() { _lstPersonnels.AddRange(await BRPersonnel.GetPersonnel("All", "All", new List <EnumRole> { EnumRole.PR, EnumRole.Liner, EnumRole.Closer, EnumRole.ExitCloser }.EnumListToString(), 1, "All", "=", EnumPermisionLevel.None, "All")); int index = _lstPersonnels.FindIndex(x => x.peID.Equals(frmPrs._clsFilter.Salesman?.peID)); if (index != -1) { cmbSalesman.SelectedIndex = index; } }
/// <summary> /// Carga al personal dependiendo del tipo de invitacion /// </summary> /// <param name="user">UserData</param> /// <param name="module">EnumModule</param> /// <history> /// [erosado] 09/08/2016 /// </history> private async Task LoadPersonnel(UserData user, EnumModule module) { List <PersonnelShort> personnel; //Si es Host carga al personal con la sala de venta if (module == EnumModule.Host) { personnel = await BRPersonnel.GetPersonnel(salesRooms : user.SalesRoom.srID, roles : "PR"); } //Si es cualquier otro lo hace con el leadSource else { personnel = await BRPersonnel.GetPersonnel(user.LeadSource.lsID, roles : "PR"); } Personnel = personnel; }
/// <summary> /// Carga los combobox de personnel /// </summary> /// <history> /// [emoguel] created 24/06/2016 /// </history> private async void LoadPersonnel() { try { List <PersonnelShort> lstPersonnel = await BRPersonnel.GetPersonnel(status : 0); cmbPersonnelNew.ItemsSource = lstPersonnel; cmbPersonnelOld.ItemsSource = lstPersonnel; cmbPersonnelOld.SelectedValue = idOldSelect; if (!string.IsNullOrWhiteSpace(idOldSelect)) { btnGetStaticsOld_Click(null, null); } } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
private async void LoadFollwUp() { cboguPRFollow.IsEnabled = false; cboguPRFollow.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR"); _guest = await BRGuests.GetGuest(_guestID); if (_guest.guFollowD.HasValue) { txtguFollowD.Text = _guest.guFollowD.Value.Date.ToString("dd-MM-yyyy"); } if (_guest.guPRFollow != string.Empty) { cboguPRFollow.SelectedValue = _guest.guPRFollow; } chkguFollow.IsChecked = _guest.guFollow; btnEdit.IsEnabled = true; btnSave.IsEnabled = btnCancel.IsEnabled = false; }
/// <summary> /// Carga el combo de Personel y ChangedBy /// </summary> /// <history> /// [emoguel] 12/04/2016 /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// </history> private async void LoadPersonnel() { try { List <PersonnelShort> lstPersonnel = await BRPersonnel.GetPersonnel(); if (enumMode == EnumMode.Search) { lstPersonnel.Insert(0, new PersonnelShort { peID = "", peN = "ALL" }); } cmbppChangedBy.ItemsSource = lstPersonnel; cmbpppe.ItemsSource = lstPersonnel; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
private async void LoadContact() { cboguPRInfo.ItemsSource = await BRPersonnel.GetPersonnel(_userPrimero.Location.loID, "ALL", "PR"); var guest = await BRGuests.GetGuest(_guestID); if (guest.guInfoD.HasValue) { txtguInfoD.Text = guest.guInfoD.Value.Date.ToString("dd-MM-yyyy"); } if (guest.guPRInfo != string.Empty) { cboguPRInfo.SelectedValue = guest.guPRInfo; } chkguInfo.IsChecked = guest.guInfo; btnEdit.IsEnabled = true; btnSave.IsEnabled = btnCancel.IsEnabled = false; cboguPRInfo.IsEnabled = false; Mouse.OverrideCursor = null; }
/// <summary> /// Obtiene la lista del personal /// </summary> /// <param name="leadSources">filtro leadsources</param> /// <param name="roles">rol del usuario loggeado</param> /// <history> /// [erosado] 22/Mar/2016 Created /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// </history> public async void DoGetPersonnel(string leadSources, string roles) { try { var data = await BRPersonnel.GetPersonnel(leadSources, "ALL", roles); if (data.Count > 0) { data.Insert(0, new PersonnelShort() { peID = "ALL", peN = "ALL", deN = "ALL" }); cbxPersonnel.ItemsSource = data; } SetNewUserLogin(); StaEnd(); } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga y configuracion del grid PRs /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnPRs"></param> /// <param name="blnAllPRs"></param> /// <history> /// [vku] 25/May/2016 Created /// </history> private async void LoadPRs(bool blnOnlyOneRegister, bool blnPRs, bool blnAllPRs) { if (!blnPRs) { return; } grdPR.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; pnlPR.Visibility = Visibility.Visible; var x = (await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID, EnumProgram.Outhouse)).Select(y => y.lsID).ToList(); _lstPRs = await BRPersonnel.GetPersonnel(string.Join(",", x), roles : EnumToListHelper.GetEnumDescription(EnumRole.PR), status : 0); grdPR.ItemsSource = _lstPRs; chkAllPR.IsChecked = blnAllPRs; chkAllPR.IsEnabled = !blnOnlyOneRegister; if (!frmPO._clsFilter._lstPRs.Any()) { return; } chkAllPR.IsChecked = (grdPR.SelectionMode == DataGridSelectionMode.Extended) && frmPO._clsFilter.AllPRs; if (grdPR.ItemsSource != null && !frmPO._clsFilter.AllPRs && !blnOnlyOneRegister) { grdPR.SelectedItem = null; frmPO._clsFilter._lstPRs.ForEach(c => { grdPR.SelectedItems.Add(_lstPRs.FirstOrDefault(pr => pr.peID == c)); }); } else { grdPR.SelectedItem = _lstPRs.FirstOrDefault(c => c.peID == frmPO._clsFilter._lstPRs[0]); } }
/// <summary> /// Obtiene la lista del personal /// </summary> /// <param name="salerRooms">filtro leadsources</param> /// <param name="roles">rol del usuario loggeado</param> /// <history> /// [erosado] 24/Mar/2016 Created /// </history> public async void DoGetPersonnel(string salesRooms, string roles) { try { List <PersonnelShort> data = await BRPersonnel.GetPersonnel("ALL", salesRooms, roles, 1); if (data.Count > 0) { data.Insert(0, new PersonnelShort() { peID = "ALL", peN = "ALL", deN = "ALL" }); cbxPersonnel.ItemsSource = data; } setNewUserLogin(); StaEnd(); } catch (Exception ex) { StaEnd(); UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga e inicializa las variables /// </summary> /// <history> /// [jorcanche] created 11/08/2016 /// </history> private async void FrmNotBookingMotive_OnLoaded(object sender, RoutedEventArgs e) { Invit = false; Save = false; lblUserName.Text = Context.User.User.peN; //Cargamos los Controles y el Guest _guest = await BRGuests.GetGuest(_guestId); cbmgunb.ItemsSource = await BRNotBookingMotives.GetNotBookingMotives(1); cbmguPRNoBook.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR"); //Asignar valores if (_guest.guNoBookD != null) { txtguNoBookD.Text = _guest.guNoBookD.Value.ToShortDateString(); } cbmgunb.SelectedValue = _guest.gunb; cbmguPRNoBook.SelectedValue = _guest.guPRNoBook; // establecemos el modo lectura SetMode(EnumMode.ReadOnly); }
/// <summary> /// Abre la ventana detalle en modo Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 10/06/2016 /// </history> private async void btnAdd_Click(object sender, RoutedEventArgs e) { frmPersonnelDetail frmPersonnelDetail = new frmPersonnelDetail(); frmPersonnelDetail.Owner = this; frmPersonnelDetail.enumMode = EnumMode.Add; if (frmPersonnelDetail.ShowDialog() == true) { var persons = await BRPersonnel.GetPersonnel(idPersonnel : frmPersonnelDetail.personnel.peID); if (persons.Count > 0) { List <PersonnelShort> lstPersonnel = (List <PersonnelShort>)dgrPersonnels.ItemsSource; PersonnelShort person = persons.FirstOrDefault(); lstPersonnel.Add(person); //Agregamos el registro lstPersonnel.Sort((x, y) => string.Compare(x.peN, y.peN)); //Ordenamos la lista int nIndex = lstPersonnel.IndexOf(person); //Obtenemos la posición del registro btnDel.IsEnabled = (lstPersonnel.Count > 0) ? _blnDel : false; dgrPersonnels.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrPersonnels, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstPersonnel.Count + " Personnels."; //Actualizamos el contador } } }
/// <summary> /// Carga el combobox de los Closer Captain /// </summary> /// <history> /// [jorcanche] created 16062016 /// </history> private async void LoadCloserCapt() { //Capitan de Closers cmbAuthorizedBy.ItemsSource = await BRPersonnel.GetPersonnel(salesRooms : Context.User.SalesRoom.srID, roles : "CLOSERCAPT"); }