コード例 #1
0
        public void LoadContactInformationList()
        {
            try
            {
                Contacts aContact = new Contacts();
                string htmlContent = "";
                List<Contacts> aContactList = aContact.GetAllContacts(_company.CompanyId);

                contactInformationTable.InnerHtml = "";
                foreach (Contacts contact in aContactList)
                {
                    htmlContent +=
                        String.Format(
                            @"<tr><th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th><th>{4}</th><th>{5}</th><th>{6}</th><th>{7}</th></tr>",
                            contact.SourceType, contact.SourceId, contact.ContactName, contact.ContactDesignation,
                            contact.IsMainContact, contact.Phone, contact.Mobile, contact.Email);

                }
                contactInformationTable.InnerHtml += htmlContent;

            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
            }
        }
コード例 #2
0
        public int ContactInformationSave()
        {
            try
            {
                Contacts newContacts = new Contacts();
                List<Contacts> contactList = newContacts.GetAllContacts(_company.CompanyId);
                long ip=0;
                if (contactList.Count > 0)
                {
                    Contacts temcon = contactList[contactList.Count - 1];
                    ip = temcon.ContactId + 1;
                }

                newContacts.ContactId = ip;
                newContacts.CompanyId = _company.CompanyId;
                newContacts.SourceType = "Name";
                newContacts.SourceId = user.UserId;
                newContacts.ContactName = txtContactName.Value;
                newContacts.ContactDesignation = designationDropDownList.SelectedItem.Value;
                newContacts.IsMainContact = chkIsMain.Checked;
                newContacts.Phone = txtContactPhone.Value;
                newContacts.Mobile = txtContactMobile.Value;
                newContacts.Email = txtContactEmail.Value;
                int result = newContacts.InsertContacts();
                txtContactEmail.Value = txtContactName.Value = txtContactPhone.Value = txtContactMobile.Value = "";
                chkIsMain.Checked = false;
                if (result > 0)
                {
                    Session["savedContactMessage"] = "Contact saved successfully";
                    Response.Redirect(Request.RawUrl);

                }
                else
                {
                    Alert.Show("Error Occured while inserting a new user");
                }
                return 1;

            }
            catch (Exception exp)
            {
                Alert.Show(exp.Message);
                return 0;
            }
        }