public ActionResult Index() { // ViewBag.Message = "GoocaBoocaへようこそ"; GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); ViewBag.DB = db; return View(db.Researches.ToArray()); }
public ActionResult Compare(string research_id, string uid) { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); var research = db.GetResearch(research_id); if (research == null) return View(); ViewBag.ResearchName = research.ResearchName; if (research.ResearchType != GoocaBoocaDataModels.ResearchType.Compare.ToString()) { return RedirectToAction("Index", new { research_id = research_id, uid = uid }); } var list = GoocaBoocaDataModels.Tool.ConverMuitiRelation(db.CompareResult(research_id, uid, this.Request.UserHostAddress), 0.7); int max = 0; foreach (var item in list) { max = Math.Max(max, item.Item1.Count); } ViewBag.maxLen = max; if (list.Any()) { ViewBag.ItemList = db.GetItemSelectedByAttribute(list.FirstOrDefault().Item1); } else { ViewBag.ItemList = new List<GoocaBoocaDataModels.Item>(); } return View(list); }
public ActionResult GoocaBoocaCategoryArrary(string research_id) { if (Request.IsAjaxRequest()) { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); var research = db.GetResearch(research_id); var list = db.ItemCategories.Where(n => n.Research.ResearchId == research.ResearchId).OrderBy(n => n.ItemCategoryId).Select(n => n.ItemCategoryName).ToArray(); return Json(list); } else { return new EmptyResult(); } }
// // GET: /Result/ public ActionResult Index(string research_id, string uid) { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); var research = db.GetResearch(research_id); if (research.ResearchType == GoocaBoocaDataModels.ResearchType.GoocaBooca.ToString()) { return RedirectToAction("GoocaBooca", new { research_id = research_id, uid = uid }); } if (research.ResearchType == "GoocaBoocaText") { return RedirectToAction("GoocaBooca", new { research_id = research_id, uid = uid }); } if (research.ResearchType == GoocaBoocaDataModels.ResearchType.Compare.ToString()) { return RedirectToAction("Compare", new { research_id = research_id, uid = uid }); } return View(); }
public ActionResult ItemDownload(string id) { if (id != null) { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); int idd; if (int.TryParse(id, out idd)) { var item = db.Items.Where(n => n.ItemId == idd); if (item.Any()) { var image = item.First(); if (image.ImageData != null) { if (image.ImageType == GoocaBoocaDataModels.ImageType.jpeg.ToString() || image.ImageType == "jpg") { return File(item.First().ImageData, "image/jpeg"); } if (image.ImageType == GoocaBoocaDataModels.ImageType.png.ToString()) { return File(item.First().ImageData, "image/png"); } } } } } using (var font = new Font("MS UI Gothic", 16)) using (var brash = new SolidBrush(Color.White)) using (var brash2 = new SolidBrush(Color.Red)) using (Bitmap img = new Bitmap(100, 200)) using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { //ImageオブジェクトのGraphicsオブジェクトを作成する Graphics g = Graphics.FromImage(img); g.FillEllipse(brash2, 0, 0, 200, 400); g.DrawString("NoImage", font, brash, new PointF(5, 5)); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); var array = ms.ToArray(); return File(ms.ToArray(), "image/jpeg", ""); } }
public void TestMethod1() { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); //var result = db.GoocaBoocaResult("cutomo2012", "20", ""); var research = db.GetResearch("cutomo2012"); var user = db.GetUser("20", ""); var result_tmp = db.ItemAnsweres.Where(n => n.Research.ResearchId == research.ResearchId && n.User.UserId == user.UserId).GroupBy(n => new { n.ItemCategory, n.ItemAnswerChoice }).Select(n => new { ItemCategory = n.Key.ItemCategory, ItemAnswerChoice = n.Key.ItemAnswerChoice, Count = n.Count() }).OrderBy(n => n.ItemCategory.ItemCategoryId).ThenBy(n => n.ItemAnswerChoice.ItemAnswerChoiceId); var r = result_tmp.ToArray(); var answerPattern = from choice in db.ItemAnswerChoice.Where(n => n.Research.ResearchId == research.ResearchId) from category in db.ItemCategories.Where(n => n.Research.ResearchId == research.ResearchId) select new { Category = category, Choice = choice }; var r1 = answerPattern.ToArray(); var result2 = from ap in answerPattern join userAnswer in result_tmp on new { ap.Category.ItemCategoryId, ap.Choice.ItemAnswerChoiceId } equals new { userAnswer.ItemCategory.ItemCategoryId, userAnswer.ItemAnswerChoice.ItemAnswerChoiceId } into z from a in z.DefaultIfEmpty() select new { ap.Category, ap.Choice, a.Count }; var r3 = result2.ToArray(); }
public ActionResult GoocaBooca(string research_id, string uid) { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); var research = db.GetResearch(research_id); if (research == null) return View(); ViewBag.ResearchName = research.ResearchName; if (research.ResearchType.Contains("GoocaBooca") == false) { return RedirectToAction("Index", new { research_id = research_id, uid = uid }); } var key = db.ItemAnswerChoice.Where(n => n.Research.ResearchId == research.ResearchId && n.Tag == "Key").FirstOrDefault(); if (key != null) ViewBag.KeyChoice = key.AnswerString; var list = db.GoocaBoocaResult(research_id, uid, this.Request.UserHostAddress); ViewBag.CategoryList = list.GroupBy(n => n.Item1).Select(n => "\"" + n.Key.ItemCategoryName + "\"").Aggregate((n, m) => n + "," + m ); var data = list.GroupBy(n => n.Item1).Select(n => n.Where(m => m.Item2.Tag == "Key").FirstOrDefault().Item3 * 100 / (double)n.Sum(m => m.Item3)); ViewBag.StringData = data.Select(n=>n.ToString()).Aggregate((n,m)=>n+","+m); var vList = db.ItemCategories.Where(n => n.Research.ResearchId == research.ResearchId).OrderBy(n => n.ItemCategoryId).Select(n => n.ItemCategoryName).ToArray().Aggregate((n, m) => n + ",\"" + m + "\""); return View(list); }
public ActionResult ViewQuestionAnswer() { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); return View(db.QuestionAnsweres.ToArray()); }
public ActionResult ViewImages() { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); return View(db.Items.ToArray()); }
public ActionResult ViewAnswerData() { GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase(); return View(db.ItemAnsweres.ToArray()); }
// // GET: /Data/ public ActionResult Index() { GoocaBoocaDataModels.GoocaBoocaDataBase gb = new GoocaBoocaDataModels.GoocaBoocaDataBase(); return View(gb.Researches.Where(n => n.Hidden == false && n.IsActive == true).ToArray()); }
public ActionResult GetResearch() { GoocaBoocaDataModels.GoocaBoocaDataBase gb = new GoocaBoocaDataModels.GoocaBoocaDataBase(); var list = gb.Researches.Where(n => n.IsActive == true && n.Hidden == false).Select(n => n.ResearchIdName).ToArray(); return Json(list,JsonRequestBehavior.AllowGet); }
public void LoadData() { using (GoocaBoocaDataModels.GoocaBoocaDataBase db = new GoocaBoocaDataModels.GoocaBoocaDataBase()) { var research = db.GetResearch("cutomo2012"); GoocaBoocaDataModels.Model.SummarizeData sd = new GoocaBoocaDataModels.Model.SummarizeData(db); datalist = new List<GoocaBoocaDataModels.Model.GoocaBoocaAnswerData>(sd.CreateGoocaBoocaAnswerData("cutomo2012")); categoryList = db.ItemCategories.Where(n => n.Research.ResearchId == research.ResearchId).OrderBy(n => n.ItemCategoryId).ToList(); } }