Example #1
0
        private List<Note> JustConvertToNoteList()
        {
            List<SupportNote> support_note = this.supportnote_list.ConvertAll<SupportNote>(t => t).ToList<SupportNote>();
            List<Note> note_list = new List<Note>();

            int count = 0;
            foreach (SupportNote snote in support_note)
            {
                Note note = new Note();
                note.supportnote = snote;
                note.id = snote.id;
                note.is_break = snote.is_break;
                count += (snote.is_break != "Y" ? 1 : 0);
                note.seq = (snote.is_break != "Y" ? count.ToString() : "");
                note.users_name = snote.users_name;
                note.date = snote.date.M2WDate();
                note.start_time = snote.start_time;
                note.end_time = snote.end_time;
                note.duration = snote.duration;
                note.sernum = snote.sernum;
                note.contact = (snote.is_break != "Y" ? snote.contact : this.GetReason(snote.reason));
                note.remark = snote.remark;

                note.map_drive = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.MAP_DRIVE.FormatNoteProblem()) ? "\u2713" : "");
                note.install = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.INSTALL_UPDATE.FormatNoteProblem()) ? "\u2713" : "");
                note.error = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.ERROR.FormatNoteProblem()) ? "\u2713" : "");
                note.fonts = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.FONTS.FormatNoteProblem()) ? "\u2713" : "");
                note.print = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.PRINT.FormatNoteProblem()) ? "\u2713" : "");
                note.training = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.TRAINING.FormatNoteProblem()) ? "\u2713" : "");
                note.stock = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.STOCK.FormatNoteProblem()) ? "\u2713" : "");
                note.form = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.FORM.FormatNoteProblem()) ? "\u2713" : "");
                note.rep_excel = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.REPORT_EXCEL.FormatNoteProblem()) ? "\u2713" : "");
                note.statement = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.STATEMENT.FormatNoteProblem()) ? "\u2713" : "");
                note.asset = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.ASSETS.FormatNoteProblem()) ? "\u2713" : "");
                note.secure = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.SECURE.FormatNoteProblem()) ? "\u2713" : "");
                note.year_end = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.YEAR_END.FormatNoteProblem()) ? "\u2713" : "");
                note.period = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.PERIOD.FormatNoteProblem()) ? "\u2713" : "");
                note.mail_wait = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.MAIL_WAIT.FormatNoteProblem()) ? "\u2713" : "");
                note.transfer_mkt = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.TRANSFER_MKT.FormatNoteProblem()) ? "\u2713" : "");

                note_list.Add(note);
            }

            return note_list;
        }
Example #2
0
        private void FilterNoteList()
        {
            List<SupportNote> support_note = this.supportnote_list.ConvertAll<SupportNote>(t => t).ToList<SupportNote>();

            if (this.chApplyCondition.CheckState == CheckState.Checked) // Applying condition
            {
                // S/N
                if (this.txtSernum.Texts.Trim().Length > 0)
                {
                    support_note = support_note.Where(n => n.sernum.Length >= this.txtSernum.Texts.Length).Where(n => n.sernum.Substring(0, this.txtSernum.Texts.Length) == this.txtSernum.Texts).ToList<SupportNote>();
                }
                // Problem
                List<SupportNote> tmp_note = new List<SupportNote>();
                foreach (DataGridViewRow r in this.dgvProblem.Rows)
                {
                    if (((ComboboxItem)r.Tag).string_value == "*")
                    {
                        tmp_note = tmp_note.Concat<SupportNote>(support_note.Where(n => n.is_break == "N" && n.problem.Trim().Length == 0).ToList<SupportNote>()).ToList<SupportNote>();
                    }
                    else
                    {
                        tmp_note = tmp_note.Concat<SupportNote>(support_note.Where(n => n.problem.Contains(((ComboboxItem)r.Tag).string_value)).ToList<SupportNote>()).ToList<SupportNote>();
                    }
                    tmp_note = tmp_note.Distinct().ToList<SupportNote>();
                }
                // Break
                List<SupportNote> tmp_break = new List<SupportNote>();
                foreach (DataGridViewRow r in this.dgvReason.Rows)
                {
                    if (support_note.Where(n => n.reason != null && n.reason.Contains(((ComboboxItem)r.Tag).string_value)).Count<SupportNote>() > 0)
                        tmp_break = tmp_break.Concat<SupportNote>(support_note.Where(n => n.reason != null && n.reason.Contains(((ComboboxItem)r.Tag).string_value)).ToList<SupportNote>()).ToList<SupportNote>();
                }
                support_note = tmp_note.Concat(tmp_break).ToList<SupportNote>().Distinct().ToList<SupportNote>();

                // Comment
                if (this.chComment.CheckState == CheckState.Checked)
                {
                    List<SupportNote> snote = support_note.ConvertAll<SupportNote>(t => t).ToList<SupportNote>();
                    foreach (SupportNote note in snote)
                    {
                        if (supportnotecomment_list.DistinctBy(p => p.note_id).ToList<SupportNoteComment>().Find(c => c.note_id == note.id) == null)
                        {
                            support_note.RemoveAll(s => s.id == note.id);
                        }
                    }
                }
            }
            if (this.sorted_column == 5) // sort by date + start_time
            {
                support_note = support_note.OrderBy(n => n.users_name + n.date + n.start_time).ToList<SupportNote>();
            }
            else if (this.sorted_column == 8) // sort by duration time
            {
                support_note = support_note.OrderBy(n => n.duration).ToList<SupportNote>();
            }

            this.note_list.Clear();
            int count = 0;
            foreach (SupportNote snote in support_note)
            {
                Note note = new Note();
                note.supportnote = snote;
                note.id = snote.id;
                note.is_break = snote.is_break;
                count += (snote.is_break != "Y" ? 1 : 0);
                note.seq = (snote.is_break != "Y" ? count.ToString() : "");
                note.users_name = snote.users_name;
                note.date = snote.date.M2WDate();
                note.start_time = snote.start_time;
                note.end_time = snote.end_time;
                note.duration = snote.duration;
                note.sernum = snote.sernum;
                note.contact = (snote.is_break != "Y" ? snote.contact : this.GetReason(snote.reason));
                note.remark = snote.remark;

                note.map_drive = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.MAP_DRIVE.FormatNoteProblem()) ? "\u2713" : "");
                note.install = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.INSTALL_UPDATE.FormatNoteProblem()) ? "\u2713" : "");
                note.error = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.ERROR.FormatNoteProblem()) ? "\u2713" : "");
                note.fonts = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.FONTS.FormatNoteProblem()) ? "\u2713" : "");
                note.print = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.PRINT.FormatNoteProblem()) ? "\u2713" : "");
                note.training = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.TRAINING.FormatNoteProblem()) ? "\u2713" : "");
                note.stock = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.STOCK.FormatNoteProblem()) ? "\u2713" : "");
                note.form = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.FORM.FormatNoteProblem()) ? "\u2713" : "");
                note.rep_excel = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.REPORT_EXCEL.FormatNoteProblem()) ? "\u2713" : "");
                note.statement = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.STATEMENT.FormatNoteProblem()) ? "\u2713" : "");
                note.asset = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.ASSETS.FormatNoteProblem()) ? "\u2713" : "");
                note.secure = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.SECURE.FormatNoteProblem()) ? "\u2713" : "");
                note.year_end = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.YEAR_END.FormatNoteProblem()) ? "\u2713" : "");
                note.period = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.PERIOD.FormatNoteProblem()) ? "\u2713" : "");
                note.mail_wait = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.MAIL_WAIT.FormatNoteProblem()) ? "\u2713" : "");
                note.transfer_mkt = (snote.problem.Contains(SupportNote.NOTE_PROBLEM.TRANSFER_MKT.FormatNoteProblem()) ? "\u2713" : "");

                this.note_list.Add(note);
            }

            this.lblTotalCall.Text = (this.current_user_from.id == this.current_user_to.id ? count.ToString() + " สาย" : "-");
            support_note = null;
        }