Google date quey,
refactiring, docpage * Yavsc.sln: * Web.csproj: * YavscModel.csproj: * OtherWebException.cs: * ProjectInfo.cs: * IValueProvider.cs: * CalendarApi.cs: * HomeController.cs: * TemplateException.cs: * WorkFlowController.cs: * NpgsqlWorkflow.csproj: * GoogleErrorMessage.cs: * ITCPNpgsqlProvider.cs: * NpgsqlContentProvider.cs: * ITContentProvider.csproj: * FrontOfficeApiController.cs: * NpgsqlContentProvider.csproj: refactoring * App.master: * WebApiConfig.cs: New Web api configuration architecture * SalesCatalog.csproj: * XmlCatalogProvider.cs: using MVC to get the catalog xml filename * WorkFlowManager.cs: * FrontOfficeController.cs: * CatalogManager.cs: No more extra argument to get the catalog * DateQuery.aspx: * AskForADate.cs: * GoogleController.cs: Google Date new query model * style.css: * BBCodeHelper.cs: Doc page responsive design * Service.cs: * SetPrice.cs: xml doc * WebApiConfig.cs: refactioring
This commit is contained in:
parent
7b0dd0c1e2
commit
721b11eba3
29 changed files with 124 additions and 104 deletions
|
|
@ -288,14 +288,13 @@ namespace Yavsc.Controllers
|
|||
public ActionResult DateQuery (AskForADate model)
|
||||
{
|
||||
if (ModelState.IsValid) {
|
||||
if (model.MinDate < DateTime.Now) {
|
||||
ModelState.AddModelError ("MinTime", "This first date must be in the future.");
|
||||
return View (model);
|
||||
}
|
||||
if (model.MinDate > model.MaxDate) {
|
||||
ModelState.AddModelError ("MinTime", "This first date must be lower than the second one.");
|
||||
return View (model);
|
||||
}
|
||||
|
||||
DateTime mindate = DateTime.Now;
|
||||
if (model.PreferedDate < mindate)
|
||||
model.PreferedDate = mindate;
|
||||
if (model.MaxDate < mindate)
|
||||
model.MaxDate = mindate.AddYears (1);
|
||||
|
||||
var muc = Membership.FindUsersByName (model.UserName);
|
||||
if (muc.Count == 0) {
|
||||
ModelState.AddModelError ("UserName", "Non existent user");
|
||||
|
|
@ -309,22 +308,18 @@ namespace Yavsc.Controllers
|
|||
return View (model);
|
||||
}
|
||||
|
||||
DateTime mindate = model.MinDate;
|
||||
mindate = mindate.AddHours (int.Parse (model.MinTime.Substring (0, 2)));
|
||||
mindate = mindate.AddMinutes (int.Parse (model.MinTime.Substring (3, 2)));
|
||||
DateTime maxdate = model.MaxDate;
|
||||
maxdate = maxdate.AddHours (int.Parse (model.MaxTime.Substring (0, 2)));
|
||||
maxdate = maxdate.AddMinutes (int.Parse (model.MaxTime.Substring (3, 2)));
|
||||
|
||||
CalendarApi c = new CalendarApi ();
|
||||
CalendarEntryList res;
|
||||
try {
|
||||
res = c.GetCalendar (calid, mindate, maxdate, upr);
|
||||
} catch (GoogleErrorException ex) {
|
||||
} catch (OtherWebException ex) {
|
||||
ViewData ["Title"] = ex.Title;
|
||||
ViewData ["Content"] = ex.Content;
|
||||
return View ("GoogleErrorMessage", ex);
|
||||
}
|
||||
|
||||
return View (res);
|
||||
}
|
||||
return View (model);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue