Mise en forme du message de contact au préstataire
* Sent.aspx: Vue de confirmation du messag envoyé * PerformerContact.cs: modèle de donnnée d'un message * Global.asax.cs: ajout d'une route /to/ * style.css: rien * style.css: forme du pointeur de liens * FrontOfficeController.cs: implémente l'envoi d'un e-mail au préstataire * YavscHelpers.cs: * HomeController.cs: l'e-mail admin est obtenu du helper global * App.master: Corrige les guillemets autour de notifications web * yavsc.js: la class des liens est "link", pas "actionlink" * Contact.aspx: mise en forme du formulaire de contact * Performer.ascx: lien vers le contact préstataire * Yavsc.csproj: ajout de la vue du message envoyé * LocalizedText.resx: * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: traductions * YavscModel.csproj: ajout du modèle de données d'un message
This commit is contained in:
parent
a14e63d26f
commit
3b33be013c
20 changed files with 283 additions and 91 deletions
|
|
@ -1,28 +1,29 @@
|
|||
using System;
|
||||
using Yavsc;
|
||||
using System.Web.Mvc;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using Yavsc.Controllers;
|
||||
using System.Collections.Generic;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Web.Security;
|
||||
using System.Threading;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using Yavsc.Model.FileSystem;
|
||||
using Yavsc.Model.Calendar;
|
||||
using System.Configuration;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Model.FrontOffice.Catalog;
|
||||
using Yavsc.Model.Skill;
|
||||
using System.Web.Profile;
|
||||
using Yavsc.Model.Google.Api;
|
||||
using System.Net;
|
||||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Mail;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Profile;
|
||||
using System.Web.Security;
|
||||
using Yavsc;
|
||||
using Yavsc.Controllers;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Model.Calendar;
|
||||
using Yavsc.Model.Circles;
|
||||
using Yavsc.Model.FileSystem;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using Yavsc.Model.FrontOffice.Catalog;
|
||||
using Yavsc.Model.Google.Api;
|
||||
using Yavsc.Model.Skill;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
|
|
@ -238,6 +239,45 @@ namespace Yavsc.Controllers
|
|||
return View (WorkFlowManager.GetCommands (Membership.GetUser ().UserName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contact the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">User.</param>
|
||||
[Authorize]
|
||||
public ActionResult Contact(PerformerContact model)
|
||||
{
|
||||
return View (model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send the specified pmsg.
|
||||
/// </summary>
|
||||
/// <param name="pmsg">Pmsg.</param>
|
||||
[Authorize]
|
||||
public ActionResult Send(PerformerContact pmsg)
|
||||
{
|
||||
var performer = Membership.GetUser (pmsg.Performer);
|
||||
if (performer == null)
|
||||
ModelState.AddModelError ("Performer", "This user doesn't exist");
|
||||
var user = Membership.GetUser();
|
||||
if (ModelState.IsValid) {
|
||||
using (System.Net.Mail.MailMessage msg = new MailMessage(
|
||||
YavscHelpers.OwnerEmail,
|
||||
performer.Email,"[Contact] ("+user.UserName+") "+pmsg.Reason,pmsg.Body))
|
||||
{
|
||||
msg.CC.Add(new MailAddress(YavscHelpers.Admail));
|
||||
using (System.Net.Mail.SmtpClient sc = new SmtpClient())
|
||||
{
|
||||
sc.Send (msg);
|
||||
ViewData.Notify(LocalizedText.Message_sent);
|
||||
}
|
||||
}
|
||||
return View ("Sent");
|
||||
}
|
||||
else
|
||||
return View ("Contact",pmsg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command the specified collection.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -71,21 +71,7 @@ namespace Yavsc.Controllers
|
|||
return View (asnlist.ToArray()) ;
|
||||
}
|
||||
|
||||
private static string owneremail = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the owner email.
|
||||
/// </summary>
|
||||
/// <value>The owner email.</value>
|
||||
public static string OwnerEmail {
|
||||
get {
|
||||
if (owneremail == null)
|
||||
owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail");
|
||||
return owneremail;
|
||||
}
|
||||
set {
|
||||
owneremail = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Index this instance.
|
||||
/// </summary>
|
||||
|
|
@ -102,6 +88,7 @@ namespace Yavsc.Controllers
|
|||
ViewData["Activities"] = WorkFlowManager.FindActivity(id,true);
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Credits this instance.
|
||||
/// </summary>
|
||||
|
|
@ -109,6 +96,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// About this instance.
|
||||
/// </summary>
|
||||
|
|
@ -116,12 +104,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
return View ();
|
||||
}
|
||||
#if DEBUG
|
||||
public ActionResult Test ()
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Contact the specified email, reason and body.
|
||||
/// </summary>
|
||||
|
|
@ -142,10 +125,10 @@ namespace Yavsc.Controllers
|
|||
return View ();
|
||||
|
||||
// requires valid owner and admin email?
|
||||
if (OwnerEmail == null)
|
||||
if (YavscHelpers.OwnerEmail == null)
|
||||
throw new Exception ("No site owner!");
|
||||
|
||||
using (System.Net.Mail.MailMessage msg = new MailMessage(email,OwnerEmail,"[Contact] "+reason,body))
|
||||
using (System.Net.Mail.MailMessage msg = new MailMessage(email,YavscHelpers.OwnerEmail,"[Contact] "+reason,body))
|
||||
{
|
||||
msg.CC.Add(new MailAddress(YavscHelpers.Admail));
|
||||
using (System.Net.Mail.SmtpClient sc = new SmtpClient())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue