Beispiel #1
0
 protected void Button_Submit_Click(object sender, EventArgs e)
 {
     string userID = (string)Session["userID"];
     SentencesData sentences = new SentencesData(MapPath("."));
     string sentenceID = sentences.AddSentence(TextBox_Sentence.Text, DropDownList_Fonts.SelectedItem.Value, userID);
     ActivitiesData activities = new ActivitiesData(MapPath("."));
     activities.AddActivity("makeSentence", sentenceID, userID);
     Response.Redirect("sentence.aspx?id=" + sentenceID);
 }
Beispiel #2
0
 protected void ShowSentence()
 {
     SentencesData sentences = new SentencesData(MapPath("."));
     if ((string)Request.QueryString["new"] == "true")
     {
         Literal_Title.Text = "新しい例文";
         Literal_HeaderTitle.Text = "新しい例文";
         MultiView_Sentence.SetActiveView(View_NewSentence);
         FontsData fonts = new FontsData(MapPath("."));
         foreach (var font in fonts)
         {
             ListItem item = new ListItem();
             item.Value = font["fontID"];
             item.Text = font["fontName"];
             DropDownList_Fonts.Items.Add(item);
         }
     }
     else if (Request.QueryString["id"] != null)
     {
         var sentence = sentences.FindSentenceID((string)Request.QueryString["id"]);
         string titleSentence;
         if (sentence["sentence"].Length > 10)
         {
             titleSentence = sentence["sentence"].Substring(0, 10) + "…";
         }
         else
         {
             titleSentence = sentence["sentence"];
         }
         Literal_Title.Text = sentence["sentence"];
         Literal_HeaderTitle.Text = sentence["sentence"];
         MultiView_Sentence.SetActiveView(View_ShowSentence);
         Literal_OrgSentence.Text = sentence["sentence"];
         Literal_FontedSentence.Text = PageKits.generateFontedContent(sentence["sentence"], sentence["fontID"]);
         Literal_FontedFontName.Text = new FontsData(MapPath(".")).FindFontID(sentence["fontID"])["fontName"];
     }
     else
     {
         Response.Redirect("index.aspx");
         return;
     }
 }
Beispiel #3
0
 protected void ShowActivities(string userID)
 {
     Literal_Activities.Text = "";
     ActivitiesData activities = new ActivitiesData(MapPath("."));
     ImagesData images = new ImagesData(MapPath("."));
     FontsData fonts = new FontsData(MapPath("."));
     UsersData users = new UsersData(MapPath("."));
     var myActivities = activities.FindUserIDs(userID);
     foreach (var activity in myActivities.Reverse())
     {
         string targetUri;
         string targetName;
         string actionName;
         switch (activity["activityType"])
         {
             case "makeImage":
                 targetName = "文字 " + images.FindImageId(activity["objectID"])["imageName"];
                 targetUri = "char.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "editImage":
                 targetName = "文字 " + images.FindImageId(activity["objectID"])["imageName"];
                 targetUri = "char.aspx?id=" + activity["objectID"];
                 actionName = "編集";
                 break;
             case "makeFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "editFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "編集";
                 break;
             case "makeSentence":
                 targetName = "例文";
                 targetUri = "sentence.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "followFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "認知";
                 break;
             case "followUser":
                 targetName = "賢者 " + users.FindUserID(activity["objectID"])["userName"];
                 targetUri = "user.aspx?id=" + activity["objectID"];
                 actionName = "認知";
                 break;
             default:
                 targetName = "UMA";
                 targetUri = "index.aspx";
                 actionName = "UFO";
                 break;
         }
         if (activity["activityType"] == "makeSentence")
         {
             var sentence = new SentencesData(MapPath(".")).FindSentenceID(activity["objectID"]);
             Literal_Activities.Text +=
                 "<a href=\"" + targetUri + "\">" +
                 PageKits.generateFontedContent(sentence["sentence"], sentence["fontID"]) +
                 "</a>";
         }
         Literal_Activities.Text +=
             "<div class=\"activity\">" +
             "<a href=\"" + targetUri + "\">" + targetName + "</a>を" +
             actionName + "しました。" +
             "<span class=\"activityDate\">" + activity["activityDate"] + "</span>" +
             "</div>";
     }
 }
Beispiel #4
0
 protected void ShowActivities()
 {
     ActivitiesData activities = new ActivitiesData(MapPath("."));
     FollowsData follows = new FollowsData(MapPath("."));
     UsersData users = new UsersData(MapPath("."));
     FontsData fonts = new FontsData(MapPath("."));
     ImagesData images = new ImagesData(MapPath("."));
     var myFollowings = follows.FindUserIDs((string)Session["userID"]);
     List<Dictionary<string, string>> shownActivities = new List<Dictionary<string, string>>();
     foreach (var following in myFollowings)
     {
         Dictionary<string, string>[] thisActivities;
         switch (following["targetType"])
         {
             case "font":
                 thisActivities = activities.FindObjectIDs("font", following["objectID"]);
                 break;
             case "user":
                 thisActivities = activities.FindUserIDs(following["objectID"]);
                 break;
             default:
                 thisActivities = new Dictionary<string, string>[0];
                 break;
         }
         foreach (var thisActivity in thisActivities)
         {
             shownActivities.Add(thisActivity);
         }
     }
     Literal_Activities.Text = "";
     foreach (Dictionary<string, string> activity in shownActivities.ToArray().Reverse())
     {
         string targetUri;
         string targetName;
         string actionName;
         switch (activity["activityType"])
         {
             case "makeImage":
                 targetName = "文字 " + images.FindImageId(activity["objectID"])["imageName"];
                 targetUri = "char.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "editImage":
                 targetName = "文字 " + images.FindImageId(activity["objectID"])["imageName"];
                 targetUri = "char.aspx?id=" + activity["objectID"];
                 actionName = "編集";
                 break;
             case "makeFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "editFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "編集";
                 break;
             case "makeSentence":
                 targetName = "例文";
                 targetUri = "sentence.aspx?id=" + activity["objectID"];
                 actionName = "作成";
                 break;
             case "followFont":
                 targetName = "字体 " + fonts.FindFontID(activity["objectID"])["fontName"];
                 targetUri = "font.aspx?id=" + activity["objectID"];
                 actionName = "認知";
                 break;
             case "followUser":
                 targetName = "賢者 " + users.FindUserID(activity["objectID"])["userName"];
                 targetUri = "user.aspx?id=" + activity["objectID"];
                 actionName = "認知";
                 break;
             default:
                 targetName = "UMA";
                 targetUri = "index.aspx";
                 actionName = "UFO";
                 break;
         }
         string userID = activity["userID"];
         string userName = users.FindUserID(userID)["userName"];
         if (activity["activityType"] == "makeSentence")
         {
             var sentence = new SentencesData(MapPath(".")).FindSentenceID(activity["objectID"]);
             Literal_Activities.Text +=
                 "<a href=\"" + targetUri + "\">" +
                 PageKits.generateFontedContent(sentence["sentence"], sentence["fontID"]) +
                 "</a>";
         }
         Literal_Activities.Text +=
             "<div class=\"activity\">" +
             "<a href=\"user.aspx?id=" + userID + "\">" + userName + "さん</a>が" +
             "<a href=\"" + targetUri + "\">" + targetName + "</a>を" +
             actionName + "しました。" +
             "<span class=\"activityDate\">" + activity["activityDate"] + "</span>" +
             "</div>";
     }
 }