using FI.FIC; using Foresight.Fleet.Services.Customer; using Foresight.Fleet.Services.Styles; using Foresight.ServiceModel; using IronIntel.Contractor; using IronIntel.Contractor.iisitebase; using IronIntel.Contractor.Site; using IronIntel.Contractor.Users; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class IronIntelMasterPage : CommonBase { protected string CompanyTitle; private string Logo1html = ""; private string Logo2html = ""; private string Logo3html = ""; protected string Logo1 = ""; protected string Logo2 = ""; protected string Logo3 = ""; protected string JQueryVersion; protected string MenuBackgroundColor = "#D7690E"; protected string TitleBarBorderColor = "#FFFFFF"; protected string CompanyID; protected string UserID; protected bool IsReadonlyUser; protected bool CanSeeUserMessage; protected override bool ExportModule { get { return true; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { var cmp = SystemParams.GetCompanyInfo(); CompanyTitle = cmp.Name; GetLogoHtml(cmp); GetUIStyle(); GetMainStyle(); } catch { // TODO: errors when get the company name. } if (this.Page is IronIntel.Contractor.Site.ContractorBasePage) { JQueryVersion = ((IronIntel.Contractor.Site.ContractorBasePage)this.Page).JQueryVersion; } } } private void GetLogoHtml(CustomerInfo cmp) { var root = ResolveUrl("~/"); var sessionid = IronIntelBasePage.GetLoginSessionID(Request); StringKeyValue kv = UserManagement.GetSiteHederStyleLogo(sessionid); string styleid = "-1"; bool hasContractorLogo = false; bool hasDealerLogo = false; if (kv != null) { styleid = kv.Key; hasContractorLogo = Helper.IsTrue(kv.Tag1); hasDealerLogo = Helper.IsTrue(kv.Tag2); } if (cmp.IsContractor) {//Logo1 Dealer;Logo2 Contractor(Self);Logo3 IronIntel CustomerInfo dealer = SystemParams.GetFirstDealerInfo(); if (dealer != null) { if (hasDealerLogo)//user Dealer { Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?cmpid=" + dealer.ID + "&cmpty=dealer&styid=" + styleid); } else if (SystemParams.HasLOGO(dealer.ID))//Dealer { Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?cmpid=" + dealer.ID); } else { Logo1 = string.Format("
{0}
", dealer.Name); } } else { Logo1 = string.Empty; } if (hasContractorLogo)//User Contractor { Logo2 = string.Format(Logo2html, root + "titlelogo.ashx?cmpid=" + cmp.ID + "&cmpty=contractor&styid=" + styleid); } else if (SystemParams.HasLOGO(cmp.ID))//Contractor { Logo2 = string.Format(Logo2html, root + "titlelogo.ashx?cmpid=" + cmp.ID); } else { Logo2 = string.Format("{0}", cmp.Name); } if (SystemParams.ShowForesightLogo()) Logo3 = string.Format(Logo3html, root + "titlelogo.ashx?cmpid=foresight"); } else {//Logo1 Dealer(Self);Logo3 IronIntel if (hasDealerLogo)//user Dealer { Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?cmpid=" + cmp.ID + "&cmpty=dealer&styid=" + styleid); } else if (SystemParams.HasLOGO(cmp.ID))//Dealer { Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?cmpid=" + cmp.ID); } else { Logo1 = string.Format("
{0}
", cmp.Name); } Logo2 = ""; if (SystemParams.ShowForesightLogo()) Logo3 = string.Format(Logo3html, root + "titlelogo.ashx?cmpid=foresight"); } } protected override StyleInfo GetUIStyle() { var info = base.GetUIStyle(); var user = info.User; if (user != null) { UserID = user.ID; IsReadonlyUser = user.UserType == UserTypes.Readonly; CanSeeUserMessage = user.UserType == UserTypes.Common || user.UserType == UserTypes.Admin; var style = info.Style; if (style != null) { if (!string.IsNullOrEmpty(style.MenuBackgroundColor)) {//目前Menu和Module背景色使用同一个颜色,在有设置的情况下 MenuBackgroundColor = style.MenuBackgroundColor; } } } CompanyID = SystemParams.CompanyID; return info; } private void GetMainStyle() { var ms = SystemParams.GetMainStyle(); if (ms != null && !string.IsNullOrEmpty(ms.TitleBarBorderColor)) { TitleBarBorderColor = ms.TitleBarBorderColor; } } }