/// <summary> /// Getting all groups which have managedBy set out of a text file and storing it in a Dictionary. /// </summary> /// <param name="aDGroupsStatic">D</param> protected bool ADGroups_Load(ref Dictionary <string, string> aDGroupsStatic) { int retval; string objContentMsg = ""; FSGetFileContent fileCont = new FSGetFileContent(); fileCont.SourceFile = WbGetParams.getValue("ADGroupsFile"); List <string> rtnList = fileCont.rtnValues(out retval, ref objContentMsg); if (retval == 0) { foreach (var itm in rtnList) { string[] itms = itm.Split('#'); aDGroupsStatic.Add(itms[0], itms[1]); } return(true); } else { return(false); } } // end ADGroups_Load()
/// <summary> /// Getting the text for the UserInterface from XML file. /// </summary> /// <param name="appText"></param> /// <param name="errorDetails"></param> /// <param name="appLanguage"></param> /// <returns>Dictionary containing the items in the detected language.</returns> public static bool GetAppText(ref Dictionary <string, string> appText, ref string errorDetails, string appLanguage) { string[] arrlangs = WbGetParams.getValue("AppLanguages").Split(','); if (!arrlangs.Contains(appLanguage)) { appLanguage = "EN"; } bool retval = false; var xmlSrc = new FSReadXML() { NameSpace = "ns", QueryParam = @"Language='" + appLanguage + @"'", SourceFile = WbGetParams.getValue("AppTextFile"), XmlChildName = "AppText" }; bool hasContent = xmlSrc.ReadSingleNode(ref appText, ref errorDetails); if (hasContent) { retval = true; } return(retval); } // end GetAppText(ref Dictionary<string, string> appText, ref string errorDetails, string appLanguage)
} // end lbtnUpdateGroupMembers_Click /// <summary> /// Updates the usage log file of this tool. /// </summary> protected void Update_UsageLog() { string authUser = Request.LogonUserIdentity.Name; string timeStamp = DateTime.UtcNow.ToString(); string appVersion = WbGetParams.getValue("AppVersion"); string appFeedback = lblAppFeedback.Text; if (String.IsNullOrWhiteSpace(appFeedback)) { appFeedback = "No errors catched."; } string changedGroup = ViewState["agGrpSelected"].ToString(); var sb = new System.Text.StringBuilder(); for (int i = 0; i < lstGroupMembers.Items.Count; i++) { sb.Append(lstGroupMembers.Items[i].Value.ToString()).Append(';'); } string groupMemberList = sb.ToString(); var logfile = new FSUsageLogWrite() { authUser = authUser, timeStamp = timeStamp, appVersion = appVersion, appFeedback = appFeedback, changedGroup = changedGroup, groupMemberList = groupMemberList }; logfile.UpdateLog(); } // end Update_UsageLog()
public void SendMailNotification() { string mailbody = @" <style> p { font-size: 11px; font-family: Verdana, sans-serif; color: #004595; } .othercolor { color: #ff7e00; } </style> " + notifymsg; string mailSubject = "SIG-GroupManagmentTool Notification on: " + DateTime.Now.ToString(); MailMessage myMessage = new MailMessage(WbGetParams.getValue("NotifyFromAddress"), Notifyrcp, mailSubject, mailbody); myMessage.IsBodyHtml = true; if (WbGetParams.getBValue("SendAdminBccNotification")) { MailAddress bcc = new MailAddress(WbGetParams.getValue("NotifyAdminToAddress")); myMessage.Bcc.Add(bcc); } SmtpClient mySmtpClient = new SmtpClient(WbGetParams.getValue("NotifyExchangeServer")); try { mySmtpClient.Send(myMessage); } catch { string foo = "bar"; } }
public string[] GetUser(string filterIn) { int retvalfr; string retMsgrf = ""; FSGetFileContent fileCont = new FSGetFileContent(); fileCont.SourceFile = WbGetParams.getValue("ADUsersFile"); List <string> rtnList = fileCont.rtnValues(out retvalfr, ref retMsgrf, filterIn); rtnList.Sort(); if (retvalfr == 0) { return(rtnList.ToArray()); } else { List <string> foundkeys = new List <string>(); foundkeys.Add("no keys" + ',' + " in cache "); return(foundkeys.ToArray()); } } //end GetUser
public void UpdateLog() { string sourceFile = WbGetParams.getValue("UsageLogFile"); try { string fileName = Path.Combine(HttpRuntime.AppDomainAppPath, sourceFile); XmlDocument xUsageLog = new XmlDocument(); xUsageLog.Load(fileName); XmlElement XParentElement = xUsageLog.CreateElement("LogEntry"); XmlElement XTimeStamp = xUsageLog.CreateElement("TimeStamp"); XmlElement XAuthUser = xUsageLog.CreateElement("AuthUser"); XmlElement XAppVersion = xUsageLog.CreateElement("AppVersion"); XmlElement XAppFeedback = xUsageLog.CreateElement("AppFeedback"); XmlElement XChangedGroup = xUsageLog.CreateElement("ChangedGroup"); XmlElement XGroupMemberList = xUsageLog.CreateElement("GroupMemberList"); if (!String.IsNullOrEmpty(timeStamp)) { XTimeStamp.InnerText = timeStamp; } else { XTimeStamp.InnerText = ""; } if (!String.IsNullOrEmpty(authUser)) { XAuthUser.InnerText = authUser; } else { XAuthUser.InnerText = ""; } if (!String.IsNullOrEmpty(appVersion)) { XAppVersion.InnerText = appVersion; } else { XAppVersion.InnerText = ""; } if (!String.IsNullOrEmpty(appFeedback)) { XAppFeedback.InnerText = appFeedback; } else { XAppFeedback.InnerText = ""; } if (!String.IsNullOrEmpty(changedGroup)) { XChangedGroup.InnerText = changedGroup; } else { XChangedGroup.InnerText = ""; } if (!String.IsNullOrEmpty(groupMemberList)) { XGroupMemberList.InnerText = groupMemberList; } else { XGroupMemberList.InnerText = ""; } XParentElement.AppendChild(XTimeStamp); XParentElement.AppendChild(XAuthUser); XParentElement.AppendChild(XAppVersion); XParentElement.AppendChild(XAppFeedback); XParentElement.AppendChild(XChangedGroup); XParentElement.AppendChild(XGroupMemberList); xUsageLog.DocumentElement.AppendChild(XParentElement); xUsageLog.Save(fileName); } catch (Exception ex) { string retMsg = ex.Message; } } // end UpdateLog()