Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Urvil Shah
/
MobEasyEditor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
65445ce5
authored
Apr 03, 2018
by
Urvil Shah
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
more Beautify.
parent
0e5286d6
Pipeline
#7263
passed with stages
in 22 minutes 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
Mobile.Search.Web/Controllers/TemplateController.cs
Mobile.Search.Web/Controllers/TemplateController.cs
View file @
65445ce5
...
@@ -64,7 +64,7 @@ namespace Mobile.Search.Web.Controllers
...
@@ -64,7 +64,7 @@ namespace Mobile.Search.Web.Controllers
{
{
html
=
value
.
AsString
();
html
=
value
.
AsString
();
}
}
templateDict
.
Add
(
document
[
"templateKey"
].
AsString
(),
html
);
templateDict
.
Add
(
document
[
"templateKey"
].
AsString
(),
html
);
}
}
// sort dictionary
// sort dictionary
...
@@ -75,7 +75,7 @@ namespace Mobile.Search.Web.Controllers
...
@@ -75,7 +75,7 @@ namespace Mobile.Search.Web.Controllers
// GET: Template/Create
// GET: Template/Create
public
ActionResult
Create
()
public
ActionResult
Create
()
{
{
return
View
(
"Edit"
,
new
KeyValuePair
<
string
,
string
>(
Chronos
.
GenerateRandom
.
String
(
6
),
"<html></html>"
));
return
View
(
"Edit"
,
new
KeyValuePair
<
string
,
string
>(
Chronos
.
GenerateRandom
.
String
(
6
),
"<html></html>"
));
}
}
public
ActionResult
CreateFroala
()
public
ActionResult
CreateFroala
()
{
{
...
@@ -96,10 +96,10 @@ namespace Mobile.Search.Web.Controllers
...
@@ -96,10 +96,10 @@ namespace Mobile.Search.Web.Controllers
return
Json
(
FroalaEditor
.
S3
.
GetHash
(
config
),
JsonRequestBehavior
.
AllowGet
);
return
Json
(
FroalaEditor
.
S3
.
GetHash
(
config
),
JsonRequestBehavior
.
AllowGet
);
}
}
// GET: Template/Edit/5
// GET: Template/Edit/5
public
ActionResult
Edit
(
string
templateKey
)
public
ActionResult
Edit
(
string
templateKey
)
{
{
var
json
=
_dynamoClient
.
Get
(
"prd_2click_templates"
,
"templateKey"
,
templateKey
);
var
json
=
_dynamoClient
.
Get
(
"prd_2click_templates"
,
"templateKey"
,
templateKey
);
var
j
=
JObject
.
Parse
(
json
);
var
j
=
JObject
.
Parse
(
json
);
...
@@ -148,46 +148,46 @@ namespace Mobile.Search.Web.Controllers
...
@@ -148,46 +148,46 @@ namespace Mobile.Search.Web.Controllers
try
try
{
{
string
url
=
"http://config.minbox.email/Offer/Create/template_attribute="
;
string
url
=
"http://config.minbox.email/Offer/Create/template_attribute="
;
Match
m
;
Match
m
;
string
HRefPattern
=
"href\\s*=\\s*(?:[\"'](?<1>[^\"']*)[\"']|(?<1>\\S+))"
;
string
HRefPattern
=
"href\\s*=\\s*(?:[\"'](?<1>[^\"']*)[\"']|(?<1>\\S+))"
;
// _dynamoClient.WriteSingle("prd_2click_templates", d);
// _dynamoClient.WriteSingle("prd_2click_templates", d);
m
=
Regex
.
Match
(
value
,
HRefPattern
,
m
=
Regex
.
Match
(
value
,
HRefPattern
,
RegexOptions
.
IgnoreCase
|
RegexOptions
.
Compiled
,
RegexOptions
.
IgnoreCase
|
RegexOptions
.
Compiled
,
TimeSpan
.
FromSeconds
(
1
));
TimeSpan
.
FromSeconds
(
1
));
while
(
m
.
Success
)
while
(
m
.
Success
)
{
{
string
to_replace
=
String
.
Format
(
"{{{{WrapUrl('{0}')}}}}"
,
m
.
Groups
[
1
]);
string
to_replace
=
String
.
Format
(
"{{{{WrapUrl('{0}')}}}}"
,
m
.
Groups
[
1
]);
value
=
value
.
Replace
(
m
.
Groups
[
1
].
Value
,
to_replace
);
value
=
value
.
Replace
(
m
.
Groups
[
1
].
Value
,
to_replace
);
m
=
m
.
NextMatch
();
m
=
m
.
NextMatch
();
}
}
var
d
=
new
Dictionary
<
string
,
object
>
var
d
=
new
Dictionary
<
string
,
object
>
{
{
{
"templateKey"
,
key
.
ToLower
()},
{
"templateKey"
,
key
.
ToLower
()},
{
"html"
,
value
}
{
"html"
,
value
}
};
};
if
(
isSendEmail
)
if
(
isSendEmail
)
{
{
if
(
sendEmail
(
value
,
EmailId
))
if
(
sendEmail
(
value
,
EmailId
))
{
{
return
Json
(
new
{
status
=
"Success"
});
return
Json
(
new
{
status
=
"Success"
});
}
}
else
else
{
{
return
Json
(
new
{
status
=
"Failed"
});
return
Json
(
new
{
status
=
"Failed"
});
}
}
}
}
else
else
{
{
_dynamoClient
.
WriteSingle
(
"prd_2click_templates"
,
d
);
_dynamoClient
.
WriteSingle
(
"prd_2click_templates"
,
d
);
}
}
url
=
url
+
key
;
url
=
url
+
key
;
return
Redirect
(
url
);
return
Redirect
(
url
);
}
}
...
@@ -198,33 +198,33 @@ namespace Mobile.Search.Web.Controllers
...
@@ -198,33 +198,33 @@ namespace Mobile.Search.Web.Controllers
}
}
}
}
public
ActionResult
SendEmail
(
string
value
,
string
EmailId
)
public
ActionResult
SendEmail
(
string
value
,
string
EmailId
)
{
{
return
View
();
return
View
();
}
}
public
bool
sendEmail
(
string
value
,
string
email_id
)
public
bool
sendEmail
(
string
value
,
string
email_id
)
{
{
MailAddress
from
=
new
MailAddress
(
FromEmail
,
"TemplateTest"
);
MailAddress
from
=
new
MailAddress
(
FromEmail
,
"TemplateTest"
);
MailAddress
to
=
new
MailAddress
(
email_id
);
MailAddress
to
=
new
MailAddress
(
email_id
);
MailMessage
message
=
new
MailMessage
(
from
,
to
);
MailMessage
message
=
new
MailMessage
(
from
,
to
);
message
.
Subject
=
"Template Testing Via Html Editor"
;
message
.
Subject
=
"Template Testing Via Html Editor"
;
message
.
Body
=
value
;
message
.
Body
=
value
;
message
.
IsBodyHtml
=
true
;
message
.
IsBodyHtml
=
true
;
SmtpClient
client
=
new
SmtpClient
();
SmtpClient
client
=
new
SmtpClient
();
client
.
Port
=
Port
;
client
.
Port
=
Port
;
if
(
email_id
.
Contains
(
"minbox"
))
if
(
email_id
.
Contains
(
"minbox"
))
{
{
client
.
Host
=
SmtpMinboxHost
;
client
.
Host
=
SmtpMinboxHost
;
}
}
else
else
{
{
client
.
Host
=
SmtpSendGridHost
;
client
.
Host
=
SmtpSendGridHost
;
System
.
Net
.
NetworkCredential
credentials
=
new
System
.
Net
.
NetworkCredential
(
SmtpSendGridUsername
,
SmtpSendGridPassword
);
System
.
Net
.
NetworkCredential
credentials
=
new
System
.
Net
.
NetworkCredential
(
SmtpSendGridUsername
,
SmtpSendGridPassword
);
client
.
Credentials
=
credentials
;
client
.
Credentials
=
credentials
;
}
}
// client.Port = Port;
// client.Port = Port;
...
@@ -232,16 +232,16 @@ namespace Mobile.Search.Web.Controllers
...
@@ -232,16 +232,16 @@ namespace Mobile.Search.Web.Controllers
{
{
client
.
Send
(
message
);
client
.
Send
(
message
);
return
true
;
return
true
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
Console
.
WriteLine
(
"Exception caught in CreateTestMessage4(): {0}"
,
Console
.
WriteLine
(
"Exception caught in CreateTestMessage4(): {0}"
,
ex
.
ToString
());
ex
.
ToString
());
return
false
;
return
false
;
}
}
}
}
...
@@ -289,10 +289,10 @@ namespace Mobile.Search.Web.Controllers
...
@@ -289,10 +289,10 @@ namespace Mobile.Search.Web.Controllers
{
{
var
jObj
=
JObject
.
Parse
(
x
);
var
jObj
=
JObject
.
Parse
(
x
);
return
new
Dictionary
<
string
,
string
>()
return
new
Dictionary
<
string
,
string
>()
{
{
{
"keyword"
,
(
string
)
jObj
[
"keyword"
]},
{
"keyword"
,
(
string
)
jObj
[
"keyword"
]},
{
"advertiserUrl"
,
(
string
)
jObj
[
"advertiserUrl"
]},
{
"advertiserUrl"
,
(
string
)
jObj
[
"advertiserUrl"
]},
};
};
}).
ToList
();
}).
ToList
();
return
blacklist
;
return
blacklist
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment