示例#1
0
 public UBFeedbackResult(string formID, FeedbackResult res, bool isRedirectEnabled)
 {
     _isFormSucceeded          = (_isRedirectToStoreEnabled == null) ? false : true;
     _formId                   = formID;
     _result                   = new UBFeedback(res);
     _isRedirectToStoreEnabled = isRedirectEnabled;
 }
示例#2
0
 public override void OnReceive(Context context, Intent intent)
 {
     if (intent != null)
     {
         FeedbackResult parcelable = (FeedbackResult)intent.GetParcelableExtra(FeedbackResult.IntentFeedbackResult);
         var            aResponse  = new UBFeedbackResult(parcelable);
         UsabillaXamarin.Instance.FormCallback(aResponse);
     }
     activity.Finish();
 }
示例#3
0
        // GET: Businesses
        public async Task <ActionResult> FeedbackAnalysis(int businessId)
        {
            List <Feedback> unAnalyzedFeedback     = db.FeedBacks.Include(a => a.Business).Where(r => r.Business.Username == User.Identity.Name && r.SentimentScore == null && r.BusinessId == businessId).ToList();
            List <int>      oldAnalyzedFeedbackIds = db.FeedBacks.Include(a => a.Business).Where(r => r.Business.Username == User.Identity.Name && r.SentimentScore != null && r.BusinessId == businessId).Select(u => u.FeedbackId).ToList();

            unAnalyzedFeedback.RemoveAll(b => oldAnalyzedFeedbackIds.Contains(b.FeedbackId));
            if (unAnalyzedFeedback.Count > 0)
            {
                await Helper.MakeRequest(db, unAnalyzedFeedback);
            }

            List <Feedback> analyzedFeedback = db.FeedBacks.Include(a => a.Business).Where(r => r.Business.Username == User.Identity.Name && r.SentimentScore != null && r.BusinessId == businessId).ToList();

            FeedbackResult result = new FeedbackResult();

            result.PositiveSentiments = analyzedFeedback.Where(m => m.SentimentScore >= 0.6m).ToList();
            result.NegativeSentiments = analyzedFeedback.Where(m => m.SentimentScore <= 0.4m).ToList();
            result.NeutralSentiments  = analyzedFeedback.Where(m => m.SentimentScore <0.6m && m.SentimentScore> 0.4m).ToList();
            return(View(result));
        }
示例#4
0
 public UBFeedback(FeedbackResult res)
 {
     result = res;
 }
示例#5
0
 public UBFeedbackResult(FeedbackResult res)
 {
     _isFormSucceeded = true;
     _result          = new UBFeedback(res);
 }
示例#6
0
        private bool preProcessFile(string outputDirectory, SevenZipArchiveFile file)
        {
            string fullPath = Path.Combine(outputDirectory, PreserveDirectoryStructure ? file.Name : Path.GetFileName(file.Name));

            if (file.IsDeleted)
            {
                if (AllowFileDeletions && File.Exists(fullPath))
                {
                    //Trace.TraceInformation($"Deleting file \"{file.Name}\"");
                    File.Delete(fullPath);
                }
            }
            else if (file.IsDirectory)
            {
                if (!PreserveDirectoryStructure)
                {
                    //Trace.TraceWarning($"Directory `{file.Name}` ignored, PreserveDirectoryStructure is disabled.");
                }
                else if (!Directory.Exists(fullPath))
                {
                    //Trace.TraceInformation($"Create directory \"{file.Name}\"");
                    Directory.CreateDirectory(fullPath);
                    if (file.Time != null)
                    {
                        Directory.SetLastWriteTimeUtc(fullPath, (DateTime)file.Time);
                    }
                }
            }
            else
            {
                FeedbackResult result = FeedbackResult.Yes;
                if (File.Exists(fullPath))
                {
                    if (OverwriteExistingFiles)
                    {
                        if (OverwriteDelegate != null)
                        {
                            result = OverwriteDelegate(new[] { file });
                            if (result == FeedbackResult.Cancel)
                            {
                                throw new OperationCanceledException("User feedback cancelled extraction.");
                            }
                        }
                    }
                    else
                    {
                        if (!SkipExistingFiles)
                        {
                            throw new SevenZipFileAlreadyExistsException(file);
                        }
                        result = FeedbackResult.No;
                    }
                }
                if (result == FeedbackResult.Yes)
                {
                    // make sure path exists
                    if (!string.IsNullOrEmpty(Path.GetDirectoryName(file.Name)))
                    {
                        if (!Directory.Exists(Path.GetDirectoryName(fullPath)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(fullPath));
                        }
                    }

                    // if file is not empty, it will need extraction
                    if (!file.IsEmpty)
                    {
                        //Trace.TraceInformation($"File included for extraction: {file.Name}, file size: {file.Size}");
                        return(false);
                    }

                    // create empty file right away
                    //Trace.TraceInformation($"Creating empty file \"{file.Name}\"");
                    File.WriteAllBytes(fullPath, new byte[0]);
                    if (file.Time != null)
                    {
                        File.SetLastWriteTimeUtc(fullPath, (DateTime)file.Time);
                    }
                }
                //else
                // skipping file, so leave it as "processed" to avoid useless decoding
                //Trace.TraceWarning($"File `{file.Name}` already exists. Skipping.");
            }

            // it's been "processed", no further processing necessary
            return(true);
        }