public static WarrantyResultModel GetAssetHeader(string ServiceTag)
        {
            if (!String.IsNullOrEmpty(ServiceTag))
            {
                String URL        = String.Format("getassetwarranty/{0}?apikey=1b31b0bf-980d-49eb-b77b-2c135ceb6974", ServiceTag);
                string jsonResult = GetAsync(URL).Result;
                if (!String.IsNullOrEmpty(jsonResult))
                {
                    AssetWarrantyResponseModel assetWarrantyResponseModel = ConvertJsonToAssetWarrantyResponse(jsonResult);
                    if (assetWarrantyResponseModel.AssetHeader != null)
                    {
                        WarrantyResultModel        warrantyResultModel = new WarrantyResultModel();
                        WarrantyDetailModel        warrantyDetailModel = new WarrantyDetailModel();
                        List <WarrantyDetailModel> warrantyDetailList  = new List <WarrantyDetailModel>();
                        warrantyResultModel.ServiceTag = assetWarrantyResponseModel.AssetHeader.ServiceTag;
                        warrantyResultModel.Country    = assetWarrantyResponseModel.AssetHeader.CountryLookupCode;
                        warrantyResultModel.ShipDate   = assetWarrantyResponseModel.AssetHeader.ShipDate;
                        if (assetWarrantyResponseModel.AssetEntitlement != null)
                        {
                            foreach (var item in assetWarrantyResponseModel.AssetEntitlement)
                            {
                                warrantyDetailModel                  = new WarrantyDetailModel();
                                warrantyDetailModel.Service          = (item.ServiceLevelCode + " (" + item.ServiceLevelDescription + ")");
                                warrantyDetailModel.ServiceLevelCode = item.ServiceLevelCode;
                                warrantyDetailModel.EntitlementType  = item.EntitlementType;
                                warrantyDetailModel.StartDate        = item.StartDate;
                                warrantyDetailModel.ExpirationDate   = item.EndDate;
                                warrantyDetailList.Add(warrantyDetailModel);
                            }
                            //Xử lý danh sách warrantyDetail
                            var WarrantyDetailResult = GroupWarrantyDetail(warrantyDetailList);
                            warrantyResultModel.WarrantyDetails = WarrantyDetailResult.OrderBy(x => x.ExpirationDate).OrderBy(x => x.Priority).ToList();
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("Thông tin bảo hành của máy có Service tag " + warrantyResultModel.ServiceTag + ":" + "<br/><br/>");
                            sb.AppendLine("- Model: " + assetWarrantyResponseModel.AssetHeader.MachineDescription + "<br/>");
                            sb.AppendLine("- Ngày ship: " + assetWarrantyResponseModel.AssetHeader.ShipDate.ToString("dd/MM/yyyy") + "<br/>");
                            sb.AppendLine("- Quốc gia: " + assetWarrantyResponseModel.AssetHeader.CountryLookupCode + "<br/>");
                            sb.AppendLine("- Ngày hết hạn BH (" + warrantyResultModel.WarrantyDetails[0].ServiceLevelCode + "): " + warrantyResultModel.WarrantyDetails[0].ExpirationDate.ToString("dd/MM/yyyy") + "<br/>");

                            //sb.AppendLine("Service Tag: " + warrantyResultModel.ServiceTag + "<br/>");
                            //sb.AppendLine("Thời hạn bảo hành: " + warrantyResultModel.WarrantyDetails[0].ExpirationDate.ToString("dd MMM yyyy") + "<br/>");
                            //sb.AppendLine("Thông tin chi tiết: <br/>");
                            //foreach (var obj in warrantyResultModel.WarrantyDetails)
                            //{
                            //    sb.AppendLine(obj.Service + "<br/>");
                            //    sb.AppendLine("Sta: "+obj.StartDate.ToString("dd MMM yyyy") + " ,Exp: "+obj.ExpirationDate.ToString("dd MMM yyyy")+"<br/>");
                            //}

                            warrantyResultModel.TextWarranty = sb.ToString();
                            return(warrantyResultModel);
                        }
                    }
                }
            }
            return(null);
        }
        //Gộp danh sách WarrantyDetail
        private static List <WarrantyDetailModel> GroupWarrantyDetail(List <WarrantyDetailModel> inputList)
        {
            List <WarrantyDetailModel> warrantyDetailsResult = new List <WarrantyDetailModel>();
            List <WarrantyDetailModel> warrantyDetailTemp    = new List <WarrantyDetailModel>();
            WarrantyDetailModel        inputModel            = new WarrantyDetailModel();

            var ServicesList = GetServicesType(inputList);

            foreach (var item in ServicesList)
            {
                int priorityDefault = 10;
                foreach (var itemPrioritize in ServicePrioritize)
                {
                    if (item.Contains(itemPrioritize.Key))
                    {
                        priorityDefault = itemPrioritize.Value;
                    }
                }
                warrantyDetailTemp = inputList.Where(x => x.Service == item).ToList();
                DateTime _beginDate      = DateTime.Now;
                DateTime _expirationDate = DateTime.Now;
                GetBeginAndExpirationDate(warrantyDetailTemp, out _beginDate, out _expirationDate);
                inputModel = new WarrantyDetailModel
                {
                    Service          = item,
                    ServiceLevelCode = warrantyDetailTemp[0].ServiceLevelCode,
                    EntitlementType  = "",
                    StartDate        = _beginDate,
                    ExpirationDate   = _expirationDate,
                    Priority         = priorityDefault
                };
                if (item.Contains("(Dell Digitial Delivery)") == false)
                {
                    warrantyDetailsResult.Add(inputModel);
                }
            }
            return(warrantyDetailsResult);
        }