/// <summary> /// Carga y configuracion del grid de LeadSources /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnLeadSources"></param> /// <param name="blnAllLeadSources"></param> /// <history> /// [edgrodriguez] 21/May/2016 Created /// </history> private async void LoadLeadSources(bool blnOnlyOneRegister, bool blnLeadSources, bool blnAllLeadSources) { if (!blnLeadSources) { return; } grdLeadSources.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; pnlLeadSource.Visibility = Visibility.Visible; _lstLeadSources = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID); grdLeadSources.ItemsSource = _lstLeadSources; chkAllLeadSources.IsChecked = blnAllLeadSources; chkAllLeadSources.IsEnabled = !blnOnlyOneRegister; if (!FrmProcGen._clsFilter.LstLeadSources.Any()) { return; } chkAllLeadSources.IsChecked = (grdLeadSources.SelectionMode == DataGridSelectionMode.Extended) && FrmProcGen._clsFilter.AllLeadSources; if (grdLeadSources.ItemsSource != null && !FrmProcGen._clsFilter.AllLeadSources && !blnOnlyOneRegister) { grdLeadSources.SelectedItem = null; FrmProcGen._clsFilter.LstLeadSources.ForEach(c => { grdLeadSources.SelectedItems.Add(_lstLeadSources.FirstOrDefault(l => l.lsID == c)); }); } else { grdLeadSources.SelectedItem = _lstLeadSources.FirstOrDefault(c => c.lsID == FrmProcGen._clsFilter.LstLeadSources[0]); } }
/// <summary> /// Carga los catalogos de los combos /// </summary> /// <history> /// [vku] 22/Jun/2016 Created /// </history> protected async void LoadCatalogs() { try { List <TourTimesSchema> lstTourTimesSchemas = await BRTourTimesSchemas.GetTourTimesSchemas(nStatus : 1); List <LeadSourceByUser> lstLeadSourceByUser = await BRLeadSources.GetLeadSourcesByUser((Context.User.User.peID)); List <SalesRoomByUser> lstSalesRoomByUser = await BRSalesRooms.GetSalesRoomsByUser((Context.User.User.peID)); List <WeekDay> lstWeekDays = await BRWeekDays.GetWeekDays("EN"); int tourTimesSchema = await BRConfiguration.GetTourTimesSchema(); cboSchema.SelectedValue = tourTimesSchema; cboSchema.ItemsSource = lstTourTimesSchemas; cboLeadSource.ItemsSource = lstLeadSourceByUser; cboSalesRoom.ItemsSource = lstSalesRoomByUser; cboWeekDay.ItemsSource = lstWeekDays; cboLeadSourceTo.ItemsSource = lstLeadSourceByUser; cboSalesRoomTo.ItemsSource = lstSalesRoomByUser; EnableCopy(); LoadListTourTimes(); } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <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> /// Carga y configuracion del grid de LeadSources /// </summary> /// <param name="blnOnlyOneRegister"></param> /// <param name="blnLeadSources"></param> /// <param name="blnAllLeadSources"></param> /// <param name="program"></param> /// <param name="blnLsHotelNotNull"></param> /// <history> /// [aalcocer] 26/May/2016 Created /// </history> private async void LoadLeadSources(bool blnOnlyOneRegister, bool blnLeadSources, bool blnAllLeadSources, EnumProgram program, bool blnLsHotelNotNull) { if (!blnLeadSources) { pnlLeadSource.Visibility = Visibility.Collapsed; return; } grdLeadSources.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended; _lstLeadSources = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID, program); if (blnLsHotelNotNull) { List <string> lstLsIDHotelNotNull = (await BRLeadSources.GetLeadSources(1, EnumProgram.All)).Where(x => x.lsHotel != null).Select(x => x.lsID).ToList(); _lstLeadSources = _lstLeadSources.Where(x => lstLsIDHotelNotNull.Contains(x.lsID)).ToList(); } grdLeadSources.ItemsSource = _lstLeadSources; chkAllLeadSources.IsChecked = blnAllLeadSources; chkAllLeadSources.IsEnabled = !blnOnlyOneRegister; if (!_frmIh._clsFilter.LstLeadSources.Any()) { return; } chkAllLeadSources.IsChecked = false; _frmIh._clsFilter.LstLeadSources.ForEach(c => grdLeadSources.SelectedItems.Add(_lstLeadSources.SingleOrDefault(x => x.lsID == c))); if (grdLeadSources.SelectedItems.Count == grdLeadSources.Items.Count) { chkAllLeadSources.IsChecked = true; } }
/// <summary> /// Llena el grid con los LeadSources a los que tiene acceso el usuario actual /// </summary> /// <history> /// [emoguel] created 11/06/2016 /// </history> private async void LoadLeadSources() { try { List <LeadSourceByUser> lstLeadSources = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID); dgrLeadSources.ItemsSource = lstLeadSources; List <string> lstSales = leadSource.Split(',').ToList(); lstSales.ForEach(lead => { LeadSourceByUser leadSource = lstLeadSources.Where(ls => ls.lsID == lead).FirstOrDefault(); if (leadSource != null) { dgrLeadSources.SelectedItems.Add(leadSource); } }); skpStatus.Visibility = Visibility.Collapsed; btnAccept.Visibility = Visibility.Visible; } catch (Exception ex) { UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga el formulario e inicializa variables /// </summary> ///<history> ///[jorcanche] created 12/05/2016 /// [erosado] 19/05/2016 Modified. Se agregó asincronía /// [edgrodriguez] 21/May/2016 Modified El método GetLeadSourcesByUser se volvió asincrónico. ///</history> private async void Window_Loaded(object sender, RoutedEventArgs e) { EnableControls(true, false, true, false); StaStart("Load LeadSource..."); cmbLeadSource.ItemsSource = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID); StaStart("Load Languages..."); cmbLanguage.ItemsSource = await BRLanguages.GetLanguages(1); cmbLanguage.SelectedIndex = cmbLeadSource.SelectedIndex = 0; StaEnd(); }
/// <summary> /// Carga la ventana /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [vipacheco] 06/Junio/2016 Created /// </history> private async void Window_Loaded(object sender, RoutedEventArgs e) { CollectionViewSource dsSalesRoom = ((CollectionViewSource)(FindResource("dsSalesRoom"))); CollectionViewSource dsLeadSource = ((CollectionViewSource)(FindResource("dsLeadSource"))); switch (_module) { case EnumSearchHostType.General: // Lead Sources dsLeadSource.Source = frmHost._lstLeadSources; btnOk.Visibility = guCheckInDColumn.Visibility = guCheckOutDColumn.Visibility = guBookD.Visibility = Visibility.Collapsed; break; case EnumSearchHostType.Transfer: btnOk.Content = "Tranfer"; // Ocultamos las columnas y los botones no utilizados en este caso stkButtons.Visibility = guLastName2Column.Visibility = guBookCancColumn.Visibility = guShowD1Column.Visibility = guMealTicketColumn.Visibility = guShowColumn.Visibility = guGiftsReceivedColumn.Visibility = guSaleColumn.Visibility = Visibility.Collapsed; // Lead Sources dsLeadSource.Source = frmHost._lstLeadSources; break; case EnumSearchHostType.Invit: btnOk.Content = "Invit"; // Ocultamos las columnas y los botones no utilizados en este caso stkButtons.Visibility = guLastName2Column.Visibility = guBookCancColumn.Visibility = guShowD1Column.Visibility = guMealTicketColumn.Visibility = guShowColumn.Visibility = guGiftsReceivedColumn.Visibility = guSaleColumn.Visibility = Visibility.Collapsed; // Ocultamos las fechas stkStartDate.Visibility = stkEndDate.Visibility = Visibility.Collapsed; // Lead Sources dsLeadSource.Source = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID, EnumProgram.Inhouse); break; } cboLeadSource.SelectedIndex = -1; // Sales Room dsSalesRoom.Source = await BRSalesRooms.GetSalesRoomsByUser(Context.User.User.peID); cboSalesRoom.SelectedIndex = -1; // Impedimos modificar los datos si el sistema esta en modo de solo lectura if (ConfigHelper.GetString("ReadOnly").ToUpper().Equals("TRUE")) { stkButtons.Visibility = btnOk.Visibility = Visibility.Collapsed; } }
/// <summary> /// Obtiene el catalogo de LeadSources /// </summary> /// <history> /// [erosado] 08/Mar/2016 Created /// [edgrodriguez] 21/May/2016 Modified El método GetLeadSourcesByUser se volvió asincrónico. /// </history> public async void DoGetLeadSources(string user) { try { List <LeadSourceByUser> data = await BRLeadSources.GetLeadSourcesByUser(user); if (data.Any()) { lsbxLeadSources.ItemsSource = data; } StaEnd(); } catch (Exception ex) { StaEnd(); UIHelper.ShowMessage(ex); } }
/// <summary> /// Obtiene los leadsource del usuario autentificado. /// </summary> /// <history> /// [edgrodriguez] 26/09/2016 Created /// </history> public async void DoGetLeadSource() { try { _leadSources = await BRLeadSources.GetLeadSourcesByUser(Context.User.User.peID); if (_leadSources.Count > 0) { lsbxLeadSources.ItemsSource = _leadSources; chbxLeadSources.IsChecked = false; } StaEnd(); } catch (Exception ex) { StaEnd(); UIHelper.ShowMessage(ex); } }
/// <summary> /// Carga los valores iniciales del formulario /// </summary> /// <history> /// [vipacheco] 17/Agosto/2016 Created /// </history> private async void Window_Loaded(object sender, RoutedEventArgs e) { // Cargamos el combo de LeadSource cboLeadSourse.ItemsSource = await BRLeadSources.GetLeadSourcesByUser(_user.User.peID, EnumProgram.Inhouse); cboLeadSourse.SelectedValue = _user.LeadSource != null ? _user.LeadSource.lsID : _user.SalesRoom.srID; cboLeadSourse.IsEnabled = (_leadSourceID == ""); DateTime dateServer = BRHelpers.GetServerDate(); // Fecha Inicial dtpStart.Value = dateServer.AddDays(-7); // Fecha Final dtpEnd.Value = dateServer; // Verificamos que Bloq Key estan activos CkeckKeysPress(StatusBarCap, Key.Capital); CkeckKeysPress(StatusBarIns, Key.Insert); CkeckKeysPress(StatusBarNum, Key.NumLock); }
/// <summary> /// /// </summary> /// <history> /// [erosado] 24/05/2016 Modified. Se agregó asincronía /// [vipacheco] 05/Agosto/2016 Modified -> Se agrego switch para el manejo de los tipos de apertura del search, se elimino ambiguedad de la columna guBooKD, se corrigio /// la consulta de sales room de OutHouse /// </history> private async void Window_Loaded(object sender, RoutedEventArgs e) { switch (_program) { case EnumProgram.Inhouse: // Cargamos el combo de LeadSource cmbLeadSourse.ItemsSource = await BRLeadSources.GetLeadSourcesByUser(user.User.peID, EnumProgram.Inhouse); cmbLeadSourse.SelectedValue = user.LeadSource.lsID; break; case EnumProgram.Outhouse: btnOK.Content = "Transfer"; guBookD.Visibility = stkSalesRoom.Visibility = Visibility.Visible; txbDateFrom.Text = "Book D. From"; txbDateTo.Text = "Book D. To"; txbName.Text = "Guest"; guIDColumn.Header = "ID"; dtgGuests.SelectionUnit = DataGridSelectionUnit.FullRow; dtgGuests.SelectionMode = DataGridSelectionMode.Single; guCheckInDColumn.Header = "Check In Date"; guCheckOutDColumn.Header = "Check Out Date"; // Cargamos el combo de LeadSource cmbLeadSourse.ItemsSource = await BRLeadSources.GetLeadSourcesByUser(user.User.peID, EnumProgram.Outhouse); cmbLeadSourse.SelectedValue = user.LeadSource?.lsID; // Cargamos el combo de Sales Room cmbSalesRoom.ItemsSource = await BRSalesRooms.GetSalesRoomsByUser(user.User.peID); cmbSalesRoom.SelectedIndex = -1; break; } StatusBarReg.Content = "0 Guests"; // Activamos los metodos encargado de verificar los bloq CkeckKeysPress(StatusBarCap, Key.Capital); CkeckKeysPress(StatusBarIns, Key.Insert); CkeckKeysPress(StatusBarNum, Key.NumLock); }
public async void GetLeadSources() { try { var data = await BRLeadSources.GetLeadSourcesByUser(user : Context.User.User.peID); if (data.Count > 0) { data.Insert(0, new LeadSourceByUser() { lsID = "ALL", lsN = "ALL", lspg = "ALL" }); cbxLeadSource.ItemsSource = data; cbxLeadSource.IsEnabled = true; } selectInCombobox(cbxLeadSource); } 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 los LeadSources por User, Programs All y Region All /// </summary> /// <history> /// [erosado] 07/04/2016 Created /// [edgrodriguez] 21/05/2016 Modified. El metodo GetLeadSourcesByUser se volvió asincrónico. /// </history> /// <param name="user">loginUserID</param> public async void DoGetLeadSources(string user) { try { List <LeadSourceByUser> data = await BRLeadSources.GetLeadSourcesByUser(user, EnumProgram.Inhouse); if (data.Count > 0) { cbxLeadSource.ItemsSource = data; cbxLeadSource.SelectedIndex = 0; } else { cbxLeadSource.Text = "No data found - Press Ctrl+F5 to load Data"; } StaEnd(); } catch (Exception ex) { StaEnd(); UIHelper.ShowMessage(ex); } }