public void FindДокументы(DsoDoc filter, int[] ids, ref int startRecord, ref int maxRecords)
 {
     Find(filter, ids, ref startRecord, ref maxRecords, null);
 }
Exemple #2
0
        private void Parse()
        {
            string txt = text.Text.Trim();

            try
            {
                ID = 0;

                if (PersonIDs == null || PersonIDs.Length == 0)
                {
                    SelectDialog(FormXml(false, false).OuterXml);
                }
                else
                {
                    if (txt.Length == 0)
                    {
                        SelectDialog(FormXml(true, true).OuterXml);
                    }
                    else
                    {
                        var findForm = FindForm();
                        if (findForm != null)
                        {
                            findForm.Cursor = Cursors.WaitCursor;
                        }

                        var filter = new DsoDoc();
                        filter.SearchText.Text    = txt;
                        filter.SearchText.Enabled = true;
                        if (PersonIDs != null)
                        {
                            for (int i = 0; i < PersonIDs.Length; i++)
                            {
                                filter.Person.Add(PersonIDs[i]);
                            }
                            filter.Person.MatchAnyItem = true;
                            filter.Person.Enabled      = true;
                        }
                        int result     = 0;
                        int maxRecords = 0;                         //поскольку не надо ничего возвращать
                        var ids        = new int[maxRecords];

                        Data.Env.Docs.FindДокументы(filter, ids, ref result, ref maxRecords);

                        if (result > 0)
                        {
                            if (result < maxResult)
                            {
                                string xml = FormXml(true, true).OuterXml;
                                SelectUniversal(Data.DALC.Documents.Search.Options.GetSQL(xml), xml);
                            }
                            else
                            {
                                SelectDialog(FormXml(true, true).OuterXml);
                            }
                        }
                        else
                        {
                            if (PersonIDs.Length > 1)
                            {
                                filter.Person.MatchAnyItem = false;
                                Data.Env.Docs.FindДокументы(filter, ids, ref result, ref maxRecords);
                                if (result > 0)
                                {
                                    if (result < maxResult)
                                    {
                                        string xml = FormXml(true, false).OuterXml;
                                        SelectUniversal(Data.DALC.Documents.Search.Options.GetSQL(xml), xml);
                                    }
                                    else
                                    {
                                        SelectDialog(FormXml(true, false).OuterXml);
                                    }
                                }
                                else
                                {
                                    SelectDialog(FormXml(false, false).OuterXml);
                                }
                            }
                            SelectDialog(FormXml(false, false).OuterXml);
                        }
                        if (findForm != null)
                        {
                            findForm.Cursor = Cursors.Default;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Data.Env.WriteToLog(ex);
                ErrorShower.OnShowError(null, ex.Message, "");
            }
        }