Пример #1
0
        /// <summary>
        /// Muestra la ventana detalle
        /// </summary>
        /// <history>
        /// [emoguel] 11/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            PostLog          postLog          = (PostLog)dgrPostsLog.SelectedItem;
            frmPostLogDetail frmPostLogDetail = new frmPostLogDetail();

            frmPostLogDetail.Owner      = this;
            frmPostLogDetail.enumMode   = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmPostLogDetail.oldPostLog = postLog;
            if (frmPostLogDetail.ShowDialog() == true)
            {
                int            nIndex      = 0;
                List <PostLog> lstPostsLog = (List <PostLog>)dgrPostsLog.ItemsSource;
                if (ValidateFilter(frmPostLogDetail.postLog))
                {
                    ObjectHelper.CopyProperties(postLog, frmPostLogDetail.postLog, true); //Actualizamos los datos del objeto
                    lstPostsLog.Sort((x, y) => y.ppDT.CompareTo(x.ppDT));                 //Ordenamos la lista
                    nIndex = lstPostsLog.IndexOf(postLog);                                //Obtenemos la posición
                }
                else
                {
                    lstPostsLog.Remove(postLog);//Quitamos el registro
                }
                dgrPostsLog.Items.Refresh();
                GridHelper.SelectRow(dgrPostsLog, nIndex);
                StatusBarReg.Content = lstPostsLog.Count + " Posts Log.";
            }
        }
Пример #2
0
        /// <summary>
        /// Abre la ventana detalle en modo busqueda
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/04/2016
        /// </history>
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            frmPostLogDetail frmPostLogDetail = new frmPostLogDetail();

            frmPostLogDetail.Owner      = this;
            frmPostLogDetail.oldPostLog = _postLogFilter;
            frmPostLogDetail.enumMode   = EnumMode.Search;
            frmPostLogDetail.blnDate    = _blnDate;
            if (frmPostLogDetail.ShowDialog() == true)
            {
                _postLogFilter = frmPostLogDetail.postLog;
                _blnDate       = frmPostLogDetail.blnDate;
                LoadPostLogs();
            }
        }
Пример #3
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 12/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmPostLogDetail frmPostLogDetail = new frmPostLogDetail();

            frmPostLogDetail.Owner    = this;
            frmPostLogDetail.enumMode = EnumMode.Add;
            if (frmPostLogDetail.ShowDialog() == true)
            {
                PostLog postLog = frmPostLogDetail.postLog;
                if (ValidateFilter(postLog))
                {
                    List <PostLog> lstPostsLog = (List <PostLog>)dgrPostsLog.ItemsSource;
                    lstPostsLog.Add(postLog);                                 //Agregamos el registro
                    lstPostsLog.Sort((x, y) => y.ppDT.CompareTo(x.ppDT));     //ordenamos la lista
                    int nIndex = lstPostsLog.IndexOf(postLog);                //obtenemos la posición del registro
                    dgrPostsLog.Items.Refresh();                              //Actualizamos la vista
                    GridHelper.SelectRow(dgrPostsLog, nIndex);                //Seleccionamos el registro
                    StatusBarReg.Content = lstPostsLog.Count + " Posts Log."; //Actualizamos el contador
                }
            }
        }