Esempio n. 1
0
        public EntitySearch(DataTable _TimeEntryCache, String _User)
        {
            InitializeComponent();

            searchInfo.Content = "";
            this.Title         = "";
            TimeEntryCache     = _TimeEntryCache;

            SearchResult = new DataTable("favorites");

            SearchResult.Columns.Add("gctype", typeof(String));
            SearchResult.Columns.Add("gcdescription", typeof(String));
            SearchResult.Columns.Add("gcinfo1", typeof(String));
            SearchResult.Columns.Add("gcinfo2", typeof(String));

            SearchGrid.ItemsSource = SearchResult;

            SearchGrid.IsFilterEnabled = true;
            SearchGrid.RefreshData();
            SearchGrid.GroupBy(SearchGrid.Columns["gctype"], DevExpress.Data.ColumnSortOrder.Ascending);

            SearchGrid.ExpandAllGroups();

            //Boolean _check_failed = false;

            //// Check marked time entries
            //Int32 _sync_count = 0;
            //for (int i = 0; i < _parent_tv.SelectedRows.Count; i++)
            //{
            //    System.Data.DataRowView _drv = (System.Data.DataRowView)_parent_tv.SelectedRows[i];
            //    DataRow _dr = _drv.Row;
            //    String _status = "";
            //    String _tekz = "";
            //    try
            //    {
            //        _tekz = _dr["tekz"].ToString().Trim().ToUpper();
            //        _status = _dr["status"].ToString().Trim().ToUpper();
            //    }
            //    catch
            //    {
            //    }

            //    if (_status == "NOSYNC")
            //    {
            //        _sync_count++;
            //        if (Sync_Entity_Type == "")
            //        {
            //            Sync_Entity_Type = _tekz;
            //        }
            //        else
            //        {
            //            if (Sync_Entity_Type != _tekz)
            //            {
            //                MessageBox.Show("Es können nur Zeiteinträge vom gleichen MSCRM Typ (AP, ANF, VC) zugewiesen werden!", "Wichtiger Hinweis", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            //                _check_failed = true;
            //                break;
            //            }
            //        }
            //    }
            //}

            //if (_sync_count == 0)
            //{
            //    MessageBox.Show("Bitte markieren Sie mindestens einen Zeiteintrag für die Übertragung nach MSCRM!", "Wichtiger Hinweis", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            //    _check_failed = true;
            //}

            //if (_check_failed)
            //{
            //    this.Close();
            //} else
            //{
            //    if (Sync_Entity_Type == "AP")
            //    {
            //        if (_sync_count == 1)
            //             this.Title = "Zeiteintrag zu MSCRM Arbeitspaket zuweisen ...";
            //        else this.Title = _sync_count.ToString()+" Zeiteinträge zu MSCRM Arbeitspaket zuweisen ...";
            //    }
            //    else if (Sync_Entity_Type == "ANF")
            //    {
            //        if (_sync_count == 1)
            //             this.Title = "Zeiteintrag zu MSCRM Anfrage zuweisen ...";
            //        else this.Title = _sync_count.ToString()+" Zeiteinträge zu MSCRM Anfrage zuweisen ...";
            //    }
            //    else if (Sync_Entity_Type == "VC")
            //    {
            //        if (_sync_count == 1)
            //            this.Title = "Zeiteintrag zu MSCRM Verkaufschance zuweisen ...";
            //        else this.Title = _sync_count.ToString() + " Zeiteinträge zu MSCRM Verkaufschance zuweisen ...";
            //    }
            //}
        }
Esempio n. 2
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            // Search

            String _searchText = tbEntitySearch.Text.Trim();

            if (_searchText.Length > 1)
            {
                SearchResult.Rows.Clear();

                String _filterExpression = "";

                _filterExpression += "[type]='WORKPACKAGE'";
                _filterExpression += " OR ";
                _filterExpression += "[type]='OPPORTUNITY'";
                _filterExpression += " OR ";
                _filterExpression += "[type]='INCIDENT'";
                _filterExpression += " OR ";
                _filterExpression += "[type]='NEW_VERSION'";
                _filterExpression += " OR ";
                _filterExpression += "[type]='CAMPAIGN'";

                DataRow[] _result = TimeEntryCache.Select("(" + _filterExpression + ") AND [description] LIKE '%" + EscapeLikeValue(_searchText) + "%'");
                foreach (DataRow _row in _result)
                {
                    DataRow _nr = SearchResult.NewRow();

                    String _EntityType = _row["type"].ToString();

                    if (_EntityType == "WORKPACKAGE")
                    {
                        _nr["gctype"] = "AP";
                    }
                    else if (_EntityType == "OPPORTUNITY")
                    {
                        _nr["gctype"] = "VC";
                    }
                    else if (_EntityType == "INCIDENT")
                    {
                        _nr["gctype"] = "ANF";
                    }
                    else if (_EntityType == "NEW_VERSION")
                    {
                        _nr["gctype"] = "REL";
                    }
                    else if (_EntityType == "CAMPAIGN")
                    {
                        _nr["gctype"] = "KA";
                    }

                    _nr["gcdescription"] = _row["description"].ToString();
                    _nr["gcinfo1"]       = "";
                    _nr["gcinfo2"]       = "";

                    //  _nr["gcmscrmid"] = _dr["mscrmid"];

                    SearchResult.Rows.Add(_nr);
                }

                SearchGrid.ExpandAllGroups();
            }
        }