예제 #1
0
        private void FComment_Load(object sender, EventArgs e)
        {
            try
            {
                this.Icon = Resources.IntuneComment;
                Comment[] comments = null;
                this.Text = Session.GetFormTitle();

                if (Entry != null)
                {
                    lblHead.Text  = string.Format("{0} Entry", Account.Name);
                    lblTitle.Text = string.Format("{0}:\n{1} on {2}\nof Qty: {3} and {4}", Account.Name, Entry.Notes, Entry.TxnDate.ToShortDateString(), Entry.Quantity, Entry.Amount.ToString("C2", CultureInfo.CurrentCulture));
                    comments      = IntuneService.GetEntryComments(Entry.Id, ByUser.Id);
                }
                else if (Account != null)
                {
                    //TODO: could display profile and photo and can display summary of a/c
                    lblHead.Text  = Account.Name;
                    lblTitle.Text = string.Format("Comments on\n{0}", Account.Name);
                    comments      = IntuneService.GetAccountComments(Account.Id, ByUser.Id);
                }
                else
                {
                    //TODO: could display profile and photo etc.
                    lblHead.Text  = string.Format("{0}@Intune", ToUser.Name);
                    lblTitle.Text = string.Format("Conversation between you and {0}", ToUser.Name);
                    comments      = IntuneService.GetContactComments(ByUser.Id, ToUser.Id);
                }

                renderComments(comments);
                rtbComments.ScrollToCaret();
                txtComment.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();
            listView1.Columns.Clear();
            listView1.Groups.Clear();
            listView1.MultiSelect   = true;
            listView1.FullRowSelect = true;
            listView1.View          = View.Details;
            //listView1.GridLines = true;
            listView1.HeaderStyle = ColumnHeaderStyle.None;
            listView1.Groups.Clear();
            listView1.Groups.Clear();

            listView1.Columns.Add("", 19);
            listView1.Columns.Add("From", 100, HorizontalAlignment.Right);
            listView1.Columns.Add("Message", 200);
            listView1.Columns.Add("At", 60);

            var comments = IntuneService.GetAccountComments(1, 2);

            foreach (var comment in comments)
            {
                var name = comment.ByUserName == "Ashok Guduru" ? "Me:" : comment.ByUserName + ":";

                var lvi = listView1.Items.Add("");
                lvi.ImageIndex = 9;
                lvi.UseItemStyleForSubItems = false;

                var lvsi = lvi.SubItems.Add(name);
                lvsi.Font      = new Font(listView1.Font, FontStyle.Bold);
                lvsi.ForeColor = name == "Me:" ? Color.Blue : Color.Purple;

                lvsi           = lvi.SubItems.Add(comment.CommentText);
                lvsi.Font      = new Font(listView1.Font, FontStyle.Regular);
                lvsi.ForeColor = Color.Black;

                lvsi           = lvi.SubItems.Add(comment.DateTimeStamp.ToString("hh:mm:tt"));
                lvsi.Font      = new Font("Tahoma", 7.0F, FontStyle.Regular);
                lvsi.ForeColor = Color.Green;
            }
        }