* Makefile: builds the doc & htmldoc folders

* DataManager.cs: Doc generations

* T.cs:
* Global.asax.cs:
* Export.cs:
* Estim.tt:
* Estim.cs:
* TaskOutput.cs:
* FileInfoCollection.cs:
* RegisterPage.cs:
* BBCodeHelper.cs:
* MvcActionValueBinder.cs:
* YavscHelpers.cs:
* ValidateAjaxAttribute.cs:
* Entity.cs:
* IOrderInfo.cs:
* HomeController.cs:
* SimpleFormatter.cs:
* BlogsController.cs:
* AdminController.cs:
* SimpleJsonPostMethod.cs:
* WebCatalogExtensions.cs:
* GoogleController.cs:
* ModuleController.cs:
* BasketController.cs:
* AccountController.cs:
* TemplateException.cs:
* BlogsApiController.cs:
* EstimToPdfFormatter.cs:
* WorkFlowController.cs:
* FileSystemController.cs:
* BackOfficeController.cs:
* FrontOfficeController.cs:
* ThanksConfigurationSection.cs:
* ThanksConfigurationElement.cs:
* FrontOfficeApiController.cs:
* ModuleConfigurationElementCollection.cs: 

* Web.csproj: cleaning an obsolete IOrderIfno
This commit is contained in:
Paul Schneider 2015-01-27 00:41:20 +01:00
commit ae38718dd9
38 changed files with 848 additions and 277 deletions

View file

@ -15,6 +15,9 @@ using Yavsc.Helpers;
namespace Yavsc.Controllers
{
/// <summary>
/// Account controller.
/// </summary>
public class AccountController : Controller
{
private static string registrationMessage =
@ -25,7 +28,7 @@ namespace Yavsc.Controllers
/// <summary>
/// Gets or sets the avatar dir.
/// This value is past to <c>Server.MapPath</c>,
/// it should start with </c>~/</c>, and we assume it
/// it should start with <c>~/</c>, and we assume it
/// to be relative to the application path.
/// </summary>
/// <value>The avatar dir.</value>
@ -33,18 +36,28 @@ namespace Yavsc.Controllers
get { return avatarDir; }
set { avatarDir = value; }
}
/// <summary>
/// Index this instance.
/// </summary>
public ActionResult Index ()
{
return View ();
}
/// <summary>
/// Login the specified returnUrl.
/// </summary>
/// <param name="returnUrl">Return URL.</param>
public ActionResult Login (string returnUrl)
{
ViewData ["returnUrl"] = returnUrl;
return View ();
}
/// <summary>
/// Gets the profile.
/// </summary>
/// <returns>The profile.</returns>
/// <param name="user">User.</param>
public static Profile GetProfile (string user)
{
return new Profile (ProfileBase.Create (user));
@ -52,6 +65,12 @@ namespace Yavsc.Controllers
// TODO [ValidateAntiForgeryToken]
/// <summary>
/// Dos the login.
/// </summary>
/// <returns>The login.</returns>
/// <param name="model">Model.</param>
/// <param name="returnUrl">Return URL.</param>
public ActionResult DoLogin (LoginModel model, string returnUrl)
{
if (ModelState.IsValid) {
@ -71,7 +90,11 @@ namespace Yavsc.Controllers
// If we got this far, something failed, redisplay form
return View ("Login", model);
}
/// <summary>
/// Register the specified model and returnUrl.
/// </summary>
/// <param name="model">Model.</param>
/// <param name="returnUrl">Return URL.</param>
public ActionResult Register (RegisterViewModel model, string returnUrl)
{
ViewData ["returnUrl"] = returnUrl;
@ -151,19 +174,29 @@ namespace Yavsc.Controllers
}
return View (model);
}
/// <summary>
/// Changes the password success.
/// </summary>
/// <returns>The password success.</returns>
public ActionResult ChangePasswordSuccess ()
{
return View ();
}
/// <summary>
/// Changes the password.
/// </summary>
/// <returns>The password.</returns>
[HttpGet]
[Authorize]
public ActionResult ChangePassword ()
{
return View ();
}
/// <summary>
/// Unregister the specified confirmed.
/// </summary>
/// <param name="confirmed">If set to <c>true</c> confirmed.</param>
[Authorize]
public ActionResult Unregister (bool confirmed = false)
{
@ -175,6 +208,12 @@ namespace Yavsc.Controllers
return RedirectToAction ("Index", "Home");
}
/// <summary>
/// Changes the password.
/// </summary>
/// <returns>The password.</returns>
/// <param name="model">Model.</param>
[Authorize]
[HttpPost]
public ActionResult ChangePassword (ChangePasswordModel model)
@ -210,7 +249,10 @@ namespace Yavsc.Controllers
return View (model);
}
/// <summary>
/// Profile the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize]
[HttpGet]
public ActionResult Profile (Profile model)
@ -222,9 +264,13 @@ namespace Yavsc.Controllers
return View (model);
}
/// <summary>
/// Profile the specified model and AvatarFile.
/// </summary>
/// <param name="model">Model.</param>
/// <param name="AvatarFile">Avatar file.</param>
[Authorize]
[HttpPost]
//public ActionResult UpdateProfile(HttpPostedFileBase Avatar, string Address, string CityAndState, string ZipCode, string Country, string WebSite)
public ActionResult Profile (Profile model, HttpPostedFileBase AvatarFile)
{
string username = Membership.GetUser ().UserName;
@ -275,6 +321,10 @@ namespace Yavsc.Controllers
return View (model);
}
/// <summary>
/// Logout the specified returnUrl.
/// </summary>
/// <param name="returnUrl">Return URL.</param>
[Authorize]
public ActionResult Logout (string returnUrl)
{
@ -283,7 +333,11 @@ namespace Yavsc.Controllers
}
/// <summary>
/// Validate the specified id and key.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="key">Key.</param>
[HttpGet]
public ActionResult Validate (string id, string key)
{

View file

@ -20,6 +20,9 @@ namespace Yavsc.Controllers
/// </summary>
public class AdminController : Controller
{
/// <summary>
/// Index this instance.
/// </summary>
public ActionResult Index()
{
if (!Roles.RoleExists (adminRoleName)) {
@ -27,7 +30,12 @@ namespace Yavsc.Controllers
}
return View ();
}
/// <summary>
/// Inits the db.
/// </summary>
/// <returns>The db.</returns>
/// <param name="datac">Datac.</param>
/// <param name="doInit">Do init.</param>
public ActionResult InitDb(DataAccess datac, string doInit)
{
if (doInit=="on") {
@ -41,13 +49,21 @@ namespace Yavsc.Controllers
}
return View ();
}
/// <summary>
/// Backups the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize(Roles="Admin")]
public ActionResult Backups(DataAccess model)
{
return View (model);
}
/// <summary>
/// Creates the backup.
/// </summary>
/// <returns>The backup.</returns>
/// <param name="datac">Datac.</param>
[Authorize(Roles="Admin")]
public ActionResult CreateBackup(DataAccess datac)
{
@ -67,18 +83,31 @@ namespace Yavsc.Controllers
}
return View (datac);
}
/// <summary>
/// Creates the user backup.
/// </summary>
/// <returns>The user backup.</returns>
/// <param name="datac">Datac.</param>
/// <param name="username">Username.</param>
[Authorize(Roles="Admin")]
public ActionResult CreateUserBackup(DataAccess datac,string username)
{
throw new NotImplementedException();
}
/// <summary>
/// Upgrade the specified datac.
/// </summary>
/// <param name="datac">Datac.</param>
[Authorize(Roles="Admin")]
public ActionResult Upgrade(DataAccess datac) {
throw new NotImplementedException();
}
/// <summary>
/// Restore the specified datac, backupName and dataOnly.
/// </summary>
/// <param name="datac">Datac.</param>
/// <param name="backupName">Backup name.</param>
/// <param name="dataOnly">If set to <c>true</c> data only.</param>
[Authorize(Roles="Admin")]
public ActionResult Restore(DataAccess datac,string backupName,bool dataOnly=true)
{
@ -108,14 +137,25 @@ namespace Yavsc.Controllers
bks.Add (ti.Name);
ViewData ["Backups"] = bks.ToArray ();
}
/// <summary>
/// Removes from role.
/// </summary>
/// <returns>The from role.</returns>
/// <param name="username">Username.</param>
/// <param name="rolename">Rolename.</param>
/// <param name="returnUrl">Return URL.</param>
[Authorize(Roles="Admin")]
public ActionResult RemoveFromRole(string username, string rolename, string returnUrl)
{
Roles.RemoveUserFromRole(username,rolename);
return Redirect(returnUrl);
}
/// <summary>
/// Removes the user.
/// </summary>
/// <returns>The user.</returns>
/// <param name="username">Username.</param>
/// <param name="submitbutton">Submitbutton.</param>
[Authorize(Roles="Admin")]
public ActionResult RemoveUser (string username, string submitbutton)
{
@ -126,6 +166,12 @@ namespace Yavsc.Controllers
}
return RedirectToAction("UserList");
}
/// <summary>
/// Removes the role.
/// </summary>
/// <returns>The role.</returns>
/// <param name="rolename">Rolename.</param>
/// <param name="submitbutton">Submitbutton.</param>
[Authorize(Roles="Admin")]
public ActionResult RemoveRole (string rolename, string submitbutton)
{
@ -135,14 +181,22 @@ namespace Yavsc.Controllers
}
return RedirectToAction("RoleList");
}
/// <summary>
/// Removes the role query.
/// </summary>
/// <returns>The role query.</returns>
/// <param name="rolename">Rolename.</param>
[Authorize(Roles="Admin")]
public ActionResult RemoveRoleQuery(string rolename)
{
ViewData["roletoremove"] = rolename;
return View ();
}
/// <summary>
/// Removes the user query.
/// </summary>
/// <returns>The user query.</returns>
/// <param name="username">Username.</param>
[Authorize(Roles="Admin")]
public ActionResult RemoveUserQuery(string username)
{

View file

@ -8,8 +8,14 @@ using Yavsc.Admin;
namespace Yavsc.Controllers
{
/// <summary>
/// Back office controller.
/// </summary>
public class BackOfficeController : Controller
{
/// <summary>
/// Index this instance.
/// </summary>
[Authorize(Roles="Admin,Providers")]
public ActionResult Index()
{

View file

@ -8,10 +8,19 @@ using Yavsc.Model.WorkFlow;
namespace Yavsc.ApiControllers
{
// TODO should mostly be an API Controller
/// <summary>
/// Basket controller.
/// </summary>
public class BasketController : ApiController
{
/// <summary>
/// The wfmgr.
/// </summary>
protected WorkFlowManager wfmgr = null;
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
@ -44,6 +53,10 @@ namespace Yavsc.ApiControllers
throw new NotImplementedException ();
}
/// <summary>
/// Yours the estimates.
/// </summary>
/// <returns>The estimates.</returns>
[HttpGet]
[Authorize]
public Estimate[] YourEstimates()
@ -52,6 +65,10 @@ namespace Yavsc.ApiControllers
Membership.GetUser().UserName);
}
/// <summary>
/// Order the specified bi.
/// </summary>
/// <param name="bi">Bi.</param>
[HttpGet]
public object Order (BasketImpact bi)
{

View file

@ -9,10 +9,17 @@ using Yavsc.Model.Blogs;
namespace Yavsc.ApiControllers
{
/// <summary>
/// Blogs API controller.
/// </summary>
public class BlogsApiController : ApiController
{
private const string adminRoleName = "Admin";
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
@ -21,6 +28,11 @@ namespace Yavsc.ApiControllers
}
}
/// <summary>
/// Tag the specified postid and tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
public long Tag (long postid,string tag) {
BlogEntry e = BlogManager.GetPost (postid);
if (!Roles.IsUserInRole ("Admin")) {
@ -34,7 +46,11 @@ namespace Yavsc.ApiControllers
}
return BlogManager.Tag (postid, tag);
}
/// <summary>
/// Removes the post.
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
public static void RemovePost(string user, string title) {
if (!Roles.IsUserInRole ("Admin")) {
string rguser = Membership.GetUser ().UserName;
@ -53,7 +69,10 @@ namespace Yavsc.ApiControllers
}
BlogManager.RemovePost (user, title);
}
/// <summary>
/// Removes the tag.
/// </summary>
/// <param name="tagid">Tagid.</param>
public void RemoveTag(long tagid) {
throw new NotImplementedException ();
}

View file

@ -22,6 +22,9 @@ using System.Net;
namespace Yavsc.Controllers
{
/// <summary>
/// Blogs controller.
/// </summary>
public class BlogsController : Controller
{
string defaultAvatarMimetype;
@ -29,11 +32,17 @@ namespace Yavsc.Controllers
WebConfigurationManager.AppSettings ["Name"];
string avatarDir = "~/avatars";
/// <summary>
/// Gets or sets the avatar dir.
/// </summary>
/// <value>The avatar dir.</value>
public string AvatarDir {
get { return avatarDir; }
set { avatarDir = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Controllers.BlogsController"/> class.
/// </summary>
public BlogsController ()
{
string[] defaultAvatarSpec = ConfigurationManager.AppSettings.Get ("DefaultAvatar").Split (';');
@ -42,7 +51,13 @@ namespace Yavsc.Controllers
defaultAvatar = defaultAvatarSpec [0];
defaultAvatarMimetype = defaultAvatarSpec [1];
}
/// <summary>
/// Index the specified user, title, pageIndex and pageSize.
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
public ActionResult Index (string user = null, string title = null, int pageIndex=0, int pageSize=10)
{
if (string.IsNullOrEmpty (user)) {
@ -64,7 +79,12 @@ namespace Yavsc.Controllers
}
}
/// <summary>
/// Blogs the list.
/// </summary>
/// <returns>The list.</returns>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
public ActionResult BlogList (int pageIndex = 0, int pageSize = 10)
{
ViewData ["SiteName"] = sitename;
@ -75,7 +95,13 @@ namespace Yavsc.Controllers
ViewData ["PageIndex"] = pageIndex;
return View ("Index", bs);
}
/// <summary>
/// Users the posts.
/// </summary>
/// <returns>The posts.</returns>
/// <param name="user">User.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
[HttpGet]
public ActionResult UserPosts (string user, int pageIndex = 0, int pageSize = 10)
{
@ -97,7 +123,11 @@ namespace Yavsc.Controllers
return View ("UserPosts", c);
}
/// <summary>
/// Removes the comment.
/// </summary>
/// <returns>The comment.</returns>
/// <param name="cmtid">Cmtid.</param>
[Authorize]
public ActionResult RemoveComment(long cmtid)
{
@ -138,7 +168,12 @@ namespace Yavsc.Controllers
ViewData ["Comments"] = BlogManager.GetComments (e.Id);
return View ("UserPost", e);
}
/// <summary>
/// Users the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
public ActionResult UserPost (string user, string title)
{
ViewData ["BlogUser"] = user;
@ -152,7 +187,11 @@ namespace Yavsc.Controllers
string prevstr = LocalizedText.Preview;
return UserPost (BlogManager.GetPost (user, title));
}
/// <summary>
/// Post the specified user and title.
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
[Authorize]
public ActionResult Post (string user, string title)
{
@ -163,7 +202,11 @@ namespace Yavsc.Controllers
ViewData ["UserName"] = un;
return View (new BlogEditEntryModel { Title = title });
}
/// <summary>
/// Validates the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="model">Model.</param>
[Authorize]
public ActionResult ValidatePost (BlogEditEntryModel model)
{
@ -178,7 +221,11 @@ namespace Yavsc.Controllers
}
return View ("Post", model);
}
/// <summary>
/// Validates the edit.
/// </summary>
/// <returns>The edit.</returns>
/// <param name="model">Model.</param>
[Authorize]
public ActionResult ValidateEdit (BlogEditEntryModel model)
{
@ -192,7 +239,10 @@ namespace Yavsc.Controllers
}
return View ("Edit", model);
}
/// <summary>
/// Edit the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize]
public ActionResult Edit (BlogEditEntryModel model)
{
@ -219,7 +269,10 @@ namespace Yavsc.Controllers
return View (model);
}
/// <summary>
/// Comment the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize]
public ActionResult Comment (BlogEditCommentModel model) {
string username = Membership.GetUser ().UserName;
@ -234,7 +287,10 @@ namespace Yavsc.Controllers
}
string defaultAvatar;
/// <summary>
/// Avatar the specified user.
/// </summary>
/// <param name="user">User.</param>
[AcceptVerbs (HttpVerbs.Get)]
public ActionResult Avatar (string user)
{

View file

@ -9,16 +9,24 @@ using System.Text.RegularExpressions;
namespace Yavsc.Controllers
{
/// <summary>
/// File system controller.
/// </summary>
public class FileSystemController : Controller
{
private static string usersDir ="~/users";
/// <summary>
/// Gets the users dir.
/// </summary>
/// <value>The users dir.</value>
public static string UsersDir {
get {
return usersDir;
}
}
/// <summary>
/// Index this instance.
/// </summary>
[Authorize]
public ActionResult Index()
{
@ -33,7 +41,10 @@ namespace Yavsc.Controllers
di.Create ();
return View (new FileInfoCollection( di.GetFiles()));
}
/// <summary>
/// Details the specified id.
/// </summary>
/// <param name="id">Identifier.</param>
public ActionResult Details(string id)
{
foreach (char x in Path.GetInvalidPathChars()) {
@ -51,11 +62,18 @@ namespace Yavsc.Controllers
return View (fi);
}
/// <summary>
/// Create this instance.
/// </summary>
public ActionResult Create()
{
return View ();
}
/// <summary>
/// Create the specified collection.
/// </summary>
/// <param name="collection">Collection.</param>
[HttpPost]
[Authorize]
public ActionResult Create(FormCollection collection)
@ -92,14 +110,24 @@ namespace Yavsc.Controllers
}
}
/// <summary>
/// Gets the base dir.
/// </summary>
/// <value>The base dir.</value>
public static string BaseDir { get { return Path.Combine (UsersDir, Membership.GetUser ().UserName); } }
/// <summary>
/// Edit the specified id.
/// </summary>
/// <param name="id">Identifier.</param>
public ActionResult Edit(int id)
{
return View ();
}
/// <summary>
/// Edit the specified id and collection.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="collection">Collection.</param>
[HttpPost]
public ActionResult Edit(int id, FormCollection collection)
{
@ -109,12 +137,19 @@ namespace Yavsc.Controllers
return View ();
}
}
/// <summary>
/// Delete the specified id.
/// </summary>
/// <param name="id">Identifier.</param>
public ActionResult Delete(int id)
{
return View ();
}
/// <summary>
/// Delete the specified id and collection.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="collection">Collection.</param>
[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{

View file

@ -26,80 +26,66 @@ using Yavsc.Model;
namespace Yavsc.ApiControllers
{
/// <summary>
/// Front office controller.
/// </summary>
public class FrontOfficeController : ApiController
{
/// <summary>
/// The wfmgr.
/// </summary>
protected WorkFlowManager wfmgr = null;
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
wfmgr = new WorkFlowManager ();
}
/// <summary>
/// Catalog this instance.
/// </summary>
[AcceptVerbs("GET")]
public Catalog Catalog ()
{
Catalog c = CatalogManager.GetCatalog (Request.RequestUri.AbsolutePath);
return c;
}
/// <summary>
/// Gets the product categorie.
/// </summary>
/// <returns>The product categorie.</returns>
/// <param name="brandName">Brand name.</param>
/// <param name="prodCategorie">Prod categorie.</param>
[AcceptVerbs("GET")]
public ProductCategory GetProductCategorie (string brandName, string prodCategorie)
{
return CatalogManager.GetCatalog (Request.RequestUri.AbsolutePath).GetBrand (brandName).GetProductCategory (prodCategorie)
;
}
/*
public HttpResponseMessage Post()
{
HttpResponseMessage result = null;
var httpRequest = HttpContext.Current.Request;
if (httpRequest.Files.Count > 0)
{
string username = HttpContext.Current.User.Identity.Name;
int nbf = 0;
foreach(string file in httpRequest.Files)
{
var postedFile = httpRequest.Files[file];
string filePath = HttpContext.Current.Server.MapPath("~/users/"+username+"/"+ postedFile.FileName);
postedFile.SaveAs(filePath);
nbf++;
}
result = Request.CreateResponse <string>(HttpStatusCode.Created,
string.Format("Received {0} files",nbf));
}
else
{
result = Request.CreateResponse <string>(HttpStatusCode.BadRequest,"No file received");
}
return result;
}
*/
/*
[Authorize]
public IOrderInfo Order()
{
}
*/
[Authorize]
[HttpGet]
/// <summary>
/// Gets the estimate.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="estid">Estid.</param>
/// <param name="Id">Estimate Id.</param>
[Authorize]
[HttpGet]
public Estimate GetEstimate (long Id)
{
Estimate est = wfmgr.ContentProvider.GetEstimate (Id);
return est;
}
/// <summary>
/// Gets the estim tex.
/// </summary>
/// <returns>The estim tex.</returns>
/// <param name="estimid">Estimid.</param>
[AcceptVerbs("GET")]
public HttpResponseMessage GetEstimTex(long estimid)
{

View file

@ -22,19 +22,29 @@ namespace Yavsc.Controllers
/// </summary>
public class FrontOfficeController : Controller
{
/// <summary>
/// The wfmgr.
/// </summary>
protected WorkFlowManager wfmgr = null;
/// <summary>
/// Initialize the specified requestContext.
/// </summary>
/// <param name="requestContext">Request context.</param>
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
{
base.Initialize (requestContext);
wfmgr = new WorkFlowManager ();
}
/// <summary>
/// Index this instance.
/// </summary>
public ActionResult Index ()
{
return View ();
}
/// <summary>
/// Estimates this instance.
/// </summary>
[Authorize]
public ActionResult Estimates ()
{
@ -42,7 +52,11 @@ namespace Yavsc.Controllers
return View(wfmgr.GetEstimates (username));
}
/// <summary>
/// Estimate the specified model and submit.
/// </summary>
/// <param name="model">Model.</param>
/// <param name="submit">Submit.</param>
[Authorize]
public ActionResult Estimate(Estimate model,string submit)
{
@ -86,7 +100,9 @@ namespace Yavsc.Controllers
}
return View(model);
}
/// <summary>
/// Catalog this instance.
/// </summary>
[AcceptVerbs("GET")]
public ActionResult Catalog ()
{
@ -109,18 +125,24 @@ namespace Yavsc.Controllers
/// <summary>
/// get the product category
/// </summary>
/// <returns>The category.</returns>
/// <param name="bn">Bn.</param>
/// <param name="pc">Pc.</param>
/// <returns>The category object.</returns>
/// <param name="brandid">Brand id.</param>
/// <param name="pcid">Product category Id.</param>
[AcceptVerbs("GET")]
public ActionResult ProductCategory (string id, string pc)
public ActionResult ProductCategory (string brandid, string pcid)
{
ViewData ["BrandName"] = id;
ViewData ["BrandId"] = brandid;
ViewData ["ProductCategoryId"] = pcid;
return View (
CatalogManager.GetCatalog (Request.Url.AbsolutePath).GetBrand (id).GetProductCategory (pc)
CatalogManager.GetCatalog (Request.Url.AbsolutePath).GetBrand (brandid).GetProductCategory (pcid)
);
}
/// <summary>
/// Product the specified id, pc and pref.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="pc">Pc.</param>
/// <param name="pref">Preference.</param>
[AcceptVerbs("GET")]
public ActionResult Product (string id, string pc, string pref)
{
@ -151,12 +173,18 @@ namespace Yavsc.Controllers
return View ((p is Service)?"Service":"Product", p);
}
/// <summary>
/// Command this instance.
/// </summary>
public ActionResult Command()
{
return View ();
}
/// <summary>
/// Command the specified collection.
/// </summary>
/// <param name="collection">Collection.</param>
[HttpPost]
[Authorize]
public ActionResult Command(FormCollection collection)

View file

@ -20,6 +20,9 @@ using Yavsc.Helpers.Google;
namespace Yavsc.Controllers
{
/// <summary>
/// Google controller.
/// </summary>
public class GoogleController : Controller
{
@ -44,7 +47,10 @@ namespace Yavsc.Controllers
Request.Url.Authority + "/Google/CalAuth";
}
}
/// <summary>
/// Login the specified returnUrl.
/// </summary>
/// <param name="returnUrl">Return URL.</param>
public void Login (string returnUrl)
{
if (string.IsNullOrWhiteSpace (returnUrl))
@ -54,13 +60,15 @@ namespace Yavsc.Controllers
oa.Login (Response, SetSessionSate ());
}
[HttpGet]
[Authorize]
/// <summary>
/// Called after the Google authorizations screen,
/// we assume that <c>Session</c> contains a redirectUrl entry
/// </summary>
/// <returns>The auth.</returns>
[HttpGet]
[Authorize]
public ActionResult CalAuth ()
{
string msg;
@ -95,10 +103,9 @@ namespace Yavsc.Controllers
HttpContext.Profile.Save ();
}
/// <summary>
/// Auth this instance.
/// </summary>
[HttpGet]
public ActionResult Auth ()
{
@ -205,6 +212,11 @@ namespace Yavsc.Controllers
return View ();
}
/// <summary>
/// Chooses the calendar.
/// </summary>
/// <returns>The calendar.</returns>
/// <param name="returnUrl">Return URL.</param>
[Authorize]
[HttpGet]
public ActionResult ChooseCalendar (string returnUrl)
@ -222,7 +234,12 @@ namespace Yavsc.Controllers
ViewData ["json"] = json;
return View (cl);
}
/// <summary>
/// Sets the calendar.
/// </summary>
/// <returns>The calendar.</returns>
/// <param name="calchoice">Calchoice.</param>
[HttpPost]
[Authorize]
public ActionResult SetCalendar (string calchoice)
@ -237,14 +254,23 @@ namespace Yavsc.Controllers
}
return Redirect ("/");
}
/// <summary>
/// Dates the query.
/// </summary>
/// <returns>The query.</returns>
[Authorize]
[HttpGet]
public ActionResult DateQuery ()
{
return View (new AskForADate ());
}
/// <summary>
/// Dates the query.
/// </summary>
/// <returns>The query.</returns>
/// <param name="model">Model.</param>
[Authorize]
[HttpPost]
public ActionResult DateQuery (AskForADate model)

View file

@ -14,6 +14,9 @@ using Yavsc.Model;
namespace Yavsc.Controllers
{
/// <summary>
/// Home controller.
/// </summary>
public class HomeController : Controller
{
// Site name
@ -43,7 +46,10 @@ namespace Yavsc.Controllers
return admail;
}
}
/// <summary>
/// Assemblies the info.
/// </summary>
/// <returns>The info.</returns>
public ActionResult AssemblyInfo()
{
AssemblyName[] model = GetType ().Assembly.GetReferencedAssemblies ();
@ -66,7 +72,9 @@ namespace Yavsc.Controllers
owneremail = value;
}
}
/// <summary>
/// Index this instance.
/// </summary>
public ActionResult Index ()
{
string startPage = WebConfigurationManager.AppSettings ["StartPage"];
@ -75,7 +83,12 @@ namespace Yavsc.Controllers
ViewData ["Message"] = LocalizedText.Welcome;
return View ();
}
/// <summary>
/// Contact the specified email, reason and body.
/// </summary>
/// <param name="email">Email.</param>
/// <param name="reason">Reason.</param>
/// <param name="body">Body.</param>
public ActionResult Contact (string email, string reason, string body)
{
if (email==null)

View file

@ -1,37 +0,0 @@
using System;
using Yavsc;
using SalesCatalog;
using SalesCatalog.Model;
using System.Web.Routing;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Web.Http;
using System.Net.Http;
using System.Web;
using System.Linq;
using System.IO;
using System.Net;
using WorkFlowProvider;
using System.Web.Security;
using Yavsc.Model.WorkFlow;
using System.Reflection;
using System.Collections.Generic;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Controllers;
using Yavsc.Formatters;
using System.Text;
using System.Web.Profile;
namespace Yavsc.ApiControllers
{
public interface IOrderInfo
{
DateTime Creation { get; set; }
string Status { get; set; }
long OrderId { get; set; }
Object [] Details { get; set; }
}
}

View file

@ -8,8 +8,15 @@ using System.Configuration;
namespace Yavsc.Controllers
{
/// <summary>
/// Module controller.
/// </summary>
public class ModuleController : Controller
{
/// <summary>
/// Initialize the specified requestContext.
/// </summary>
/// <param name="requestContext">Request context.</param>
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
{
base.Initialize (requestContext);
@ -18,7 +25,9 @@ namespace Yavsc.Controllers
}
// List<IModule> modules = new List<IModule> ();
/// <summary>
/// Index this instance.
/// </summary>
public ActionResult Index()
{
return View ();

View file

@ -25,7 +25,6 @@ using System.Collections.Specialized;
namespace Yavsc.ApiControllers
{
class TemplateException : Exception
{
public TemplateException(string message):base(message)

View file

@ -12,10 +12,20 @@ using System.Web.Http;
namespace Yavsc.ApiControllers
{
/// <summary>
/// Work flow controller.
/// </summary>
public class WorkFlowController : ApiController
{
string adminRoleName="Admin";
/// <summary>
/// The wfmgr.
/// </summary>
protected WorkFlowManager wfmgr = null;
/// <summary>
/// Initialize the specified controllerContext.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (HttpControllerContext controllerContext)
{
// TODO move it in a module initialization
@ -26,6 +36,13 @@ namespace Yavsc.ApiControllers
wfmgr = new WorkFlowManager ();
}
/// <summary>
/// Creates the estimate.
/// </summary>
/// <returns>The estimate.</returns>
/// <param name="title">Title.</param>
/// <param name="client">Client.</param>
/// <param name="description">Description.</param>
[HttpGet]
[Authorize]
public Estimate CreateEstimate (string title,string client,string description)
@ -34,6 +51,10 @@ namespace Yavsc.ApiControllers
Membership.GetUser().UserName,client,title,description);
}
/// <summary>
/// Drops the writting.
/// </summary>
/// <param name="wrid">Wrid.</param>
[HttpGet]
[Authorize]
public void DropWritting(long wrid)
@ -41,8 +62,10 @@ namespace Yavsc.ApiControllers
wfmgr.DropWritting (wrid);
}
/// <summary>
/// Drops the estimate.
/// </summary>
/// <param name="estid">Estid.</param>
[HttpGet]
[Authorize]
public void DropEstimate(long estid)
@ -50,6 +73,9 @@ namespace Yavsc.ApiControllers
wfmgr.DropEstimate (estid);
}
/// <summary>
/// Index this instance.
/// </summary>
[HttpGet]
[Authorize]
public object Index()
@ -71,6 +97,11 @@ namespace Yavsc.ApiControllers
errs);
}
/// <summary>
/// Updates the writting.
/// </summary>
/// <returns>The writting.</returns>
/// <param name="wr">Wr.</param>
[Authorize]
[AcceptVerbs("POST")]
[ValidateAjax]
@ -80,14 +111,14 @@ namespace Yavsc.ApiControllers
return Request.CreateResponse (System.Net.HttpStatusCode.OK);
}
[AcceptVerbs("POST")]
[Authorize]
[ValidateAjax]
/// <summary>
/// Adds the specified imputation to the given estimation by estimation id.
/// </summary>
/// <param name="estid">Estimation identifier</param>
/// <param name="wr">Imputation to add</param>
[AcceptVerbs("POST")]
[Authorize]
[ValidateAjax]
public HttpResponseMessage Write ([FromUri] long estid, [FromBody] Writting wr) {
if (estid <= 0) {
ModelState.AddModelError ("EstimationId", "Spécifier un identifiant d'estimation valide");