예제 #1
0
        public static TableProfiles ImportRecords(string strUrl, string strUserName, string strPassword)
        {
            AddressBook proxy = new AddressBook();

            AddressBookItem[] ab    = null;
            TableProfiles     table = new TableProfiles();

            if (strUrl.Trim().Length > 0)
            {
                proxy.Url = strUrl;
            }
            if (strUserName.Trim().Length > 0 || strPassword.Trim().Length > 0)
            {
                proxy.Credentials = new System.Net.NetworkCredential(strUserName, strPassword);
            }
            proxy.Timeout = Properties.Settings.Default.soapTimeoutSec * 1000;

            ab = proxy.GetList();

            foreach (AddressBookItem item in ab)
            {
                table.Add(new RecordUserProfile(item));
            }

            return(table);
        }
예제 #2
0
 public void Add(TableProfiles tableUserProfiles)
 {
     this.Clear();
     foreach (RecordUserProfile record in tableUserProfiles.userProfiles)
     {
         Add(record);
     }
     this._bEmpty = false;
 }
예제 #3
0
        public static TableProfiles ImportRecords(string strUrl, string strUserName, string strPassword)
        {
            AddressBook proxy = new AddressBook();
            AddressBookItem[] ab = null;
            TableProfiles table = new TableProfiles();

            if (strUrl.Trim().Length > 0)
            {
                proxy.Url = strUrl;
            }
            if (strUserName.Trim().Length > 0 || strPassword.Trim().Length > 0)
            {
                proxy.Credentials = new System.Net.NetworkCredential(strUserName, strPassword);
            }
            proxy.Timeout = Properties.Settings.Default.soapTimeoutSec * 1000;

            ab = proxy.GetList();

            foreach (AddressBookItem item in ab)
                table.Add(new RecordUserProfile(item));

            return table;
        }
예제 #4
0
 public void ReadProfiles()
 {
     try
     {
         _tableProfiles = new TableProfiles();
         if (SPDataSource == SPDataSourcer.API)
             _tableProfiles.ReadSPProfiles(SPContext.Current.Site.ID);
         else
             _tableProfiles.ReadSqlSPProfiles(SPConnectionString, SPSiteProfiles);
     }
     catch (Exception ex)
     {
         if (_labelError == null)
             _labelError = new Label();
         _labelError.ForeColor = System.Drawing.Color.Red;
         _labelError.Text = "Помилка при отриманні профілів користувача!<br/><br/>\n\n" + ex.Message;
         _labelError.Visible = true;
     }
 }
예제 #5
0
 public void Add(TableProfiles tableUserProfiles)
 {
     this.Clear();
     foreach (RecordUserProfile record in tableUserProfiles.userProfiles)
     {
         Add(record);
     }
     this._bEmpty = false;
 }
예제 #6
0
 public void RegisterUserProfileProvider(ITableProfiles provider)
 {
     this._provider = provider;
     _tableProfiles = this._provider.ProfilesTable;
 }
예제 #7
0
        /// <summary>
        /// Imports records (list of RecordUserProfile) from 1C through SOAP
        /// </summary>
        /// <returns>true on success, false on failed</returns>
        bool Read1CRecords()
        {
            try
            {
                users1C = Import1CUserProfiles.ImportRecords(Properties.Settings.Default.soapServerUrl,
                    Properties.Settings.Default.soapServerUser,
                    Properties.Settings.Default.soapServerPassword);
            }
            catch (Exception ex)
            {
                string sError = string.Format("Read1CRecords(): Error was occured while reading 1C user profile records:\n{0}",
                    ex.ToString());

                TextWriter errorWriter = Console.Error;
                Console.WriteLine(sError);
                errorWriter.WriteLine(sError);
                return false;
            }

            return true;
        }