Exemple #1
0
        /// <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>
        /// [vku] 09/Jul/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            TeamGuestServices teamPRs          = (TeamGuestServices)dgrTeams.SelectedItem;
            frmTeamPRsDetail  frmTeamPRsDetail = new frmTeamPRsDetail();

            frmTeamPRsDetail.Owner    = this;
            frmTeamPRsDetail.oldTeam  = teamPRs;
            frmTeamPRsDetail.enumMode = EnumMode.Edit;
            if (frmTeamPRsDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <TeamGuestServices> lstTeams = (List <TeamGuestServices>)dgrTeams.ItemsSource;
                if (ValidateFilter(frmTeamPRsDetail.team))                       //Valida si cumple con los filtros
                {
                    ObjectHelper.CopyProperties(teamPRs, frmTeamPRsDetail.team); //Actualiza los datos
                    lstTeams.Sort((x, y) => string.Compare(x.tgN, y.tgN));       //Ordena la lista
                    nIndex = lstTeams.IndexOf(teamPRs);                          //busca la posición del registro
                }
                else
                {
                    lstTeams.Remove(teamPRs);                      //Quita el registro
                }
                dgrTeams.Items.Refresh();                          //Actualiza la vista
                GridHelper.SelectRow(dgrTeams, nIndex);            //Selecciona el registro
                StatusBarReg.Content = lstTeams.Count + " Teams."; //Actualiza el contador
            }
        }
Exemple #2
0
        /// <summary>
        ///   Abre la ventana detalle en modo agregar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        ///   [vku] 09/Jul/2016 Created
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmTeamPRsDetail frmTeamPRsDetail = new frmTeamPRsDetail();

            frmTeamPRsDetail.Owner    = this;
            frmTeamPRsDetail.enumMode = EnumMode.Add;
            if (frmTeamPRsDetail.ShowDialog() == true)
            {
                if (ValidateFilter(frmTeamPRsDetail.team))//Valida que cumpla con los filtros actuales
                {
                    List <TeamGuestServices> lstTeams = (List <TeamGuestServices>)dgrTeams.ItemsSource;
                    lstTeams.Add(frmTeamPRsDetail.team);                   //Agrega el registro
                    lstTeams.Sort((x, y) => string.Compare(x.tgN, y.tgN)); //ordena la lista
                    int nIndex = lstTeams.IndexOf(frmTeamPRsDetail.team);  //BUsca la posición del registro
                    dgrTeams.Items.Refresh();                              //Refresca la vista
                    GridHelper.SelectRow(dgrTeams, nIndex);                //Selecciona el registro
                    StatusBarReg.Content = lstTeams.Count + " Teams.";     //Actualiza el contador
                }
            }
        }