Exemple #1
0
        public IActionResult AddCallCenter(CallCenterView request)
        {
            request.UserId = _httpContextAccessor.HttpContext.Request.Cookies["UserId"];
            var response = _iCallCenterService.AddCallCenter(request);

            return(Ok(response));
        }
        public TblSshMachineryServicesResponse AddCallCenter(CallCenterView view)
        {
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();
            string userId = view.UserId;

            TblSshMachineryServices machinery = new TblSshMachineryServices();
            var machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {view.SerialNo}").ToList();

            if (machineDetail.Count > 0)
            {
                view.SkuCode     = machineDetail[0].Sku;
                view.TracingName = Convert.ToString(machineDetail[0].SkuId);
            }


            machinery.SkuCode               = view.SkuCode;
            machinery.TracingName           = view.TracingName;
            machinery.SerialNo              = view.SerialNo;
            machinery.CallCenterComment     = view.CallCenterComment;
            machinery.CompressorInformation = view.CompressorInformation;
            machinery.RelatedPersonName     = view.RelatedPersonName;
            machinery.CompanyName           = view.CompanyName;
            machinery.RelatedPersonLastName = view.RelatedPersonLastName;
            machinery.RelatedPersonEmail    = view.RelatedPersonEmail;
            machinery.RelatedPersonPhone    = view.RelatedPersonPhone;
            machinery.ReadFlags             = false;
            machinery.IsApproved            = false;
            machinery.IsRejected            = false;
            machinery.CreatedBy             = Convert.ToInt32(userId);
            machinery.CreatedDate           = DateTime.Now;
            machinery.ServiceTypeId         = 4;
            machinery.FileNames             = view.FileNames;


            bool kaydedildiMi = context.TblSshMachineryServicesRepository.Insert(machinery);

            context.Save();
            if (kaydedildiMi == false)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Hata oluştu!! Lütfen tekrar deneyiniz..";
                return(response);
            }
            else
            {
                response.isSuccess    = true;
                response.ErrorMessage = "";
                return(response);
            }
        }
Exemple #3
0
        public TblSshMachineryServicesResponse AddCallCenter(CallCenterView view)
        {
            string fileName       = "";
            string uniqueFileName = null;

            if (view.files != null && view.files.Count > 0)
            {
                foreach (IFormFile photo in view.files)
                {
                    string[] paths         = { @"C:\", "Files", "ACS", "Services" };
                    string   uploadsFolder = Path.Combine(paths);
                    uniqueFileName = Guid.NewGuid().ToString() + "_" + photo.FileName;
                    if (photo.ContentType == "image/jpeg")
                    {
                        Image image      = Image.FromStream(photo.OpenReadStream(), true, true);
                        int   origWidth  = image.Width;
                        int   origHeight = image.Height;
                        int   sngRatio   = origWidth / origHeight;

                        int bannerWidth  = origWidth / 2;
                        int bannerHeight = origHeight / 2;


                        if (image.Width > 1024)
                        {
                            Bitmap   bannerBMP = new Bitmap(image, bannerWidth, bannerHeight);
                            Graphics oGraphics = Graphics.FromImage(bannerBMP);

                            oGraphics = Graphics.FromImage(bannerBMP);
                            // Set the properties for the new graphic file
                            oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

                            // Draw the new graphic based on the resized bitmap
                            oGraphics.DrawImage(image, 0, 0, bannerWidth, bannerHeight);
                            // Save the new graphic file to the server
                            bannerBMP.Save(uploadsFolder + "/" + uniqueFileName);

                            bannerBMP.Dispose();
                            oGraphics.Dispose();
                        }
                        else
                        {
                            image.Save(uploadsFolder + "/" + uniqueFileName);
                        }
                    }
                    else
                    {
                        string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                        photo.CopyTo(new FileStream(filePath, FileMode.Create));
                    }


                    if (view.files.IndexOf(photo) == view.files.Count - 1)
                    {
                        fileName += uniqueFileName;
                    }
                    else
                    {
                        fileName += uniqueFileName + "||";
                    }
                }
            }

            view.files     = null;
            view.FileNames = fileName;

            var request = new RestRequest("api/CallCenter/AddCallCenter/", Method.POST, DataFormat.Json)
                          .AddJsonBody(view);

            var resp = Globals.ApiClient.Execute <TblSshMachineryServicesResponse>(request);

            return(resp.Data);
        }
        public IActionResult AddCallCenter(CallCenterView view)
        {
            var response = _callCenter.AddCallCenter(view);

            return(Ok(response));
        }