コード例 #1
0
        public bool CompanyLogoUpload(AddLogo logo)
        {
            var result      = false;
            var CmpToUpdate = _unitOfWork.CompanyRepository.GetByID(logo.CompanyId);

            CmpToUpdate.CompanyLogo = logo.CompanyLogo;
            using (var scope = new TransactionScope())
            {
                _unitOfWork.CompanyRepository.Update(CmpToUpdate);
                _unitOfWork.Save();
                result = true;
                scope.Complete();
            }
            return(result);
        }
コード例 #2
0
        public HttpResponseMessage UploadLogo()
        {
            try
            {
                if (!Request.Content.IsMimeMultipartContent())
                {
                    throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
                }
                var    CompanyLogo  = HttpContext.Current.Request.Files["CompanyLogo"];
                var    CompanyId    = Convert.ToInt32(HttpContext.Current.Request.Form["CompanyId"]);
                string path         = HttpContext.Current.Server.MapPath("~/UploadedDocuments");
                bool   folderExists = Directory.Exists(path);

                if (!folderExists)
                {
                    Directory.CreateDirectory(path);
                }

                var fileName     = DateTime.Now.Ticks + Path.GetExtension(CompanyLogo.FileName);
                var fileSavePath = Path.Combine(path, fileName);
                CompanyLogo.SaveAs(fileSavePath);
                var cmpData = new AddLogo();

                if (File.Exists(fileSavePath))
                {
                    var cmp          = _companyServices.GetCompanyById(CompanyId);
                    var fileToDelete = Path.Combine(path, cmp.CompanyLogo);
                    File.Delete(fileToDelete);
                    cmpData.CompanyId   = CompanyId;
                    cmpData.CompanyLogo = fileName;
                }
                var result = _companyServices.CompanyLogoUpload(cmpData);
                return(Request.CreateResponse(HttpStatusCode.OK, "success!"));
            }
            catch (Exception ex)
            {
                throw new ApiDataException(1000, "Company Not Found", HttpStatusCode.NotFound);
            }
        }
コード例 #3
0
        void ReleaseDesignerOutlets()
        {
            if (campNameTxtBox != null)
            {
                campNameTxtBox.Dispose();
                campNameTxtBox = null;
            }

            if (colourTxtBox != null)
            {
                colourTxtBox.Dispose();
                colourTxtBox = null;
            }

            if (commentTxtBox != null)
            {
                commentTxtBox.Dispose();
                commentTxtBox = null;
            }

            if (CounterStep != null)
            {
                CounterStep.Dispose();
                CounterStep = null;
            }

            if (counterTxtBox != null)
            {
                counterTxtBox.Dispose();
                counterTxtBox = null;
            }

            if (CountRejectBtn != null)
            {
                CountRejectBtn.Dispose();
                CountRejectBtn = null;
            }

            if (custCodeTxtBox != null)
            {
                custCodeTxtBox.Dispose();
                custCodeTxtBox = null;
            }

            if (errorOutputBox != null)
            {
                errorOutputBox.Dispose();
                errorOutputBox = null;
            }

            if (finishingTxtBox != null)
            {
                finishingTxtBox.Dispose();
                finishingTxtBox = null;
            }

            if (fireworksButton != null)
            {
                fireworksButton.Dispose();
                fireworksButton = null;
            }

            if (heightTxtBox != null)
            {
                heightTxtBox.Dispose();
                heightTxtBox = null;
            }

            if (jobNumTxtBox != null)
            {
                jobNumTxtBox.Dispose();
                jobNumTxtBox = null;
            }

            if (notificationLabel != null)
            {
                notificationLabel.Dispose();
                notificationLabel = null;
            }

            if (origFNTxtBox != null)
            {
                origFNTxtBox.Dispose();
                origFNTxtBox = null;
            }

            if (quantTxtBox != null)
            {
                quantTxtBox.Dispose();
                quantTxtBox = null;
            }

            if (rejectCheck != null)
            {
                rejectCheck.Dispose();
                rejectCheck = null;
            }

            if (resultTxtBox != null)
            {
                resultTxtBox.Dispose();
                resultTxtBox = null;
            }

            if (revVerTxtBox != null)
            {
                revVerTxtBox.Dispose();
                revVerTxtBox = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (showFilePathTxtBox != null)
            {
                showFilePathTxtBox.Dispose();
                showFilePathTxtBox = null;
            }

            if (stockTxtBox != null)
            {
                stockTxtBox.Dispose();
                stockTxtBox = null;
            }

            if (totalPDFsStep != null)
            {
                totalPDFsStep.Dispose();
                totalPDFsStep = null;
            }

            if (totalPDFsTxtBox != null)
            {
                totalPDFsTxtBox.Dispose();
                totalPDFsTxtBox = null;
            }

            if (widthTxtBox != null)
            {
                widthTxtBox.Dispose();
                widthTxtBox = null;
            }

            if (AddLogo != null)
            {
                AddLogo.Dispose();
                AddLogo = null;
            }
        }