public void AddComment(HttpListenerContext context) { try { var data = GetRequestPostData(context.Request); var session = ValidateSession(data); if (!data.AllKeys.Contains("ticketId")) { throw new InputException("ticketId"); } int ticketId = Convert.ToInt32(data["ticketId"]); var ticket = ticketData.GetTicket(session, ticketId); if (ticket == null || !ticket.Permissions.CanComment) { ticketData.LogEvent(session, ticketId, TICKET_EVENT.SECURITY_PREVENTED, null); throw new RequestException("Not authorized to comment on ticket"); } if (!data.AllKeys.Contains("comment")) { throw new InputException("comment"); } string comment = data["comment"]; if (!data.AllKeys.Contains("type")) { throw new InputException("type"); } COMMENT_TYPE type = (COMMENT_TYPE)Convert.ToInt32(data["type"]); if (type == COMMENT_TYPE.INTERNAL && !ticket.Permissions.CanViewInternalComments) { ticketData.LogEvent(session, ticketId, TICKET_EVENT.SECURITY_PREVENTED, null); throw new RequestException("Not authorized to comment internally on ticket"); } commentData.AddComment(session, ticketId, ticketData, comment, comment, type, COMMENT_SOURCE.Web); //TODO: Send email //TODO: If created by SMS AND public, send SMS if (data.AllKeys.Contains("subtask_assigned") && data["subtask_assigned"] != "nulL") { int subtaskUserId = Convert.ToInt32(data["subtask_assigned"]); //TODO: Create new subtask } SendTextResponse(context, "1"); } catch (RequestException e) { SendUnexpectedError(context, e.Reason); } catch (InputException e) { SendMissingParameter(context, e.Reason); } }
/// <summary> /// コンストラクタ /// </summary> public Speach( string text // セリフのテキストデータ ) { // セリフのテキストデータ this.text = text; // 発声者タイプの読み込み this.speakerType = (SPEAKER_TYPE)ReadType(typeof(SPEAKER_TYPE)); // コメントタイプの設定 switch (this.speakerType) { case SPEAKER_TYPE.SYSTEM: this.commentType = COMMENT_TYPE.SYSTEM_MESSAYGE; break; default: this.commentType = COMMENT_TYPE.CHARA_SPEACH; break; } // 発声者名の設定 switch (this.speakerType) { case SPEAKER_TYPE.PLAYER: this.speakerName = "プレイヤー"; break; case SPEAKER_TYPE.COMMANDER: this.speakerName = "指令キャラ"; break; case SPEAKER_TYPE.ENEMY: this.speakerName = "敵"; break; default: this.speakerName = ""; break; } // イベント番号の読み込み this.iventNumber = ReadNumber(); // 寿命の設定 // // キャラのセリフは数秒で自動消滅、システムメッセージは無制限。 // if ( (int)SPEAKER_TYPE.SYSTEM > (int)this.speakerType ) this.lifeTime = 2.0f; // else this.lifeTime = -1; this.lifeTime = -1; triggerFlg = false; isFinished = false; differentialTimeCounter = 0; }
public void AddComment(Session session, int ticketId, TicketData ticketData, string sourceHTML, string sourceText, COMMENT_TYPE type, COMMENT_SOURCE source) { Insert(AddCommentQuery, Config.Get("mysql_db"), ticketId, session.AccountId, session.UserId, E(sourceHTML), E(sourceText), (int)source, (int)type); switch (type) { case COMMENT_TYPE.INTERNAL: ticketData.LogEvent(session, ticketId, TICKET_EVENT.COMMENTED_INTERNAL, ""); break; case COMMENT_TYPE.PUBLIC: ticketData.LogEvent(session, ticketId, TICKET_EVENT.COMMENTED_EXTERNAL, ""); break; } }
private void FillDgv(DataGridView dgv, COMMENT_TYPE comment_type) { dgv.Rows.Clear(); dgv.Columns.Clear(); dgv.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "โดย", Width = 50, SortMode = DataGridViewColumnSortMode.NotSortable, }); dgv.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "รายละเอียด", AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, SortMode = DataGridViewColumnSortMode.NotSortable, }); foreach (DataGridViewColumn col in dgv.Columns) { col.HeaderCell.Style.BackColor = (comment_type == COMMENT_TYPE.COMMENT ? this.color_light_blue : this.color_light_red); col.HeaderCell.Style.SelectionBackColor = (comment_type == COMMENT_TYPE.COMMENT ? this.color_light_blue : this.color_light_red); } foreach (SupportNoteComment n in this.parent_wind.supportnotecomment_list.FindAll(t => t.note_id == this.note_id && t.type == (int)comment_type)) { int r = dgv.Rows.Add(); dgv.Rows[r].Tag = n; dgv.Rows[r].Cells[0].ValueType = typeof(string); dgv.Rows[r].Cells[0].Value = n.rec_by; dgv.Rows[r].Cells[1].ValueType = typeof(string); dgv.Rows[r].Cells[1].Value = n.description; } dgv.DrawDgvRowBorder(); }
private void ShowInlineForm(COMMENT_TYPE comment_type, FORM_MODE mode) { this.curr_comment_type = comment_type; DataGridView dgv = null; switch (comment_type) { case COMMENT_TYPE.COMMENT: dgv = this.dgvComment; this.inline_comment_desc = new CustomTextBox() { Read_Only = false }; dgv.Parent.Controls.Add(this.inline_comment_desc); break; case COMMENT_TYPE.COMPLAIN: dgv = this.dgvComplain; this.inline_comment_desc = new CustomTextBox() { Read_Only = false }; dgv.Parent.Controls.Add(this.inline_comment_desc); break; case COMMENT_TYPE.NONE: break; default: break; } if (dgv != null && mode == FORM_MODE.ADD) { dgv.Rows[dgv.Rows.Add()].Cells[0].Selected = true; this.prepared_comment = new SupportNoteComment(); this.prepared_comment.id = -1; this.prepared_comment.type = (int)comment_type; this.prepared_comment.note_id = this.note_id; this.prepared_comment.rec_by = this.parent_wind.main_form.G.loged_in_user_name; this.FormAdd(); } if (dgv != null && mode == FORM_MODE.EDIT && dgv.Rows[dgv.CurrentCell.RowIndex].Tag is SupportNoteComment) { this.prepared_comment = (SupportNoteComment)dgv.Rows[dgv.CurrentCell.RowIndex].Tag; this.prepared_comment.rec_by = this.parent_wind.main_form.G.loged_in_user_name; this.inline_comment_desc.Texts = this.prepared_comment.description; this.FormEdit(); } this.SetInlineFormPosition(dgv); dgv.Enabled = false; dgv.SendToBack(); this.inline_comment_desc.BringToFront(); this.inline_comment_desc.Focus(); this.inline_comment_desc.SelectionStart = 0; this.inline_comment_desc.SelectionLength = 0; dgv.Tag = HelperClass.DGV_TAG.READ; dgv.Refresh(); }