コード例 #1
0
        /// <summary>
        /// Requires the type of the contactList to be generated
        /// Once generetaed add the retails of the contacts to the contact list and returns ContactListView to be added to the controls
        /// </summary>
        /// <param name="type">The type wether its "load" or "search" and depending on the type the releavant panel is been loaded</param>
        /// <returns>The List of Contacts that should be added to the panels</returns>
        private List <ContactListView> GenerateContactList(String type)
        {
            this.AddSeachHeaderAndClose();

            List <Contact> contactList = new List <Contact>();

            if (type.Equals("load"))
            {
                contactList = contactHelper.GetUserContacts();
            }
            else if (type.Equals("search"))
            {
                contactList = contactHelper.GetUserContactsByName(txt_search.Text.Trim());
            }
            List <ContactListView> contactLists = new List <ContactListView>();

            foreach (Contact contactDetails in contactList)
            {
                ContactListView contact = new ContactListView();
                contact.Tag          = contactDetails.ContactId;
                contact.ContactName  = contactDetails.Name;
                contact.ContactEmail = contactDetails.Email;
                contact.ContactId    = contactDetails.ContactId;
                contact.ContactImage = commonUtil.Base64ToBitmap(contactDetails.Image);
                contact.Name         = $"ctx_";
                contact.Click       += new EventHandler(this.ContactControlClick);
                contactLists.Add(contact);
            }
            return(contactLists);
        }
コード例 #2
0
 private bool doAddContacts()
 {
     try
     {
         contacts = contactHelper.GetUserContacts();
         this.AddContactList();
         return(true);
     }
     catch (Exception ex)
     {
         logger.LogException(ex);
         return(false);
     }
 }
コード例 #3
0
        public EditEvent(string eventid)
        {
            InitializeComponent();

            userEvent           = eventHelper.GetUserEvent(eventid);
            txt_name.Text       = userEvent.Title;
            txt_email.Text      = userEvent.Description;
            dtp_startdate.Value = userEvent.StartDate;
            dtp_starttime.Value = userEvent.StartDate;
            dtp_enddate.Value   = userEvent.StartDate;
            dtp_endtime.Value   = userEvent.EndDate;

            allContacts = contactHelper.GetUserContacts();
            allContacts.RemoveAll(x => contacts.Exists(y => y.ContactId == x.ContactId));

            if (userEvent.EventContacts != null)
            {
                foreach (EventContact eventContact in userEvent.EventContacts)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem()
                    {
                        Id        = eventContact.Id,
                        ContactId = eventContact.ContactId,
                        Name      = this.GetContactName(eventContact.ContactId),
                    };
                    cmb_evetncollab.DisplayMember = "Name";
                    cmb_evetncollab.ValueMember   = "ContactId";
                    cmb_evetncollab.DisplayMember = "Name";
                    cmb_evetncollab.ValueMember   = "ContactId";
                    cmb_evetncollab.Items.Add(comboBoxItem);
                    comboBoxItems.Add(comboBoxItem);
                }
            }

            if (userEvent.Type.Equals("Task"))
            {
                rb_task.Checked = true;
            }
            else
            {
                rb_appointment.Checked = true;
            }



            if (allContacts != null)
            {
                foreach (Contact eventContact in allContacts)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem()
                    {
                        ContactId = eventContact.ContactId,
                        Name      = eventContact.Name,
                    };

                    cmb_contacts.DisplayMember = "Name";
                    cmb_contacts.ValueMember   = "ContactId";
                    cmb_contacts.DisplayMember = "Name";
                    cmb_contacts.ValueMember   = "ContactId";
                    cmb_contacts.Items.Add(comboBoxItem);
                }
                cmb_contacts.Items.Remove("Loading....");
                //cmb_contacts.SelectedIndex = 0;
            }

            if (!userEvent.AddressLine1.Equals("") || !userEvent.AddressLine2.Equals("") || !userEvent.City.Equals("") || !userEvent.State.Equals("") || !userEvent.Zipcode.Equals(""))
            {
                this.AddAddressControls();
                this.changeConrolLocations("add");
            }
            else
            {
                PictureBox pbx = uiBuilder.GeneratePictureBox(17, 390, "dynamicpbx_chevdown", Properties.Resources.chevdown, 15, 15);
                pbx.Click += new EventHandler(this.AddUiClick);

                this.Controls.Add(pbx);

                Label label = uiBuilder.GenerateLabel(40, 390, "dynamiclbl_address", "Address");
                this.Controls.Add(label);
            }

            cmb_repeattype.SelectedItem = userEvent.RepeatType;
        }