PK -}*UGjT jT AW_11.2.0.0_release9.zipPK @Q*U % AW_11.2.0.0_release9/ReleaseNotes.txt
• Task ID-007677 -- Feature: Adding global variables/dynamic form related variables through AxMemLoad function during Login/DoFormLoad(Web Code and DLL)
○ Script: AxMemLoad({sqlfunction},{parameters})
§ example:
□ AxMemLoad({fn_get_employee_attributes_json},{m_employee_code})
• Task ID-007678 -- Toolbar action button grouping not working if define through Custom tstruct(Kauvery)
• Task ID-007679 -- While adding new row in grid by using the tab button, curser is pointed to header DC(Pharmacy order)(Kauvery)
• Task ID-007368 -- Issue : On saving a record and checking view history it should show server date and time.Allow time zone variation controlled through settings page with true/false values.
○ Note: Allow time zone variation controlled through Settings Page with true/false. By default, time zone variation time would be applied in transaction created on/ modified on values. If time zone variation not required time zone variation setting needs to be switch off in Setting Page.
• Task ID-007567 -- Issue : Task PDF option is not working.
• Task ID-007659 -- when they tried to use m_systemdate (defined as a global variable) in the expression of the date field.
• Task ID-007636 : When user loads the data from listview, unable to see the checklist data
• Task ID-007602 : Unable to Export data from grid
• Task ID-007606 - Listview is not functioning if the form has single record. It shows empty page while we open the listview.
• Task ID-007649 - check that when User create an Dropdown from Form field Then pop up error message displayed as "confirm! Task not completed due to an unexpected error." (DLL Fix)
• Task ID-007658 - Unable to see the data in Listview when Form is having only one data in RUNTIME
• Task ID-007637 - When user selects the value in the Param Field otherthan the 'ALL', it is not redirecting to the corresponding IVIEW data. Same issue in Multiselect Iview
Task ID-007288 - In Menu List, End Tsruct has the error while submit in Form properties. (Def_Structs)PKLS PK @Q*U : AW_11.2.0.0_release9/AW_11.2.0.0_release9/versionInfo.json{
"version": "11.2.0.0",
"subVersion": "release9",
"11.0.0.0": {
"11.0.0.0": {
"releaseDate": "",
"description": [""],
"features": [""],
"enhancements": [""]
}
}
}PKK PK @Q*U B AW_11.2.0.0_release9/AW_11.2.0.0_release9/App_Code/BundleConfig.csusing System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Optimization;
///
/// CSS and JS Bundles for all pages : BundleConfig
///
/// Prashik
public class BundleConfig
{
private static readonly BundleMimeType CssContentMimeType = new BundleMimeType("text/css");
private static readonly BundleMimeType JsContentMimeType = new BundleMimeType("text/javascript");
public static void RegisterBundles(BundleCollection bundles)
{
#region ltrBundleCss + rtlBundleCss + bundleJs => iview.aspx
var ltrBundleCss = new Bundle("~/UI/axpertUI/ltrBundleCss");
ltrBundleCss.Include(
"~/UI/axpertUI/style.bundle.css",
"~/UI/axpertUI/plugins.bundle.css"
);
ltrBundleCss.EnableFileExtensionReplacements = true;
ltrBundleCss.Transforms.Add(CssContentMimeType);
ltrBundleCss.Transforms.Insert(0, new CssRewriteUrlTransformWrapper());
ltrBundleCss.Orderer = new BundleSorter();
bundles.Add(ltrBundleCss);
var rtlBundleCss = new Bundle("~/UI/axpertUI/rtlBundleCss");
rtlBundleCss.Include(
"~/UI/axpertUI/style.bundle.rtl.css",
"~/UI/axpertUI/plugins.bundle.rtl.css"
);
rtlBundleCss.EnableFileExtensionReplacements = true;
rtlBundleCss.Transforms.Add(CssContentMimeType);
rtlBundleCss.Transforms.Insert(0, new CssRewriteUrlTransformWrapper());
rtlBundleCss.Orderer = new BundleSorter();
bundles.Add(rtlBundleCss);
var bundleJs = new Bundle("~/UI/axpertUI/bundleJs")
.Include(
"~/UI/axpertUI/plugins.bundle.js",
"~/UI/axpertUI/scripts.bundle.js"
);
bundleJs.EnableFileExtensionReplacements = true;
bundleJs.Transforms.Add(JsContentMimeType);
bundleJs.Orderer = new BundleSorter();
bundles.Add(bundleJs);
#endregion
#region SmartViews + Listviews + InMemoryDB => iview.aspx
var smartviewsCSS = new Bundle("~/Css/smartviews");
smartviewsCSS.Include(
"~/UI/axpertUI/datatables.bundle.css",
//"~/UI/axpertUI/style.bundle.css",
//"~/UI/axpertUI/plugins.bundle.css",
"~/ThirdParty/jquery-confirm-master/jquery-confirm.min.css",
"~/ThirdParty/bgrins-spectrum/spectrum.css"
);
smartviewsCSS.EnableFileExtensionReplacements = true;
smartviewsCSS.Transforms.Add(CssContentMimeType);
smartviewsCSS.Transforms.Insert(0, new CssRewriteUrlTransformWrapper());
smartviewsCSS.Orderer = new BundleSorter();
bundles.Add(smartviewsCSS);
var smartviewsJS = new Bundle("~/Js/smartviews")
.Include(
//"~/UI/axpertUI/plugins.bundle.js",
//"~/UI/axpertUI/scripts.bundle.js",
"~/UI/axpertUI/datatables.bundle.js",
"~/Js/noConflict.min.js",
"~/ThirdParty/lodash.min.js",
"~/ThirdParty/jquery-confirm-master/jquery-confirm.min.js",
"~/Js/alerts.js",//min
"~/Js/handlebars.min.js",
"~/Js/handleBarsHelpers.js",//min
"~/ThirdParty/Highcharts/highcharts.js",
"~/ThirdParty/Highcharts/highcharts-3d.js",
"~/ThirdParty/Highcharts/highcharts-more.js",
"~/ThirdParty/Highcharts/highcharts-exporting.js",
"~/Js/common.js",//min
"~/Js/iview.js",//min
"~/Js/jsclient.js",//min
"~/Js/process.js",//min
"~/Js/helper.js",//min
"~/Js/util.min.js",
"~/Js/JDate.min.js",
"~/Js/jquery.browser.min.js",
"~/Js/printjs.js",//min
"~/Js/iviewjs.js",//min
"~/Js/smartViews.js",//min
"~/ThirdParty/bgrins-spectrum/spectrum.js"
);
smartviewsJS.EnableFileExtensionReplacements = true;
smartviewsJS.Transforms.Add(JsContentMimeType);
smartviewsJS.Orderer = new BundleSorter();
bundles.Add(smartviewsJS);
#endregion
#region reports => html
var reportCss = new Bundle("~/Css/report");
reportCss.Include(
"~/ThirdParty/DataTables-1.10.13/media/css/jquery.dataTables.css",
"~/ThirdParty/DataTables-1.10.13/extensions/FixedColumns/css/les.min.css",
"~/ThirdParty/bgrins-spectrum/spectrum.css",
"~/Thirdparty/newMaterialUI/plugins/node-waves/waves.css",
"~/Css/iviewNewUi.css",
"~/Css/animate.min.css"
);
reportCss.EnableFileExtensionReplacements = true;
reportCss.Transforms.Add(CssContentMimeType);
reportCss.Transforms.Insert(0, new CssRewriteUrlTransformWrapper());
reportCss.Orderer = new BundleSorter();
bundles.Add(reportCss);
var reportJs = new Bundle("~/Js/report")
.Include(
"~/Thirdparty/newMaterialUI/plugins/node-waves/waves.js",
"~/ThirdParty/DataTables-1.10.13/media/js/jquery.dataTables.js",
"~/ThirdParty/DataTables-1.10.13/media/js/dataTables.bootstrap.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/dataTables.buttons.js",
//"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/buttons.flash.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/buttons.html5.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/buttons.print.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/jszip.min.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/pdfmake.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Buttons/js/vfs_fonts.min.js",
"~/ThirdParty/DataTables-1.10.13/extensions/FixedColumns/js/dataTables.fixedColumns.js",
"~/ThirdParty/DataTables-1.10.13/extensions/ColReorderWithResize/ColReorderWithResize.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Scroller/js/dataTables.scroller.js",
"~/Js/handlebars.min.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Extras/moment.min.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Extras/jquery.visible.min.js",
"~/ThirdParty/DataTables-1.10.13/extensions/Extras/datetime-moment.js",
"~/ThirdParty/bgrins-spectrum/spectrum.js"
);
reportJs.EnableFileExtensionReplacements = true;
reportJs.Transforms.Add(JsContentMimeType);
reportJs.Orderer = new BundleSorter();
bundles.Add(reportJs);
#endregion
#region Form => tstruct.aspx
var formCSS = new Bundle("~/Css/form");
formCSS.Include(
"~/ThirdParty/jquery-confirm-master/jquery-confirm.min.css",
//"~/UI/axpertUI/plugins.bundle.css",
//"~/UI/axpertUI/style.bundle.css",
"~/ThirdParty/gridstack.js-0.3.0/dist/jquery-ui/jquery-ui.css",
"~/ThirdParty/gridstack.js-0.3.0/dist/jquery-ui/jquery-ui.structure.css",
"~/ThirdParty/gridstack.js-0.3.0/dist/gridstack.css",
"~/UI/axpertUI/datatables.bundle.css",
"~/ThirdParty/codemirror/codemirror.css"
);
formCSS.EnableFileExtensionReplacements = true;
formCSS.Transforms.Add(CssContentMimeType);
formCSS.Transforms.Insert(0, new CssRewriteUrlTransformWrapper());
formCSS.Orderer = new BundleSorter();
bundles.Add(formCSS);
var formBasic = new Bundle("~/Js/formBasic")
.Include(
//"~/UI/axpertUI/plugins.bundle.js",
//"~/UI/axpertUI/scripts.bundle.js",
"~/ThirdParty/jquery-confirm-master/jquery-confirm.min.js",
"~/UI/axpertUI/datatables.bundle.js",
"~/Js/jquery.browser.min.js",
"~/Js/printjs.js",//min
"~/Js/noConflict.min.js",
"~/Js/propSheet.js",
"~/Js/alerts.js",
"~/Js/common.js",
"~/Js/ckeditor/ckeditor.js",
"~/Js/ckRtf.js",
"~/Js/JDate.min.js",
"~/ThirdParty/lodash.min.js",
"~/ThirdParty/gridstack.js-0.3.0/dist/jquery-ui/jquery-ui.js",
"~/ThirdParty/gridstack.js-0.3.0/dist/gridstack.js",
"~/ThirdParty/gridstack.js-0.3.0/dist/gridstack.jQueryUI.js",
"~/Js/tstructvars.js",
"~/Js/md5.min.js",
"~/Js/util.min.js",
"~/Js/tstruct-pdf.min.js",
"~/Js/expressions_config.min.js",
"~/Js/multiselect.min.js",
"~/Js/sqlBuilder.js",
"~/Js/createTheEditor.js",//min
"~/Js/codemirror/codemirror.js",
"~/Js/codemirror/mode/sql.js",
"~/Js/codemirror/addon/hint/sql-hint.js",
"~/Js/codemirror/mode/javascript.js",
"~/Js/codemirror/addon/hint/javascript-hint.js"
);
formBasic.EnableFileExtensionReplacements = true;
formBasic.Transforms.Add(JsContentMimeType);
formBasic.Orderer = new BundleSorter();
bundles.Add(formBasic);
var formInit = new Bundle("~/Js/formInit")
.Include(
"~/Js/process.js",//min
"~/Js/tstruct.js",//min
"~/Js/helper.js",//min
"~/Js/jsclient.js",//min
"~/Js/main-tstruct.js",//min
"~/Js/newGridJS.js",//min
"~/Js/select2.js",//min
"~/Js/multigroupselect.js"//min
);
formInit.EnableFileExtensionReplacements = true;
formInit.Transforms.Add(JsContentMimeType);
formInit.Orderer = new BundleSorter();
bundles.Add(formInit);
#endregion
}
}
public class CssRewriteUrlTransformWrapper : IBundleTransform
{
private static Regex pattern = new Regex(@"url\s*\(\s*([""']?)([^:)]+)\1\s*\)", RegexOptions.IgnoreCase);
public void Process(BundleContext context, BundleResponse response)
{
response.Content = string.Empty;
foreach (BundleFile file in response.Files)
{
using (var reader = new StreamReader(file.VirtualFile.Open()))
{
var contents = reader.ReadToEnd();
var matches = pattern.Matches(contents);
if (matches.Count > 0)
{
var directoryPath = VirtualPathUtility.GetDirectory(file.VirtualFile.VirtualPath);
foreach (Match match in matches)
{
var fileRelativePath = match.Groups[2].Value;
var fileVirtualPath = VirtualPathUtility.Combine(directoryPath, fileRelativePath);
var quote = match.Groups[1].Value;
var replace = String.Format("url({0}{1}{0})", quote, VirtualPathUtility.ToAbsolute(fileVirtualPath));
contents = contents.Replace(match.Groups[0].Value, replace);
}
}
response.Content = String.Format("{0}\r\n{1}", response.Content, contents);
}
}
}
}
internal sealed class BundleMimeType : IBundleTransform
{
private readonly string _mimeType;
public BundleMimeType(string mimeType) { _mimeType = mimeType; }
public void Process(BundleContext context, BundleResponse response)
{
if (context == null)
throw new ArgumentNullException();
if (response == null)
throw new ArgumentNullException();
response.ContentType = _mimeType;
}
}
PK5(. . PK @Q*U ? AW_11.2.0.0_release9/AW_11.2.0.0_release9/App_Code/Constants.csusing System;
using System.Collections.Generic;
using System.Web;
///
/// Summary description for Constants
///
public class Constants
{
public Constants()
{
//
// TODO: Add constructor logic here
//
}
public const string vbCrLf = "";
#region Error messages for culture
public const string ERROR = "";
public const string ERRORCLOSE = "";
public const string REC_NOT_FOUND = "No data found.";
public const string SEL_ROWS_FOUND = "All rows are already selected.";
public const string SESSIONERROR = "invalid sessionid";
public const string CUSTOMERROR = "Server error. Please try again.If the problem continues, please contact your administrator.";
public const string SUCCESS = "";
public const string SUCCESSCLOSE = "";
public const string SESSIONEXPMSG = "Disconnected because you have logged into another session.";
public const string EMPTYOPTION = "-- Select --";
public const string PARAMERR = "err.aspx?errmsg=Invalid parameter";
public const string LOGINERR = "signin.aspx?msg=Invalid Username or Password.";
public const string LOGINPAGE = "signin.aspx";
public const string ERRPATH = "../aspx/err.aspx?errmsg=";
public const string ERAUTHENTICATION = "Session Authentication failed...";
public const string DUPLICATESESS = "Duplicate_session";
public const string INVALIDURL = "Requested Page cannot be loaded as the URL contains invalid character.";
public const string MALICIOUSNPUTDETECTED = "Invalid input detected, Please try again.";
public const string SESSIONTIMEOUT = "SESSION_TIMEOUT";
#endregion
public const string IMGPrefix = "nodb_";
public const string AXPIMAGEPATH = "axpimagepath";
public const string TRACESPLITSTR2 = "♦♦";
public const string TRACESPLITSTR1 = "♦";
public const string IMGSRCPrefix = "nodbsrc_";
public const string PROGRESS = "InProgress";
public const string INIT = "INIT";
public const string AOWE = "AOWE";
public const string APPEND = "APPEND";
public const string BACKIMG = "../AxpImages/icons/24X24/backbutton.png";
public const string FORWARDIMG = "../AxpImages/icons/24X24/forwardbutton.png";
public const string TILE = "tile";
public const string DEFAULT = "default";
public const string DOUBLE = "double";
public const string SINGLE = "single";
public const string ACPICKPAGESIZE = "50";
public const string TABBED = "tabbed";
public const string AXPISROWVALID = "axp__isGrdVld";
public const string GeneralLog = "GeneralLog";
public const string structHTML = "TSTHTML";
public const string tstHeaderHTML = "TSTHDRHTML";
public const string toolbarBtnIcons = "TOOLBTNS";
public const string modernToolbarBtnOpen = "MODERNTOOLBTNS";
public const string attachHTML = "ATTHTML";
public const string taskBtns = "TSKBTNS";
public const string structScript = "TSTSCRIPT";
public const string structBtns = "TSTBTNS";
public const string structCaption = "TSTCAPTION";
public const string strSubmitCancel = "TSTFOOTER";
public const string strDesign = "TSTDESIGN";
public static string[] fileTypes = { ".bmp", ".jpg", ".jpeg", ".pjpeg", ".png", ".gif", ".doc", ".docx", ".xml", ".xlsx", ".ppt", ".pdf", ".txt", ".xls", ".pwd", ".tiff", ".tif", ".dib", ".jfif", ".heic", ".xlxs", ".csv", ".html", ".css", ".js", "htm", ".eml", ".msg", ".pptx" };
public static string fileExtensionImage = ".gif,.png,.jpg,.jpeg,.bmp,.tiff,.tif,.heic,.jfif";
public const string NO_DRAFTS = "No Drafts";
public const string DRAFT_REFRESH = "refresh";
public const string NO_DRAFT_HTML = "
";
public const string ORCL_QRY_PRPS_DSGN = "declare cnt int; val varchar2(31000); begin val := '$VALUE$'; select count(*) into cnt from axpCloudDevSettings where TranID='$TRANID$' and type='$TYPE$'; if (cnt>0) then UPDATE axpCloudDevSettings SET value = val where TranID='$TRANID$' and type='$TYPE$'; else insert into axpCloudDevSettings (USERID,tranid,type,value) Values ('$USERID$','$TRANID$','$TYPE$',val) ; END IF; end; ";
public const string ORCL_QRY_PRPS_USER = "declare cnt int; begin select count(*) into cnt from axpCloudUserSettings where userid = '$USERID$' and TranID='$TRANID$' and type='$TYPE$'; if (cnt>0) then UPDATE axpCloudUserSettings SET value = '$VALUE$' where userid = '$USERID$' and TranID='$TRANID$' and type='$TYPE$'; else insert into axpCloudUserSettings (userid,tranid,type,value) Values ('$USERID$','$TRANID$','$TYPE$','$VALUE$') ; END IF; end;";
public const string MYSQL_QRY_PRPS_DSGN = "INSERT INTO axpCloudDevSettings (userid,TranID,Type,Value) values ('$USERID$','$TRANID$','$TYPE$','$VALUE$') ON DUPLICATE KEY UPDATE Value= values(Value);";
public const string MYSQL_QRY_PRPS_USER = "INSERT INTO axpCloudUserSettings (userid,TranID,Type,Value) values ('$USERID$','$TRANID$','$TYPE$','$VALUE$') ON DUPLICATE KEY UPDATE Value= values(Value);";
public const string SQL_QRY_PRPS_USER = "if exists(select * from axpCloudUserSettings where userid='$USERID$' and Type='$TYPE$' and TranID='$TRANID$') update axpCloudUserSettings set Value ='$VALUE$' where userid='$USERID$' and Type='$TYPE$' and TranID='$TRANID$' else insert into axpCloudUserSettings (userid,TranID,Type,Value) values ('$USERID$','$TRANID$','$TYPE$','$VALUE$')";
public const string SQL_QRY_PRPS_DSGN = "if exists(select * from axpCloudDevSettings where Type='$TYPE$' and TranID='$TRANID$') update axpCloudDevSettings set Value ='$VALUE$' where Type='$TYPE$' and TranID='$TRANID$' else insert into axpCloudDevSettings (userid,TranID,Type,Value) values ('$USERID$','$TRANID$','$TYPE$','$VALUE$')";
public const string QUERY_GET_PRPS_STATUS = "Select ( CASE WHEN (Select Value from axpCloudDevSettings where userid='$USERID$' and type='$TYPE$' and TranID='$TRANID$') IS NULL THEN to_clob('0') else (Select Value from axpCloudDevSettings where userid='$USERID$' and type='$TYPE$' and TranID='$TRANID$') end ) AS admn,(CASE WHEN (Select Value from axpCloudUserSettings where USERID='$USERID$' and type ='$TYPE$' and TranID='$TRANID$') IS NULL THEN to_clob('0') else (Select Value from axpCloudUserSettings where USERID='$USERID$' and type='$TYPE$' and TranID='$TRANID$')end ) AS usr from dual"; //from dual, to_clob
public const string MYSQL_QUERY_GET_PRPS_STATUS = "Select ( CASE WHEN (Select Value from axpCloudDevSettings where userid='$USERID$' and type='$TYPE$' and TranID='$TRANID$') IS NULL THEN '0' else (Select Value from axpCloudDevSettings where userid='$USERID$' and type='$TYPE$' and TranID='$TRANID$') end ) AS admn,(CASE WHEN (Select Value from axpCloudUserSettings where USERID='$USERID$' and type ='$TYPE$' and TranID='$TRANID$') IS NULL THEN '0' else (Select Value from axpCloudUserSettings where USERID='$USERID$' and type='$TYPE$' and TranID='$TRANID$')end ) AS usr ";
public const string SQL_CHECK_USER = "SELECT USERNAME FROM AX_USER_SETTINGS WHERE USERNAME = '$USERID$'";
public const string SQL_LOAD_USER_APPSETTINGS = "SELECT APPSETTINGS FROM AX_USER_SETTINGS WHERE USERNAME = '$USERID$'";
public const string SQL_SAVE_USER_APPSETTINGS = "UPDATE AX_USER_SETTINGS SET APPSETTINGS = '$VALUE$' WHERE USERNAME = '$USERID$'";
public const string SQL_INSERT_USER_APPSETTINGS = "INSERT INTO AX_USER_SETTINGS (USERNAME, APPSETTINGS) VALUES ('$USERID$', '$VALUE$')";
public const string DEFAULT_USER_APPSETTINGS = "{\"sabrnig\":false}";
public const string MYSQL_QUERY_IVIR_SAVE_JSON = "update AX_USER_SETTINGS set IR_CONFIG = '$VALUE$' where USERNAME = '$USERID$'";
public const string MYSQL_QUERY_IVIR_GET_JSON = "select IR_CONFIG from AX_USER_SETTINGS where USERNAME = '$USERID$'";
public const string UPDATE_PRIVATE_SSO_TOKEN_IN_DB = "update axusers set singleloginkey = '$VALUE$' where USERNAME = '$USERID$'";
public const string GET_TST_CUSTOM_ACTIONS = "Select configname,cvalue from axpconfigs_$TRANSID$";
public const string RAPID_FORMLOAD_TBL = "Axp_formload";
public const string RAPID_DEPENDENCY_TBL = "Axp_Dependents";
public const string GET_RAPID_DEF_SP = "SP_RAPIDDEFINITION";
public const string GET_IV_GROUPED_BUTTONS = "Select cvalue from axpconfigsiv_$IVNAME$ where configname='groupbtns'";
public const string GET_IV_TEMPLETE = "select cvalue, elements from templates where type='Iview' and iviewid='$IVNAME$'";
public const string VAR_TRANSID = "$TRANSID$";
public const string VAR_IVNAME = "$IVNAME$";
public const string IVIEWSTRUCT = "ivewstruct";
public const string IVIEWPARAM = "ivewsparam";
public const string REDISXML = "
TESTING
axrowtypeaxp__fontdetailsTypeName
Caption
keysizeTotal keyskeys";
public const string CACMENU = "CACMENU";
public const string REDISTSTRUCT = "Tstruct";
public const string REDISTSTRUCTMOB = "TstructMob";
public const string REDISTSTRUCTTABLE = "TstDcTable";
public const string REDISTSTRUCTDOFORM = "TstructDoForm";
public const string REDISTSTRUCTDESIGN = "TstDsgn";
public const string REDISTSTRUCTAXDESIGN = "axTstDsgn";
public const string REDISTSTRUCTAXCUSTHTML = "axTstCustomHtml";
public const string REDISTSTRUCTAXDESIGNTABLE = "axTstDsgnTbl";
public const string REDISTSTRUCTALL = "axTstAll";
public const string REDISTSTRUCTDTLS = "TstructDtls";
public const string REDISTSTRUCTDTLSMOB = "TstructDtlsMob";
public const string REDISTSTRUCTDESIGNDTLS = "TstDsgnDtls";
public const string DEPFLDARRAY = "depFldArray";
public const string FIELDNAME = "fieldName";
public const string FIELDINDEX = "fieldIndex";
public const string FORMLOADARRAY = "FormLoadArray";
public const string FORMLOADINDEX = "FormLoadIndex";
public const string FORMLOADRES = "FormLoadRes";
public const string CLOUD_HOME_API = "api/Session/IsValidSession/{0}/{1}";
public const string REDISMENUDATA = "MenuData";
public const string REDISCARDSDATA = "CardsData";
public const string REDISCARDKEYS = "CardKeys";
public const string REDISCARDPARAMS = "CardsParams";
public const string REDISCARDROLES = "CardsRoles";
public const string REDISAPIKEYS = "ApiKeys";
public const string REDISGLOBALVARS = "GlobalVars";
public const string REDISAXUSEROPTIONS = "axUserOptions";
public const string REDISLVRECORDLISTING = "lvRecordListing";
public const string REDISHYBRIDINFO = "mobilehybridinfo";
public const string REDISKEEPWEBINFO = "keepaliveweb";
public const string ListViewFieldsInfo = "ListFldsInfo";
public const string RedisIviewObjList = "IviewObjList";
public const string RedisIviewObj = "IviewObj";
public const string RedisListviewObjList = "ListviewObjList";
public const string RedisListviewObj = "ListviewObj";
public const string RedisIviewBuilderObj = "IviewBuildObj";
public const string RedisIviewSettings = "IviewSettings";
public const string RedisListviewSettings = "ListviewSettings";
public const string RedisIviewBuilderSettingsObj = "IviewBuildSetingsObj";
public const string RedisOldIviewSettings = "IviewOldSettings";
public const string RedisOldListviewSettings = "ListviewOldSettings";
public const string RedisOldIviewTemplates = "IviewOldTemplates";
public const string RedisOldListviewTemplates = "ListviewOldTemplates";
public const string IviewNavigationData = "IviewNavigationData";
public const string GET_SEARCH_DATA = "select SEARCHTEXT,HLTYPE,STRUCTNAME,PARAMS from axp_appsearch where username=:username and lower(searchtext) like $KEYWORD$";
public const string GET_SEARCH_DATA_LANG = " select case when b.dispname= :language and b.dispname is not null then b.compcaption else searchtext end as caption,HLTYPE,STRUCTNAME,PARAMS , case when b.dispname is null then 'ALL' else b.dispname end as language, b.compcaption as searchtext from axp_appsearch a left join axlanguage b on a.params is null and b.compname like '%'||a.structname and b.sname= 'axpages' where username =:username and lower(b.compcaption) like $KEYWORD$";
public const string COLLAPSEMENU = "Collapse";
public const string CFG_CONFIG_FILE = "generic_config";
public const string GET_DASHBOARD_FILTERDATA = "select * from axp_fparamvalues where username=:username";// columns will be adding dynamically
//Note: While changing 'DEFAULT_CONFIGSTR', verify the 'AppConfiguration.cs' scenarios as well. No spaces should be used before and after in Key Names.
public const string DEFAULT_CONFIGSTR = "{\"configStr\": [{\"AxLoginTrace\": \"false\"},{\"AxAlertTimeout\": \"3\"},{\"AxSessionExpiryDays\": \"5\"},{\"AxBreadCrumb\": \"false\"},{\"AxEnableCards\": \"true\"},{\"AxExportTallyTid\": \"\"},{\"AxCPWDOnLogin\": \"true\"},{\"AxHelpIview\": \"\"},{\"AxSessionExtend\": \"true\"},{\"AxTimezoneVariation\": \"true\"},{\"AxDisableSplit\":\"false\"},{\"AxGlobalSrchLimit\":\"10000\"},{\"AxErrorMsg\": \"false\"},{\"AxErrorMsgTimeout\": \"0\"},{\"AxShowLoggedinUsersCount\": \"false\"},{\"AxImpExpTemptPath\": \"\"},{\"AxLanguages\": \"english\"},{\"AxUSCulture\": \"false\"},{\"AxDevInstance\": \"false\"},{\"AxDisplayAutoGenVal\": \"false\"},{\"AxIsPerfCode\": \"true\"},{\"AxDcGridOnSave\": \"true\"},{\"AxAttachmentSize\": \"1\"},{\"AxImagePath\": \"\"},{\"AxAttachFilePath\": \"\"},{\"AxGridAttachPath\": \"\"},{\"AxShowSubmitCancel\": \"false\"},{\"AxDesignerAccess\": \"designer\"},{\"AxIsPrintExe\": \"true\"},{\"AxPrintExePath\": \"\"},{\"AxHtmlPath\": \"\"},{\"AxPrintMargins\": \"50,50,200,100\"},{\"AxPrintTitleAlign\": \"center\"},{\"AxIviewcelltextwrap\": \"true\"},{\"AxMergeRowIviews\": \"\"},{\"AxPrintRowsMaxLimit\": \"10000\"},{\"AxDbPagination\": \"true\"},{\"AxDefaultPageSize\": \"30\"},{\"AxShowAppTitle\": \"true\"},{\"AxGetIviewRowCount\": \"false\"},{\"AxIviewDataWSRows\": \"1000\"},{\"AxInlineGridEdit\": \"true\"},{\"AxHomeBuildAccess\": \"default\"},{\"AxMaxNumOfWidgets\": \"99\"},{\"AxMenuStyle\": \"default\"},{\"AxMenuColumns\": \"3\"},{\"AxSubmenuPerView\": \"6\"},{\"AxMenuWordWrap\": \"false\"},{\"AxSubMenuCount\": \"4\"},{\"AxDirectSubMenuCount\": \"6\"},{\"AxWizardType\": \"classic\"},{\"AxDrafts\": \"false\"},{\"AxAutoPurge\": \"true\"},{\"AxMaxDraftsCount\": \"1\"},{\"AutoSavePublish\" : \"false\"}],\"configLangKeys\": [{\"AxAppTitle_ENG\": \"\"},{\"AxCopyRightText_ENG\": \"Powered by Axpert\"},{\"AxPrintTitle_ENG\": \"\"}]}";
#region Fast Data
public const string FD_TBL_DEFINITION = "select * from axp_FastDataDefinition";
public const string FD_TBL_ASSOCIATION = "select * from axp_fastdataassociation";
public const string FD_DT_DEFINITION = "FdDtDefinition";
public const string FD_DT_ASSOCIATION = "FdDtAssociation";
public const string RS_FD_DEFINITION = "RsFdDefinition";
public const string FD_REFRESH_DT = "FDRefreshDT";
#endregion
//public const string IMPEXP_GETTSTUCTS = "select name,caption from tstructs where blobno=1 and name in (SELECT SNAME FROM AXUSERACCESS WHERE STYPE = 't' AND RNAME IN (select userroles from axuserlevelgroups ul join axusergroups ug on ul.usergroup= ug.groupname where ul.username = '{0}')) order by lower(caption)";
public const string IMPEXP_GETTSTRUCTS = "select distinct t.name, t.caption from tstructs t left outer join AXUSERACCESS a on a.sname=t.name and a.stype='t' where (('default' in (select userroles from axuserlevelgroups ul join axusergroups ug on ul.usergroup=ug.groupname where ul.username = '{0}')) or a.rname in (select userroles from axuserlevelgroups ul join axusergroups ug on ul.usergroup=ug.groupname where ul.username = '{0}')) order by 2";
public const string SQL_GET_AXLANGSOURCE = "Select distinct langname from axlangsource order by langname asc";
public const string AXPATTACHMENTPATH = "axpattachmentpath";
public const string DESIGN_MODE_BTN_HTML = "
");
}
else if (task != "tasks")
{
btnHtml.Append("
");
btnHtml.Append("");
btnHtml.Append("
");
btnHtml.Append("");
string btnFunction = string.Empty;
btnFunction = GetBtnFunction(transId, task);
//TODO: provide the button like any other case, on click it should alert "No task defined"
//This button can be added for customisation, hence need not display the above.\
if (string.IsNullOrEmpty(image))
btnHtml.Append("");
else
btnHtml.Append("");
btnHtml.Append("
");
else
btnHtml.Append("");
if (colFldWidth != "")
btnHtml.Append("
");
btnHtml.Append("
");
}
else if (task != "tasks")
{
btnHtml.Append("
");
btnHtml.Append("");
btnHtml.Append("
");
btnHtml.Append(colFldWidth);
btnHtml.Append("");
string btnFunction = string.Empty;
btnFunction = GetBtnFunction(transId, task);
//TODO: provide the button like any other case, on click it should alert "No task defined"
//This button can be added for customisation, hence need not display the above.\
if (string.IsNullOrEmpty(image))
btnHtml.Append("
");
colCount++;
}
}
string dcBtns = GetGridButtonHtml(dcNo.ToString());
//TODO: need to fix the calculation of colcount, the same code is there in GetTabFullDcHtml
colCount = 100;
gridHdHtml.Append("
";
}
dcHtml.Append(fullGridHtml1 + "");
}
else
{
// innermost div for all non grid dcs.
// lastDcHeight is used if there is a calendar control in the last Dc, So this
// was affecting the dcheight to overcome this there is check where the the greater height isa set as dcheight
if (dcNo == dcs.Count)
{
if (((DcStruct)(dcs[dcNo - 1])).dcHeight > lastDcHeight)
{
lastDcHeight = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
}
//commented because form-horizontal was affecting ui.. previously added by anand.. checking need to be done after removing.
ngBorder = "
";
}
else
{
int tstHieght = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
if (isTab == "true")
{
if (((DcStruct)(dcs[dcNo - 1])).isgrid)
ngBorder = "
";
else
{
string visibledc = GetVisibleDCs();
string[] arrVisibleDc = visibledc.Split(',');
int pos = Array.IndexOf(arrVisibleDc, "dc" + dcNo);
if (pos > -1)
{
if (EnableOldTheme == "true")
ngBorder = "
";
return finalHtml;
}
///
/// Gets the tab inner html for the currently clicked tabbed DC.
///
///
///
public string GetTabHtml(string DcNo)
{
int tabNo = 0;
if (DcNo != "")
tabNo = Convert.ToInt32(DcNo);
string fieldhtml = string.Empty;
string finalHtml = string.Empty;
fieldhtml = GetFieldHtml(tabNo);
finalHtml = (GetFullDCHtml(tabNo, fieldhtml, "true"));
return finalHtml;
}
///
/// Function to check if the field is checkbox in grid.
///
///
///
private Boolean IsGridCheckBox(string[] moeValue)
{
bool chkBox = false;
if (moeValue.Length <= 3)
{
StringBuilder tmpStr = new StringBuilder();
for (int cnt = 0; cnt < moeValue.Length; cnt++)
{
tmpStr.Append(moeValue[cnt].ToLower());
}
chkBox = tmpStr.ToString() == "yesno" || tmpStr.ToString() == "noyes" ? true : false;
}
return chkBox;
}
///
/// Function to return the currently visible DC's in the tstruct.
///
///
public string GetVisibleDCs()
{
int i = 0; string strDc = string.Empty;
for (i = 0; i < visibleDCs.Count; i++)
{
if (i == 0)
{
strDc = "dc" + visibleDCs[i].ToString();
}
else
{
strDc += "," + "dc" + visibleDCs[i].ToString();
}
}
return strDc;
}
///
/// Function to construct the field's id from the arrays.
///
///
/// The Component field ID of the given field name.
public string GetFieldID(string fieldName)
{
string fieldId = "";
int dcNo = 0;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name == fieldName)
{
dcNo = fld.fldframeno;
break;
}
}
bool IsGrid = false;
for (int j = 0; j < dcs.Count; j++)
{
DcStruct dc = (DcStruct)dcs[j];
if (dc.frameno == dcNo)
{
IsGrid = dc.isgrid;
break;
}
}
if (IsGrid)
fieldId = fieldName + "001F" + dcNo;
else
fieldId = fieldName + "000F" + dcNo;
return fieldId;
}
///
/// Function to get the index of the given field from the fields in the tstruct.
///
///
///
public int GetFieldIndex(string fieldName)
{
int fieldIndex = -1;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToUpper() == fieldName.ToUpper())
{
fieldIndex = i;
break;
}
}
return fieldIndex;
}
public int GetFieldDc(string fieldName)
{
int dcNo = 0;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToLower() == fieldName.ToLower())
{
dcNo = fld.fldframeno;
break;
}
}
return dcNo;
}
public string GetFieldParents(string fieldName)
{
string fieldParents = string.Empty;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToLower() == fieldName.ToLower())
{
fieldParents = fld.fieldParents;
break;
}
}
return fieldParents;
}
public int GetButtonIndex(string btnName)
{
int btnIndex = -1;
for (int i = 0; i < btns.Count; i++)
{
ButtonStruct invbtn = (ButtonStruct)btns[i];
if (invbtn.ID.ToUpper() == btnName.ToUpper())
{
btnIndex = i;
break;
}
}
return btnIndex;
}
public string GetColumnWidth(string dcNo, string columnName)
{
string colWidth = defaultColWidth;
for (int i = 0; i < fldDcRange.Count; i++)
{
string[] fldRange = fldDcRange[i].ToString().Split('~');
if (dcNo == fldRange[0].ToString())
{
string[] dcIndex = fldRange[1].Split(',');
int startIndex = Convert.ToInt32(dcIndex[0].ToString());
int endIndex = Convert.ToInt32(dcIndex[1].ToString());
for (int j = startIndex; j <= endIndex; j++)
{
FieldStruct fld = (FieldStruct)flds[j];
if (fld.caption.ToLower() == columnName.ToLower())
{
string fldWidth = fld.cwid;
if (fldWidth != "" && Convert.ToInt32(fldWidth) > -1)
{
if (Convert.ToInt32(colWidth) > 130) colWidth = "100";
colWidth = fldWidth;
break;
}
}
}
}
}
return colWidth;
}
#region GetJScriptArrays
///
/// Function to Get the javascript dependency arrays and write it on to the response
///
///
public string GetJScriptArrays(TStructDef strObj)
{
string tst_Scripts = string.Empty;
StringBuilder strJSArray = new StringBuilder();
strJSArray.Append(strObj.jsFieldArray);
strJSArray.Append(strObj.jsFormcontrolArray);
strJSArray.Append(strObj.jsHyperlinkArray);
strJSArray.Append(strObj.jsPatternArray);
strJSArray.Append(strObj.jsExpressionArray);
strJSArray.Append(strObj.jsDCArray);
strJSArray.Append(strObj.jsTabDCArray);
strJSArray.Append(strObj.jsRuleDefArray);
string tstructDetails = "var tstructName='" + strObj.transId + "';var tstructCaption='" + ReplaceSpecialCharsInHTML(strObj.tstCaption) + "';var tstructAttachment='" + strObj.tstAttachment + "';var tstructCancelled='" + strObj.tstCancelled + "';var tstructUpdateOn='" + strObj.tstUpdateOn + "';var tstructUpdatedBy='" + strObj.tstUpdateBy + "';var tstructReadonly='" + strObj.tstReadOnly + "';var tstructWorkflow='" + strObj.tstWorkflow + "';";
string listFlds = "AxFromLstFlds='" + fromListFlds + "';";
string dcNum = "TotalDCs='" + strObj.dcs.Count + "';";
tst_Scripts = "";
tst_Scripts = tst_Scripts.Replace("\n", "");
return tst_Scripts;
}
///
/// Function to return the tab event by generating the script for tab container.
///
///
///
public string GenerateTabScript(TStructDef strObj)
{
StringBuilder dcScript = new StringBuilder();
dcScript.Append("");
}
}
dcScript.Append("}");
//return tabScript.ToString() + dcScript.ToString();
return dcScript.ToString();
}
public Boolean IsDcGrid(int dcNo)
{
Boolean isGrid = false;
for (int i = 0; i < dcs.Count; i++)
{
DcStruct dcStr = (DcStruct)dcs[i];
if (dcStr.frameno == dcNo)
{
if (dcStr.isgrid)
isGrid = true;
else
isGrid = false;
}
}
return isGrid;
}
#endregion
#endregion
#region Field HTML
///
/// function to construct the field html for a particular dc. It doesnot contains the outer
/// part of the DC like outer border, DC header, ADD, Fill.
/// It iterates throug the complete fields, check whether it belongs the DC by checking the
/// frame no. Then it constructs the HTML string for that field and appended to the DC HTML.
///
///
///
/// returns the field html.
private string GetFieldHtml(int dcNo)
{
//NOTE: Assigning javascript functions for grid and non-grid fields's is done seperately,
//as the grid field javascript functions are written into the hidden field through the variable gridHiddenHtml.
//The difference for grid functions is usage of \"+quo+\" instead of \".
//The hidden field is used to store the dummy row value,
//the value assigned to hidden field will be written within double quotes and hence we use \"+quo+\" to write a double quote in the HTML.
colCount = 0;
Boolean isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid;
DcStruct dc = (DcStruct)(dcs[dcNo - 1]);
if (isGrid)
{
dcArrayNo++;
}
string divDirection = "left";
if (HttpContext.Current.Session["language"].ToString() == "ARABIC")
{
divDirection = "right";
}
int fcwidth = 0;
string colFldCaption = "", colFldWidth = "", colFldGridStackItem = "", colDivInputPadding = "";
if (!isGrid && (axdesignJObject.dcLayout != null && axdesignJObject.dcLayout != "" && axdesignJObject.dcLayout != "default"))
{
fcwidth = int.Parse(axdesignJObject.fieldCaptionWidth);
fcwidth = fcwidth / 10;
colFldCaption = "col-sm-" + fcwidth + "";
fcwidth = 12 - fcwidth;
colFldWidth = "
";
}
}
}
else
{
dcRowone = rowHTML;
if (rowHTML == "" && fillGridRowHTML != "")
dcRowone = fillGridRowHTML;
}
dcOtherRows.Append(dcRowone);
serialNo++;
}
}
//int rowCount = rowCnt + 1;
tabHTML = GetFullTabDCHTML(dcNo, dcOtherRows.ToString(), isTab, rowCnt.ToString(), fillGriddcRowone);
return tabHTML;
}
//This function returns the dhtml and thier pop grid dc's html.
public string GetTabDcHTML(int dcNo, TStructData tstDataObj, string IsTabDisabled)
{
if (tstDataObj.recordID.ToString() != "0" && ((DcStruct)(dcs[dcNo - 1])).isgrid)
{
IsFillGridCall = true;
}
string result = string.Empty;
//To check if the tab dc contains any pop grid and store the popGrid dc number in subGridDcs.
ArrayList subGridDcs = new ArrayList();
for (int i = 0; i < popdcs.Count; i++)
{
if (dcNo == ((PopDcStruct)(popdcs[i])).pdcno)
{
subGridDcs.Add(((PopDcStruct)(popdcs[i])).frameno);
}
}
StringBuilder popGridDcHTML = new StringBuilder();
for (int j = 0; j < subGridDcs.Count; j++)
{
int rowCnt = GetRowCount(Convert.ToInt32(subGridDcs[j]), tstDataObj);
if (popGridDcHTML.ToString() == "")
popGridDcHTML.Append(subGridDcs[j] + "♣" + rowCnt + "*?*" + GetTabFullHTML(Convert.ToInt32(subGridDcs[j]), rowCnt, tstDataObj, "false", IsTabDisabled));
else
popGridDcHTML.Append("*Tab*" + subGridDcs[j] + "♣" + rowCnt + "*?*" + GetTabFullHTML(Convert.ToInt32(subGridDcs[j]), rowCnt, tstDataObj, "false", IsTabDisabled));
dcOtherRows = new StringBuilder();
}
colCount = 0;
//If HasDataRows=no flRowCnt should be 0 else should be total row count
int flRowCnt = 0;
if (IsFillGridCall)
{
if (((DcStruct)(dcs[dcNo - 1])).DCHasDataRows)
flRowCnt = GetRowCount(dcNo, tstDataObj);
}
else
flRowCnt = GetRowCount(dcNo, tstDataObj);
//Construct the result in the format of dcno♣rowCount + "*?*" + TabDcHTML + "*Tab*" + popGridDcHTMl + "*Tab*" + next pop grid dcs...
int rCnt = GetRowCount(dcNo, tstDataObj);
string isTab = IsDcTab(dcNo);
result = dcNo + "♣" + flRowCnt + "*?*" + GetTabFullHTML(dcNo, rCnt, tstDataObj, isTab, IsTabDisabled) + "*Tab*" + popGridDcHTML;
dcOtherRows = new StringBuilder();
if (tstDataObj.recordID.ToString() != "0" && ((DcStruct)(dcs[dcNo - 1])).isgrid)
{
IsFillGridCall = false;
}
return result;
}
private string IsDcTab(int dcNo)
{
string isTab = "false";
for (int i = 0; i < pagePositions.Count; i++)
{
if (pagePositions[i].ToString().Contains(","))
{
string[] tabContainers = pagePositions[i].ToString().Split(',');
for (int j = 0; j < tabContainers.Length; j++)
{
if (tabContainers[j].ToString() == dcNo.ToString())
{
isTab = "true";
break;
}
}
if (isTab == "true")
break;
}
}
return isTab;
}
public int GetRowCount(int dcNo, TStructData tstData)
{
int rCnt = 0;
if (tstData.dcRowCntVals != null)
{
for (int i = 0; i < tstData.dcRowCntVals.Count; i++)
{
string[] dcNumber = tstData.dcRowCntVals[i].ToString().Split('~');
//dcNumber[0] = dcNumber[0].Replace("dc", "");
string arrDcNo = dcNumber[0].Substring(2);
if (arrDcNo == dcNo.ToString())
{
rCnt = Convert.ToInt32(dcNumber[1]);
break;
}
}
}
if (rCnt == 0)
rCnt = 1;
return rCnt;
}
///
/// function to construct the field html for a particular dc. It doesnot contains the outer
/// part of the DC like outer border, DC header, ADD, Fill.
/// It iterates throug the complete fields, check whether it belongs the DC by checking the
/// frame no. Then it constructs the HTML string for that field and appended to the DC HTML.
///
///
///
/// returns the field html.
private string GetTabFieldHtml(int dcNo, TStructData tstData, string IsTabDisabled, string rowNo, string keyColValue, ArrayList keyCols, ArrayList keyRowNos)
{
//NOTE: Assigning javascript functions for grid and non-grid fields's is done seperately,
//as the grid field javascript functions are written into the hidden field through the variable gridHiddenHtml.
//The difference for grid functions is usage of \"+quo+\" instead of \".
//The hidden field is used to store the dummy row value,
//the value assigned to hidden field will be written within double quotes and hence we use \"+quo+\" to write a double quote in the HTML.
string divDirection = "left";
if (HttpContext.Current.Session["language"].ToString() == "ARABIC")
{
divDirection = "right";
}
Boolean isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid;
DcStruct dc = (DcStruct)(dcs[dcNo - 1]);
if (isGrid)
{
dcArrayNo++;
}
int fcwidth = 0;
string colFldCaption = "", colFldWidth = "", colFldGridStackItem = "", colDivInputPadding = "";
if (!isGrid && (axdesignJObject.dcLayout != null && axdesignJObject.dcLayout != "" && axdesignJObject.dcLayout != "default"))
{
fcwidth = int.Parse(axdesignJObject.fieldCaptionWidth);
fcwidth = fcwidth / 10;
colFldCaption = "col-sm-" + fcwidth + "";
fcwidth = 12 - fcwidth;
colFldWidth = "
";
}
else
{
// innermost div for all non grid dcs.
// lastDcHeight is used if there is a calendar control in the last Dc, So this
// was affecting the dcheight to overcome this there is check where the the greater height isa set as dcheight
if (dcNo == dcs.Count - 1)
{
if (((DcStruct)(dcs[dcNo - 1])).dcHeight > lastDcHeight)
{
lastDcHeight = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
}
ngBorder = "
";
}
else
dcRowHtml = rowHTML;
}
return dcRowHtml;
}
///
/// Function to check if the dc has a associated fill grid and returns the index.
///
///
///
public int GetFillGridIndex(string dcNo)
{
int fgIdx = -1;
for (int i = 0; i < fgs.Count; i++)
{
FGStruct fg = (FGStruct)fgs[i];
if (fg.fgtargetdc == dcNo)
{
fgIdx = i;
break;
}
}
return fgIdx;
}
///
/// Function to check if the grid dc is format grid.
///
///
///
public bool IsDcFormatGrid(int dcNo)
{
try
{
DcStruct dc = (DcStruct)(dcs[dcNo - 1]);
return dc.IsFormatGrid;
}
catch (Exception ex)
{
return false;
}
}
protected string findGridcol(float percentage)
{
int col = (Convert.ToInt32(percentage / 8) - 1);
int rem = Convert.ToInt32(percentage % 8);
if (col == 0)
return "col-lg-1";
else if (col < 12)
return (rem >= 5) ? ("col-lg-" + (col).ToString() + smBootstrapClass(col)) : ("col-lg-" + col.ToString() + smBootstrapClass(col));
else
return "col-lg-12";
}
protected string bsClassByDatawidth(int datawidth, int i, FieldStruct fld)
{
if (fld.ctype.ToUpper() == "MEMO" || fld.datatype.ToLower() == "text")
{
return " w-100 agform grid-stack-item-content form-group fldindex" + i;
}
else if (fld.datatype.ToUpper() == "DATE/TIME")
{
return " w-100 agform grid-stack-item-content form-group fldindex" + i;
}
else if (fld.ctype.ToUpper() == "CHECK LIST" || fld.ctype.ToUpper() == "RADIO GROUP")
{
return " w-100 agform grid-stack-item-content form fldindex" + i;
}
else
{
int col = Convert.ToInt32(datawidth / 15) + 2;
col = col - 2;
return (datawidth <= 15) ? " w-100 agform grid-stack-item-content form-group fldindex" + i : " w-100 agform grid-stack-item-content form-group fldindex" + i;
}
}
protected string xywhGridStack(FieldStruct fld = new FieldStruct(), bool isTable = false, int GridX = 0, int GridY = 0)
{
var designMode = false;
if (HttpContext.Current.Session[transId + "IsDesignMode"] != null && HttpContext.Current.Session[transId + "IsDesignMode"].ToString() != string.Empty)
{
designMode = Convert.ToBoolean(HttpContext.Current.Session[transId + "IsDesignMode"]);
}
int dcNo = fld.fldFrameNo;
bool isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid;
int x = 0;
int y = 0;
int w = 0;
int minW = 2;
int maxW = 0;
int h = 0;
int minH = 0;
int maxH = 0;
int autoPosition = 0;
if (axdesignJObject == null)
{
axdesignJObject = new DesignObject();
axdesignJObject.newDesign = true;
}
//try
//{
// isFreshDesign = axdesignJObject.transid != null && axdesignJObject.transid == transId ? false : true;
//}
//catch (Exception ex)
//{
// isFreshDesign = true;
//}
bool freshAutoArrange = false;
string tableWidth = string.Empty;
//if (isFreshDesign) {
// autoPosition = 1;
// tableWidth = (fld.fldlength > 51 ? 400 : (fld.fldlength <= 15) ? 150 : (fld.fldlength * 8)).ToString();
//}
//if (fld.datatype == "special")
//{
// freshAutoArrange = true;
//}
//if is not table pixels
Dc curDc;
string DcLayout = axdesignJObject.dcLayout;
if (DcLayout == null || DcLayout == "default")
{
if (axdesignJObject.dcs == null)
{
axdesignJObject.dcs = new List();
}
curDc = axdesignJObject.dcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString());
}
else
{
if (axdesignJObject.newdcs == null)
{
axdesignJObject.newdcs = new List();
}
curDc = axdesignJObject.newdcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString());
}
try
{
if (curDc == null)
{
curDc = new Dc();
curDc.dc_id = dcNo.ToString();
}
}
catch (Exception ex)
{
//while (axdesignJObject.dcs.Count != dcNo)
//{
// axdesignJObject.dcs.Add(new Dc());
// if (axdesignJObject.dcs.Count == dcNo)
// {
// axdesignJObject.dcs[axdesignJObject.dcs.Count - 1].dc_id = dcNo.ToString();
// }
//}
}
curDc.isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid ? "T" : "F";
if (!isTable)
{
FieldsDesign fDsign = null;
try
{
fDsign = curDc.fieldsDesign.FirstOrDefault(elm => elm.fld_id == fld.name);
}
catch (Exception ex)
{
}
//if (!isFreshDesign && fDsign != null)
if (fDsign != null)
{
/*if (fDsign.visibility || designMode)
{*/
x = fDsign.x;
y = fDsign.y;
w = fDsign.width;
h = fDsign.height;
/*}else
{
w = curDc.fieldsDesign.FirstOrDefault(elm => elm.fld_id == fld.name).width = 0;
h = curDc.fieldsDesign.FirstOrDefault(elm => elm.fld_id == fld.name).height = 0;
}*/
}
else
{
//if (isFreshDesign && fDsign == null)
if (fDsign == null)
{
//autoPosition = 1;
//data-gs-x="2" data-gs-y="5" data-gs-width="1" data-gs-height="1"
if (fld.ctype.ToUpper() == "MEMO" || fld.datatype.ToLower() == "text")
{
w = 15; h = 2;
//return " data-gs-width=\"5\" data-gs-height=\"1\" data-gs-min-height=\"2\" ";
}
else if (fld.datatype.ToUpper() == "DATE/TIME")
{
w = 9; h = 1;
//return " data-gs-width=\"3\" data-gs-height=\"1\" data-gs-max-height=\"1\" ";
}
else if (fld.ctype.ToUpper() == "CHECK LIST" || fld.ctype.ToUpper() == "RADIO GROUP")
{
w = 36; h = 1;
//return " data-gs-width=\"12\" data-gs-height=\"1\" data-gs-max-height=\"1\" ";
}
else if (fld.datatype.ToLower() == "image")
{
w = 10; h = 4;
}
else
{
int col = (Convert.ToInt32(fld.fldlength / 15) + 2) * 3;
if (col > 36) { col = 36; }
if (fld.fldlength <= 15)
{
w = 9; h = 1;
}
else
{
w = col; h = 1;
}
//return (fld.fldlength <= 15) ? " data-gs-width=\"3\" data-gs-height=\"1\" data-gs-max-height=\"1\" " : " data-gs-width=\"" + col + "\" data-gs-max-height=\"1\" ";
}
if (!fld.visibility)
{
if (curDc.fieldsDesign == null)
{
curDc.fieldsDesign = new List();
}
if (fld.datatype == "special" && fDsign == null && !axdesignJObject.newDesign && !isFreshDesign)
{
freshAutoArrange = true;
}
curDc.fieldsDesign.Add(new FieldsDesign());
int newX = 0;
int newY = 0;
if (freshAutoArrange || isGrid)
{
if (curDc.fieldsDesign.Count == 1)
{
newX = 0;
newY = 0;
}
else
{
newX = curDc.fieldsDesign[curDc.fieldsDesign.Count - 2].x + curDc.fieldsDesign[curDc.fieldsDesign.Count - 2].width;
int currentY = curDc.fieldsDesign[curDc.fieldsDesign.Count - 2].y;
if (newX + w > 36)
{
newX = 0;
int maxHeightFD = curDc.fieldsDesign.Where(i => i.y == currentY).Select(i => i.height).Max();
newY = currentY + maxHeightFD;
}
else
{
newY = currentY;
}
}
}
else
{
if (curDc.fieldsDesign.Count == 1)
{
newX = 0;
newY = 0;
}
else
{
newX = 0;
int currentY = curDc.fieldsDesign[curDc.fieldsDesign.Count - 2].y;
int maxHeightFD = curDc.fieldsDesign.Where(i => i.y == currentY).Select(i => i.height).Max();
newY = currentY + maxHeightFD;
}
}
x = curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].x = newX;
y = curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].y = newY;
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].width = w;
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].height = h;
//if (fld.ctype == "button" && fDsign == null && !axdesignJObject.newDesign && !isFreshDesign)
if (fld.ctype == "button" && fDsign == null && !axdesignJObject.newDesign)
{
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].visibility = false;
}
else
{
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].visibility = true;
}
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].fld_id = fld.name;
}
}
}
//set min/max height
if (fld.ctype.ToUpper() == "MEMO" && fld.fldType.ToLower() != "rich text")
{
minH = 2;
}
else if (fld.datatype.ToLower() == "text" && (fld.name.Contains("rtf_") || fld.name.Contains("rtfm_") || fld.fldType.ToLower() == "rich text"))
{
minH = 5;
}
else if (fld.datatype.ToLower() == "image")
{
minH = 2;
}
else if (fld.ctype.ToUpper() == "RADIO GROUP" && fld.type.ToLower() != "h")//fld.ctype.ToUpper() == "CHECK LIST" || (
{
minH = 2;
}
else if (fld.ctype.ToUpper() == "RADIO GROUP" && fld.type.ToLower() == "h")
{
minH = 1;
}
else if (fld.datatype.ToLower() == "text" && fld.ctype.ToLower() == "")
{
minH = 2;
}
else if (fld.ctype == "button")
{
minH = 1;
}
else
{
maxH = 1;
}
if (h < minH)
{
try
{
h = minH;
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].height = h;
}
catch (Exception ex) { }
}
if (w < minW)
{
try
{
w = minW;
curDc.fieldsDesign[curDc.fieldsDesign.Count - 1].width = w;
}
catch (Exception ex) { }
}
if (DcLayout == null || DcLayout == "default")
{
if (axdesignJObject.dcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()) == null)
{
axdesignJObject.dcs.Add(curDc);
}
else
{
int index = axdesignJObject.dcs.IndexOf(axdesignJObject.dcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()));
axdesignJObject.dcs[index] = curDc;
}
}
else
{
if (axdesignJObject.newdcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()) == null)
{
axdesignJObject.newdcs.Add(curDc);
}
else
{
int index = axdesignJObject.newdcs.IndexOf(axdesignJObject.newdcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()));
axdesignJObject.newdcs[index] = curDc;
}
}
return " " + (x >= 0 ? "data-gs-x=\"" + x + "\"" : "") + " " + (y >= 0 ? "data-gs-y=\"" + y + "\"" : "") + " " + (w > 0 ? "data-gs-width=\"" + w + "\"" : "") + " " + (minW > 0 ? "data-gs-min-width=\"" + minW + "\"" : "") + " " + (maxW > 0 ? "data-gs-max-width=\"" + maxW + "\"" : "") + " " + (h > 0 ? "data-gs-height=\"" + h + "\"" : "") + " " + (minH > 0 ? "data-gs-min-height=\"" + minH + "\"" : "") + " " + (maxH > 0 ? "data-gs-max-height=\"" + maxH + "\"" : "") + " " + ("data-gs-auto-position=\"" + autoPosition + "\"") + " ";
}
else
{
//if(tableWidth == "") {
// tableWidth = (fld.fldlength > 51 ? 400 : (fld.fldlength <= 15) ? 150 : (fld.fldlength * 8)).ToString();
//}
if (curDc.isGrid == "")
{
return "0";
}
TableDesign tDsign = null;
try
{
if (curDc.tableDesign != null)
{
tDsign = curDc.tableDesign.FirstOrDefault(elm => elm.fld_id == fld.name);
}
}
catch (Exception ex)
{
}
try
{
/*if (tDsign != null && !tDsign.visibility && !designMode)
{
tableWidth = "0";
}
else */
//if (!isFreshDesign && tDsign != null)
if (curDc.tableDesign == null)
{
curDc.tableDesign = new List();
}
if (fld.datatype == "special" && tDsign == null && !axdesignJObject.newDesign && !isFreshDesign)
{
freshAutoArrange = true;
}
curDc.tableDesign.Add(new TableDesign());
if (tDsign != null)
{
tableWidth = tDsign.width.ToString();
}
else
{
if (!fld.visibility)
{
tableWidth = (fld.fldlength > 51 ? 400 : (fld.fldlength <= 15) ? 150 : (fld.fldlength * 8)).ToString();
curDc.tableDesign[curDc.tableDesign.Count - 1].width = Convert.ToInt32(tableWidth != "" ? tableWidth : "0");
if (fld.ctype == "button" && tDsign == null && !axdesignJObject.newDesign)
{
curDc.tableDesign[curDc.tableDesign.Count - 1].visibility = false;
}
else
{
curDc.tableDesign[curDc.tableDesign.Count - 1].visibility = true;
}
curDc.tableDesign[curDc.tableDesign.Count - 1].fld_id = fld.name;
}
}
}
catch (Exception ex)
{
}
if (DcLayout == null || DcLayout == "default")
{
if (axdesignJObject.dcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()) == null)
{
axdesignJObject.dcs.Add(curDc);
}
else
{
int index = axdesignJObject.dcs.IndexOf(axdesignJObject.dcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()));
axdesignJObject.dcs[index] = curDc;
}
}
else
{
if (axdesignJObject.newdcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()) == null)
{
axdesignJObject.newdcs.Add(curDc);
}
else
{
int index = axdesignJObject.newdcs.IndexOf(axdesignJObject.newdcs.FirstOrDefault(elm => elm.dc_id == dcNo.ToString()));
axdesignJObject.newdcs[index] = curDc;
}
}
return tableWidth != "" ? tableWidth : "0";
//return " " + 0 + " ";
//return (fld.fldlength > 51 ? 400 : (fld.fldlength <= 15) ? 150 : (fld.fldlength * 8)).ToString();
}
}
private string smBootstrapClass(int number)
{
if (number < 2)
{
return " ";
}
else
{
return " col-sm-" + (number + (number / 2));
}
}
public string OldToNewDesignJSONParser(string oldjson, XmlDocument xmlDoc)
{
JObject json = JObject.Parse(oldjson);
StringBuilder str = new StringBuilder();
Boolean previouclass = false;
Boolean cpMode = json["cpMode"] != null ? Convert.ToBoolean(json["cpMode"]) : true;
char isgrid = 'F';
string gridStretch = "false";
str.Append("[");
str.Append("{\"transid\":\"" + json["tstructName"] + "\",");
str.Append("\"compressedMode\":" + cpMode.ToString().ToLower() + ",");
str.Append("\"newDesign\":false,");
str.Append("\"staticRunMode\":false,");
str.Append("\"wizardDC\":false,");
str.Append("\"selectedLayout\":null,");
str.Append("\"selectedFontSize\":14,");
str.Append("\"selectedControlHeight\":25,");
str.Append("\"tstUpdatedOn\":\"" + tstUpdateOn + "\",");
str.Append("\"dcLayout\":\"default\",");
str.Append("\"formWidth\":\"100\",");
str.Append("\"formAlignment\":\"default\",");
str.Append("\"fieldCaptionWidth\":\"30\",");
str.Append("\"formLabel\":\"[]\",");
str.Append("\"buttonFieldFont\":\"[]\",");
str.Append("\"dcs\": [");
foreach (JObject dccontent in json["dcs"].Children())
{
int yaxsis = 0;
int xaxsis = 0;
int xaxsisGrid = 0;
int yaxsisGrid = 0;
int imagewidth = 0;
Boolean nextline = false;
Boolean nextlineGrid = false;
int thisDc = dccontent["id"].ToString().StartsWith("divDc") ? Convert.ToInt32(dccontent["id"].ToString().Substring(5)) : dccontent["id"].ToString().StartsWith("sp") ? Convert.ToInt32(dccontent["id"].ToString().Substring(dccontent["id"].ToString().LastIndexOf("F") + 1)) : dccontent["id"].ToString().StartsWith("#gridHd") ? Convert.ToInt32(dccontent["id"].ToString().Substring(7)) : 0;
str.Append("{\"dc_id\": \"" + thisDc + "\",");
str.Append("\"fieldsDesign\":[");
var dcelementcontent = dccontent["elements"];
Boolean isSpecialField = false;
Boolean isCkeditor = false;
foreach (var item in dcelementcontent.Children())
{
JArray j = new JArray();
try
{
j = (JArray)item;
}
catch (Exception ex)
{
}
foreach (var item1 in j)
{
JObject j1 = (JObject)item1;
var msgProperty = j1.Property("classes");
if (msgProperty != null && j1["classes"].ToString() == "row")
{
previouclass = true;
}
else
{
previouclass = false;
nextline = false;
}
var dcinnerelement = j1["elements"];
foreach (var iteminner in dcinnerelement.Children())
{
JArray jinner = new JArray();
try
{
jinner = (JArray)iteminner;
}
catch (Exception ex)
{
//jinner = JArray.Parse("[" + iteminner.ToString() + "]");
}
foreach (var iteminner1 in jinner)
{
JObject j1inner = (JObject)iteminner1;
string classname = ((Newtonsoft.Json.Linq.JValue)(j1inner["classes"])).Value.ToString();
if (classname != null && !(classname.Contains("grid-icons")) && !(classname.Contains("griddivColumn")))
{
System.Xml.XmlNodeList Memonode;
System.Xml.XmlNodeList checkboxnode;
System.Xml.XmlNodeList radiobuttonnode;
System.Xml.XmlNodeList image = null;
System.Xml.XmlNodeList ckeditor;
int heigntField = 1;
try
{
Memonode = xmlDoc.SelectNodes("root/" + j1inner["id"].ToString().Substring(2) + "/a31[@ctype='Memo']");
image = xmlDoc.SelectNodes("root/" + j1inner["id"].ToString().Substring(2) + "/a3");
if (image.Count > 0 && image[0].InnerText.ToLower() == "image")
{
isSpecialField = true;
if (j1inner["height"] != null)
{
int pxHeight = Convert.ToInt32(j1inner["height"].ToString().Replace("px", string.Empty));
if (cpMode)
{
heigntField = Convert.ToInt32(Math.Round(Convert.ToDouble((pxHeight + 22 + 17) / 41)));
}
else
{
heigntField = Convert.ToInt32(Math.Round(Convert.ToDouble((pxHeight + 20 + 17) / 48)));
}
}
else
{
heigntField = 2;
}
}
checkboxnode = xmlDoc.SelectNodes("root/" + j1inner["id"].ToString().Substring(2) + "/a31[@ctype='Check list']");
radiobuttonnode = xmlDoc.SelectNodes("root/" + j1inner["id"].ToString().Substring(2) + "/a31[@ctype='Radio group']");
ckeditor = xmlDoc.SelectNodes("root/" + j1inner["id"].ToString().Substring(2) + "/a1");
if (Memonode.Count > 0 || checkboxnode.Count > 0 || radiobuttonnode.Count > 0)
{
isSpecialField = true;
heigntField = 2;
}
if (ckeditor.Count > 0 && (ckeditor[0].InnerText.ToLower().Contains("rtf_") || ckeditor[0].InnerText.ToLower().Contains("rtfm_")))
{
isCkeditor = true;
heigntField = 5;
}
int leastMDValue = GetLeastMDValue(classname);
if (image.Count > 0 && image[0].InnerText.ToLower() == "image")
{
imagewidth = leastMDValue * 3;
}
if (xaxsis + (leastMDValue * 3) > 36)
{
if (!isSpecialField)
{
yaxsis += 1;
xaxsis = 0;
}
else if (isCkeditor)
{
yaxsis += 5;
isCkeditor = false;
isSpecialField = false;
}
else if (isSpecialField && image.Count > 0)
{
yaxsis += 1;
xaxsis = imagewidth;
}
else if (isSpecialField)
{
yaxsis += 2;
xaxsis = 0;
isSpecialField = false;
}
}
str.Append("{\"fld_id\":" + "\"" + j1inner["id"].ToString().Substring(2) + "\",");
str.Append("\"x\":" + xaxsis + ",");
str.Append("\"y\":" + yaxsis + ",");
str.Append("\"width\":" + (leastMDValue * 3) + ",");
str.Append("\"visibility\":true,");
str.Append("\"height\":" + heigntField + "},");
if (previouclass)
{
if (!isSpecialField)
{
yaxsis++;
}
else if (isCkeditor)
{
yaxsis += 5;
isCkeditor = false;
isSpecialField = false;
}
else if (isSpecialField)
{
yaxsis += 2;
isSpecialField = false;
}
xaxsis = 0;
nextline = true;
}
if (leastMDValue > 0 && !(nextline))
{
xaxsis += leastMDValue * 3;
}
}
catch
{
}
}
//Grid Elment
else if (classname != null && classname.Contains("grid-icons") || classname.Contains("griddivColumn"))
{
try
{
int mdcountTotal = 0;
isgrid = 'T';
var dcgridelement = j1inner["elements"];
foreach (var itemgridelement in dcgridelement.Children())
{
JObject jgridinner = (JObject)itemgridelement;
string classnameGrid = ((Newtonsoft.Json.Linq.JValue)(jgridinner["classes"])).Value.ToString();
bool isSingleLength = classname.Length - (classname.LastIndexOf("col-md") + 7) == 1;
int leastMDValue = GetLeastMDValue(classnameGrid);
int heightfieldgrid = 1;
mdcountTotal += leastMDValue;
if (mdcountTotal > 12)
{
yaxsisGrid++;
mdcountTotal = leastMDValue;
xaxsisGrid = 0;
nextlineGrid = true;
}
else
{
nextlineGrid = false;
}
str.Append("{\"fld_id\":" + "\"" + jgridinner["id"].ToString().Substring(6) + "\",");
str.Append("\"x\":" + xaxsisGrid + ",");
str.Append("\"y\":" + yaxsisGrid + ",");
str.Append("\"width\":" + (leastMDValue * 3) + ",");
if (jgridinner["isVisible"] != null)
{
str.Append("\"visibility\":" + jgridinner["isVisible"].ToString().ToLower() + ",");
}
else
{
str.Append("\"visibility\":true,");
}
str.Append("\"height\":" + heightfieldgrid + "},");
if (leastMDValue > 0)
{
xaxsisGrid += leastMDValue * 3;
}
}
}
catch (Exception ex) { }
}
//Table head
if (classname != null && classname.Contains("griddivColumn"))
{
var dcTableElement = j1inner["elements"];
str.Append("],");
str.Append("\"tableDesign\":[");
foreach (var itemTableElement in dcTableElement.Children())
{
JObject jTableinner = (JObject)itemTableElement;
if (jTableinner["id"].ToString().StartsWith("uniqueEditDeleteAct") || jTableinner["id"].ToString().StartsWith("uniqueThHead"))
str.Append("{\"fld_id\":" + "\"" + jTableinner["id"].ToString() + "\",");
else
str.Append("{\"fld_id\":" + "\"" + jTableinner["id"].ToString().Substring(3) + "\",");
if (j1inner["gridStretch"] != null)
{
gridStretch = j1inner["gridStretch"].ToString();
}
if (jTableinner["visibility"] != null)
{
if (jTableinner["visibility"].ToString().ToLower() == "none")
str.Append("\"visibility\":false,");
else
str.Append("\"visibility\":true,");
}
else
{
str.Append("\"visibility\":true,");
}
str.Append("\"width\" :" + "\"" + Math.Round(Convert.ToDouble(jTableinner["width"].ToString().Replace("px", string.Empty))) + "\"},");
}
}
}
}
}
}
str.Append("],");
if (isgrid == 'T')
{
str.Append("\"gridStretch\":" + gridStretch.ToString().ToLower() + ",");
}
str.Append("\"isGrid\":\"" + isgrid + "\"},");
}
str.Append("],");
str.Append("\"newdcs\":[]");
str.Append("}]");
string finaljson = str.ToString().Replace(",]", "]");
return finaljson;
}
public int GetLeastMDValue(string classNames)
{
string[] clsArray = classNames.Split(' ');
ArrayList mdList = new ArrayList();
foreach (var item in clsArray)
{
if (item.ToString().Contains("col-md"))
{
mdList.Add(item.ToString());
}
}
ArrayList numbers = new ArrayList();
foreach (string item in mdList)
{
numbers.Add(int.Parse(item.Substring(item.LastIndexOf('-') + 1)));
}
int min = 0;
min = (int)numbers[0];
foreach (int x in numbers)
{
if (min > x)
{
min = x;
}
}
return min;
}
private string NodeApiCall(string APIName, string DATA)
{
string response = string.Empty;
LogFile.Log logObj = new LogFile.Log();
string URL = System.Configuration.ConfigurationManager.AppSettings["NodeAPI"] + APIName;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST";
request.ContentType = "application/json; charset=utf-8";
request.ContentLength = DATA.Length;
StreamWriter requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
requestWriter.Write(DATA);
requestWriter.Close();
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(webStream);
response = responseReader.ReadToEnd();
logObj.CreateLog(APIName + " - " + response + "ApiName - " + APIName + "DataToApi - " + DATA, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
responseReader.Close();
}
catch (Exception e)
{
logObj.CreateLog(APIName + " - " + response + " ApiName - " + APIName + " DataToApi - " + DATA + " Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
}
return response;
}
public string GetPublishNodeApiCall(string nodeAccessToken, string session_id, string utl, string userName, string appsesskey)
{
string DATA = "{\"session_id\":\"" + session_id + "\"" + ",\"utl\":\"" + utl + "\"" + ",\"userName\":\"" + userName + "\"" + ",\"authorization\":\"" + nodeAccessToken + "\"" + ",\"appSKey\":\"" + appsesskey + "\"" + ",\"transid\":\"" + transId.ToLower() + "\"" + ",\"module\":\"TSTRUCT\",\"type\":\"PUBLISH\"}";
string response = NodeApiCall("getLayout", DATA);
LogFile.Log logObj = new LogFile.Log();
try
{
JObject JSONResponse = JObject.Parse(response);
if (JSONResponse["status"].ToString().ToLower() == "true")
{
JToken outer = JToken.Parse(response);
JArray inner = outer["metaData"].Value();
var list = new List>();
int contentplace = 0;
int contentDesign_id = 0;
int i = 0;
foreach (JObject content in inner.Children())
{
foreach (JProperty prop in content.Properties())
{
list.Add(new KeyValuePair(prop.Value.ToString(), i));
i++;
}
}
for (int j = 0; j < list.Count; j++)
{
if (list[j].Key.ToLower() == "content")
{
contentplace = list[j].Value;
}
if (list[j].Key.ToLower() == "design_id")
{
contentDesign_id = list[j].Value;
}
}
if (((Newtonsoft.Json.Linq.JContainer)(JSONResponse["data"])).Count > 0)
{
IsPublish = true;
JToken JtokenValue = JSONResponse["data"][0][contentplace];
Publish_id = JSONResponse["data"][0][contentDesign_id].ToString();
return JtokenValue.ToString();
}
}
return string.Empty;
}
catch (Exception e)
{
logObj.CreateLog("Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
return string.Empty;
}
}
public string GetSaveNodeApiCall(string nodeAccessToken, string session_id, string utl, string userName, string appsesskey)
{
string DATA = "{\"session_id\":\"" + session_id + "\"" + ",\"utl\":\"" + utl + "\"" + ",\"userName\":\"" + userName + "\"" + ",\"authorization\":\"" + nodeAccessToken + "\"" + ",\"appSKey\":\"" + appsesskey + "\"" + ",\"transid\":\"" + transId.ToLower() + "\"" + ",\"module\":\"TSTRUCT\",\"type\":\"SAVE\"}";
string response = NodeApiCall("getLayout", DATA);
LogFile.Log logObj = new LogFile.Log();
try
{
JObject JSONResponse = JObject.Parse(response);
if (JSONResponse["status"].ToString().ToLower() == "true")
{
JToken outer = JToken.Parse(response);
JArray inner = outer["metaData"].Value();
var list = new List>();
int contentplace = 0;
int contentDesign_id = 0;
int publishid = 0;
int ispublishid = 0;
int i = 0;
foreach (JObject content in inner.Children())
{
foreach (JProperty prop in content.Properties())
{
list.Add(new KeyValuePair(prop.Value.ToString(), i));
i++;
}
}
for (int j = 0; j < list.Count; j++)
{
if (list[j].Key.ToLower() == "content")
{
contentplace = list[j].Value;
}
if (list[j].Key.ToLower() == "design_id")
{
contentDesign_id = list[j].Value;
}
if (list[j].Key.ToLower() == "parent_design_id")
{
publishid = list[j].Value;
}
if (list[j].Key.ToLower() == "is_publish")
{
ispublishid = list[j].Value;
}
}
if (((Newtonsoft.Json.Linq.JContainer)(JSONResponse["data"])).Count > 0)
{
JToken JtokenValue = JSONResponse["data"][0][contentplace];
save_id = JSONResponse["data"][0][contentDesign_id].ToString();
Publish_id = JSONResponse["data"][0][publishid].ToString();
Is_Publish = JSONResponse["data"][0][ispublishid].ToString();
return JtokenValue.ToString();
}
}
return string.Empty;
}
catch (Exception e)
{
logObj.CreateLog("Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
return string.Empty;
}
}
public void SetSaveNodeApiCall(string nodeAccessToken, string session_id, string utl, string userName, string appsesskey)
{
string DATA = "{\"session_id\":\"" + session_id + "\"" + ",\"utl\":\"" + utl + "\"" + ",\"userName\":\"" + userName + "\"" + ",\"authorization\":\"" + nodeAccessToken + "\"" + ",\"appSKey\":\"" + appsesskey + "\"" + ",\"transid\":\"" + transId.ToLower() + "\"" + ",\"content\":" + axdesignJson + ",\"type\":\"SAVE\",\"module\":\"TSTRUCT\"}";
string response = NodeApiCall("setLayoutSave", DATA);
LogFile.Log logObj = new LogFile.Log();
try
{
JObject JSONResponse = JObject.Parse(response);
save_id = JSONResponse["data"].ToString();
}
catch (Exception e)
{
logObj.CreateLog("Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
}
}
public void SetPublishNodeApiCall(string nodeAccessToken, string session_id, string utl, string userName, string appsesskey)
{
string DATA = "{\"session_id\":\"" + session_id + "\"" + ",\"utl\":\"" + utl + "\"" + ",\"userName\":\"" + userName + "\"" + ",\"authorization\":\"" + nodeAccessToken + "\"" + ",\"appSKey\":\"" + appsesskey + "\"" + ",\"transid\":\"" + transId.ToLower() + "\"" + ",\"design_id\":\"" + save_id + "\"}";
string response = NodeApiCall("setLayoutPublish", DATA);
LogFile.Log logObj = new LogFile.Log();
try
{
JObject JSONResponse = JObject.Parse(response);
Publish_id = JSONResponse["data"].ToString();
}
catch (Exception e)
{
logObj.CreateLog("Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
}
}
public string GetOldLayoutNodeApi(string nodeAccessToken, string session_id, string utl, string userName, string appsesskey)
{
string DATA = "{\"session_id\":\"" + session_id + "\"" + ",\"utl\":\"" + utl + "\"" + ",\"userName\":\"" + userName + "\"" + ",\"authorization\":\"" + nodeAccessToken + "\"" + ",\"appSKey\":\"" + appsesskey + "\"" + ",\"transid\":\"" + transId + "\"" + ",\"type\":\"axDesign\"}";
string response = NodeApiCall("getOldLayout", DATA);
LogFile.Log logObj = new LogFile.Log();
try
{
JObject JSONResponse = JObject.Parse(response);
if (JSONResponse["status"].ToString().ToLower() == "true")
{
JToken outer = JToken.Parse(response);
JArray inner = outer["metaData"].Value();
var list = new List>();
int contentplace = 0;
int i = 0;
foreach (JObject content in inner.Children())
{
foreach (JProperty prop in content.Properties())
{
list.Add(new KeyValuePair(prop.Value.ToString(), i));
i++;
}
}
for (int j = 0; j < list.Count; j++)
{
if (list[j].Key.ToLower() == "value")
{
contentplace = list[j].Value;
}
}
if (((Newtonsoft.Json.Linq.JContainer)(JSONResponse["data"])).Count > 0)
{
IsPublish = true;
JToken JtokenValue = JSONResponse["data"][0][contentplace];
return JtokenValue.ToString();
}
}
return string.Empty;
}
catch (Exception e)
{
logObj.CreateLog("Exception - " + e.Message, HttpContext.Current.Session["nsessionid"].ToString(), "GetPublishNodeApiCall", "new");
return string.Empty;
}
}
public DesignObject getDesignObjectFromJson(string axdesignJson)
{
DesignObject axdesignJObject = new DesignObject();
try
{
axdesignJObject = JsonConvert.DeserializeObject(axdesignJson.TrimStart(new char[] { '[' }).TrimEnd(new char[] { ']' }));
//if (axdesignJObject.transid != transId)
//{
// axdesignJObject = null;
//}
if (axdesignJObject.transid == null)
{
axdesignJObject.newDesign = true;
isFreshDesign = true;
}
else
{
isFreshDesign = false;
}
}
catch (Exception ex)
{
}
return axdesignJObject;
}
private void getDesignDataPerf()
{
if (HttpContext.Current.Session["Axp_DesignJson"] != null && HttpContext.Current.Session["Axp_DesignJson"].ToString() != "")
{
axdesignJson = HttpContext.Current.Session["Axp_DesignJson"].ToString();
HttpContext.Current.Session["Axp_DesignJson"] = null;
}
else if (HttpContext.Current.Session["Axp_OldDesignJson"] != null && HttpContext.Current.Session["Axp_OldDesignJson"].ToString() != "")
{
//Parsing old JSON to new JSON
try
{
axdesignJson = OldToNewDesignJSONParser(HttpContext.Current.Session["Axp_OldDesignJson"].ToString(), xmlDoc);
}
catch (Exception ex)
{
axdesignJson = string.Empty;
}
string schemaName = string.Empty;
if (HttpContext.Current.Session["dbuser"] != null)
schemaName = HttpContext.Current.Session["dbuser"].ToString();
FDW fdwObj = FDW.Instance;
string designKey = Constants.REDISTSTRUCTAXDESIGN;
fdwObj.SaveInRedisServer(utilObj.GetRedisServerkey(designKey, transId), axdesignJson, designKey, schemaName);
}
axdesignJObject = getDesignObjectFromJson(axdesignJson);
if (axdesignJObject == null)
{
axdesignJObject = new DesignObject();
axdesignJObject.newDesign = true;
isFreshDesign = true;
}
}
private void getDesignData()
{
var designMode = false;
if (HttpContext.Current.Session[transId + "IsDesignMode"] != null && HttpContext.Current.Session[transId + "IsDesignMode"].ToString() != string.Empty)
{
designMode = Convert.ToBoolean(HttpContext.Current.Session[transId + "IsDesignMode"]);
}
string session_id = HttpContext.Current.Session["nsessionid"].ToString();
string utl = HttpContext.Current.Session["utl"].ToString();
string userName = HttpContext.Current.Session["username"].ToString();
string nodeAccessToken = string.Empty;
if (HttpContext.Current.Session["nodeAccessToken"] != null)
nodeAccessToken = HttpContext.Current.Session["nodeAccessToken"].ToString();
string appsesskey = HttpContext.Current.Session["AppSessionKey"].ToString();
//Calling getLayout node api for publish data on run mode
if (HttpContext.Current.Session["Axp_DesignJson"] != null && HttpContext.Current.Session["Axp_DesignJson"].ToString() != "")
{
axdesignJson = HttpContext.Current.Session["Axp_DesignJson"].ToString();
HttpContext.Current.Session["Axp_DesignJson"] = null;
}
//If no data yet saved and published then checking for old design
//if (axdesignJson == string.Empty && !IsPublish && nodeAccessToken != string.Empty && HttpContext.Current.Session["Axp_OldDesign"] !=null && HttpContext.Current.Session["Axp_OldDesign"].ToString() ==string.Empty)
if (axdesignJson == string.Empty && HttpContext.Current.Session["Axp_OldDesign"] != null && HttpContext.Current.Session["Axp_OldDesign"].ToString() == string.Empty)
{
string schemaName = string.Empty;
if (HttpContext.Current.Session["dbuser"] != null)
schemaName = HttpContext.Current.Session["dbuser"].ToString();
FDW fdwObj = FDW.Instance;
//Calling getNewLayout for getting old JSON
DBContext objdb = new DBContext();
if (!designMode)
axdesignJson = objdb.GetAxNewDesign(transId);
if (axdesignJson == string.Empty)
{
//Calling getOldLayout for getting old JSON
axdesignJson = objdb.GetAxOldDesign(transId); //GetOldLayoutNodeApi(nodeAccessToken, session_id, utl, userName, appsesskey);
if (axdesignJson != string.Empty)
{
//Parsing old JSON to new JSON
try
{
axdesignJson = OldToNewDesignJSONParser(axdesignJson, xmlDoc);
}
catch (Exception ex)
{
axdesignJson = string.Empty;
}
if (axdesignJson != string.Empty)
{
string SavedId = objdb.SaveDesignJson(transId, axdesignJson);
if (SavedId != "")
objdb.PublishDesignJson(transId, SavedId);
}
string designKey = Constants.REDISTSTRUCTAXDESIGN;
fdwObj.SaveInRedisServer(utilObj.GetRedisServerkey(designKey, transId), axdesignJson, designKey, schemaName);
//string designTblKey = Constants.REDISTSTRUCTAXDESIGNTABLE;
//fdwObj.ClearRedisServerDataByKey(utilObj.GetRedisServerkey(designTblKey, transId), "", false, schemaName);
}
else
{
string axpOldDesignKey = Constants.AXOLDDESIGN;
fdwObj.SaveInRedisServer(utilObj.GetRedisServerkey(axpOldDesignKey, transId), "NoOldDesign", axpOldDesignKey, schemaName);
}
}
else
{
string designKey = Constants.REDISTSTRUCTAXDESIGN;
fdwObj.SaveInRedisServer(utilObj.GetRedisServerkey(designKey, transId), axdesignJson, designKey, schemaName);
//string designTblKey = Constants.REDISTSTRUCTAXDESIGNTABLE;
//fdwObj.ClearRedisServerDataByKey(utilObj.GetRedisServerkey(designTblKey, transId), "", false, schemaName);
}
}
axdesignJObject = getDesignObjectFromJson(axdesignJson);
if (axdesignJObject == null)
{
axdesignJObject = new DesignObject();
axdesignJObject.newDesign = true;
isFreshDesign = true;
}
}
#endregion
#endregion
}
[Serializable()]
public class FieldsDesign
{
public string fld_id { get; set; }
public int x { get; set; }
public int y { get; set; }
public int width { get; set; }
public int height { get; set; }
public bool visibility { get; set; }
}
[Serializable()]
public class TableDesign
{
public string fld_id { get; set; }
public int width { get; set; }
public bool visibility { get; set; }
}
[Serializable()]
public class Dc
{
public string dc_id { get; set; }
public string isGrid { get; set; }
public bool gridStretch { get; set; }
public List fieldsDesign { get; set; }
public List tableDesign { get; set; }
}
[Serializable()]
public class DesignObject
{
public string transid { get; set; }
public bool compressedMode { get; set; }
public bool newDesign { get; set; }
public bool staticRunMode { get; set; }
public bool wizardDC { get; set; }
public string selectedLayout { get; set; }
public string selectedFontSize { get; set; }
public string selectedControlHeight { get; set; }
public string tstUpdatedOn { get; set; }
public string dcLayout { get; set; }
public string formWidth { get; set; }
public string formAlignment { get; set; }
public string fieldCaptionWidth { get; set; }
public List formLabel { get; set; }
public List buttonFieldFont { get; set; }
public List dcs { get; set; }
public List newdcs { get; set; }
}
[Serializable()]
public class FormLabel
{
public string ftype { get; set; }
public string id { get; set; }
public int dc { get; set; }
public string afterField { get; set; }
public string name { get; set; }
public string fontFamilly { get; set; }
public string fontFamillyCode { get; set; }
public string hyperlinkJson { get; set; }
}
[Serializable()]
public class ButtonFieldFont
{
public string ftype { get; set; }
public string id { get; set; }
public string fontFamilly { get; set; }
public string fontFamillyCode { get; set; }
public string hyperlinkJson { get; set; }
}
#endregion
PK%HJ J PK @Q*U : AW_11.2.0.0_release9/AW_11.2.0.0_release9/App_Code/Util.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.IO;
using System.Data;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Collections;
using System.Web.Caching;
using Newtonsoft.Json.Linq;
using CacheMgr;
using System.Text;
using System.Xml;
using Newtonsoft.Json;
using ASBExt;
using System.Linq;
using System.Xml.Linq;
using System.Net;
using System.Web.Script.Serialization;
using Tools;
using System.Net.Mail;
using System.Security.Cryptography;
using System.Web.UI;
using Microsoft.VisualBasic;
using System.Threading;
using System.Globalization;
using System.Data.Odbc;
using StackExchange.Redis;
namespace Util
{
///
/// Summary description for Util
///
[Serializable()]
public class Util
{
public string errorString = "../aspx/err.aspx?errmsg=Unknown error. Please try again. If the problem continues, please contact your administrator.";
public string ScriptsPath = HttpContext.Current.Application["ScriptsPath"].ToString();
public string draftsPath = string.Empty;
public string enableOldTheme = "false";
public string CachePath = string.Empty;
public string ScriptsurlPath = HttpContext.Current.Application["ScriptsurlPath"].ToString();
public string[] InvalidFileTypes = new string[] { "dll", "exe", "bat" };
//Global application constants
public string LOGINPATH = Convert.ToString(HttpContext.Current.Application["LoginPath"]);
public string SIGNOUTPATH = Convert.ToString(HttpContext.Current.Application["SignOutPath"]);
public string SESSEXPIRYPATH = Convert.ToString(HttpContext.Current.Application["SessExpiryPath"]);
public string MAINPATH = Convert.ToString(HttpContext.Current.Application["MainPath"]);
public string IviewWrap = "true";
public Boolean BreadCrumb = true;
public string ERRPATH = "../aspx/err.aspx?errmsg=";
public string ACERRPATH = "../aspx/CloudErrorPage.aspx?errmsg=";
public string SESSTIMEOUT = "SESSION_TIMEOUT";
public string AXMANAGERPATH = "../aspx/axmanager.aspx";
public Boolean sysErrorlog = false;
public const int capacity = 10;
List allUrls = new List(capacity);
List allurlIdx = new List(capacity);
[NonSerialized]
public ConnectionMultiplexer redisLic;
public void LogErrorToFile(string str)
{
}
public Util()
{
if (HttpContext.Current.Session != null)
{
if (HttpContext.Current.Session["AxTrace"] != null && HttpContext.Current.Session["AxTrace"].ToString() != "")
sysErrorlog = Convert.ToBoolean(HttpContext.Current.Session["AxTrace"]);
if (HttpContext.Current.Session["AxEnableOldTheme"] != null)
enableOldTheme = HttpContext.Current.Session["AxEnableOldTheme"].ToString();
//if (HttpContext.Current.Session["AxIviewcelltextwrap"] != null)
// IviewWrap = HttpContext.Current.Session["AxIviewcelltextwrap"].ToString();
if (HttpContext.Current.Session["AxBreadCrumb"] != null)
BreadCrumb = Convert.ToBoolean(HttpContext.Current.Session["AxBreadCrumb"]);
}
}
public string GetToken()
{
string token = "";
try
{
AxpertToken.Token objToken = new AxpertToken.Token();
string oldToken = "";
if (HttpContext.Current.Session["axpToken"] != null)
oldToken = HttpContext.Current.Session["axpToken"].ToString();
token = objToken.GetToken(oldToken);
}
catch (Exception ex)
{
LogFile.Log logobj = new LogFile.Log();
logobj.CreateLog("Exception in GetToken- util.cs-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-GetToken", "new");
}
//return "11711311101132110113111411321171134118113111411311115113";
return token;
}
#region Validation
///
/// Function to validate TransactionId length lesser or equal to 5 and allow only alphanumerics
///
///
///
///
public bool IsTransIdValid(string str)
{
if (str == null) return false;
if (IsUserNameValid(str) && (str.Length <= 5))
return true;
else
return false;
}
public bool IsValidIvName(string str)
{
if (str == null) return false;
if (IsUserNameValid(str) && (str.Length <= 8))
return true;
else
return false;
}
///
/// Function to validate alphanumerics numbers
///
///
///
///
public bool IsAlphaNum(string str)
{
if (str == null) return false;
Regex regexitem = new Regex("^[a-zA-Z0-9 ]*$");
if (regexitem.IsMatch(str))
return true;
else
return false;
}
///
/// Function to validate alphanumerics numbers and underscore(_)
///
///
///
///
public bool IsAlphaNumUnd(string str)
{
if (str == null) return false;
Regex regexitem = new Regex("^[a-zA-Z0-9 _]*$");
if (regexitem.IsMatch(str))
return true;
else
return false;
}
///
/// Function to validate rowid allow only numerics
///
///
///
///
public bool IsNumber(string number)
{
if (number == null) return false;
Regex regexItem = new Regex("^[0-9]*$");
if (regexItem.IsMatch(number))
return true;
else
return false;
}
///
/// Function to validate string to allow only alphabets
///
///
///
///
public bool IsChar(string str)
{
if (str == null) return false;
Regex regexItem = new Regex("^[a-zA-z]*$");
if (regexItem.IsMatch(str))
return true;
else
return false;
}
///
/// Function to validate and allow only valid docname
///
///
///
///
public bool IsDocName(string DocName)
{
if (DocName == null) return true;
Regex regexItem = new Regex("^[*?<>:|]+$");
if (regexItem.IsMatch(DocName))
return false;
else
return true;
}
///
/// Function to validate string to allow only alphanumeric and underscore
///
/// string
///
///
public bool IsUserNameValid(string Str)
{
if (Str == null) return false;
if (Str.Contains('@'))
{
return Regex.IsMatch(Str, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase);
}
else
{
Regex regexItem = new Regex("^[a-zA-Z0-9_.]*$");
if (regexItem.IsMatch(Str))
return true;
else
return false;
}
}
public bool IsSearchFieldNameValid(string Str)
{
if (Str == null) return false;
Regex regexItem = new Regex("^[a-zA-Z~0-9_.]*$");
if (regexItem.IsMatch(Str))
return true;
else
return false;
}
public bool IsPwdValid(string str)
{
if (str == null) return true;
Regex regexItem = new Regex("^[a-zA-Z0-9-_.!@#$]*$");
if (regexItem.IsMatch(str))
return false;
else
return true;
}
public bool IsHashValid(string str)
{
if (str == null) return false;
Regex regexItem = new Regex("^[0-9]*$");
if (regexItem.IsMatch(str))
return true;
else
return false;
}
public bool IsProjectValid(string str)
{
if (str == null) return false;
Regex regexItem = new Regex("^[a-zA-Z0-9_,. ]*$");
if (regexItem.IsMatch(str))
return true;
else
return false;
}
///
/// To get get error msg as json
///
///
/// Json string
public string ErrorMsgToJson(string str)
{
string jsnnode = "{ \"error\": [{ \"msg\": \"" + str + "\"}] }";
return jsnnode;
}
public bool IsParamArrayList(ArrayList arr)
{
return (arr != null && arr.GetType() == typeof(ArrayList) && arr.Count >= 0);
}
public bool IsParamArrayList(ArrayList arr1, ArrayList arr2, ArrayList arr3, ArrayList arr4)
{
if ((arr1 != null && arr1.GetType() == typeof(ArrayList) && arr1.Count >= 0) &&
(arr2 != null && arr2.GetType() == typeof(ArrayList) && arr2.Count >= 0) &&
(arr3 != null && arr3.GetType() == typeof(ArrayList) && arr3.Count >= 0) &&
(arr4 != null && arr4.GetType() == typeof(ArrayList) && arr4.Count >= 0))
return true;
else
return false;
}
#endregion
///
/// Function to check for special characters in given str and replace them with standard constants.
///
///
///
public string CheckSpecialChars(string str)
{
if (str == null)
str = "";
str = Regex.Replace(str, "&", "&");
str = Regex.Replace(str, "<", "<");
str = Regex.Replace(str, ">", ">");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, "\"", """);
string delimited = @"\\";
str = Regex.Replace(str, delimited, ";bkslh");
return str;
}
public string ReverseCheckSpecialChars(string str)
{
if (str == null)
str = "";
str = Regex.Replace(str, "&", "&");
str = Regex.Replace(str, "<", "<");
str = Regex.Replace(str, ">", ">");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, """, "\"");
str = Regex.Replace(str, " ", " ");
return str;
}
///
/// This function replaces special characters in sql query, since singlequote is handled differently
///
///
///
public string ReverseCheckSpecialCharsInQuery(string str)
{
if (str == null)
str = "";
str = Regex.Replace(str, "&", "&");
str = Regex.Replace(str, "<", "<");
str = Regex.Replace(str, ">", ">");
str = Regex.Replace(str, "'", "''");
str = Regex.Replace(str, """, "\"");
return str;
}
public string CheckSplChrInputXML(string str)
{
if (str != null && str != "")
{
if (!str.StartsWith("<"))
{
int strSpChar = str.Split('<')[0].Length;
str = str.Substring(strSpChar, str.Length - strSpChar);
str = str.TrimStart();
}
if (!str.EndsWith(">"))
{
int endSpChar = str.Split('>').Last().Length;
str = str.Substring(0, str.Length - endSpChar);
str = str.TrimEnd();
}
}
return str;
}
public string ReplaceSqlInjChar(string str)
{
if (str == null)
str = "";
return str.Replace("'", "''");
}
public bool IsNullOrEmpty(String value)
{
return (value == null || value.Length == 0);
}
public string loginFormValues()
{
StringBuilder sbLoginFrmVals = new StringBuilder();
for (int i = 0; i < HttpContext.Current.Request.Form.Count; i++)
{
sbLoginFrmVals.Append("");
}
return sbLoginFrmVals.ToString();
}
public string toggleTheme()
{
string href = string.Empty;
if (HttpContext.Current.Session["AxEnableOldTheme"] != null)
enableOldTheme = HttpContext.Current.Session["AxEnableOldTheme"].ToString().ToLower();
if (enableOldTheme == "true")
href = @"~\css\genericOld.min.css";
else
href = @"~\css\generic.css";
return href;
}
///
/// Function to check for special characters in given str and replace them with standard constants.
///
///
///
public string CheckSpecialCharsSaveAs(string str)
{
if (str == null)
str = "";
str = Regex.Replace(str, """, "\"");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, "&", "&");
str = Regex.Replace(str, "<", "<");
str = Regex.Replace(str, ">", ">");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, "\"", """);
return str;
}
public string CheckSpecialCharacterPurpose(string str)
{
if (str == null)
str = "";
str = Regex.Replace(str, """, "\"");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, "&", "&");
str = Regex.Replace(str, "<", "<");
str = Regex.Replace(str, ">", ">");
str = Regex.Replace(str, "'", "'");
str = Regex.Replace(str, "\"", """);
str = Regex.Replace(str, @"\\", "\");
str = Regex.Replace(str, "/", "/");
str = Regex.Replace(str, ",", ",");
str = Regex.Replace(str, @"\*", "*");
str = Regex.Replace(str, "-", "¯");
str = Regex.Replace(str, ":", ":");
str = Regex.Replace(str, @"\.", ".");
return str;
}
public Array AxSplit(string str, string delimiter)
{
str = str.Replace(delimiter, "♣");
string[] splitArr = str.Split('♣');
return splitArr;
}
public string[] AxSplit1(string str, string delimiter)
{
str = str.Replace(delimiter, "♣");
string[] splitArr = str.Split('♣');
return splitArr;
}
public string GetNextSet(int setNo, int noOfPages)
{
string str = "";
for (int i = 1; i <= 10; i++)
{
int j = ((setNo - 1) * 10) + i;
if (j <= noOfPages)
{
if (str == "")
str += j.ToString();
else
str += "," + j.ToString();
}
}
return str;
}
///
/// Returns true if the file type is not any of the InvalidFileTypes.
///
///
///
public bool IsFileTypeValid(HttpPostedFile file)
{
bool isValid = true;
string fileName = Path.GetFileName(file.FileName);
string[] fileExtnStr = fileName.Split('.');
if (file.ContentType == "application/x-msdownload")
{
string fileExtn = fileExtnStr[fileExtnStr.Length - 1].ToString();
if (fileExtn == "dll" || fileExtn == "exe" || fileExtn == "bat" || fileExtn == "reg" || fileExtn == "com")
{
isValid = false;
}
}
return isValid;
}
///
/// Loops through the application cache objects and deletes them.
///
///
public string ClearApplicationCache()
{
string msg = "Cache cleared.";
List keys = new List();
// retrieve application Cache enumerator
IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator();
// copy all keys that currently exist in Cache
while (enumerator.MoveNext())
{
keys.Add(enumerator.Key.ToString());
}
try
{
// delete every key from cache
for (int i = 0; i < keys.Count; i++)
{
HttpRuntime.Cache.Remove(keys[i]);
}
}
catch (Exception ex)
{
msg = ex.Message;
}
return msg;
}
public bool fBrowserIsMobile()
{
if (HttpContext.Current.Request != null && HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"] != null)
{
var u = HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"].ToString();
if (u.Contains("mobile") || u.Contains("Mobile"))
return true;
}
return false;
}
public string GetClientDateString(string clientCulture, string dt, bool isUnProcessed = false)
{
if (dt == string.Empty)
return dt;
// as the default format is en-gb, do nothing. so handling only the us culture
// the last value, year, also contains the time.
if (clientCulture.ToLower().ToString() == "en-us")
{
string[] tmpDateArr = dt.Split(' ');
string[] tmpDateArr2 = tmpDateArr[0].Split('/');
if (tmpDateArr2.Length > 2)
{
if (isUnProcessed && tmpDateArr2[0].Length == 4)
{
dt = tmpDateArr2[2] + "/" + tmpDateArr2[0] + "/" + tmpDateArr2[1];
}
else
{
dt = tmpDateArr2[1] + "/" + tmpDateArr2[0] + "/" + tmpDateArr2[2];
}
}
}
else if (clientCulture.ToLower().ToString() == "en-gb")
{
string[] tmpDateArr = dt.Split(' ');
string[] tmpDateArr2 = tmpDateArr[0].Split('-');
if (tmpDateArr2.Length > 2)
{
//dt = tmpDateArr2[0] + "/" + tmpDateArr2[1] + "/" + tmpDateArr2[2];
if (isUnProcessed && tmpDateArr2[0].Length == 4)
{
dt = tmpDateArr2[2] + "/" + tmpDateArr2[1] + "/" + tmpDateArr2[0];
}
else
{
dt = tmpDateArr[0];
}
}
}
return dt;
}
///
/// Function returns the error message if the error node is there, else returns empty.
///
///
///
public string ParseJSonErrorNode(string result, bool throwEx = true)
{
result = result.Replace("^^dq", "\'");
string returnStr = result.Replace("*$*", "¿");
string[] newResult = returnStr.Split('¿');
for (int i = 0; i < newResult.Length; i++)
{
JArray msg = null;
try
{
JObject message = JObject.Parse(newResult[i].ToString());
msg = (JArray)message["error"];
}
catch (Exception ex)
{
if (throwEx)
{
throw ex;
}
}
if (msg != null)
{
string saveResult = msg[0].SelectToken("msg").ToString();
saveResult = saveResult.Remove(0, 1);
saveResult = saveResult.Remove(saveResult.Length - 1, 1);
return saveResult;
}
}
return "";
}
///
/// Function to return the random number
///
///
///
public int GenereateRndNo()
{
Random rNo = new Random();
int n;
n = rNo.Next(1111111, 9999999);
return n;
}
///
/// Function to generate the key for storing the tstruct data object in session.
///
///
///
public string GetTstDataId(string transid)
{
return transid + "_" + GenereateRndNo();
}
public string GetIviewId(string ivName)
{
return ivName + "_" + GenereateRndNo();
}
public string GetLviewId(string lvName)
{
return lvName + "_" + GenereateRndNo();
}
///
/// Function to check if the result contains error node
/// If the result contains error, return the error message
/// else return empty.
///
///
///
public string ParseXmlErrorNode(string result)
{
string errMsg = string.Empty;
if (result.StartsWith(Constants.ERROR))
{
result = result.Replace(Constants.ERROR, "");
result = result.Replace(Constants.ERRORCLOSE, "");
if (result == string.Empty)
result = "Unknown error.";
errMsg = result;
}
return errMsg;
}
public string ParseXmlErrorMsgNode(string result)
{
string errMsg = string.Empty;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
if (xmlDoc.ChildNodes[0] != null)
{
if (xmlDoc.ChildNodes[0].Name == "error")
{
foreach (XmlNode childNode in xmlDoc.ChildNodes[0])
{
if (childNode.Name == "msg")
{
return childNode.InnerText;
}
}
errMsg = xmlDoc.ChildNodes[0].InnerText;
}
}
return errMsg;
}
///
/// Function to replace the browser generated html tags in the result.
///
///
///
public string ReplaceTextAreaChars(string result, string src)
{
//The below lines are commented as the result from GetIView is called and it replaces the symbols with
//result = Regex.Replace(result, "<", "<");
//result = Regex.Replace(result, ">", ">");
result = Regex.Replace(result, "", "");
result = Regex.Replace(result, "", "");
if (src == "pdf")
{
result = Regex.Replace(result, " ", "\n");
}
else
{
result = Regex.Replace(result, " ", " ");
result = Regex.Replace(result, "", " ");
result = Regex.Replace(result, " ", " ");
}
return result;
}
///
/// Function to check for the image with the given image name under the axpimages folder.
/// Returns true, if the image is foun, else returns false.
///
///
///
public bool IsImageAvailable(string imageName, string imgType = "")
{
bool imageExists = false;
FileInfo fil;
if (imgType == "icon")
{
string Iconpath = GetAdvConfigs("icon path");
string name = imageName.Substring(imageName.LastIndexOf("/") + 1);
if (Iconpath == null || Iconpath == string.Empty)
{
Iconpath = HttpContext.Current.Application["ScriptsPath"].ToString() + "images\\user Icons\\" + name;
}
else
{
Iconpath = HttpContext.Current.Application["ScriptsPath"].ToString() + Iconpath + "\\" + name;
}
// string path = HttpContext.Current.Application["ScriptsPath"].ToString() + imageName.Split(new[] { "localhost" },StringSplitOptions.None)[1];
fil = new FileInfo(Iconpath);
}
else
fil = new FileInfo(HttpContext.Current.Server.MapPath("../Axpimages\\" + imageName));
if (fil.Exists)
imageExists = true;
return imageExists;
}
///
/// Function to check the langauge for arabic .
///
///
public string GetLngAttribute()
{
string language = string.Empty;
if (HttpContext.Current.Session["language"] != null)
language = HttpContext.Current.Session["language"].ToString();
string lang_at = string.Empty;
if (language != "ENGLISH")
{
lang_at = " lang=\"" + language + "\"";
}
return lang_at;
}
public bool IsLogoExists()
{
bool isLogo = false;
FileInfo fil = new FileInfo(HttpContext.Current.Server.MapPath("../assets/img/logo.png"));
if (fil.Exists)
isLogo = true;
return isLogo;
}
public void IFrameSessExpiry()
{
string url = Convert.ToString(HttpContext.Current.Application["SessExpiryPath"]);
HttpContext.Current.Response.Write("");
}
//public bool licencedValidSessionCheck()
//{
// try
// {
// string prevProj = string.Empty;
// var licSessDetail = new List();
// string licSessDetails = string.Empty;
// string existUser = string.Empty;
// string existSid = string.Empty;
// string existLic = string.Empty;
// if (HttpContext.Current.Session["project"] != null && Convert.ToString(HttpContext.Current.Session["project"]) != string.Empty)
// {
// prevProj = HttpContext.Current.Session["project"].ToString();
// licSessDetail = GetUserList(prevProj);
// if (licSessDetail.Count == 1)
// {
// licSessDetails = licSessDetail.ElementAt(0);
// }
// if (licSessDetails != string.Empty)
// {
// existUser = licSessDetails.Split('♦')[0];
// licSessDetails = licSessDetails.Split('♦')[1];
// existSid = licSessDetails.Split('♣')[0];
// existLic = licSessDetails.Split('♣')[1];
// }
// if (existLic.ToLower() == "limited" && existSid != HttpContext.Current.Session["nsessionid"].ToString())
// {
// return false;
// }
// }
// else
// {
// return false;
// }
// }
// catch (Exception ex)
// {
// return true;
// }
// return true;
//}
public List GetUserList(string pName)
{
List lstUser = new List();
try
{
FDW fdwObj = FDW.Instance;
bool isRedisConnected = fdwObj.IsConnected;
if (isRedisConnected)
{
FDR fObj = new FDR();
string strflKeys = fObj.StringFromRedis(Constants.AXLOGGEDUSER, pName);
if (strflKeys != "")
lstUser = strflKeys.Split('¿').ToList();
}
else
{
//Read from file
if (HttpContext.Current.Application[pName + Constants.AXLOGGEDUSER] != null)
lstUser = (List)HttpContext.Current.Application[pName + Constants.AXLOGGEDUSER];
}
}
catch (Exception ex)
{ }
return lstUser;
}
public void SetUserList(string pName, List usrDetails)
{
try
{
string lstDtls = string.Join("¿", usrDetails);
FDW fdwObj = FDW.Instance;
bool isRedisConnected = fdwObj.IsConnected;
if (isRedisConnected)
fdwObj.SaveInRedisServer(Constants.AXLOGGEDUSER, lstDtls, "", pName);
else
{
//Store in file.
HttpContext.Current.Application[pName + Constants.AXLOGGEDUSER] = usrDetails;
}
}
catch (Exception ex)
{ }
}
public string GetCustomsGroupButtons(string idd, string callertype)
{
string result = string.Empty;
string groupButtons = string.Empty;
ASBCustom.CustomWebservice objWeb = new ASBCustom.CustomWebservice();
try
{
string sqlStr = String.Empty;
if (callertype == "iview")
{
sqlStr = Constants.GET_IV_GROUPED_BUTTONS.Replace(Constants.VAR_IVNAME, idd);
}
result = objWeb.GetChoices(idd, sqlStr);
}
catch (Exception ex)
{
throw ex;
}
if (result.Contains(Constants.ERROR) == true)
{
result = result.Replace(Constants.ERROR, "");
result = result.Replace("", "");
result = result.Replace("\n", "");
//TODO: Exception logging to be done
}
if (result != string.Empty)
{
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.LoadXml(result);
}
catch (Exception ex)
{
//TODO: exception logging to be done
}
XmlNode resultNode = null;
resultNode = xmlDoc.SelectSingleNode("//row");
if (resultNode != null)
{
foreach (XmlNode childNode in resultNode.ChildNodes)
{
if (childNode.Name.ToLower() == "cvalue")
{
groupButtons = childNode.InnerText;
break;
}
}
}
}
return groupButtons;
}
#region "Public function"
public TStructDef GetTstructDefObj(string errorLog, string transid)
{
TStructDef strObj = null;
LogFile.Log logobj = new LogFile.Log();
try
{
CacheManager cacheMgr = new CacheManager(errorLog);
strObj = cacheMgr.GetStructDef(HttpContext.Current.Session["project"].ToString(), HttpContext.Current.Session["nsessionid"].ToString(), HttpContext.Current.Session["user"].ToString(), transid, HttpContext.Current.Session["AxRole"].ToString());
}
catch (Exception ex)
{
if (sysErrorlog)
logobj.CreateLog("Exception in GetStructure Service :--- " + ex.Message.ToString(), HttpContext.Current.Session["nsessionid"].ToString(), "GetStructDef" + transid, "");
HttpContext.Current.Server.Transfer(errorString);
}
return strObj;
}
public void UploadFiles(string f, string sid)
{
string axpert = "Axpert\\";
string ScriptsPath = HttpContext.Current.Application["ScriptsPath"].ToString();
//Create a Folder
try
{
DirectoryInfo di = new DirectoryInfo(ScriptsPath + axpert + sid);
//' Determine whether the directory exists.
if (di.Exists)
{
}
else
{
// create the directory.
di.Create();
}
}
catch (Exception ex)
{
throw ex;
}
string[] files = new string[21];
if ((f.IndexOf(",") != -1))
{
files = f.Split(',');
}
else
{
files[0] = f;
}
int i = 0;
if ((files.Length > 0))
{
for (i = 0; i <= files.Length - 1; i++)
{
if (((files[i] != null)))
{
string outputPath = null;
System.IO.BinaryReader brReader = default(System.IO.BinaryReader);
System.IO.BinaryWriter brWriter = default(System.IO.BinaryWriter);
f = files[i].ToString();
string filename = "";
int index = f.LastIndexOf("\\");
if ((index != -1))
{
//if the file value is a path location then copy the file to session script folder
filename = f.Substring(index + 1);
outputPath = ScriptsPath + axpert + sid + "\\" + filename;
//remove if file exists in the session script folder & copy again the file from the path to session script folder
if (File.Exists(outputPath))
File.Delete(outputPath);
if (File.Exists(f))
File.Copy(f, outputPath);
}
else
{
filename = f;
outputPath = ScriptsPath + axpert + sid + "\\" + filename;
//' Create a file
f = ScriptsPath + axpert + sid + "\\" + f;
if (!File.Exists(outputPath))
{
FileStream input = new FileStream(outputPath, FileMode.Open, FileAccess.Read);
FileStream output = new FileStream(outputPath, FileMode.Create, FileAccess.Write);
int Iindexer = 0;
int FileLen = 0;
brReader = new System.IO.BinaryReader(input);
brWriter = new System.IO.BinaryWriter(output);
int bufsize = 30000;
// this is buffer size
int readcount = 0;
int bsize = 0;
Iindexer = 0;
FileInfo fileInfo = new FileInfo(f);
FileLen = Convert.ToInt32(fileInfo.Length);
while ((readcount < FileLen))
{
if (bufsize < FileLen - readcount)
{
bsize = bufsize;
}
else
{
bsize = FileLen - readcount;
}
byte[] buffer = new byte[bsize];
brReader.Read(buffer, Iindexer, bsize);
brWriter.Write(buffer, Iindexer, bsize);
readcount = readcount + bsize;
}
brReader.Close();
brWriter.Close();
}
}
}
}
files = null;
}
}
public void RefreshField()
{
}
public void RefreshDc()
{
}
public void KillSession()
{
if (HttpContext.Current.Session.Contents.Count > 0)
{
HttpContext.Current.Session.Contents.Clear();
}
System.Web.Configuration.SessionStateSection sessionStateSection = (System.Web.Configuration.SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState");
string cookieName = sessionStateSection.CookieName;
HttpCookie mycookie = new HttpCookie(cookieName);
mycookie.Expires = DateTime.Now.AddDays(-1);
HttpContext.Current.Response.Cookies.Add(mycookie);
HttpContext.Current.Session.Abandon();
}
public string CheckUrlSpecialChars(string value)
{
value = value.Replace("%", "%25");
value = value.Replace("#", "%23");
value = value.Replace("&", "%26");
value = value.Replace("'", "%27");
value = value.Replace("\"", "%22");
value = value.Replace("+", "%2b");
value = value.Replace("<", "%3C");
value = value.Replace("\\", "%5C");
value = value.Replace(" ", "%20");
return value;
}
public string CheckReverseUrlSpecialChars(string value)
{
value = value.Replace("%25", "%");
value = value.Replace("%23", "#");
value = value.Replace("%26", "&");
value = value.Replace("%27", "'");
value = value.Replace("%22", "\"");
value = value.Replace("%2b", "+");
value = value.Replace("%3C", "<");
value = value.Replace("%3E", ">");
value = value.Replace("%5C", "\\");
value = value.Replace("%20", " ");
return value;
}
internal void ClearAxpStructConfigInRedis(string key, string transid, string cfgRoles, string type, string pageName)
{
FDW fdwObj = FDW.Instance;
string schemaName = string.Empty;
if (HttpContext.Current.Session["dbuser"] != null)
schemaName = HttpContext.Current.Session["dbuser"].ToString();
FDR fdrObj = (FDR)HttpContext.Current.Session["FDR"];
if (type == "general")
{
string configKey = "axGenConfigs-";
ArrayList allConfigKeys = fdrObj.GetAllKeys(configKey);
for (int i = 0; i < allConfigKeys.Count; i++)
{
string keyName = allConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
string configNoKey = "-axNoGenConfigs-";
ArrayList allNoDataConfigKeys = fdrObj.GetAllKeys(configNoKey);
for (int i = 0; i < allNoDataConfigKeys.Count; i++)
{
string keyName = allNoDataConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
}
else if (type == "tstruct")
{
if (pageName != "ALL Forms")
{
//string configKey = pageName + "-axconfigstruct-" + cfgRoles + '-';
string configKey = pageName + "-axconfigstruct-";
ArrayList allConfigKeys = fdrObj.GetAllKeys(configKey);
for (int i = 0; i < allConfigKeys.Count; i++)
{
string keyName = allConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
//string axpConfigTable = pageName + "-tstNoConfigs-" + cfgRoles + '-';
string axpConfigTable = pageName + "-tstNoConfigs-";
ArrayList allConfigTblKeys = fdrObj.GetAllKeys(axpConfigTable);
for (int i = 0; i < allConfigTblKeys.Count; i++)
{
string keyName = allConfigTblKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
}
else
{
//string configKey = "-axconfigstruct-" + cfgRoles + '-';
string configKey = "-axconfigstruct-";
ArrayList allConfigKeys = fdrObj.GetAllKeys(configKey);
for (int i = 0; i < allConfigKeys.Count; i++)
{
//remove these keys in REDIS
string keyName = allConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
//string axpConfigTable = "-tstNoConfigs-" + cfgRoles + '-';
string axpConfigTable = "-tstNoConfigs-";
ArrayList allConfigTblKeys = fdrObj.GetAllKeys(axpConfigTable);
for (int i = 0; i < allConfigTblKeys.Count; i++)
{
//remove these keys in REDIS
string keyName = allConfigTblKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
}
}
else if (type == "iview")
{
if (pageName != "ALL Reports")
{
//string configKey = pageName + "-axconfigstruct-" + cfgRoles + '-';
string configKey = pageName + "-axivconfigstruct-";
ArrayList allConfigKeys = fdrObj.GetAllKeys(configKey);
for (int i = 0; i < allConfigKeys.Count; i++)
{
string keyName = allConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
//string axpConfigTable = pageName + "-tstNoConfigs-" + cfgRoles + '-';
string axpConfigTable = pageName + "-ivNoConfigs-";
ArrayList allConfigTblKeys = fdrObj.GetAllKeys(axpConfigTable);
for (int i = 0; i < allConfigTblKeys.Count; i++)
{
string keyName = allConfigTblKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
}
else
{
//string configKey = "-axconfigstruct-" + cfgRoles + '-';
string configKey = "-axivconfigstruct-";
ArrayList allConfigKeys = fdrObj.GetAllKeys(configKey);
for (int i = 0; i < allConfigKeys.Count; i++)
{
//remove these keys in REDIS
string keyName = allConfigKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
//string axpConfigTable = "-tstNoConfigs-" + cfgRoles + '-';
string axpConfigTable = "-ivNoConfigs-";
ArrayList allConfigTblKeys = fdrObj.GetAllKeys(axpConfigTable);
for (int i = 0; i < allConfigTblKeys.Count; i++)
{
//remove these keys in REDIS
string keyName = allConfigTblKeys[i].ToString();
fdwObj.DeleteAllKeys(keyName, schemaName);
}
}
}
}
public string ReplaceUrlSpecialChars(string value)
{
value = value.Replace("%25", "%");
value = value.Replace("%23", "#");
value = value.Replace("%26", "&");
value = value.Replace("%27", "'");
value = value.Replace("%22", "\"");
value = value.Replace("%2b", "+");
return value;
}
#endregion
#region Print Docs
///
/// Function to construct the html of the print docs from the array in session.
///
///
///
public string GetPrintDocsHTML(ArrayList docs)
{
StringBuilder docsHtml = new StringBuilder();
if (docs.Count == 0)
{
docsHtml.Append("
");
docsHtml.Append("No Documents to print.
");
}
else
{
docsHtml.Append("
Your document is being generated, you may close this window now. ");
docsHtml.Append("To know the status click on the 'PrintDocs' link at the top rigth corner of the page
");
docsHtml.Append("
");
docsHtml.Append("
Page
Document
Requested On
Status
");
for (int i = 0; i < docs.Count; i++)
{
int idx = docs[i].ToString().IndexOf("♣");
int idx1 = docs[i].ToString().IndexOf("¿");
int idx2 = docs[i].ToString().IndexOf("~");
string status = docs[i].ToString().Substring(idx2 + 1);
string fileName = docs[i].ToString().Substring(0, idx);
docsHtml.Append("
");
return sb.ToString();
}
///
/// Function to construct the html to display the list of drafts from the drafts folder.
///
///
///
///
public string CreateDraftsHtml(ArrayList fileNames, ArrayList captions)
{
//filename will be in the format of transidkey~createdtime
StringBuilder draftsHtml = new StringBuilder();
if (fileNames.Count == 0)
{
draftsHtml.Append("
");
int i = 0;
for (i = 0; i <= arrFillList.Count - 1; i++)
{
if (arrFillList[i].ToString() == paramValue)
{
paramHtml.Append("");
}
else
{
paramHtml.Append("");
}
}
paramHtml.Append("