Exemplo n.º 1
0
        public App_Class.ServiceResponse Delete(int id)
        {
            Air_PackageGroupImage result = _ent.Air_PackageGroupImage.Where(u => u.PackageGroupImageId == id).FirstOrDefault();

            try
            {
                AirPackageGroupProvider _p     = new AirPackageGroupProvider();
                string PackageGroupImageFolder = _p.GetPackageGroupImageFolderName(result.PackageGroupId);
                string imageName = result.ImageName;

                _ent.DeleteObject(result);
                _ent.SaveChanges();
                if (!string.IsNullOrEmpty(PackageGroupImageFolder) && !string.IsNullOrEmpty(imageName))
                {
                    AirPackageGroupImageModel _model = new AirPackageGroupImageModel();
                    AppUploader.DeleteFileByName(_model.PackageImageRootPath + "\\" + PackageGroupImageFolder, imageName);
                    AppUploader.DeleteFileByName(_model.PackageImageRootPath + "\\" + PackageGroupImageFolder + "\\Images", imageName);
                    AppUploader.DeleteFileByName(_model.PackageImageRootPath + "\\" + PackageGroupImageFolder + "\\Thumbnail", imageName);
                }
                _response = new ServiceResponse("Successfully deleted!!", MessageType.Success, true, "Delete");
                return(_response);
            }
            catch (SqlException ex)
            {
                _response = new ServiceResponse(ServiceResponsesProvider.SqlExceptionMessage(ex), MessageType.SqlException, false);
            }
            catch (Exception ex)
            {
                _response = new ServiceResponse(ex.Message, MessageType.Exception, false, "Delete");
            }
            return(_response);
        }
Exemplo n.º 2
0
        public AirPackageModel GetPackageGroupNameDdl(AirPackageModel _model)
        {
            AirPackageGroupProvider _apgp = new AirPackageGroupProvider();

            _model.ddlPackageGroupName = new SelectList(_apgp.GetPackageGroupNameList(), "PackageGroupId", "GroupName");
            return(_model);
        }
Exemplo n.º 3
0
        private ServiceResponse ManagePackageFolder(AirPackageGroupImageModel _model)
        {
            if (string.IsNullOrEmpty(_model.PackageGroupImageFolder))
            {
                //   AirPackageProvider _p = new AirPackageProvider();
                //_model.PackageImageFolder = _p.GetPackageImageFolderName(_model.PackageId);

                AirPackageGroupProvider _p = new AirPackageGroupProvider();
                _model.PackageGroupImageFolder = _p.GetPackageGroupImageFolderName(_model.PackageGroupId);
            }
            packageRootFolder = _model.PackageImageRootPath + "\\" + _model.PackageGroupImageFolder;
            if (!AppUploader.IsDirectoryExist(_model.PackageGroupImageFolder, _model.PackageImageRootPath))
            {
                if (!AppUploader.CreateDirectory(_model.PackageGroupImageFolder, _model.PackageImageRootPath))
                {
                    _response = new ServiceResponse("Error Occured while uploading folder/images!!", MessageType.Error, false, "Save");
                    return(_response);
                }
                CreatePackageImageFolder("Images", packageRootFolder);
                CreatePackageThumbnailFolder("Thumbnail", packageRootFolder);
            }

            _response = new ServiceResponse("Error Occured while uploading folder/images!!", MessageType.Success, true, "Save");
            return(_response);
        }