private void LoadEmailConfiguration() { BCCManageConfigData configData = new BCCManageConfigData(); configData.Speedcode = EmailConfigSpeedCode; configData.Query(); NameValuePairSet configSet = configData.ConfigurationData; foreach (NameValuePair nvPair in configSet) { if (nvPair.Name.Equals(BCCUIHelper.Constants.TASK_REMINDER_EMAIL_FLAG)) { Boolean.TryParse(nvPair.Value, out taskReminderEmailFlag); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.TASK_REMINDER_EMAIL_TIME)) { int hour = 9; int min = 0; try { string[] timeComponent = nvPair.Value.Split(':'); if (timeComponent != null) { Int32.TryParse(timeComponent[0], out hour); Int32.TryParse(timeComponent[1], out min); } } catch (Exception exception) { System.Diagnostics.Debug.Write(exception.Message, "TaskNotifier"); } ScheduledTimeToRun = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, hour, min, 0); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.TASK_CLONING_FLAG)) { Boolean.TryParse(nvPair.Value, out taskCloningEnabled); } } }
private void PurgeControlCenterData() { try { int mdaDaysToKeep = 30; int pcdaDaysToKeep = 7; int webAuditDaysToKeep = 30; BCCManageConfigData configData = new BCCManageConfigData(); configData.Speedcode = BCC_AGENT_CONFIG_SPEEDCODE; configData.Query(); NameValuePairSet configSet = configData.ConfigurationData; foreach (NameValuePair nvPair in configSet) { if (nvPair.Name.Equals(BCCUIHelper.Constants.DAYS_TO_KEEP_PERFDATA)) { Int32.TryParse(nvPair.Value, out pcdaDaysToKeep); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.DAYS_TO_KEEP_USRAVT)) { Int32.TryParse(nvPair.Value, out webAuditDaysToKeep); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.DAYS_TO_KEEP_USRNTF)) { Int32.TryParse(nvPair.Value, out mdaDaysToKeep); } } BCCMonitoringDataAccess mda = new BCCMonitoringDataAccess(); mda.PurgeMonitoringData(mdaDaysToKeep); BCCPerfCounterDataAccess pcda = new BCCPerfCounterDataAccess(); pcda.PurgePerformanceCounterData(pcdaDaysToKeep); BCCWebAudit.PurgeWebAuditEvents(webAuditDaysToKeep); } catch (Exception exception) { WriteToEventLog(exception.Message + exception.StackTrace); } }
static void Main(string[] args) { try { //BCCMonitoringDataAccess da = new BCCMonitoringDataAccess(); //List<BCCMonitoringEntry> list = da.MonitoringEntryList(); //foreach (BCCMonitoringEntry entry in list) //{ // Console.WriteLine("Entry: "+ entry.ArtifactName); //} //Console.Write("ggg" + System.DateTime.Now.ToString("MMM-dd-yyyy hh:mm:ss tt")); //Console.ReadLine(); //BCCMonitoring x = new BCCMonitoring(ArtifactType.SendPort, "SynergyCRMDynamics", 10); // BCCMonitoring x = new BCCMonitoring(ArtifactType.HostInstance, "IHS_Receive", 10); //BCCMonitoring x = new BCCMonitoring(ArtifactType.ServiceInstance, "BizTalk Application 1", 10); //BCCMonitoring x = new BCCMonitoring(ArtifactType.EventLog, "Application", 10); //x.EnableMonitoring(); //x.ArtifactStatusChanged += new ArtifactMonitoringEventHandler(x_PortStatusChanged); //Console.Write("Waiting for events..."); //Console.ReadLine(); //x.DisableMonitoring(); //Console.Write("Monitoring disabled..."); //Console.ReadLine(); NameValuePairSet set = new NameValuePairSet(); NameValuePair pair = new NameValuePair(); pair.Name = "IsWebEmail"; pair.DisplayName = "Web Email"; pair.Value = "True"; pair.ToolTip = "For web-based email, set it to True, else False."; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailHost"; pair.DisplayName = "Email Host"; pair.Value = "smtp.gmail.com"; pair.ToolTip = "Email server name"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailPort"; pair.DisplayName = "Email Port"; pair.Value = "587"; pair.ToolTip = "Email port number"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailUserName"; pair.DisplayName = "From Email ID"; pair.Value = "*****@*****.**"; pair.ToolTip = "From email address or email server username"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailUserPassword"; pair.DisplayName = "Password"; pair.Value = "P@ssw0rd$"; pair.ToolTip = "password"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailRecipient"; pair.DisplayName = "Recipient Email ID"; pair.Value = "*****@*****.**"; pair.ToolTip = "destination email address (use comma for mulitple email addresses)"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailSubject"; pair.DisplayName = "Subject"; pair.Value = "BizTalk Control Center (BCC) Alert on [$machineName]"; pair.ToolTip = "Email subject"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailTitle"; pair.DisplayName = "Title"; pair.Value = "BizTalk Control Center (BCC) - Alert Notification"; pair.ToolTip = "Email Title"; set.Add(pair); pair = new NameValuePair(); pair.Name = "SmtpEmailSSL"; pair.DisplayName = "SSL enabled"; pair.Value = "True"; pair.ToolTip = "Specify 'False', if SSL is not enabled."; set.Add(pair); pair = new NameValuePair(); pair.Name = "KeepPerformanceData"; pair.DisplayName = "Keep Performance Data"; pair.Value = "7"; pair.ToolTip = "Default value is 7 days"; set.Add(pair); pair = new NameValuePair(); pair.Name = "KeepUserNotifications"; pair.DisplayName = "Keep User Notifications"; pair.Value = "30"; pair.ToolTip = "Default value is 30 days"; set.Add(pair); pair = new NameValuePair(); pair.Name = "KeepUserActivity"; pair.DisplayName = "Keep User Activity"; pair.Value = "30"; pair.ToolTip = "Default value is 30 days"; set.Add(pair); pair = new NameValuePair(); pair.Name = "TaskReminderEmailFlag"; pair.DisplayName = "Tasks Email"; pair.Value = "True"; pair.ToolTip = "Default value is 'True'"; set.Add(pair); pair = new NameValuePair(); pair.Name = "TaskReminderEmailTime"; pair.DisplayName = "Tasks Email Time (UTC)"; pair.Value = "09:00"; pair.ToolTip = "Specify time in 24-hour format (hh:mm), default value is '09:00'"; set.Add(pair); pair = new NameValuePair(); pair.Name = "TaskCloningFlag"; pair.DisplayName = "Task Cloning"; pair.Value = "True"; pair.ToolTip = "Task cloning will check for recurring tasks and create new tasks"; set.Add(pair); BCC.Core.BCCManageConfigData cd = new BCCManageConfigData(); cd.Speedcode = "604"; cd.ConfigurationData = set; cd.Update(); cd = new BCCManageConfigData(); cd.Speedcode = "604"; cd.Query(); set = cd.ConfigurationData; Console.WriteLine("Count: " + set.Count); //BCCPerformanceCounters x = new BCCPerformanceCounters(); //DataTable dt = x.EnumeratePerformanceCounters(); //int count = dt.Rows.Count; //BCCPerfCounterDataAccess x = new BCCPerfCounterDataAccess(); //BCCPerfCounterEntry entry = new BCCPerfCounterEntry("Cat", "Inst", "Counter"); //x.CreatePerformanceCounterEntry(entry); //BCCMonitoringDataAccess da = new BCCMonitoringDataAccess(); //da.LogMonitoringData(ArtifactType.ReceivePort, "DropCRMRequestLocation", "Hello"); //string[] daysOfWeek = new string[7]; //for (int count = 0; count < 7; count++) //{ // daysOfWeek[count] = DateTime.Today.Subtract(new TimeSpan(6 - count, 0, 0, 0)).DayOfWeek.ToString(); //} //BCCPerfCounterDataAccess da = new BCCPerfCounterDataAccess(); ////da.LogPerformanceCounterData(".NET Data Provider for SqlServer", "NumberOfInactiveConnectionPools", "windowsservice_0[1432]", 33); //List<BCCPerfCounterEntry> list = da.PerformanceCounterEntryList(); //string data = "This is my data"; //UnicodeEncoding unicode = new UnicodeEncoding(); //byte[] byteData = unicode.GetBytes(data); //string hexString = BCCHexUtil.ToString(byteData); //Console.WriteLine("hexString: " + hexString); //if (BCCHexUtil.IsHexString(hexString)) //{ // Console.WriteLine("Yes. This is a hex string."); // byte[] normalData = BCCHexUtil.GetBytes(hexString); // string normal = unicode.GetString(normalData); // Console.WriteLine("Back to normal::" + normal); //} //BCCTransformationHelper helper = new BCCTransformationHelper(); //XmlDocument xDoc = new XmlDocument(); //xDoc.Load(@"C:\BCC_Classic\BCC\tasks.xml"); //string data = helper.Transform(xDoc.OuterXml, @"C:\BCC_Classic\BCC\BCC.web\xslt\TaskEmailView.xslt"); //File.WriteAllText(@"C:\BCC_Classic\BCC\Sample.html", data); //System.Timers.Timer t = new System.Timers.Timer(); //t.Interval = 60 * 1000; //t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed); //t.AutoReset = true; //t.Enabled = true; //Console.WriteLine("waiting for timer event...." + DateTime.Now.ToString()); } catch (Exception e) { String data = e.Message + e.StackTrace; Console.WriteLine(data); } Console.WriteLine("Press any key..."); Console.Read(); }
private void LoadEmailConfiguration() { BCCManageConfigData configData = new BCCManageConfigData(); configData.Speedcode = SpeedCode; configData.Query(); NameValuePairSet configSet = configData.ConfigurationData; foreach (NameValuePair nvPair in configSet) { if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_HOST)) { smtp_email_host = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_PORT)) { Int32.TryParse(nvPair.Value, out smtp_email_port); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_RCPNT)) { smtp_email_rcpnt = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_SSL)) { Boolean.TryParse(nvPair.Value, out smtp_email_ssl); } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_SUBJECT)) { smtp_email_subject = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_TITLE)) { smtp_email_title = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_USERNAME)) { smtp_email_username = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.SMTP_EMAIL_USERPWD)) { smtp_email_userpwd = nvPair.Value; } else if (nvPair.Name.Equals(BCCUIHelper.Constants.IS_WEB_EMAIL)) { Boolean.TryParse(nvPair.Value, out isWebEmail); } } }
private void LoadEmailConfiguration() { try { BCC.Core.BCCManageConfigData configData = new BCCManageConfigData(); configData.Speedcode = SiteMap.CurrentNode.Description; configData.Query(); NameValuePairSet configSet = configData.ConfigurationData; editBoxControls = new Controls_EditBox[configSet.Count]; for (int count = 0; count < configSet.Count; count++) { editBoxControls[count] = (Controls_EditBox)LoadControl("~/Controls/EditBox.ascx"); editBoxControls[count].ID = "EditBox_" + (count + 1); editBoxControls[count].LabelName = configSet[count].Name; editBoxControls[count].DisplayName = configSet[count].DisplayName; editBoxControls[count].ToolTip = configSet[count].ToolTip; if (configSet[count].DisplayName.Contains("Password")) { editBoxControls[count].IsPasswordField = true; } editBoxControls[count].TextValue = configSet[count].Value; phEmailConfig.Controls.Add(editBoxControls[count]); } } catch (Exception e) { phEmailConfig.Controls.Add( new LiteralControl("Unable to load email configuration from the BCC database. Error:" + e.Message)); lnkSaveEmailProp.Enabled = false; } }
protected void SaveProperties_Click(object sender, EventArgs e) { BCC.Core.BCCManageConfigData configData = new BCCManageConfigData(); configData.Speedcode = SiteMap.CurrentNode.Description; configData.Query(); NameValuePairSet configSet = configData.ConfigurationData; for (int count = 0; count < configSet.Count; count++) { if (editBoxControls[count].LabelName == configSet[count].Name) { configSet[count].Value = editBoxControls[count].TextValue; } } configData.Update(); new ActivityHelper().RaiseAuditEvent(this, lblCaption.Text, "updated config data", 604); }