Beispiel #1
0
        public static void Load(bool log)
        {
            AtUserControl form       = null;
            AtLogWatcher  logWatcher = new AtLogWatcher();

            try
            {
                if (log)
                {
                    MdiManager.Add(logWatcher);
                    AtLog.LogWatcher = logWatcher;
                }

                try
                {
                    form = new MainForm();
                    MdiManager.Add((AtUserControl)form);
                }
                catch (Exception e)
                {
                    AtLog.AddMessage(e.ToString());
                }
            }
            finally
            {
                MdiManager.tabs.Remove(form);
            }
        }
Beispiel #2
0
 public static bool autoExportReportByName(string name, ArrayList vars, bool autoPrint, short copies, IEnumerable sourceData)
 {
     AtUserControl atuc = new AtUserControl();
     
     atuc.db.command.CommandText = "SELECT TOP 1 idreport FROM dbo.report WHERE name LIKE '" + name + "' and deleted is null";
     
     DataTable dTbl = new DataTable();
     atuc.db.adapter.Fill(dTbl);
     
     int reportID = Useful.GetInt32(dTbl.Rows[0]["idreport"]);
     
     return autoExportReport(reportID, vars, autoPrint, copies, sourceData);
 }
Beispiel #3
0
 //
 
 //функция авто экспорта отчетов
 public static bool autoExportReport(int idreport, ArrayList vars, bool autoPrint, short copies, IEnumerable sourceData)
 {
     DataTable repTbl = new DataTable();
     repTbl.Clear();
     
     AtUserControl atuc = new AtUserControl();
     atuc.db.command.CommandText = "SELECT * FROM dbo.report WHERE idreport = " + idreport;
     atuc.db.adapter.Fill(repTbl);
     atuc.db.command.Parameters.Clear();
     
     if (repTbl.Rows.Count == 0)
     {
         MessageBox.Show("Не могу найти запись об отчете в БД.");
         return false;
     }
     
     DataRow dr = repTbl.Rows[0];
     
     AtReport rep = new AtReport(dr, vars);
     
     if(sourceData != null)
     {
         StiReport stiRep = rep.rep;
         stiRep.Dictionary.Databases.Clear();
         stiRep.Dictionary.DataSources.Clear();
         stiRep.RegData("Список", sourceData);
         stiRep.Dictionary.Synchronize();
     }
     
     if(autoPrint)
     {
         rep.PrintReport(copies);
     }
     else
     {
         rep.ShowReport();
     }
     
     return true;
 }