public string GetPassword(string department) { IDictionary <string, Tuple <string, string> > userCredentials = GetUserCredentials(); if (userCredentials.ContainsKey(department)) { string password = userCredentials[department].Item2; if (password.Length > 0) { password = CredentialsManager.DecryptText(password); } return(password); } return(""); }
/// <summary> /// <para>Get the configuration of the server by printer name.</para> /// <para> /// Note: If the information of the server is not found, /// the function will return null. /// </para> /// </summary> /// <param name="printerName">The name of the printer, eg: lj_cl_112a </param> /// <returns> /// A array of size 3 containing the information of the server /// </returns> public string[] GetServerConfig(string printerName) { IDictionary <string, string> DepartmentPrinterMap = GetDepartmentMap(); IDictionary <string, string[]> ServerInfo = GetServerInfo(); if (DepartmentPrinterMap != null && ServerInfo != null && DepartmentPrinterMap.ContainsKey(printerName)) { string department = DepartmentPrinterMap[printerName]; if (ServerInfo.ContainsKey(department)) { string[] ret = new string[NUMBER_OF_INFO_FIELDS]; ServerInfo.TryGetValue(department, out ret); ret[2] = CredentialsManager.DecryptText(ret[2]); return(ret); } } return(null); }