Пример #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);
        }
        private void InsertDataUsingContactRow()
        {
            this.txt_name.Text       = contact.Name;
            this.txt_email.Text      = contact.Email;
            this.cpb_userimage.Image = commonUtil.Base64ToBitmap(contact.Image);
            if (this.IsAddressAvailable(contact.AddressLine1, contact.AddressLine2))
            {
                PictureBox pbx = uiBuilder.GeneratePictureBox(17, 293, "dynamicpbx_chevdown", Properties.Resources.chevdown, 15, 15);
                pbx.Click += new EventHandler(this.AddUiClick);
                this.Controls.Add(pbx);

                Label label = uiBuilder.GenerateLabel(40, 295, "dynamiclbl_address", "Address");
                this.Controls.Add(label);
            }
            else
            {
                this.AddAddressControls(contact.AddressLine1, contact.AddressLine2, contact.City, contact.State, contact.Zipcode);
            }
        }