Ejemplo n.º 1
0
        /// <summary>
        /// Iterates the row from the CSV file
        /// </summary>
        /// <param name="context">The ClientContext instance.</param>
        /// <param name="entries">The collection values per row.</param>
        /// <param name="logger">The logger.</param>
        public override void IterateCollection(ClientContext context, Collection<string> entries, LogHelper logger)
        {
            List<PropertyData> data = new List<PropertyData>();         

            foreach (PropertyBase item in this.Properties)
            {
                if (item.Index < entries.Count)
                {
                    try
                    {
                        string account = entries[this.UserNameIndex];
                        PropertyData property = new PropertyData();
                        property.Name = item.Name;
                        property = item.Process(property, entries[item.Index], this) as PropertyData;
                        data.Add(property);
                    }
                    catch (Exception ex)
                    {
                        logger.LogException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Error occured whilst processing account '{0}', Property '{1}'. Stack {2}", entries[this.UserNameIndex], item.Name, ex.ToString()), ex);
                    }
                }
            }

            logger.LogVerbose(string.Format("Attempting to update profile for account '{0}'", entries[this.UserNameIndex]));
            
            try
            {
                this.profileService.ModifyUserPropertyByAccountName(entries[this.UserNameIndex], data.ToArray());
                logger.LogOutcome(entries[this.UserNameIndex], "SUCCESS");
            }
            catch(Exception ex)
            {
                logger.LogException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Error occured whilst processing account '{0}' - the account does not exist", entries[this.UserNameIndex]), ex);
                logger.LogOutcome(entries[this.UserNameIndex], "FAILURE");
            }

        }
Ejemplo n.º 2
0
 /// <remarks/>
 public void ModifyUserPropertyByAccountNameAsync(string accountName, PropertyData[] newData) {
     this.ModifyUserPropertyByAccountNameAsync(accountName, newData, null);
 }
Ejemplo n.º 3
0
 /// <remarks/>
 public void ModifyUserPropertyByAccountNameAsync(string accountName, PropertyData[] newData, object userState) {
     if ((this.ModifyUserPropertyByAccountNameOperationCompleted == null)) {
         this.ModifyUserPropertyByAccountNameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnModifyUserPropertyByAccountNameOperationCompleted);
     }
     this.InvokeAsync("ModifyUserPropertyByAccountName", new object[] {
                 accountName,
                 newData}, this.ModifyUserPropertyByAccountNameOperationCompleted, userState);
 }
Ejemplo n.º 4
0
 public void ModifyUserPropertyByAccountName(string accountName, PropertyData[] newData) {
     this.Invoke("ModifyUserPropertyByAccountName", new object[] {
                 accountName,
                 newData});
 }