This commit is contained in:
2020-06-17 23:28:05 +00:00
parent 2cc99de152
commit c1efb235fe
4 changed files with 28 additions and 16 deletions

View File

@@ -134,7 +134,14 @@ namespace rockfishCore.Controllers
//inform customer and return no content //inform customer and return no content
var body = $"Thank you for your purchase!\nYour AyaNova license key is ready to be installed.\nAyaNova will fetch it automatically within 24 hours or you can force it to fetch immediately from the License page in AyaNova now.\n---\n{l}"; var body = $"Thank you for your purchase!\nYour AyaNova license key is ready to be installed.\nAyaNova will fetch it automatically within 24 hours or you can force it to fetch immediately from the License page in AyaNova now.\n---\n{l}";
//send license email //send license email
RfMail.SendMessage("support@ayanova.com", Customer.AdminEmail, "AyaNova license key", body, false); #if (DEBUG)
RfMail.SendMessage("support@ayanova.com", "cardjohn@ayanova.com", "AyaNova license key", body, false);
#else
throw new System.Exception("UNCOMMENT THIS FOR PRODUCTION");
// RfMail.SendMessage("support@ayanova.com", Customer.AdminEmail, "AyaNova license key", body, false);
#endif
return NoContent(); return NoContent();
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -102,15 +102,19 @@ namespace rockfishCore.Controllers
} }
//Get api/site/77/name //Get api/site/77/name
[HttpGet("{id}/customerinfo")] [HttpGet("{id}/newlicenseinfo")]
public async Task<IActionResult> GetCustomerInfo([FromRoute] long id) public async Task<IActionResult> GetNewLicenseInfo([FromRoute] long id)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
return BadRequest(ModelState); return BadRequest(ModelState);
} }
var custId = await ct.Site.AsNoTracking().Where(z => z.Id == id).Select(z => z.CustomerId).FirstAsync(); var site = await ct.Site.AsNoTracking().Where(z => z.Id == id).FirstOrDefaultAsync();
var custInfo = await ct.Customer.AsNoTracking().Where(z => z.Id == custId).Select(z => new { z.Name, z.Id }).SingleAsync(); if (site == null)
{
return NotFound();
}
var custInfo = await ct.Customer.AsNoTracking().Where(z => z.Id == site.CustomerId).Select(z => new { z.Name, z.Id, dbid = site.DbId }).SingleAsync();
return Ok(custInfo); return Ok(custInfo);
} }

View File

@@ -68,15 +68,15 @@ app.ravLicense = (function () {
//clean up the data before submit //clean up the data before submit
//submit //submit
alert("STUB submit"); // alert("STUB submit");
// app.api.createRavLicense(submitData, function (res) { app.api.createRavLicense(submitData, function (res) {
// if (res.error) { if (res.error) {
// $.gevent.publish('app-show-error', res.msg); $.gevent.publish('app-show-error', res.msg);
// } else { } else {
// $('#key').val(res); $('#key').val(res);
// return false; return false;
// } }
// }); });
return false; //prevent default return false; //prevent default
}; };
@@ -135,11 +135,12 @@ app.ravLicense = (function () {
//get company name to pre-fill regto //get company name to pre-fill regto
//api/site/77/name //api/site/77/name
app.api.get("site/" + stateMap.id + "/customerinfo", function (res) { app.api.get("site/" + stateMap.id + "/newlicenseinfo", function (res) {
if (res.error) { if (res.error) {
$.gevent.publish("app-show-error", res.msg); $.gevent.publish("app-show-error", res.msg);
} else { } else {
$("#registeredTo").val(res.name); $("#registeredTo").val(res.name);
$("#dbId").val(res.dbId);
} }
}); });

View File

@@ -14,7 +14,7 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label for="dbId">dbId</label> <label for="dbId">dbId</label>
<input class="form-control" type="text" id="dbId" name="dbId" value="23945a86-0aa7-46de-9485-539ec7d31b31"> <input class="form-control" type="text" id="dbId" name="dbId" value="">
</div> </div>
</div> </div>