public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
            {
                string     serialized = value as string;
                Replacment replacmnet = new Replacment();

                return(replacmnet = new Replacment(serialized));
            }
 public Replacment(string serialized)
 {
     try
     {
         this = new Replacment();
         SettingsCollection settings = new SettingsCollection(serialized);
         ReplaceFrom     = settings["ReplaceFrom"];
         ReplaceTo       = settings["ReplaceTo"];
         CalcMembersOnly = bool.Parse(settings["CalcMembersOnly"]);
     }
     catch (Exception ex)
     {
         throw new Exception("Can't convert from Value to Replacment object", ex);
     }
 }
        protected void UpdateOltpDataBase(Dictionary <string, object> collectedData)
        {
            using (SqlConnection sqlConnection = new SqlConnection(accountWizardSettings.Get("OLTP.Connection.string")))
            {
                sqlConnection.Open();
                foreach (KeyValuePair <string, object> input in collectedData)
                {
                    if (input.Key.StartsWith("AccountSettings"))
                    {
                        using (SqlCommand sqlCommand = DataManager.CreateCommand(@"INSERT INTO User_Gui_AccountSettings
																			(ScopeID,AccountID,Name,Value,sys_creation_date)
																			Values
																			(@ScopeID:Int,
																			 @AccountID:NVarchar,
																			 @Name:NVarchar,
																			 @Value:NVarchar,
																			 @sys_creation_date:DateTime)"                                                                            ))
                        {
                            sqlCommand.Connection = sqlConnection;
                            sqlCommand.Parameters["@ScopeID"].Value   = collectedData["AccountSettings.BI_Scope_ID"]; //TODO: TEMPORARLY WILL COME FROM OTHER COLLECTOR (GENERAL COLLECTOR-ASK DORON)
                            sqlCommand.Parameters["@AccountID"].Value = DBNull.Value;                                 //TODO: CHECK THIS FOR NOW IT'S NULL
                            sqlCommand.Parameters["@Name"].Value      = input.Key;
                            if (input.Value is Replacment)
                            {
                                Replacment replacement = (Replacment)input.Value;
                                sqlCommand.Parameters["@Value"].Value = replacement.ReplaceTo;
                            }
                            else
                            {
                                sqlCommand.Parameters["@Value"].Value = input.Value;
                            }
                            sqlCommand.Parameters["@sys_creation_date"].Value = DateTime.Now;

                            sqlCommand.ExecuteNonQuery();
                        }
                    }
                }
            }
        }