using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Xml.Linq;
using System.Diagnostics;
using System.Collections.Specialized;
using System.Configuration;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Configuration;
namespace TownSuiteWebPortals
{
public class GlobalConfig
{
public static string Url
{
get
{
return System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"].ToString();
}
}
public static readonly string DevKey = "zSodcUpzUMSDacpwjGge";
public static readonly string DevName = "Procom Data Services Inc. Web Portals";
public static readonly LibTsDto.ReportType ReportExportType = LibTsDto.ReportType.PDF;
public static bool IsLoggedIn
{
get
{
return UC != null;
}
}
public static LibTsDto.UserCredentials UC
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["Cred"] != null)
{
return (LibTsDto.UserCredentials)context.Session["Cred"];
}
return null;
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["Cred"] = value;
}
}
public LibTsDto.Logins.LoginResponse UserDetailsInst
{
get
{
return UserDetails;
}
}
public static LibTsDto.Logins.LoginResponse UserDetails
{
get
{
var context = System.Web.HttpContext.Current;
if (context.Session["UserDetailsFromLogin"] != null)
{
return (LibTsDto.Logins.LoginResponse)context.Session["UserDetailsFromLogin"];
}
return new LibTsDto.Logins.LoginResponse();
}
set
{
var context = System.Web.HttpContext.Current;
context.Session["UserDetailsFromLogin"] = value;
}
}
public static string UsersEmail
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["UserInfo"] != null)
{
return context.Session["UserInfo"].ToString();
}
else
{
return "";
}
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UserInfo"] = value;
}
}
public static List<string> CustCodes
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return (List<string>)context.Session["CustCodes"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["CustCodes"] = value;
}
}
public static LibTsDto.FinancialAccess.MiscCustAccountInfo MiscCustAccountInfo
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return (LibTsDto.FinancialAccess.MiscCustAccountInfo)context.Session["MiscCustAccountInfo"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["MiscCustAccountInfo"] = value;
}
}
//Property Details
public static List<string> PropertyList
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return (List<string>)context.Session["PropertyList"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["PropertyList"] = value;
}
}
private static string CertSubject { get; set; }
private static string CertIssuer { get; set; }
private static string CertSerialNumber { get; set; }
private static string CertThumbPrint { get; set; }
private static bool EnableSsLValidation { get; set; }
public static bool customXertificateValidation(object sender, System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors error)
{
if (EnableSsLValidation == true)
{
if (CertSubject == cert.Subject & CertIssuer == cert.Issuer & CertSerialNumber == cert.GetSerialNumberString() & CertThumbPrint == cert.GetCertHashString())
{
return true;
}
TownSuiteWebPortals.Trace.LogMessage("Invalid SSL Cert Configuration Detected");
return false;
}
return true;
}
public static string GetUserPassword(string value)
{
try
{
string[] lines = value.Split(new string[] { "[**]" }, StringSplitOptions.None);
return lines[1];
}
catch (Exception ex)
{
TownSuiteWebPortals.Trace.TrapErrors(ex);
return "";
}
}
public static string GetUserKey(string value)
{
try
{
string[] lines = value.Split(new string[] { "[**]" }, StringSplitOptions.None);
return lines[1];
}
catch (Exception ex)
{
TownSuiteWebPortals.Trace.TrapErrors(ex);
return "";
}
}
/// <summary>
/// The Procom Local Application Directory.
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks>This is usually something along the lines of: C:\Users\UserName\AppData\Local\Procom</remarks>
public static string ProcomLocalAppDataDirectory
{
get
{
string procomDir = null;
#if LINUX
procomDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
#else
procomDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
#endif
procomDir = System.IO.Path.Combine(procomDir, "Procom");
return procomDir;
}
}
public static string Key
{
get { return "6468666761736C646B6A686633377279686B66676132383934333879725E252A5955484248566372373674383779756833776876726664777375663332377963265E25534445522A373975"; }
}
public static string UserMainRole
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["UserMainRole"] == null)
{
return "";
}
else
{
return Convert.ToString(context.Session["UserMainRole"]);
}
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UserMainRole"] = value;
}
}
public static string TwoFactorAnswerStatus
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["Answered"] == null)
{
return null;
}
else
{
return Convert.ToString(context.Session["Answered"]);
}
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["Answered"] = value;
}
}
public static string NumberOfVisitsToSecurityPage
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["NumberOfVisitsToSecurityPage"] == null)
{
return null;
}
else
{
return Convert.ToString(context.Session["NumberOfVisitsToSecurityPage"]);
}
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["NumberOfVisitsToSecurityPage"] = value;
}
}
public static string AdminPortalEnabled
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
if (context.Session["AdminPortalEnabled"] == null)
{
return null;
}
else
{
return Convert.ToString(context.Session["AdminPortalEnabled"]);
}
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["AdminPortalEnabled"] = value;
}
}
public static object ComplaintUploadedFiles
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["UploadedFiles"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UploadedFiles"] = value;
}
}
public static object ListComplaintsAttachments
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["ListComplaintsAttachments"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["ListComplaintsAttachments"] = value;
}
}
///' Reports Sessions
public static LibTsDto.ReportInfo UserReport
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
var val = context.Session["UserReport"];
if (val == null)
{
return new LibTsDto.ReportInfo();
}
return (LibTsDto.ReportInfo)val;
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UserReport"] = value;
}
}
public static object UserReport2
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["UserReport2"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UserReport2"] = value;
}
}
public static object UserReport3
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["UserReport3"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["UserReport3"] = value;
}
}
///'''''Webportal Caching Sesstions
public static object CurrentBalanceStatementResponse
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["CurrentBalanceStatementResponse"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["CurrentBalanceStatementResponse"] = value;
}
}
public static object MeterResponseUtilcodeDetail
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["responseUtilcodeDetail"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["responseUtilcodeDetail"] = value;
}
}
public static object MeterChartResponseUtilcodeDetail
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["responseChartUtilcodeDetail"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["responseChartUtilcodeDetail"] = value;
}
}
public static object PeakMeterReadingResponse
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["PeakMeterReadingResponse"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["PeakMeterReadingResponse"] = value;
}
}
public static object ReprintReceiptReportResponse
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["ReprintReceiptReportResponse"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["ReprintReceiptReportResponse"] = value;
}
}
public static object CurrentBalanceStatementReportResponse
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["CurrentBalanceStatementReportResponse"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["CurrentBalanceStatementReportResponse"] = value;
}
}
public static IDbConnection SqliteLogDatabase
{
get
{
string logfile = GlobalConfig.ProcomLocalAppDataDirectory;
logfile = System.IO.Path.Combine(logfile, "WebPortalsLog.sqlite");
var _sqliteFactory = new System.Data.SQLite.SQLiteConnection(string.Format("Data Source={0}; Version=3", logfile));
return _sqliteFactory;
}
}
public static object KanbanUploadedFiles
{
get
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
return context.Session["KanbanCardsUploadedFiles"];
}
set
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Session["KanbanCardsUploadedFiles"] = value;
}
}
}
}
No comments:
Post a Comment