public async Task <bool> DisplayURIAsync(StringWriter writer, ContentURI uri, DataHelpers.GeneralHelpers.DOC_STATE_NUMBER displayDocType) { bool bIsCompleted = false; if (displayDocType == DataHelpers.GeneralHelpers.DOC_STATE_NUMBER.thirddoc) { if (uri.URIDataManager.NeedsFullView == false && uri.URIDataManager.NeedsSummaryView == false) { uri.ErrorMessage += AppHelper.GetErrorMessage("DISPLAYHELPER_DONTNEEDHTMLDOC"); return(bIsCompleted); } } //don't let existing errors interfere with html generation string sErrorMsg = uri.ErrorMessage; uri.ErrorMessage = string.Empty; //xhtml state is saved to increase performance and improve packaging string sDocToReadPath = await DataHelpers.AddInHelper.GetDevTrekPath(uri, displayDocType); if (await DataHelpers.FileStorageIO.URIAbsoluteExists(uri, sDocToReadPath)) { //first uri string sHtmlFragDocPath = string.Empty; string sHtmlDocPath = string.Empty; //ajax state management needs html fragments (for partial page updates) //the html fragment can be reused in full html doc bool bHasHtmlDoc = await SaveFullXhtmlDocFromXmlDoc2Async(uri, sDocToReadPath, sHtmlFragDocPath, DataAppHelpers.Resources.FILEEXTENSION_TYPES.frag, displayDocType); sHtmlFragDocPath = uri.URIDataManager.MiscDocPath; if (bHasHtmlDoc) { //init with frag file sHtmlDocPath = sHtmlFragDocPath; //restful state management needs full xhtml documents (for ebook packages) await SaveFullXhtmlDocFromXmlDoc2Async(uri, sDocToReadPath, sHtmlDocPath, DataAppHelpers.Resources.FILEEXTENSION_TYPES.html, displayDocType); sHtmlDocPath = uri.URIDataManager.MiscDocPath; //write the fragment html doc to the writer DataHelpers.FileStorageIO oFileStorageIO = new DataHelpers.FileStorageIO(); await oFileStorageIO.SaveHtmlURIToWriterAsync(uri, writer, sHtmlFragDocPath); if (string.IsNullOrEmpty(uri.ErrorMessage)) { //check whether additional html files are needed //(i.e. full, rather than summary, docs) await SaveFullXhtmlDocFromFullXmlDoc1Async(writer, uri, sDocToReadPath, displayDocType); } } else { if (displayDocType == DataHelpers.GeneralHelpers.DOC_STATE_NUMBER.seconddoc) { //if it doesn't have an addin it's not an error bool bHasAddIn = DataHelpers.LinqHelpers.LinkedViewHaveAddIn(uri.URIDataManager.LinkedView); if (bHasAddIn) { string sComplexMsg = uri.ErrorMessage; uri.ErrorMessage = AppHelper.GetErrorMessage("DISPLAYHELPER_NOHTMLFILE"); uri.ErrorMessage += sComplexMsg; } } else { string sComplexMsg = uri.ErrorMessage; uri.ErrorMessage = AppHelper.GetErrorMessage("DISPLAYHELPER_NOHTMLFILE"); uri.ErrorMessage += sComplexMsg; } } } else { if (displayDocType == DataHelpers.GeneralHelpers.DOC_STATE_NUMBER.seconddoc) { if (uri.URIDataManager.UseSelectedLinkedView) { if ((uri.URIDataManager.AppType == DataHelpers.GeneralHelpers.APPLICATION_TYPES.linkedviews || uri.URIDataManager.AppType == DataHelpers.GeneralHelpers.APPLICATION_TYPES.devpacks) && uri.URIDataManager.ServerSubActionType == DataHelpers.GeneralHelpers.SERVER_SUBACTION_TYPES.runaddin) { //if it doesn't have an addin it's not an error bool bHasAddIn = DataHelpers.LinqHelpers.LinkedViewHaveAddIn(uri.URIDataManager.LinkedView); if (bHasAddIn) { SetNoXmlDocErrorMsg(uri, displayDocType); } } //no error -just showing a selected view explanation } else { //if it doesn't have an addin it's not an error bool bHasAddIn = DataHelpers.LinqHelpers.LinkedViewHaveAddIn(uri.URIDataManager.LinkedView); if (bHasAddIn) { SetNoXmlDocErrorMsg(uri, displayDocType); } } } else { SetNoXmlDocErrorMsg(uri, displayDocType); } } uri.ErrorMessage = string.Concat(sErrorMsg, uri.ErrorMessage); bIsCompleted = true; return(bIsCompleted); }
public static void FillInClubCreditFormData(Microsoft.AspNetCore.Http.HttpContext context, AccountToMember loggedInMember) { if (loggedInMember != null) { if (loggedInMember.ClubDefault == null) { //retrieve the account id and build a new club loggedInMember.ClubDefault = new Account(); } if (loggedInMember.ClubDefault.AccountToCredit == null) { loggedInMember.ClubDefault.AccountToCredit = new List <AccountToCredit>(); loggedInMember.ClubDefault.AccountToCredit.Add(new AccountToCredit()); } if (loggedInMember.ClubDefault.AccountToCredit.Count == 0) { loggedInMember.ClubDefault.AccountToCredit.Add(new AccountToCredit()); } string sFormValue = context.Request.Form.FirstOrDefault(k => k.Key == "txtCardFullName").Value; //string sFormValue = context.Request.Form["txtCardFullName"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardFullName = sFormValue; //sFormValue = context.Request.Form["txtCardFullNumber"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardFullNumber = sFormValue; //sFormValue = context.Request.Form["txtCardShortNumber"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardShortNumber = sFormValue; //sFormValue = context.Request.Form["selectcardtype"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardType = sFormValue; //sFormValue = context.Request.Form["selectcardmonth"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardEndMonth = sFormValue; //sFormValue = context.Request.Form["selectcardyear"] ?? AppHelper.GetResource("NONE"); if (sFormValue.EndsWith("*")) { //get rid of the javascript-inserted stars sFormValue = sFormValue.Replace("*", string.Empty); } loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardEndYear = sFormValue; //why store state? is it a requirement? loggedInMember.ClubDefault.AccountToCredit.FirstOrDefault().CardState = AppHelper.GetResource("NONE");//context.Request.Form["selectcardlocation"] ?? AppHelper.GetResource("NONE"); } }