This commit is contained in:
@@ -93,6 +93,8 @@ namespace rockfishCore.Controllers
|
|||||||
public IEnumerable<dtoNameIdChildrenItem> GetActiveSubsForSites([FromRoute] long id)
|
public IEnumerable<dtoNameIdChildrenItem> GetActiveSubsForSites([FromRoute] long id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
long EpochNow = DateUtil.NowAsEpoch();
|
||||||
|
|
||||||
var res = from c in _context.Site
|
var res = from c in _context.Site
|
||||||
.Where(c => c.CustomerId.Equals(id)).OrderBy(c => c.Name)
|
.Where(c => c.CustomerId.Equals(id)).OrderBy(c => c.Name)
|
||||||
select new dtoNameIdChildrenItem
|
select new dtoNameIdChildrenItem
|
||||||
@@ -108,7 +110,7 @@ namespace rockfishCore.Controllers
|
|||||||
{
|
{
|
||||||
var subs = from c in _context.Purchase
|
var subs = from c in _context.Purchase
|
||||||
.Where(c => c.SiteId.Equals(child.id))
|
.Where(c => c.SiteId.Equals(child.id))
|
||||||
.Where(c => c.CancelDate == null)
|
.Where(c => c.CancelDate == null || c.CancelDate > EpochNow)
|
||||||
.OrderByDescending(c => c.PurchaseDate)
|
.OrderByDescending(c => c.PurchaseDate)
|
||||||
select new dtoNameIdItem
|
select new dtoNameIdItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -328,45 +328,48 @@ namespace rockfishCore.Util
|
|||||||
|
|
||||||
quoted.WriteLine("On {0}, {1} wrote:", message.Date.ToString("f"), name);
|
quoted.WriteLine("On {0}, {1} wrote:", message.Date.ToString("f"), name);
|
||||||
|
|
||||||
//TODO: get text message just like in reader here for html only message
|
//Try to get the original message text and format it as > quoted
|
||||||
//sometimes body text is empty.
|
|
||||||
/*
|
var theBody = message.GetTextBody(MimeKit.Text.TextFormat.Plain);
|
||||||
var theBody = m.GetTextBody(MimeKit.Text.TextFormat.Plain);
|
|
||||||
if (theBody == null)
|
if (theBody == null)
|
||||||
{
|
{
|
||||||
//might be an html email, try to get the text anyway
|
//No text body so go with the new method to extract the text part
|
||||||
var ht = m.HtmlBody;
|
// might be an html email, try to get the text anyway
|
||||||
|
var ht = message.HtmlBody;
|
||||||
if (!string.IsNullOrWhiteSpace(ht))
|
if (!string.IsNullOrWhiteSpace(ht))
|
||||||
{
|
{
|
||||||
theBody = "**** HTML-ONLY MESSAGE ****";
|
|
||||||
theBody += "\r\n=-=-=-=- TEXT CONVERSION =-=-=-=-\r\n";
|
theBody = StripHTML(ht, true);
|
||||||
theBody += StripHTML(ht, true);
|
theBody += "> ";
|
||||||
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
|
theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>');
|
||||||
theBody += "\r\n=-=-=-=- SOURCE HTML =-=-=-=-\r\n";
|
theBody ="\r\n"+theBody;//descend the first line under the On you wrote bit
|
||||||
theBody += ht;
|
|
||||||
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
|
|
||||||
theBody += "\r\n******* END MESSAGE *******";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theBody = "NO MESSAGE BODY WAS FOUND NEITHER HTML NOR TEXT";
|
theBody = "> Source Message Empty";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quoted.WriteLine(theBody);
|
||||||
}
|
}
|
||||||
sb.AppendLine(theBody);
|
else
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
using (var reader = new StringReader(message.TextBody))
|
|
||||||
{
|
{
|
||||||
string line;
|
//has a text body so go with old method
|
||||||
|
using (var reader = new StringReader(message.TextBody))
|
||||||
while ((line = reader.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
quoted.Write("> ");
|
string line;
|
||||||
quoted.WriteLine(line);
|
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
quoted.Write("> ");
|
||||||
|
quoted.WriteLine(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reply.Body = new TextPart("plain")
|
reply.Body = new TextPart("plain")
|
||||||
{
|
{
|
||||||
Text = replyBody + "\r\n\r\n\r\n" + quoted.ToString()
|
Text = replyBody + "\r\n\r\n\r\n" + quoted.ToString()
|
||||||
|
|||||||
@@ -7,139 +7,155 @@
|
|||||||
|
|
||||||
/*global $, app */
|
/*global $, app */
|
||||||
|
|
||||||
app.purchases = (function () {
|
app.purchases = (function() {
|
||||||
'use strict';
|
"use strict";
|
||||||
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
|
||||||
var
|
var configMap = {
|
||||||
|
//main_html: '',
|
||||||
|
|
||||||
configMap = {
|
settable_map: {}
|
||||||
//main_html: '',
|
},
|
||||||
|
stateMap = {
|
||||||
|
$append_target: null
|
||||||
|
},
|
||||||
|
onSubmit,
|
||||||
|
loadList,
|
||||||
|
configModule,
|
||||||
|
initModule;
|
||||||
|
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||||
|
|
||||||
settable_map: {}
|
//------------------- BEGIN UTILITY METHODS ------------------
|
||||||
},
|
loadList = function() {
|
||||||
stateMap = {
|
var epochNow = Math.round(new Date().getTime() / 1000);
|
||||||
$append_target: null
|
|
||||||
},
|
|
||||||
onSubmit, loadList, configModule, initModule;
|
|
||||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
|
||||||
|
|
||||||
//------------------- BEGIN UTILITY METHODS ------------------
|
//----
|
||||||
loadList = function () {
|
//fetch
|
||||||
//----
|
app.api.get("site/" + stateMap.id + "/purchases", function(res) {
|
||||||
//fetch
|
if (res.error) {
|
||||||
app.api.get('site/' + stateMap.id + '/purchases', function (res) {
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
if (res.error) {
|
} else {
|
||||||
$.gevent.publish('app-show-error',res.msg);
|
//get the list ul
|
||||||
} else {
|
var $appList = $("#rf-list");
|
||||||
//get the list ul
|
$appList.empty();
|
||||||
var $appList = $('#rf-list');
|
$.each(res, function(i, obj) {
|
||||||
$appList.empty();
|
//bugbug: don't just check for the presence of a cancel date but also is it in the past otherwise it's not cancelled
|
||||||
$.each(res, function (i, obj) {
|
if (obj.cancelDate && obj.cancelDate < epochNow) {
|
||||||
|
$appList.append(
|
||||||
|
"<li class='rfc-list-item-inactive'><a href=\"#!/purchaseEdit/" +
|
||||||
|
obj.id +
|
||||||
|
"/" +
|
||||||
|
stateMap.id +
|
||||||
|
'">' +
|
||||||
|
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||||
|
// ' ' +
|
||||||
|
"<span class='text-muted'>" +
|
||||||
|
app.utilB.genListColumn(obj.name) +
|
||||||
|
" cancelled " +
|
||||||
|
app.utilB.genListColumn(
|
||||||
|
app.utilB.epochToShortDate(obj.cancelDate)
|
||||||
|
) +
|
||||||
|
"</span>" +
|
||||||
|
"</a></li>"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$appList.append(
|
||||||
|
'<li><a href="#!/purchaseEdit/' +
|
||||||
|
obj.id +
|
||||||
|
"/" +
|
||||||
|
stateMap.id +
|
||||||
|
'">' +
|
||||||
|
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
||||||
|
// ' ' +
|
||||||
|
app.utilB.genListColumn(obj.name) +
|
||||||
|
" expires " +
|
||||||
|
app.utilB.genListColumn(
|
||||||
|
app.utilB.epochToShortDate(obj.expireDate)
|
||||||
|
) +
|
||||||
|
"</a></li>"
|
||||||
|
);
|
||||||
|
|
||||||
if (obj.cancelDate) {
|
//
|
||||||
$appList.append("<li class='rfc-list-item-inactive'><a href=\"#!/purchaseEdit/" + obj.id + "/" + stateMap.id + "\">" +
|
}
|
||||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
|
||||||
// ' ' +
|
|
||||||
"<span class='text-muted'>"+
|
|
||||||
app.utilB.genListColumn(obj.name) +
|
|
||||||
" cancelled " +
|
|
||||||
app.utilB.genListColumn(app.utilB.epochToShortDate(obj.cancelDate)) +
|
|
||||||
"</span>"+
|
|
||||||
"</a></li>");
|
|
||||||
} else {
|
|
||||||
$appList.append("<li><a href=\"#!/purchaseEdit/" + obj.id + "/" + stateMap.id + "\">" +
|
|
||||||
// app.utilB.genListColumn(app.utilB.epochToShortDate(obj.purchaseDate)) +
|
|
||||||
// ' ' +
|
|
||||||
app.utilB.genListColumn(obj.name) +
|
|
||||||
" expires " +
|
|
||||||
app.utilB.genListColumn(app.utilB.epochToShortDate(obj.expireDate)) +
|
|
||||||
"</a></li>");
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//------
|
}
|
||||||
|
});
|
||||||
|
//------
|
||||||
|
};
|
||||||
|
//-------------------- END UTILITY METHODS -------------------
|
||||||
|
|
||||||
|
//--------------------- BEGIN DOM METHODS --------------------
|
||||||
|
|
||||||
|
// Begin private DOM methods
|
||||||
|
|
||||||
|
// End private DOM methods
|
||||||
|
//---------------------- END DOM METHODS ---------------------
|
||||||
|
|
||||||
|
//------------------- BEGIN EVENT HANDLERS -------------------
|
||||||
|
|
||||||
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
|
|
||||||
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
|
//CONFIGMODULE
|
||||||
|
//
|
||||||
|
configModule = function(context) {
|
||||||
|
stateMap.context = context.context;
|
||||||
|
if (stateMap.context.params.id) {
|
||||||
|
stateMap.id = stateMap.context.params.id;
|
||||||
}
|
}
|
||||||
//-------------------- END UTILITY METHODS -------------------
|
};
|
||||||
|
|
||||||
//--------------------- BEGIN DOM METHODS --------------------
|
// Begin public method /initModule/
|
||||||
|
// Example : app.customer.initModule( $('#div_id') );
|
||||||
|
// Purpose : directs the module to being offering features
|
||||||
|
// Arguments : $container - container to use
|
||||||
|
// Action : Provides interface
|
||||||
|
// Returns : none
|
||||||
|
// Throws : none
|
||||||
|
//
|
||||||
|
initModule = function($container) {
|
||||||
|
if (typeof $container === "undefined") {
|
||||||
|
$container = $("#app-shell-main-content");
|
||||||
|
}
|
||||||
|
stateMap.sortOrder = "d";
|
||||||
|
$container.html(Handlebars.templates["app.purchases"]({}));
|
||||||
|
|
||||||
|
if (!stateMap.id) {
|
||||||
|
throw "app.purchases.js::initModule - There is no stateMap.id!";
|
||||||
|
}
|
||||||
|
|
||||||
|
app.api.get("site/" + stateMap.id, function(res) {
|
||||||
|
if (res.error) {
|
||||||
// Begin private DOM methods
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
//Context menu
|
||||||
|
app.nav.contextClear();
|
||||||
// End private DOM methods
|
app.nav.contextAddLink(
|
||||||
//---------------------- END DOM METHODS ---------------------
|
"purchaseEdit/new/" + stateMap.id,
|
||||||
|
"New",
|
||||||
//------------------- BEGIN EVENT HANDLERS -------------------
|
"plus"
|
||||||
|
);
|
||||||
|
app.nav.contextAddLink(
|
||||||
|
"customerEdit/" + res.customerId,
|
||||||
|
"Customer",
|
||||||
//-------------------- END EVENT HANDLERS --------------------
|
"account"
|
||||||
|
);
|
||||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
app.nav.contextAddLink(
|
||||||
//CONFIGMODULE
|
"customerSiteEdit/" + stateMap.id + "/" + res.customerId,
|
||||||
//
|
"Site",
|
||||||
configModule = function (context) {
|
"city"
|
||||||
stateMap.context = context.context;
|
);
|
||||||
if (stateMap.context.params.id) {
|
if (stateMap.id) {
|
||||||
stateMap.id = stateMap.context.params.id;
|
loadList();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// End public method /initModule/
|
||||||
|
|
||||||
// Begin public method /initModule/
|
// return public methods
|
||||||
// Example : app.customer.initModule( $('#div_id') );
|
return {
|
||||||
// Purpose : directs the module to being offering features
|
configModule: configModule,
|
||||||
// Arguments : $container - container to use
|
initModule: initModule
|
||||||
// Action : Provides interface
|
};
|
||||||
// Returns : none
|
//------------------- END PUBLIC METHODS ---------------------
|
||||||
// Throws : none
|
})();
|
||||||
//
|
|
||||||
initModule = function ($container) {
|
|
||||||
if (typeof $container === 'undefined') {
|
|
||||||
$container = $('#app-shell-main-content');
|
|
||||||
}
|
|
||||||
stateMap.sortOrder = 'd';
|
|
||||||
$container.html(Handlebars.templates['app.purchases']({}));
|
|
||||||
|
|
||||||
if (!stateMap.id) {
|
|
||||||
throw ('app.purchases.js::initModule - There is no stateMap.id!');
|
|
||||||
}
|
|
||||||
|
|
||||||
app.api.get('site/' + stateMap.id, function (res) {
|
|
||||||
if (res.error) {
|
|
||||||
$.gevent.publish('app-show-error',res.msg);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//Context menu
|
|
||||||
app.nav.contextClear();
|
|
||||||
app.nav.contextAddLink('purchaseEdit/new/' + stateMap.id, "New", "plus");
|
|
||||||
app.nav.contextAddLink("customerEdit/" + res.customerId, "Customer", "account");
|
|
||||||
app.nav.contextAddLink("customerSiteEdit/" + stateMap.id + '/' + res.customerId, "Site", "city");
|
|
||||||
if (stateMap.id) {
|
|
||||||
loadList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// End public method /initModule/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// return public methods
|
|
||||||
return {
|
|
||||||
configModule: configModule,
|
|
||||||
initModule: initModule
|
|
||||||
};
|
|
||||||
//------------------- END PUBLIC METHODS ---------------------
|
|
||||||
}());
|
|
||||||
|
|||||||
Reference in New Issue
Block a user