111 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			111 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using DocumentFormat.OpenXml.Wordprocessing;
 | |
| using Foresight.Fleet.Services.Asset;
 | |
| using Foresight.Fleet.Services.Customer;
 | |
| using IronIntel.Contractor;
 | |
| using IronIntel.Contractor.Machines;
 | |
| using IronIntel.Contractor.MapView;
 | |
| using IronIntel.Contractor.Site;
 | |
| using Newtonsoft.Json;
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Web;
 | |
| using System.Web.UI;
 | |
| using System.Web.UI.WebControls;
 | |
| 
 | |
| public partial class AssetLocationHis : ContractorBasePage
 | |
| {
 | |
|     public string LocationHistoryDateFrom = DateTime.Now.Date.AddMonths(-2).ToShortDateString();
 | |
|     public string LocationHistoryDateTo = DateTime.Now.Date.ToShortDateString();
 | |
| 
 | |
|     private string Logo1html = "<img class=\"logo\" src=\"{0}\" style=\"width:24px;height:24px; \" />";
 | |
|     protected string Logo1 = "";
 | |
|     public string CurrentDate = "";
 | |
|     protected void Page_Load(object sender, EventArgs e)
 | |
|     {
 | |
|         string tp = Request.Params["tp"];
 | |
|         if (string.Compare(tp, "ashx", true) == 0)
 | |
|         {
 | |
|             ProcessRequest();
 | |
|         }
 | |
|         else if (!IsPostBack)
 | |
|         {
 | |
|             Title = PageTitle;
 | |
|             if (CheckLoginSession())
 | |
|             {
 | |
|                 var cmp = SystemParams.GetCompanyInfo();
 | |
|                 GetLogoHtml(cmp);
 | |
|             }
 | |
|         }
 | |
|         DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
 | |
|         CurrentDate = userlocaldate.ToShortDateString();
 | |
|     }
 | |
| 
 | |
|     private void GetLogoHtml(CustomerInfo cmp)
 | |
|     {
 | |
|         var root = ResolveUrl("~/");
 | |
|         if (cmp.IsContractor)
 | |
|         {//Logo1 Dealer;
 | |
|             CustomerInfo dealer = SystemParams.GetFirstDealerInfo();
 | |
|             if (dealer != null)
 | |
|             {
 | |
|                 if (SystemParams.HasLOGO(dealer.ID))//Dealer
 | |
|                 {
 | |
|                     Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?tp=dealer&cmpid=" + dealer.ID);
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     Logo1 = string.Format("<div class=\"logo\">{0}</div>", dealer.Name);
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 Logo1 = string.Empty;
 | |
|             }
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             if (SystemParams.HasLOGO(cmp.ID))//Dealer
 | |
|             {
 | |
|                 Logo1 = string.Format(Logo1html, root + "titlelogo.ashx?tp=dealer&cmpid=" + cmp.ID);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 Logo1 = string.Format("<div class=\"logo\">{0}</div>", cmp.Name);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     protected void ProcessRequest()
 | |
|     {
 | |
|         object result = null;
 | |
| 
 | |
|         string methodName = Request.Form["MethodName"];
 | |
|         try
 | |
|         {
 | |
|             if (methodName != null)
 | |
|             {
 | |
|             }
 | |
|         }
 | |
|         catch (System.Threading.ThreadAbortException)
 | |
|         {
 | |
|             throw;
 | |
|         }
 | |
|         catch (Exception ex)
 | |
|         {
 | |
|             SystemParams.WriteLog("error", "MapViewChart." + methodName, ex.Message, ex.ToString());
 | |
|         }
 | |
|         string json = JsonConvert.SerializeObject(result);
 | |
|         Response.Write(json);
 | |
|         Response.End();
 | |
|     }
 | |
| 
 | |
|     public bool EnableSmartWitness
 | |
|     {
 | |
|         get
 | |
|         {
 | |
|             bool lic = SystemParams.HasLicense("SmartWitness");
 | |
|             return lic;
 | |
|         }
 | |
|     }
 | |
| } |