using Foresight.Fleet.Services.AssetHealth;
using IronIntel.Contractor.FilterQ;
using IronIntel.Contractor.Maintenance;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronIntel.Contractor.Site
{
    public class PrintBasePage : ContractorBasePage
    {
        protected string ProcessRequest()
        {
            int printType = -1;
            string pt = Request.Params["pt"];
            if (!int.TryParse(pt, out printType))
                return "";

            string result = "";
            switch (printType)
            {
                case (int)PrintType.WorkOrder:
                    result = PrintWorkOrder();
                    break;
            }

            return result;
        }

        private string PrintWorkOrder()
        {
            string woidstr = Request.Params["wo"];
            long woid = -1;
            if (!long.TryParse(woidstr, out woid) || woid <= 0)
                return "";

            return WorkOrderManager.GenerateWorkOrderPrintHtml(GetCurrentLoginSession().SessionID, SystemParams.CompanyID, woid);
        }

        protected enum PrintType
        {
            WorkOrder = 1
        }
    }
}
