Пример #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>
        /// [emoguel] created 13/05/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            LeadSource          leadSource          = (LeadSource)dgrLeadSources.SelectedItem;
            frmLeadSourceDetail frmLeadSourceDetail = new frmLeadSourceDetail();

            frmLeadSourceDetail.Owner         = this;
            frmLeadSourceDetail.enumMode      = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmLeadSourceDetail.oldLeadSource = leadSource;
            if (frmLeadSourceDetail.ShowDialog() == true)
            {
                List <LeadSource> lstLeadSources = (List <LeadSource>)dgrLeadSources.ItemsSource;
                int nIndex = 0;
                if (ValidateFilter(frmLeadSourceDetail.leadSource))
                {
                    ObjectHelper.CopyProperties(leadSource, frmLeadSourceDetail.leadSource, true); //Actualizar los datos
                    lstLeadSources.Sort((x, y) => string.Compare(x.lsN, y.lsN));                   //Ordenar la lista
                    nIndex = lstLeadSources.IndexOf(leadSource);                                   //Obtener el indice del registro
                }
                else
                {
                    lstLeadSources.Remove(leadSource);
                }
                dgrLeadSources.Items.Refresh();                                //Actualizamos la vista
                GridHelper.SelectRow(dgrLeadSources, nIndex);                  //Seleccionamos el registro
                StatusBarReg.Content = lstLeadSources.Count + " Lead Sources"; //Actualizmos el contador
            }
        }
Пример #2
0
        /// <summary>
        /// Abre la ventana de busqueda
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/05/2016
        /// </history>
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            frmLeadSourceDetail frmLeadSourceDetail = new frmLeadSourceDetail();

            frmLeadSourceDetail.Owner         = this;
            frmLeadSourceDetail.enumMode      = EnumMode.Search;
            frmLeadSourceDetail.nStatus       = _nStatus;
            frmLeadSourceDetail.nRegen        = _nRegen;
            frmLeadSourceDetail.nAnimation    = _nAnimation;
            frmLeadSourceDetail.oldLeadSource = _leadSourceFilter;
            if (frmLeadSourceDetail.ShowDialog() == true)
            {
                _leadSourceFilter = frmLeadSourceDetail.leadSource;
                _nStatus          = frmLeadSourceDetail.nStatus;
                _nRegen           = frmLeadSourceDetail.nRegen;
                _nAnimation       = frmLeadSourceDetail.nAnimation;
                loadLeadSources();
            }
        }
Пример #3
0
        /// <summary>
        /// Abre la ventana detalle en Modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/05/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmLeadSourceDetail frmLeadSourceDetail = new frmLeadSourceDetail();

            frmLeadSourceDetail.Owner    = this;
            frmLeadSourceDetail.enumMode = EnumMode.Add;
            if (frmLeadSourceDetail.ShowDialog() == true)
            {
                if (ValidateFilter(frmLeadSourceDetail.leadSource))
                {
                    List <LeadSource> lstLeadSource = (List <LeadSource>)dgrLeadSources.ItemsSource;
                    lstLeadSource.Add(frmLeadSourceDetail.leadSource);                  //Agregamos el registro
                    lstLeadSource.Sort((x, y) => string.Compare(x.lsN, y.lsN));         //Ordenamos la lista
                    int nIndex = lstLeadSource.IndexOf(frmLeadSourceDetail.leadSource); //BUscamos la posición del registro
                    dgrLeadSources.Items.Refresh();                                     //Actualizamos la vista
                    GridHelper.SelectRow(dgrLeadSources, nIndex);                       //Seleccionamos el registro
                    StatusBarReg.Content = lstLeadSource.Count + " Lead Sources.";      //Actualizamos el contador
                }
            }
        }