Ejemplo n.º 1
0
        public async Task <IActionResult> SerialNoCheckTechnicalDocument()
        {
            string serialNo = HttpContext.Request.Query["serialNo"].ToString();
            string userId   = _httpContextAccessor.HttpContext.Request.Cookies["UserId"];
            TechnicalDocumentResponse response = _iTechnicalDocumentService.SerialNoCheckTechnicalDocument(serialNo, userId);

            return(Ok(response));
        }
        public TechnicalDocumentResponse SerialNoCheckTechnicalDocument(string serialNo, string UserId)
        {
            TechnicalDocumentResponse response = new TechnicalDocumentResponse();

            List <sp_SSH_GetSkuBySerial> machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {serialNo}").ToList();

            //var GetPath = context.TblSettingsRepository.Get().Where(q => q.SettingName == "TechnicalDocumentPath").FirstOrDefault();

            if (machineDetail != null && machineDetail.Count > 0)
            {
                bool machineControl = context.TblSshMachinesRepository.Get().Where(a => a.SerialNo == serialNo && a.CreatedBy == Convert.ToInt32(UserId)).Any();


                if (machineControl == true)
                {
                    var skuName = machineDetail[0].Sku;
                    List <sp_SSH_GetTechnicalDocument> documentListesi = _dbContext.sp_SSH_GetTechnicalDocument.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetTechnicalDocument {skuName}").ToList();
                    response.ErrorMessage    = null;
                    response.DocumentListesi = documentListesi;
                    response.MachineDetail   = machineDetail;
                    response.isSuccess       = true;
                    response.isModal         = false;
                    //response.Path = GetPath.SettingValue;
                }
                else
                {
                    response.DocumentListesi = null;
                    response.MachineDetail   = null;
                    response.ErrorMessage    = "Kurulum Yapılmamış!";
                    response.isSuccess       = true;
                    response.isModal         = true;
                    response.Path            = null;
                }
            }
            else
            {
                //response.DocumentListesi = null;
                //response.MachineDetail = null;
                response.isModal      = false;
                response.ErrorMessage = "Seri numarası kontrol ediniz!";
                response.isSuccess    = false;
                response.Path         = null;
            }
            return(response);
        }