nature_net.user_controls.window_content.submit_text C# (CSharp) Метод

submit_text() публичный Метод

public submit_text ( RoutedEventArgs e ) : void
e System.Windows.RoutedEventArgs
Результат void
        void submit_text(RoutedEventArgs e)
        {
            bool is_design_idea = hide_expander;
            if (is_design_idea)
            {
                Contribution idea = new Contribution();
                idea.date = DateTime.Now;
                idea.location_id = 0;
                idea.note = this.GetActiveTextBox().Text;
                idea.tags = "Design Idea";
                database_manager.InsertDesignIdea(idea, this.comment_user_id);
                int collection_id = configurations.get_or_create_collection(this.comment_user_id, 1, DateTime.Now);
                Collection_Contribution_Mapping map = new Collection_Contribution_Mapping();
                map.collection_id = collection_id;
                map.contribution_id = idea.id;
                map.date = DateTime.Now;
                database_manager.InsertCollectionContributionMapping(map);

                if (the_item.Content != null)
                    ((design_ideas_listbox)the_item.Content).list_all_design_ideas();
                //window_manager.load_design_ideas();
                log.WriteInteractionLog(42, "Idea" + "; Text: " + this.GetActiveTextBox().Text + "; object_type: " + _object_type + "; object_id: " + _object_id.ToString(), ((TouchEventArgs)e).TouchDevice);
                window_manager.close_submit_design_idea_window((window_frame)this.parent, idea.note);
                //if (((design_ideas_listbox)the_item.Content).parent != null)
                //    ((design_ideas_listbox)the_item.Content).parent.list_all_design_ideas();
            }
            else
            {
                Feedback comment = new Feedback();
                comment.date = DateTime.Now;
                comment.note = this.GetActiveTextBox().Text;
                comment.object_id = this._object_id;
                comment.object_type = this._object_type.ToString();
                //if (comments_listbox._list.SelectedIndex == -1)
                //    comment.parent_id = 0;
                //else
                //{
                    //int p_id = (int)((item_generic)comments_listbox._list.Items[comments_listbox._list.SelectedIndex]).Tag;
                if (is_reply)
                    comment.parent_id = reply_id;
                else
                    comment.parent_id = 0;
                //}
                comment.technical_info = "";
                comment.type_id = 1;
                comment.user_id = this.comment_user_id;
                database_manager.InsertFeedback(comment);
                if (is_reply)
                    log.WriteInteractionLog(42, "Comment; Reply id: " + reply_id + "; Text: " + this.GetActiveTextBox().Text + "; object_type: " + _object_type + "; object_id: " + _object_id.ToString(), ((TouchEventArgs)e).TouchDevice);
                else
                    log.WriteInteractionLog(42, "Comment; Text: " + this.GetActiveTextBox().Text + "; object_type: " + _object_type + "; object_id: " + _object_id.ToString(), ((TouchEventArgs)e).TouchDevice);

                if (this.the_item.Content != null)
                {
                    try
                    {
                        item_generic_v2 v2 = (item_generic_v2)this.the_item.Content;
                        v2.number.Text = (Convert.ToInt32(v2.number.Text) + 1).ToString();
                    }
                    catch (Exception) { }
                }
                this.list_all_comments();

                if (this._object_type.ToString() == "nature_net.Contribution")
                    window_manager.load_design_ideas_sync();
            }
            //this.GetActiveTextBox().SelectAll();
            cancel_comment_auth_clicked(null, null);
            GotoDefaultMode();
            comment_textbox_default.Text = "";
            comment_textbox_reply.Text = "";
            CheckTextBoxText();
        }