Exemplo n.º 1
0
        void SetDataRow(DataRow dr, Alert alert)
        {
            string txt;

            dr["AlertId"] = alert.Id;

            dr["QueryName"] = alert.QueryName;
            if (alert.LastQueryUpdate != DateTime.MinValue)
            {
                dr["QueryLastModified"] = alert.LastQueryUpdate;
            }
            else
            {
                dr["QueryLastModified"] = DBNull.Value;
            }

            dr["CheckInterval"]             = alert.Interval;
            dr["AlertLastChecked"]          = alert.LastCheck;
            dr["LastCheckThatFoundNewData"] = alert.LastNewData;

            if (alert.LastCheckExecutionTime >= 0)
            {
                dr["LastCheckExecutionTime"] = new TimeSpan(0, 0, alert.LastCheckExecutionTime);
            }
            else
            {
                dr["LastCheckExecutionTime"] = DBNull.Value;
            }

            dr["NewCompounds"]     = alert.NewCompounds;
            dr["ChangedCompounds"] = alert.ChangedCompounds;
            dr["TotalCompounds"]   = alert.TotalCompounds;          //alert.ChangedCompounds;
            dr["NewChangedRows"]   = alert.NewRows;
            dr["TotalRows"]        = alert.TotalRows;
            txt          = alert.MailTo.Replace("\r\n", ", ");    // remove newlines
            dr["SendTo"] = txt;
            txt          = alert.Owner;
            try { txt = SecurityUtil.GetShortPersonNameReversed(alert.Owner); }
            catch (Exception ex) { }
            dr["Owner"]   = txt;
            dr["QueryId"] = alert.QueryObjId;

            return;
        }
Exemplo n.º 2
0
        public static void MailBackgroundExportResults(
            Query q,
            string fileName,
            int rowCount,
            int compoundCount,
            bool copiedToDestinationFile,
            string viewCmd,
            string mailTo,
            string mailSubject,
            string templateFileName)
        {
            MailMessage mail = new MailMessage();

            mail.From    = new MailAddress("Mobius@[server]", UmlautMobius.String);
            mail.Subject = mailSubject;
            Email.SetMultipleMailTo(mail, mailTo);

            string queryLabel = q.UserObject.Name;
            string txt;

            try
            {
                txt         = SecurityUtil.GetShortPersonNameReversed(q.UserObject.Owner);          // include owner's name
                queryLabel += " (" + txt + ")";
            }
            catch (Exception ex) { }

            string html = ReadTemplateFile(templateFileName);

            html = SubstituteBackgroundExportParameters(
                html, queryLabel, fileName, rowCount, compoundCount, copiedToDestinationFile, viewCmd);

            mail.Body       = html;
            mail.IsBodyHtml = true;

            Email.Send(mail);
            return;
        }
Exemplo n.º 3
0
/// <summary>
/// Get new data & update grid
/// </summary>

        void UpdateGrid()
        {
            InUpdateGrid = true;

            ServiceHostInfo svcInf = ServiceFacade.ServiceFacade.GetServiceHostInfo();

            if (svcInf == null)
            {
                return;
            }

            List <Mobius.NativeSessionClient.SessionInfo> sil = new Mobius.NativeSessionClient.NativeSessionClient().GetSessionInfoForAllSessions();

            if (sil == null)
            {
                sil = new List <SessionInfo>();
            }

            Label.Text =
                "Server: " + svcInf.ServerName +
                ", Version: " + VersionMx.FormatVersion(svcInf.Version) +
                ", Count: " + sil.Count;

            DataTable.Rows.Clear();
            DateTime now = DateTime.Now;

            foreach (SessionInfo si in sil)
            {
                DataRow dr = DataTable.NewRow();
                dr["SessionIdCol"]   = si.Id;
                dr["IsNonNativeCol"] = si.Native ? "" : "Y";
                dr["UserIdCol"]      = si.UserId;
                try { dr["UserNameCol"] = SecurityUtil.GetShortPersonNameReversed(si.UserId); }
                catch { }

                dr["CreationDtCol"] = CommandLine.FormatTimeSpan(now.Subtract(si.CreationDT));

                if (!si.ExpirationDT.Equals(DateTime.MinValue))                 // calc idle time
                {
                    dr["IdleTimeCol"] = CommandLine.FormatTimeSpan(now.Subtract(si.ExpirationDT));
                }

                if (si.ProcessId > 0)
                {
                    dr["ProcessIdCol"] = si.ProcessId;
                }

                if (si.CpuTimeSecs > 0)
                {
                    dr["CpuTimeCol"] = (int)si.CpuTimeSecs;
                }

                if (si.MemoryMb > 0)
                {
                    dr["MemoryCol"] = si.MemoryMb;
                }

                if (si.Threads > 0)
                {
                    dr["ThreadsCol"] = si.Threads;
                }

                if (si.Handles > 0)
                {
                    dr["HandlesCol"] = si.Handles;
                }

                DataTable.Rows.Add(dr);
            }

            Grid.DataSource = DataTable;
            Grid.Refresh();
            Application.DoEvents();

            InUpdateGrid = false;
            return;
        }