aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-06-21 21:49:58 +0300
committerRoy <Roy.mail.net@gmail.com>2022-06-21 21:49:58 +0300
commit5280a0b306a370cd464dfc391d7ff57f201d6643 (patch)
treee0d855cfc3db32e2c43d0b116bc234d4415ca21b /Software/Visual_Studio/Utilities
parentaac9149694dceea12240ece6b760055292de7e48 (diff)
downloadTango-5280a0b306a370cd464dfc391d7ff57f201d6643.tar.gz
Tango-5280a0b306a370cd464dfc391d7ff57f201d6643.zip
Email Bulk Modifier.
Diffstat (limited to 'Software/Visual_Studio/Utilities')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/App.config16
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Emails.csv12
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Model.cs14
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Program.cs88
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Properties/AssemblyInfo.cs36
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Tango.BulkEmailModifier.CLI.csproj79
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/packages.config4
7 files changed, 249 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/App.config
new file mode 100644
index 000000000..f05da3520
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/App.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+ </startup>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Emails.csv b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Emails.csv
new file mode 100644
index 000000000..802ed4a2e
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Emails.csv
@@ -0,0 +1,12 @@
+Old,New
+chaim@twine-s.com,Chaim.Dikman@twine-s.com
+Dana@twine-s.com,Dana.Hochberg@twine-s.com
+Daria@twine-s.com,Daria.Fonshtein@twine-s.com
+David@twine-s.com,David.Orenstein@twine-s.com
+dekel@twine-s.com,Dekel.tsuberi@twine-s.com
+Eran@twine-s.com,Eran.Hirschberg@twine-s.com
+ErezK@twine-s.com,Erez.Koppel@twine-s.com
+Gal.l@twine-s.com,Gal.Lahav@twine-s.com
+Gil@twine-s.com,Gil.Garama@twine-s.com
+gilad@twine-s.com,Gilad.Gotesman@twine-s.com
+gili@twine-s.com,Gili.Mitshel@twine-s.com
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Model.cs b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Model.cs
new file mode 100644
index 000000000..df207add8
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Model.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.BulkEmailModifier.CLI
+{
+ public class Model
+ {
+ public String Old { get; set; }
+ public String New { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Program.cs
new file mode 100644
index 000000000..a5370b12c
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Program.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.Core;
+using Tango.CSV;
+using System.Data.Entity;
+using Tango.BL.Entities;
+
+namespace Tango.BulkEmailModifier.CLI
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Modifying email addresses...");
+
+ var emails = CsvFile.Read<Model>(new CsvSource("Emails.csv")).ToList();
+
+ DataSource dataSource = new DataSource();
+ dataSource.Address = "twine.database.windows.net";
+ dataSource.IntegratedSecurity = false;
+ dataSource.UserName = "Roy";
+ dataSource.Password = "Aa123456";
+
+ List<String> catalogs = new List<string>()
+ {
+ "Tango_DEV",
+ "Tango_TEST",
+ "Tango_PROCESS",
+ "Tango_ALPHA",
+ "Tango_BETA",
+ "Tango_STAGE",
+ "Tango",
+ "Tango_BB",
+ };
+
+ foreach (var catalog in catalogs)
+ {
+ Console.WriteLine();
+ Console.WriteLine($"Switching to database {catalog}...");
+ Console.WriteLine();
+
+ dataSource.Catalog = catalog;
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault(dataSource))
+ {
+ foreach (var email in emails)
+ {
+ var user = db.Users.Include(x => x.Contact).SingleOrDefault(x => x.Email.ToLower() == email.Old.ToLower());
+
+ if (user == null)
+ {
+ Console.ForegroundColor = ConsoleColor.DarkGray;
+ Console.WriteLine($"'{email.Old}' not found.");
+ Console.ForegroundColor = ConsoleColor.Gray;
+ continue;
+ }
+
+ var existingNewUser = db.Users.SingleOrDefault(x => x.Email.ToLower() == email.New.ToLower());
+ if (existingNewUser != null)
+ {
+ Console.WriteLine($"Deleting existing new user for {existingNewUser.Email}...");
+ db.Users.Remove(existingNewUser);
+ db.SaveChanges();
+ }
+
+ user.Email = email.New;
+
+ if (user.Contact.Email.ToLower() == email.Old.ToLower())
+ {
+ user.Contact.Email = email.New;
+ }
+
+ Console.WriteLine($"Modifying {catalog} {email.Old} => {email.New}");
+ db.SaveChanges();
+ }
+ }
+ }
+
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine();
+ Console.WriteLine("DONE");
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..71ba01d8a
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango.BulkEmailModifier.CLI")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.BulkEmailModifier.CLI")]
+[assembly: AssemblyCopyright("Copyright © 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("da4fca0b-e0ea-431f-b0cc-aa9b0a4c73c2")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Tango.BulkEmailModifier.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Tango.BulkEmailModifier.CLI.csproj
new file mode 100644
index 000000000..6343e017a
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/Tango.BulkEmailModifier.CLI.csproj
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{DA4FCA0B-E0EA-431F-B0CC-AA9B0A4C73C2}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>Tango.BulkEmailModifier.CLI</RootNamespace>
+ <AssemblyName>Tango.BulkEmailModifier.CLI</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Model.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="Emails.csv">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{A34EE0F0-649D-41C8-8489-B6F1CC6924EE}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.CSV\Tango.CSV.csproj">
+ <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project>
+ <Name>Tango.CSV</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/packages.config
new file mode 100644
index 000000000..b3daf0d6c
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.BulkEmailModifier.CLI/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+</packages> \ No newline at end of file