示例#1
0
        /// <summary>
        /// Add a new contact info
        /// </summary>
        /// <param name="field"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool AddContactDetail(ProfileField field, string value)
        {
            lock (BusinessEntity.m_sDS)
            {
                bool success = false;

                if (field != null)
                {
                    value = string.IsNullOrEmpty(value) ? "" : value;
                    var dataRow = m_sDS.BusinessEntityContactDetails.AddBusinessEntityContactDetailsRow(m_dataRow, field.m_dataRow, value);

                    try
                    {
                        success = 1 == BusinessEntityContactDetail.m_sTA.Update(dataRow);
                    }
                    catch { }

                    if (success)
                    {
                        m_contactDetails.Add(new BusinessEntityContactDetail(this, dataRow));
                    }
                    else
                    {
                        m_sDS.BusinessEntityContactDetails.RemoveBusinessEntityContactDetailsRow(dataRow);
                    }
                }

                return(success);
            }
        }
示例#2
0
        /// <summary>
        /// Remove
        /// </summary>
        /// <param name="name"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public bool RemoveField(ProfileField field)
        {
            lock (BusinessEntity.m_sDS)
            {
                bool success = false;

                if (field != null)
                {
                    try
                    {
                        success = 1 == ProfileField.m_sTA.DeleteByID(field.ID);
                    }
                    catch { }

                    if (success)
                    {
                        m_fields.Remove(field);
                        BusinessEntity.m_sDS.ProfileFields.RemoveProfileFieldsRow(field.m_dataRow);
                    }
                }

                return(success);
            }
        }