#region NameSpaces using System; using System.Collections.Generic; using System.Web; using System.Web.UI.WebControls; using System.Collections; using System.Xml; using System.Text; using System.IO; using System.Data; using System.Linq; using System.Configuration; using Newtonsoft.Json.Linq; using Newtonsoft.Json; using System.Net; //using RestSharp; #endregion #region TstructDef Class /// /// TStructDef class contains complete TStruct related Data. This also has method to /// create the page HTML. The HTML can be generated in DC level. The necessary Javascript /// arrays are created and passed on the client for client side validation and expression /// processing. /// /// /// // TODO: Dc, Js -> DC, JS [Serializable()] public class TStructDef { # region attributes // attributes of the tstruct public enum moe { ACCEPT, SELECT, FILL }; public string EnableOldTheme = "false"; public string transId = string.Empty; public string tstCaption = string.Empty; public string tstPform = string.Empty; public string tstWorkflow = string.Empty; //public string tstRuntimeModification = "F"; //public string fldRuntimeCriteria = "F"; public string tstUpdateOn = string.Empty; public string tstUpdateBy = string.Empty; public string tstReadOnly = string.Empty; public string tstCancelled = string.Empty; public string tstPdf = string.Empty; public string tstVersion = string.Empty; public string tstAttachment = string.Empty; public string tstIviewButton = string.Empty; public Boolean tstHyperLink = false; public string tstLayout = string.Empty; public string hlpText = string.Empty; public string pdfList = string.Empty; public bool wsPerfFormLoadCall = true; public string wsPerfEvalExpClient = string.Empty; public string[] wsPerfFGDcName; public string[] wsPerfLDcName; public string wsPerfFields = string.Empty; public bool wsPerfEnabled = false; public ArrayList wsPerfGRDDcs = new ArrayList(); public string axdesignJson = string.Empty; public DesignObject axdesignJObject = new DesignObject(); public bool isFreshDesign = false; int fieldIndex = 0; public bool dwbToolbar = false; // List with structure public ArrayList dcs = new ArrayList(); public ArrayList popdcs = new ArrayList(); public ArrayList flds = new ArrayList(); public ArrayList btns = new ArrayList(); public ArrayList taskBtns = new ArrayList(); public ArrayList fgs = new ArrayList(); public ArrayList hlnks = new ArrayList(); public ArrayList actions = new ArrayList(); public ArrayList customBtns = new ArrayList(); //public StringBuilder customBtns = new StringBuilder(); // List without structure public ArrayList searchDataNames = new ArrayList(); public ArrayList searchDataCaptions = new ArrayList(); public ArrayList customLabels = new ArrayList(); public ArrayList customLblDcNo = new ArrayList(); public ArrayList pageActionButtons = new ArrayList(); public ArrayList pageActionDcNo = new ArrayList(); public ArrayList dcTable = new ArrayList(); public ArrayList gridScriptButtons = new ArrayList(); public ArrayList gridScriptDcNo = new ArrayList(); public ArrayList gridHeaderScriptButtons = new ArrayList(); public ArrayList gridHeaderScriptDcNo = new ArrayList(); //holds the dc's according to the page positioning public ArrayList pagePositions = new ArrayList(); public ArrayList visibleDCs = new ArrayList(); public ArrayList tabDCs = new ArrayList(50); public ArrayList tabDCStatus = new ArrayList(50); // javascript array attributes public string jsFormcontrolArray = string.Empty; public string jsHyperlinkArray = string.Empty; public StringBuilder tabScript = new StringBuilder(); public StringBuilder jsPatternArray = new StringBuilder(); public StringBuilder jsFieldArray = new StringBuilder(); public StringBuilder jsDCArray = new StringBuilder(); public StringBuilder jsTabDCArray = new StringBuilder(); public StringBuilder jsExpressionArray = new StringBuilder(); public StringBuilder gridHeadHtml = new StringBuilder(); public StringBuilder dummyGridHeadHtml = new StringBuilder(); public StringBuilder gridHiddenHtml = new StringBuilder(); public StringBuilder customLabelHtml = new StringBuilder(); public StringBuilder btnHtml = new StringBuilder(); public StringBuilder dcOtherRows = new StringBuilder(); //public StringBuilder headerHtml = new StringBuilder(); public Boolean IsObjFromCache = false; public Boolean IsObjCustomHtml = false; public ArrayList fldDcRange = new ArrayList(); public int colCount = 0; //this is old ifdesignmode flag.. do not change public Boolean IsDesignMode = false; //Dependency arrays public ArrayList childArray = new ArrayList(); public ArrayList parentArray = new ArrayList(); public ArrayList dependentsArray = new ArrayList(); public ArrayList subTotColValues = new ArrayList(); private int fgCount = 0; public string srchCols = string.Empty; public string grpActBtns = string.Empty; public string refreshSelect = string.Empty; public string htmlToPDF = string.Empty; //Fastdata variables public string fastDataFlds = string.Empty; public string fastDataDynamicFlds = string.Empty; public string fastDataActiveFlds = string.Empty; public ArrayList fastDataRefDSName = new ArrayList(); public ArrayList fastDataRefEvent = new ArrayList(); public DataSet dsFastDataDef = new DataSet(); public List lstGlobalParams = new List(); public bool isFastFormLoad = false; //public string formLoadCache = String.Empty; public bool isWizardTstruct = false; public bool hideToolBar = false; //Variables for Rapid performance changes- EPI public DataTable dt_RapidFormControl = new DataTable(); public DataTable dt_RapidDependents = new DataTable(); public DataTable dt_RapidDependentsTemp = new DataTable(); public bool rapidIsClientFormLoad = false; public bool rapidDoFormLoad = true; public string rapidFormLoadExpFlds = string.Empty; public List rapidFLExpFlds = new List(); public string rapidFormLoadJSON = string.Empty; public string rapidGlobalParams = string.Empty; public string rapidFormLoadActionXML = string.Empty; public string fromListFlds = string.Empty; public ArrayList AxImageFields = new ArrayList(); public ArrayList AxAttachFields = new ArrayList(); public ArrayList AxpFileUploadFields = new ArrayList(); Util.Util utilObj = new Util.Util(); public Dictionary AxRowLimit = new Dictionary(); public string FormLoadGlobalVarNode = string.Empty; // Global variables [NonSerialized] System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); int exprNo = 0; int fldNo = 0; int DCNo = 0; int popDCNo = 0; int grfldNo = 0; int patternNo = 0; int lastDcHeight = 0; int dcArrayNo = 0; int gridDcColwidth = 0; int maxDcHeight = 0; int dcNo = 0; int DcCnt = 0; string dcRange = ""; int fldGlobal = 0; int dcFldCount = 0; int dcFldVisibleCount = 0; string defaultDateStr = "dd/mm/yyyy"; string defaultTimeStr = "HH:MM"; string defaultColWidth = "50"; string res = string.Empty; //If this property comes in Grid DC from xml, showZeroForNumeric variable should be updated. Boolean showZeroForNumeric = true; Boolean isFillGridCall = false; public Boolean isAxpImagePath = false; public Boolean ContainsImage = false; public Boolean ContainsGridAttach = false; public Boolean ContainsGridRefer = false; string tabFunction = string.Empty; public string browser = string.Empty; string fldCss = string.Empty; string fldHdnCss = string.Empty; string ActiveKeyColValue = string.Empty; public int docHeight = 0; public int left = 0; public int top = 0; Custom cust = Custom.Instance; //murali bool flgEnblPurpose = true; public string isPerfCode = "false"; public bool AlwaysServer = true; public string axp_inmemTids = string.Empty; public string axp_inmemKeys = string.Empty; //DesignMode IDs public string save_id = string.Empty; public string Publish_id = string.Empty; public string Is_Publish = "N"; public string dcPlistaddrow = string.Empty; Boolean IsPublish = false; bool isMobile = false; public ArrayList fldSetCarry = new ArrayList(); public ArrayList fldAcceptFromApi = new ArrayList(); private int webServiceTimeout = 100000; public int WebServiceTimeout { get { return webServiceTimeout > 0 ? webServiceTimeout : 100000; } set { webServiceTimeout = value; } } #endregion #region Constructor /// /// Constructor which has the xml data. /// /// public TStructDef(string xml, DataTable customDS, DataSet dsRapidDef) { if (HttpContext.Current.Session != null) EnableOldTheme = HttpContext.Current.Session["AxEnableOldTheme"].ToString().ToLower(); if (HttpContext.Current.Session["AxImagePath"] != null && HttpContext.Current.Session["AxImagePath"].ToString() != "") isAxpImagePath = true; if (HttpContext.Current.Session["ClientLocale"] != null && HttpContext.Current.Session["ClientLocale"].ToString() == "en-us") defaultDateStr = "mm/dd/yyyy"; if (HttpContext.Current.Session["MobileView"] != null && HttpContext.Current.Session["MobileView"].ToString().ToLower() == "true") isMobile = true; ParseSearchAndGroups(customDS); this.structRes = xml; this.Create(xml); if (!string.IsNullOrEmpty(tstVersion) && Int64.Parse(tstVersion) > 10000) { if (dsRapidDef != null && dsRapidDef.Tables.Count > 1) { ParseRapidDef(dsRapidDef); SetRapidExpFlds(); } } if (HttpContext.Current.Session["AxIsPerfCode"] != null && !utilObj.IsNullOrEmpty(HttpContext.Current.Session["AxIsPerfCode"].ToString())) isPerfCode = HttpContext.Current.Session["AxIsPerfCode"].ToString(); } private void ParseRapidDef(DataSet dsRapidDef) { try { dt_RapidFormControl = dsRapidDef.Tables[0]; dt_RapidDependents = dsRapidDef.Tables[1]; dt_RapidDependentsTemp = dt_RapidDependents.Clone(); SetRapidFormLoadProps(); } catch (Exception ex) { LogFile.Log logObj = new LogFile.Log(); logObj.CreateLog("Exception in ParseRapidDef-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-ParseRapidDef", "new"); } } /// /// Function to get the Dependents, and their type from axp_Dependents table /// /// /// /*private FieldStruct SetRapidDependents(FieldStruct fld) { try { if (dt_RapidDependents != null && dt_RapidDependents.Rows.Count > 0) { var strDeps = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == fld.name).OrderBy(x => x.Field("frmno")).ThenBy(x => x.Field("ordno")) .Select(x => new { dependentFld = x.Field("dependenttype") + x.Field("childfield"), allRows = x.Field("allrows") }).Distinct().ToList(); fld.FldRapidDeps = string.Join(",", strDeps.Select(x => x.dependentFld).ToArray()); var strExpDeps = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == fld.name && x.Field("dependenttype") == "e").OrderBy(x => x.Field("frmno")).Select(x => x.Field("dependenttype") + x.Field("childfield")).Distinct().ToList(); fld.FldRapidExpDeps = string.Join(",", strExpDeps.Select(x => x.ToString()).ToArray()); var strParents = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == fld.name && x.Field("dirparam") == "T") .Select(x => new { parent = x.Field("paramname"), allRows = x.Field("allrows") }).Distinct().ToList(); fld.FldRapidParents = string.Join(",", strParents.Select(x => x.parent).ToArray()); fld.FldRapidAllRows = string.Join(",", strParents.Select(x => x.allRows).ToArray()); //Loop through dependents and their parents List strParFlds = new List(); strParFlds.AddRange(strParents.Select(x => x.parent).ToList()); for (int i = 0; i < strDeps.Count; i++) { var strAllPars = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == strDeps[i].dependentFld.Substring(1)) .Select(x => x.Field("paramname")).Distinct().ToList(); strParFlds.AddRange(strAllPars.Select(x => x.ToString()).ToList()); } strParFlds = strParFlds.Distinct().ToList(); //Loop through the parents and their parents List strParParFlds = new List(); for (int j = 0; j < strParFlds.Count; j++) { var strAllPars = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == strParFlds[j].ToString() && !string.IsNullOrEmpty(x.Field("paramname"))).OrderBy(x => x.Field("frmno")) .Select(x => x.Field("paramname")).Distinct().ToList(); strParParFlds.AddRange(strAllPars.Select(x => x.ToString()).ToList()); //strParParFlds.AddRange(strAllPars.Select(x => tranform(x)).Where(y => y != null).ToString().ToList(); } List fldAllParents = new List(); fldAllParents.AddRange(strParFlds); fldAllParents.AddRange(strParParFlds.Distinct().ToList()); fldAllParents = fldAllParents.Distinct().ToList(); fld.FldRapidAllParents = string.Join(",", fldAllParents.Select(x => x.ToString()).Distinct().ToArray()); //var strAllParents = dt_RapidDependents.AsEnumerable().Where(x => x.Field("parentfield") == fld.name) // .Select(x => new { parent = x.Field("paramname"), allRows = x.Field("allrows") }).Distinct().ToList(); //fld.FldRapidAllParents = string.Join(",", strAllParents.Select(x => x.parent).ToArray()); if (fld.FldRapidDeps == fld.FldRapidExpDeps) fld.FldRapidDepType = "c"; else fld.FldRapidDepType = "w"; } } catch (Exception ex) { LogFile.Log logObj = new LogFile.Log(); logObj.CreateLog("Exception in SetRapidDependents-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-SetRapidDep", "new"); } return fld; }*/ private FieldStruct SetRapidDependents(FieldStruct fld) { try { if (dt_RapidDependents != null && dt_RapidDependents.Rows.Count > 0) { dt_RapidDependentsTemp.Clear(); if (dt_RapidDependents.Select("parentfield ='" + fld.name + "'").Length > 0) dt_RapidDependentsTemp = dt_RapidDependents.Select("parentfield ='" + fld.name + "'").CopyToDataTable(); if (dt_RapidDependentsTemp.Rows.Count > 0) { var strDeps = dt_RapidDependentsTemp.AsEnumerable().Select(x => new { dependentFld = x.Field("dependenttype") + x.Field("childfield"), allRows = x.Field("allrows") }).Distinct().ToList(); fld.FldRapidDeps = string.Join(",", strDeps.Select(x => x.dependentFld).ToArray()); var strExpDeps = dt_RapidDependentsTemp.AsEnumerable().Where(x => x.Field("dependenttype") == "e").Select(x => x.Field("dependenttype") + x.Field("childfield")).Distinct().ToList(); fld.FldRapidExpDeps = string.Join(",", strExpDeps.Select(x => x.ToString()).ToArray()); var strParents = dt_RapidDependentsTemp.AsEnumerable().Where(x => x.Field("dirparam") == "T") .Select(x => new { parent = x.Field("paramname"), allRows = x.Field("allrows") }).Distinct().ToList(); fld.FldRapidParents = string.Join(",", strParents.Select(x => x.parent).ToArray()); fld.FldRapidAllRows = string.Join(",", strParents.Select(x => x.allRows).ToArray()); fld.FldRapidAllParents = string.Join(",", dt_RapidDependentsTemp.AsEnumerable().Select(x => x.Field("paramname")).Distinct().ToArray()); if (fld.FldRapidDeps == fld.FldRapidExpDeps) fld.FldRapidDepType = "c"; else fld.FldRapidDepType = "w"; } } } catch (Exception ex) { LogFile.Log logObj = new LogFile.Log(); logObj.CreateLog("Exception in SetRapidDependents-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-SetRapidDep", "new"); } return fld; } private void SetRapidFormLoadProps() { try { if (dt_RapidFormControl.Rows.Count == 0) { rapidDoFormLoad = false; rapidFormLoadJSON = string.Empty; } else { string strRapidDefs; string strRapidExpFlds; var rapidDefs = dt_RapidFormControl.AsEnumerable().Where(x => x.Field("context") == "new") .Select(r => new { fieldname = r.Field("fieldname"), paramname = r.Field("paramname") }).ToList(); rapidGlobalParams = string.Join(",", rapidDefs.Select(x => x.paramname).Distinct().ToArray()); strRapidDefs = string.Join(",", rapidDefs.Select(x => x.fieldname).ToArray()); var rapidExpFlds = dt_RapidFormControl.AsEnumerable().Where(x => x.Field("context") == "new" && (string.IsNullOrWhiteSpace(x.Field("fldsql")) || string.IsNullOrEmpty(x.Field("fldsql"))) && !string.IsNullOrEmpty(x.Field("expression"))).Select(r => r.Field("fieldname")).ToList(); strRapidExpFlds = string.Join(",", rapidExpFlds.Select(x => x.ToString()).ToArray()); rapidFLExpFlds = rapidExpFlds; if (rapidDefs.Count == 0 || strRapidExpFlds == strRapidDefs) rapidIsClientFormLoad = true; } } catch (Exception ex) { LogFile.Log logObj = new LogFile.Log(); logObj.CreateLog("Exception in SetRapidFormLoadProps-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-SetRapidFormLoadProps", "new"); } } private void ParseSearchAndGroups(DataTable customDS) { if (customDS != null) { if (customDS.Rows.Count > 0) { try { foreach (DataRow dr in customDS.Rows) { if (dr["configname"].ToString() == "searchcols") { srchCols = dr["cvalue"].ToString(); } else if (dr["configname"].ToString() == "groupbtns") { grpActBtns = dr["cvalue"].ToString(); } else if (dr["configname"].ToString().ToLower() == "refreshselect") { refreshSelect = dr["cvalue"].ToString(); } else if (dr["configname"].ToString().ToLower() == "printform") { htmlToPDF = dr["cvalue"].ToString(); HttpContext.Current.Session["htmltopdfParams"] = dr["cvalue"].ToString(); } } } catch (Exception ex) { LogFile.Log logObj = new LogFile.Log(); logObj.CreateLog("Exception in ParseSearchAndGroups-" + ex.Message, HttpContext.Current.Session["nsessionid"].ToString(), "Exc-ParseSearchAndGroups", "new"); } } } } private bool CheckpurposeFld()//murali { bool resPurpose = false; ASBCustom.CustomWebservice objCWbSer = new ASBCustom.CustomWebservice(); string dbType = string.Empty; if (!string.IsNullOrEmpty(HttpContext.Current.Session["axdb"].ToString())) dbType = HttpContext.Current.Session["axdb"].ToString().ToLower(); string sql = string.Empty; sql = "Select ( CASE WHEN (Select Value from axpCloudDevSettings where ID='" + HttpContext.Current.Session["user"] + "' and type=\'axPurpose\') IS NULL THEN 0 else (Select Value from axpCloudDevSettings where ID='" + HttpContext.Current.Session["user"] + "' and type=\'axPurpose\') end ) AS admn,(CASE WHEN (Select Value from axpCloudUserSettings where USERID='" + HttpContext.Current.Session["user"] + "' and \'axPurpose\') IS NULL THEN 0 else (Select Value from axpCloudUserSettings where USERID='" + HttpContext.Current.Session["user"] + "' and type=\'axPurpose\')end ) AS usr " + (dbType == "oracle" ? "from dual" : ""); //sql = "select * from axpCloudDevSettings where ID='" + HttpContext.Current.Session["user"] + "'"; string result = objCWbSer.GetChoices(transId, sql); if (result != string.Empty) { DataSet ds = new DataSet(); StringReader sr = new StringReader(result); ds.ReadXml(sr); DataTable dt = ds.Tables["row"]; if (dt != null && dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["admn"].ToString())) { int adminValue = Convert.ToInt32(dt.Rows[0]["admn"]); int userValue = Convert.ToInt32(dt.Rows[0]["usr"]); if (adminValue > 0 && userValue > 0) resPurpose = true; else if (adminValue <= 0 && userValue > 0) resPurpose = true; else if (adminValue > 0 && userValue <= 0) resPurpose = false; else if (adminValue <= 0 && userValue <= 0) resPurpose = false; } else resPurpose = false; } } return resPurpose; } #endregion # region DataMembers with get set properties public ArrayList lstDc1 { get { return dcs; } set { dcs = value; } } public ArrayList lstPopDc { get { return popdcs; } set { popdcs = value; } } public ArrayList lstField { get { return flds; } set { flds = value; } } public ArrayList lstButton { get { return btns; } set { btns = value; } } public ArrayList lstFillgrid { get { return fgs; } set { fgs = value; } } public ArrayList lstHyperLink { get { return hlnks; } set { hlnks = value; } } public ArrayList lstSearchDataNames { get { return searchDataNames; } set { searchDataNames = value; } } public ArrayList lstSearchDataCaptions { get { return searchDataCaptions; } set { searchDataCaptions = value; } } public ArrayList lstActions { get { return actions; } set { actions = value; } } public string structRes { get { return res; } set { res = value; } } public Boolean ShowZeroForNumeric { get { return showZeroForNumeric; } set { showZeroForNumeric = value; } } public Boolean IsFillGridCall { get { return isFillGridCall; } set { isFillGridCall = value; } } public string HlpText { get { return hlpText; } set { hlpText = value; } } #endregion # region Structures /// /// Structure for Dc data. /// [Serializable] public struct DcStruct { string dcName; string dcCaption; int dcNo; int fldCount; int visFldCount; bool dcIsGrid; bool dcIsPopGrid; int dcHgt; int dcWdt; bool dcIsAllowAddRows; bool dcIsAllowchange; bool dcIsAllowDeleteRows; bool dcIsFormatGrid; bool showAddBtn; bool dcHasDataRows; bool dcAllowEmpty; string keyCol; bool multiSelect; string sql; string hideColumns; string mapColumn; string mapParColumn; ArrayList subTotalCols; string displayKeyCol; string displayTotCol; string headerStyle; string subTotalStyle; string action; string dcPurpose;//murali ArrayList dispKeyColValues; ArrayList keyColumnValues; ArrayList tabParentFlds; StringBuilder dcExpDependents; string dcAcceptMRFields; string dcPlist; public string dcPList { get { return dcPlist; } set { dcPlist = value; } } public int dcHeight { get { return dcHgt; } set { dcHgt = value; } } public int dcWidht { get { return dcWdt; } set { dcWdt = value; } } public int fieldCount { get { return fldCount; } set { fldCount = value; } } public int visibleFldCount { get { return visFldCount; } set { visFldCount = value; } } public string name { get { return dcName; } set { dcName = value; } } public string caption { get { return dcCaption; } set { dcCaption = value; } } public int frameno { get { return dcNo; } set { dcNo = value; } } public bool isgrid { get { return dcIsGrid; } set { dcIsGrid = value; } } public bool DCHasDataRows { get { return dcHasDataRows; } set { dcHasDataRows = value; } } public bool DcAllowEmpty { get { return dcAllowEmpty; } set { dcAllowEmpty = value; } } public bool ispopgrid { get { return dcIsPopGrid; } set { dcIsPopGrid = value; } } public bool isallowaddrows { get { return dcIsAllowAddRows; } set { dcIsAllowAddRows = value; } } public bool isallowchange { get { return dcIsAllowchange; } set { dcIsAllowchange = value; } } public bool isallowdeletrows { get { return dcIsAllowDeleteRows; } set { dcIsAllowDeleteRows = value; } } public bool IsFormatGrid { get { return dcIsFormatGrid; } set { dcIsFormatGrid = value; } } public bool MultiSelect { get { return multiSelect; } set { multiSelect = value; } } public bool ShowAddBtn { get { return showAddBtn; } set { showAddBtn = value; } } public string KeyColumn { get { return keyCol; } set { keyCol = value; } } public string Sql { get { return sql; } set { sql = value; } } public string HideColumns { get { return hideColumns; } set { hideColumns = value; } } public string Action { get { return action; } set { action = value; } } public string MapColumn { get { return mapColumn; } set { mapColumn = value; } } public string MapParentCol { get { return mapParColumn; } set { mapParColumn = value; } } public ArrayList SubTotalColumns { get { return subTotalCols; } set { subTotalCols = value; } } public string DisplayKeyCol { get { return displayKeyCol; } set { displayKeyCol = value; } } public string DisplayTotalCol { get { return displayTotCol; } set { displayTotCol = value; } } public string HeaderStyle { get { return headerStyle; } set { headerStyle = value; } } public string SubTotalStyle { get { return subTotalStyle; } set { subTotalStyle = value; } } public string DCAcceptMRFields { get { return dcAcceptMRFields; } set { dcAcceptMRFields = value; } } public string purpose //murali { get { return dcPurpose; } set { dcPurpose = value; } } public ArrayList DispKeyColValues { get { return dispKeyColValues; } set { dispKeyColValues = value; } } public ArrayList KeyColValues { get { return keyColumnValues; } set { keyColumnValues = value; } } public ArrayList tabParentFields { get { return tabParentFlds; } set { tabParentFlds = value; } } public StringBuilder dcExpressionDeps { get { return dcExpDependents; } set { dcExpDependents = value; } } } /// /// Structure for PopDc data. /// [Serializable] public struct PopDcStruct { string dcCaption; int dcNo; int pDcNo; string pFields; string popField; string popFirm; string popAuto; string popKeyCols; string displaySummaryField; string summaryParent; string delimiter; string sqlFill; string popCond; public string caption { get { return dcCaption; } set { dcCaption = value; } } public int frameno { get { return dcNo; } set { dcNo = value; } } public int pdcno { get { return pDcNo; } set { pDcNo = value; } } public string pfields { get { return pFields; } set { pFields = value; } } public string popfield { get { return popField; } set { popField = value; } } public string pFirm { get { return popFirm; } set { popFirm = value; } } public string pAuto { get { return popAuto; } set { popAuto = value; } } public string pKeyCols { get { return popKeyCols; } set { popKeyCols = value; } } public string dispSummaryField { get { return displaySummaryField; } set { displaySummaryField = value; } } public string dispSummaryParent { get { return summaryParent; } set { summaryParent = value; } } public string summaryDelimiter { get { return delimiter; } set { delimiter = value; } } public string fillSql { get { return sqlFill; } set { sqlFill = value; } } public string PopCondition { get { return popCond; } set { popCond = value; } } } /// /// Structure for Action data. /// [Serializable] public struct ActionStruct { string actName; string actDesc; string actApply; string actApplyOn; string actStrName; string actValidate; string actWeb; string actRemarks; string manRemarks; string actParentRefresh; string actsavetask; string actscripttask; public string actname { get { return actName; } set { actName = value; } } public string actdesc { get { return actDesc; } set { actDesc = value; } } public string actapply { get { return actApply; } set { actApply = value; } } public string actapplyon { get { return actApplyOn; } set { actApplyOn = value; } } public string actstrname { get { return actStrName; } set { actStrName = value; } } public string actvalidate { get { return actValidate; } set { actValidate = value; } } public string actweb { get { return actWeb; } set { actWeb = value; } } public string actRem { get { return actRemarks; } set { actRemarks = value; } } public string manRem { get { return manRemarks; } set { manRemarks = value; } } public string actParRefresh { get { return actParentRefresh; } set { actParentRefresh = value; } } public string actSaveTask { get { return actsavetask; } set { actsavetask = value; } } public string actScriptTask { get { return actscripttask; } set { actscripttask = value; } } } /// /// Structure for field data. /// [Serializable] public struct FieldStruct { string fldName; string fldCaption; string fldDatatype; string fldTableVal; string fldModeofEntry; string fldExpression; string fldValidateExpression; string fldTLHW; string fldChecktype; string fldAllignType; string fldColumnWidth; string fldLabelTLHW; string fldPattern; string fldPasswordCharacter; string fldApplyComma; string fldSqlList; string fldExpressionList; string fldFillList; string fldFillGridList; string fldPopDepList; string fldAutoSelect; string fldRefreshOnSave; string fldSourceField; string fldSqlField; string isSqlFld; string isApiFld; string fldSqlQuery; string fldSelAPI; string fieldSelApiParams; string fldSelectMode; string fldMoeValue; string fldTooltip; string fldDependents; string fldSqlDeps; string fldExpDeps; string fldGridSqlDeps; string fldSqlDepParents; string fldDepGridDcs; string fldDepFillDcs; string fldParents; string clientFldParents; string fldHint; string fldPurpose;//mAdd //Events for the field string fldOnFocus; string fldOnBlur; string fldOnKeyDown; string fldOnKeyUp; string fldOnClick; string fldOnDbClick; string fldOnKeyPress; string fldOnChange; string fldValue; string masterRow; string fldComboVals; string fldIdCol; string fldLblCss; string fldTxtCss; string fldValSeparator; string fldBgColor; ArrayList advSrchFlds; ArrayList advSrchFldsType; string pLabelTLHW; string pwfldtlhw; public int fldFrameNo; int fldLength; int fldDecimalPlaces; int fldParamCount; int fldSelectRefresh; int fldOrder; bool fldIsVisibility; bool fldIsAllowEmpty; bool fldIsReadonly; bool fldIsSaveNormal; bool fldIsEditCombo; bool fldIsSelectFireSql; bool fldIsSaveValue; bool fldIsAllowDuplicate; bool fldIsImage; bool fldIsFromList; bool fldIsOnlyPositive; bool fldIsTabStop; string fldRapidDeps; string fldRapidExpDeps; string fldRapidDepType; string fldRapidParents; string fldRapidAllParents; string fldRapidAllRows; int fieldindex; string fldmultiselect; string fldmultiselectsep; string fldtype; string fldacceptapi; int pwdMinChar; bool pwdAlphaNumeric; int pwdNodExpiry; public string OnFocus { get { return fldOnFocus; } set { fldOnFocus = value; } } public string OnBlur { get { return fldOnBlur; } set { fldOnBlur = value; } } public string OnKeyDown { get { return fldOnKeyDown; } set { fldOnKeyDown = value; } } public string OnKeyUp { get { return fldOnKeyUp; } set { fldOnKeyUp = value; } } public string OnClick { get { return fldOnClick; } set { fldOnClick = value; } } public string OnDbClick { get { return fldOnDbClick; } set { fldOnDbClick = value; } } public string OnKeyPress { get { return fldOnKeyPress; } set { fldOnKeyPress = value; } } public string OnChange { get { return fldOnChange; } set { fldOnChange = value; } } public string name { get { return fldName; } set { fldName = value; } } public string caption { get { return fldCaption; } set { fldCaption = value; } } public string datatype { get { return fldDatatype; } set { fldDatatype = value; } } public string tabletypeval { get { return fldTableVal; } set { fldTableVal = value; } } public string moe { get { return fldModeofEntry; } set { fldModeofEntry = value; } } public string expr { get { return fldExpression; } set { fldExpression = value; } } public string vexpr { get { return fldValidateExpression; } set { fldValidateExpression = value; } } public string fldtlhw { get { return fldTLHW; } set { fldTLHW = value; } } public string lbltlhw { get { return fldLabelTLHW; } set { fldLabelTLHW = value; } } public string plbltlhw { get { return pLabelTLHW; } set { pLabelTLHW = value; } } public string pfldtlhw { get { return pwfldtlhw; } set { pwfldtlhw = value; } } public string pattern { get { return fldPattern; } set { fldPattern = value; } } public string pwdchar { get { return fldPasswordCharacter; } set { fldPasswordCharacter = value; } } public int pwdminchar { get { return pwdMinChar; } set { pwdMinChar = value; } } public bool pwdalphanumeric { get { return pwdAlphaNumeric; } set { pwdAlphaNumeric = value; } } public int pwdnodexpiry { get { return pwdNodExpiry; } set { pwdNodExpiry = value; } } public string applycomma { get { return fldApplyComma; } set { fldApplyComma = value; } } public string fieldHint { get { return fldHint; } set { fldHint = value; } } public string fieldPurpose //m { get { return fldPurpose; } set { fldPurpose = value; } } public string slist { get { return fldSqlList; } set { fldSqlList = value; } } public string elist { get { return fldExpressionList; } set { fldExpressionList = value; } } public string flist { get { return fldFillList; } set { fldFillList = value; } } public string sflist { get { return fldPopDepList; } set { fldPopDepList = value; } } public string fglist { get { return fldFillGridList; } set { fldFillGridList = value; } } public string ctype { get { return fldChecktype; } set { fldChecktype = value; } } public string type { get { return fldAllignType; } set { fldAllignType = value; } } public string cwid { get { return fldColumnWidth; } set { fldColumnWidth = value; } } public string selectmode { get { return fldSelectMode; } set { fldSelectMode = value; } } public string autoselect { get { return fldAutoSelect; } set { fldAutoSelect = value; } } public string refreshOnSave { get { return fldRefreshOnSave; } set { fldRefreshOnSave = value; } } public string srcfld { get { return fldSourceField; } set { fldSourceField = value; } } public string sqlfld { get { return fldSqlField; } set { fldSqlField = value; } } public string isFieldSql { get { return isSqlFld; } set { isSqlFld = value; } } public string fieldSqlQuery { get { return fldSqlQuery; } set { fldSqlQuery = value; } } public string isFieldApi { get { return isApiFld; } set { isApiFld = value; } } public string fieldSelAPI { get { return fldSelAPI; } set { fldSelAPI = value; } } public string fieldSelAPIParams { get { return fieldSelApiParams; } set { fieldSelApiParams = value; } } public int fldframeno { get { return fldFrameNo; } set { fldFrameNo = value; } } public int fldlength { get { return fldLength; } set { fldLength = value; } } public int flddecimal { get { return fldDecimalPlaces; } set { fldDecimalPlaces = value; } } public int pcount { get { return fldParamCount; } set { fldParamCount = value; } } public int refresh { get { return fldSelectRefresh; } set { fldSelectRefresh = value; } } public int order { get { return fldOrder; } set { fldOrder = value; } } public string Value { get { return fldValue; } set { fldValue = value; } } public bool visibility { get { return fldIsVisibility; } set { fldIsVisibility = value; } } public bool allowempty { get { return fldIsAllowEmpty; } set { fldIsAllowEmpty = value; } } public bool allowduplicate { get { return fldIsAllowDuplicate; } set { fldIsAllowDuplicate = value; } } public bool freadonly { get { return fldIsReadonly; } set { fldIsReadonly = value; } } public bool savenormal { get { return fldIsSaveNormal; } set { fldIsSaveNormal = value; } } public bool savevalue { get { return fldIsSaveValue; } set { fldIsSaveValue = value; } } public bool editcombo { get { return fldIsEditCombo; } set { fldIsEditCombo = value; } } public bool firesql { get { return fldIsSelectFireSql; } set { fldIsSelectFireSql = value; } } public bool fieldIsImage { get { return fldIsImage; } set { fldIsImage = value; } } public bool fieldIsFrmList { get { return fldIsFromList; } set { fldIsFromList = value; } } public string moeval { get { return fldMoeValue; } set { fldMoeValue = value; } } public string tooltip { get { return fldTooltip; } set { fldTooltip = value; } } public string fieldLabelCss { get { return fldLblCss; } set { fldLblCss = value; } } public string fieldCtrlCss { get { return fldTxtCss; } set { fldTxtCss = value; } } public string mRow { get { return masterRow; } set { masterRow = value; } } public string fldComboValues { get { return fldComboVals; } set { fldComboVals = value; } } public string fldIdCols { get { return fldIdCol; } set { fldIdCol = value; } } public string fieldParents { get { return fldParents; } set { fldParents = value; } } public string ClientFldParents { get { return clientFldParents; } set { clientFldParents = value; } } public string fieldDependents { get { return fldDependents; } set { fldDependents = value; } } public string fieldSqlDeps { get { return fldSqlDeps; } set { fldSqlDeps = value; } } public string fieldExpDeps { get { return fldExpDeps; } set { fldExpDeps = value; } } public string fieldSqlGridDeps { get { return fldGridSqlDeps; } set { fldGridSqlDeps = value; } } public string fieldSqlDepParents { get { return fldSqlDepParents; } set { fldSqlDepParents = value; } } public string fieldDepGridDcs { get { return fldDepGridDcs; } set { fldDepGridDcs = value; } } public string fieldDepFillDcs { get { return fldDepFillDcs; } set { fldDepFillDcs = value; } } public string fieldValSeparator { get { return fldValSeparator; } set { fldValSeparator = value; } } public string fldColor { get { return fldBgColor; } set { fldBgColor = value; } } public bool onlyPositive { get { return fldIsOnlyPositive; } set { fldIsOnlyPositive = value; } } public bool tabStop { get { return fldIsTabStop; } set { fldIsTabStop = value; } } public ArrayList AdvSrchFlds { get { return advSrchFlds; } set { advSrchFlds = value; } } public ArrayList AdvSrchFldsType { get { return advSrchFldsType; } set { advSrchFldsType = value; } } public string FldRapidDeps { get { return fldRapidDeps; } set { fldRapidDeps = value; } } public string FldRapidExpDeps { get { return fldRapidExpDeps; } set { fldRapidExpDeps = value; } } public string FldRapidDepType { get { return fldRapidDepType; } set { fldRapidDepType = value; } } public string FldRapidParents { get { return fldRapidParents; } set { fldRapidParents = value; } } public string FldRapidAllParents { get { return fldRapidAllParents; } set { fldRapidAllParents = value; } } public string FldRapidAllRows { get { return fldRapidAllRows; } set { fldRapidAllRows = value; } } public int fieldIndex { get { return fieldindex; } set { fieldindex = value; } } public string fldMultiSelect { get { return fldmultiselect; } set { fldmultiselect = value; } } public string fldMultiSelectSep { get { return fldmultiselectsep; } set { fldmultiselectsep = value; } } public string fldType { get { return fldtype; } set { fldtype = value; } } public string fldAcceptApi { get { return fldacceptapi; } set { fldacceptapi = value; } } } /// /// FillGrid Structure /// [Serializable] public struct FGStruct { string fgsqlparams; string fgTargetDc; string fgSourceDc; string fgMultiSelect; string fgAutoShow; string fgCondition; string fgCaption; string fName; string fgValidateExp; ArrayList dcFldName; ArrayList sqlFldName; string fgExecOnSave; public string fgSqlParams { get { return fgsqlparams; } set { fgsqlparams = value; } } public string fgcaption { get { return fgCaption; } set { fgCaption = value; } } public string fgName { get { return fName; } set { fName = value; } } public string fgtargetdc { get { return fgTargetDc; } set { fgTargetDc = value; } } public string fgSourceDC { get { return fgSourceDc; } set { fgSourceDc = value; } } public string fgmultiselect { get { return fgMultiSelect; } set { fgMultiSelect = value; } } public string fgautoshow { get { return fgAutoShow; } set { fgAutoShow = value; } } public string FGCondition { get { return fgCondition; } set { fgCondition = value; } } public string FGExecOnSave { get { return fgExecOnSave; } set { fgExecOnSave = value; } } public string fgValExpression { get { return fgValidateExp; } set { fgValidateExp = value; } } public ArrayList fgDcFldName { get { return dcFldName; } set { dcFldName = value; } } public ArrayList fgSqlFldName { get { return sqlFldName; } set { sqlFldName = value; } } } /// /// HyperLink Structure /// [Serializable] private struct HLinkStruct { string hlName; string hlSource; string hlPop; string hlLoad; string hlParamName; string hlParamValue; public string hlname { get { return hlName; } set { hlName = value; } } public string hlsource { get { return hlSource; } set { hlSource = value; } } public string hlpop { get { return hlPop; } set { hlPop = value; } } public string hlload { get { return hlLoad; } set { hlLoad = value; } } public string hlparamname { get { return hlParamName; } set { hlParamName = value; } } public string hlparamval { get { return hlParamValue; } set { hlParamValue = value; } } } /// /// icon structure /// [Serializable] public struct IconStruct { public string text; public string addclass; } /// /// Api structure /// [Serializable] public struct btnApiStruct { public string url; public string reqstr; public string restype; public string resformat; public string category; public string method; } /// /// Button structure /// [Serializable] public struct ButtonStruct { string btnTask; string btnActionValue; string btnFileUpload; string btnFileMessage; string btnFileType; string btnImageName; string btnCaption; string btnFooter; string btnVisible; string btnHint; string btnTLHW; string btnCancel; string btnID; bool isDrpDwnBtn; bool scriptapi; bool isFormBtn; IconStruct btnIcon; btnApiStruct btnApi; ArrayList childButtons; bool script; public bool isformbtn { get { return isFormBtn; } set { isFormBtn = value; } } public bool isDrpDwn { get { return isDrpDwnBtn; } set { isDrpDwnBtn = value; } } public bool scriptApi { get { return scriptapi; } set { scriptapi = value; } } public IconStruct icon { get { return btnIcon; } set { btnIcon.text = value.text; btnIcon.addclass = value.addclass; } } public btnApiStruct btnapi { get { return btnApi; } set { btnApi.url = value.url; btnApi.reqstr = value.reqstr; btnApi.restype = value.restype; btnApi.resformat = value.resformat; btnApi.category = value.category; btnApi.method = value.method; } } public ArrayList childBtns { get { return childButtons; } set { childButtons = value; } } public string ID { get { return btnID; } set { btnID = value; } } public string task { get { return btnTask; } set { btnTask = value; } } public string action { get { return btnActionValue; } set { btnActionValue = value; } } public string fileupload { get { return btnFileUpload; } set { btnFileUpload = value; } } public string cancelBtn { get { return btnCancel; } set { btnCancel = value; } } public string fmessage { get { return btnFileMessage; } set { btnFileMessage = value; } } public string ftype { get { return btnFileType; } set { btnFileType = value; } } public string image { get { return btnImageName; } set { btnImageName = value; } } public string hint { get { return btnHint; } set { btnHint = value; } } public string caption { get { return btnCaption; } set { btnCaption = value; } } public string dimension { get { return btnTLHW; } set { btnTLHW = value; } } public bool isScript { get { return script; } set { script = value; } } public string footer { get { return btnFooter; } set { btnFooter = value; } } public string visible { get { return btnVisible; } set { btnVisible = value; } } } #endregion # region Methods #region Private Methods /// /// function to update the tstruct related properties. /// /// private void FillTstructProperties(XmlDocument xmlDoc) { //Loop through the root node and update the dcTitle //Tstruct attributes of the TstructDef class. XmlNodeList tstAttributeNodes = default(XmlNodeList); tstAttributeNodes = xmlDoc.GetElementsByTagName("root"); foreach (XmlNode tstAttributeNode in tstAttributeNodes) { if (tstAttributeNode.Attributes["pform"] != null) tstPform = tstAttributeNode.Attributes["pform"].Value.ToString(); if (tstAttributeNode.Attributes["wflow"] != null) tstWorkflow = tstAttributeNode.Attributes["wflow"].Value.ToString(); if (tstAttributeNode.Attributes["updatedon"] != null) tstUpdateOn = tstAttributeNode.Attributes["updatedon"].Value.ToString(); if (tstAttributeNode.Attributes["updusername"] != null) tstUpdateBy = tstAttributeNode.Attributes["updusername"].Value.ToString(); if (tstAttributeNode.Attributes["readonly"] != null) tstReadOnly = tstAttributeNode.Attributes["readonly"].Value.ToString(); if (tstAttributeNode.Attributes["cancelled"] != null) tstCancelled = tstAttributeNode.Attributes["cancelled"].Value.ToString(); if (tstAttributeNode.Attributes["pdf"] != null) tstPdf = tstAttributeNode.Attributes["pdf"].Value.ToString(); if (tstAttributeNode.Attributes["sverno"] != null) tstVersion = tstAttributeNode.Attributes["sverno"].Value.ToString(); //if (tstAttributeNode.Attributes["runtimemod"] != null) // tstRuntimeModification = tstAttributeNode.Attributes["runtimemod"].Value.ToString(); // TODO : This is for temporary , we have to give all the tstruct related // attributes either in the root node or in the first childnode[tstruct node] of the root node. XmlNode tstBaseNode = tstAttributeNode.ChildNodes[0]; if (tstBaseNode.Attributes["cat"].Value.ToString().ToLower() == "tstruct") { foreach (XmlNode tstNode in tstBaseNode) { if (tstNode.Name == "a1") transId = tstNode.InnerText; else if (tstNode.Name == "a2") { tstCaption = tstNode.InnerText; tstCaption = tstCaption.Replace("&&", "&"); } else if (tstNode.Name == "a18") tstAttachment = tstNode.InnerText; else if (tstNode.Name == "a20") tstIviewButton = tstNode.InnerText; //else if (tstNode.Name == "a28") // formLoadCache = tstNode.InnerText; else if (tstNode.Name == "a29") if (tstNode.InnerText != null && tstNode.InnerText.ToLower() == "wizard") isWizardTstruct = true; } } if (tstBaseNode.Attributes != null && tstBaseNode.Attributes["wsflds"] != null) { string tempWsFieldDetails = string.Empty; try { tempWsFieldDetails = tstBaseNode.Attributes["wsflds"].Value.ToString(); } catch (Exception ex) { } //DoFormload~exflds~dcname`fillgrid names with auto show true~dcname`accpetsql,dcname`selectautoselectflds if (tempWsFieldDetails != string.Empty) { wsPerfEnabled = true; string[] wsDetails = tempWsFieldDetails.Split('~'); if (wsDetails.Length >= 1)//Doformload wsPerfFormLoadCall = wsDetails[0].ToString().ToLower() == "true" ? true : false; if (wsDetails.Length >= 2)//Expression flds wsPerfEvalExpClient = wsDetails[1].ToString(); if (wsDetails.Length >= 3 && wsDetails[2] != "") { string[] flgDetails = wsDetails[2].Split(',').ToArray(); wsPerfFGDcName = flgDetails.Select(x => x.Split('`')[0]).ToArray();//Fillgrid dcname } if (wsDetails.Length >= 4 && wsDetails[3] != "") { string[] ldcDetails = wsDetails[3].Split(',').ToArray(); wsPerfLDcName = ldcDetails.Select(x => x.Split('`')[0]).ToArray();//dcname wsPerfFields = string.Join(",", ldcDetails.Select(x => x.Split('`')[1]).ToArray());//acceptsql and select with autosel true fields } } } } } /// /// Function to parse the format grid xml and update the dc properties. /// /// private void XmlLoadFormatDcs(XmlNode gFormatNodes) { string actions = string.Empty; foreach (XmlNode dcNode in gFormatNodes) { for (int i = 0; i < dcs.Count; i++) { DcStruct dc = (DcStruct)dcs[i]; if (dc.name == dcNode.Name) { dc.IsFormatGrid = true; foreach (XmlNode dataNode in dcNode.ChildNodes) { string value = string.Empty; if (dataNode.Attributes["val"] != null) value = dataNode.Attributes["val"].Value; if (dataNode.Name.ToLower() == "keycol") dc.KeyColumn = value; else if (dataNode.Name.ToLower() == "keyval") { if (dataNode.Attributes["multiselect"] != null) { if (dataNode.Attributes["multiselect"].Value == "true") dc.MultiSelect = true; else dc.MultiSelect = false; } if (value != string.Empty) { string[] strValues = value.Split(','); for (int j = 0; j < strValues.Length; j++) { dc.KeyColValues.Add(value); } } } else if (dataNode.Name.ToLower() == "headlp") { dc.HeaderStyle = value; } else if (dataNode.Name.ToLower() == "headl") { string[] dispKeyCol = value.Split('='); dc.DisplayKeyCol = dispKeyCol[0].ToString(); foreach (XmlNode newItem in dataNode.ChildNodes) { dc.DispKeyColValues.Add(newItem.Name + "¿" + newItem.InnerText); } } else if (dataNode.Name.ToLower() == "totlp") { dc.SubTotalStyle = value; } else if (dataNode.Name.ToLower() == "totl") { string[] stDetails = value.Split(','); for (int j = 0; j < stDetails.Length; j++) { string[] cols = stDetails[j].ToString().Split('='); if (cols.Length > 1) { if (cols[1].Substring(0, 1) != "#") dc.DisplayTotalCol = cols[0].ToString().Trim(); else dc.SubTotalColumns.Add(cols[0].ToString().Trim()); } } } else if (dataNode.Name.ToLower() == "actions") { foreach (XmlNode actionNode in dataNode.ChildNodes) { if (actions == "") actions = actionNode.InnerText; else actions = "," + actionNode.InnerText; } dc.Action = actions; } else if (dataNode.Name.ToLower() == "defaultvalues") { foreach (XmlNode defaultVal in dataNode.ChildNodes) { dc.KeyColValues.Add(defaultVal.Name); dc.DispKeyColValues.Add(defaultVal.InnerText); } } else if (dataNode.Name.ToLower() == "btns") { if (dataNode.InnerText.IndexOf("add") != -1) dc.ShowAddBtn = true; else dc.ShowAddBtn = false; } else if (dataNode.Name.ToLower() == "sql") { if (dataNode.Attributes["hidecol"] != null) dc.HideColumns = dataNode.Attributes["hidecol"].Value; if (dataNode.Attributes["map"] != null) dc.MapColumn = dataNode.Attributes["map"].Value; if (dataNode.Attributes["mappar"] != null) dc.MapParentCol = dataNode.Attributes["mappar"].Value; dc.Sql = dataNode.InnerText; } } dcs[i] = dc; } LoadFormatDcArray(dc); } } } /// /// Function to get the Tabbed DC's information and store in the pagePositions and visibleDC's array. /// /// private void XmlLoadTabDcs(XmlNode iframeNodes) { if (axdesignJObject.selectedLayout != null) { string visibleDC = string.Empty; StringBuilder strTab = new StringBuilder(); string lastDc = string.Empty; string layout = axdesignJObject.selectedLayout; tstLayout = layout.ToLower(); 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"]); } if (dcs.Count == 1) isWizardTstruct = false; if ((tstLayout == "tile" && designMode) || isWizardTstruct || isMobile || dcs.Count == 1) tstLayout = "default"; ArrayList tempPositions = new ArrayList(); foreach (DcStruct dc in dcs) { bool isFirstDc = false; bool isSecondLastDc = false; bool isLastDc = false; if (dc.frameno == 1) { isFirstDc = true; } if (dc.frameno == dcs.Count) { isLastDc = true; } if (dc.frameno == dcs.Count - 1 && dcs.Count > 2) { isSecondLastDc = true; } switch (tstLayout) { case "default": case "tile": { tempPositions.Add(dc.frameno); visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(tempPositions[0].ToString()); tempPositions = new ArrayList(); } break; case "tabbed": { tempPositions.Add(dc.frameno); if (isLastDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } } break; case "double": { tempPositions.Add(dc.frameno); if (isFirstDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } if (isSecondLastDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } if (isLastDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } } break; case "single": { tempPositions.Add(dc.frameno); if (isFirstDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } if (isLastDc) { visibleDCs.Add(tempPositions[0].ToString()); pagePositions.Add(String.Join(",", tempPositions.ToArray())); tempPositions = new ArrayList(); } } break; } } } else if (iframeNodes.Attributes["layout"] != null) { string visibleDC = string.Empty; StringBuilder strTab = new StringBuilder(); string lastDc = string.Empty; //The layout attribute is expected to be there only in 9.0 structue xml string layout = iframeNodes.Attributes["layout"].Value; tstLayout = layout.ToLower(); var designMode = false; //Below line will convert tile to default as tile is not working and not supported. if (dcs.Count == 1) isWizardTstruct = false; if (tstLayout == "tile" || isWizardTstruct || isMobile /* || designMode*/) tstLayout = "default"; foreach (XmlNode frmNode in iframeNodes) { //string dcName = frmNode.Attributes["name"].Value; // //string frameNo = frmNode.Attributes["fno"].Value; string dcTLHW = frmNode.Attributes["tlhw"].Value; foreach (XmlNode pageNode in frmNode) { foreach (XmlNode dcNode in pageNode) { string dcName = dcNode.InnerText; string frameNo = dcName.Substring(2); if (dcName.Substring(0, 2) != "dc") continue; SetDcWidth(frameNo, dcTLHW); if (tstLayout == Constants.DEFAULT || tstLayout == Constants.TILE) { visibleDCs.Add(frameNo); pagePositions.Add(frameNo); } else if (tstLayout == Constants.SINGLE || tstLayout == Constants.TABBED || tstLayout == Constants.DOUBLE) { if ((tstLayout == Constants.SINGLE || tstLayout == Constants.DOUBLE) && dcName == "dc1") { pagePositions.Add(frameNo); visibleDCs.Add(frameNo); } else { if (tstLayout == Constants.DOUBLE && strTab.ToString() != string.Empty && frmNode.NextSibling == null) lastDc = frameNo; if (strTab.ToString() == string.Empty) { strTab.Append(frameNo); visibleDCs.Add(frameNo); } else { if ((tstLayout == Constants.DOUBLE && lastDc == string.Empty) || (tstLayout != Constants.DOUBLE)) strTab.Append("," + frameNo); } } } } } if (strTab.ToString() != string.Empty) { pagePositions.Add(strTab.ToString()); strTab = new StringBuilder(); } } if (tstLayout == Constants.DOUBLE && lastDc != string.Empty) { pagePositions.Add(lastDc); visibleDCs.Add(lastDc); } } else { foreach (XmlNode ifrNode in iframeNodes) { string visibleDC = string.Empty; XmlNodeList frames = ifrNode.ChildNodes; StringBuilder strTab = new StringBuilder(); string lastDc = string.Empty; foreach (XmlNode pageNode in frames) { if (pageNode.Name == "pages") { for (int i = 0; i < pageNode.ChildNodes.Count; i++) { string dcName = pageNode.ChildNodes[i].InnerText; string tabNo = dcName.Substring(2, dcName.Length - 2); if (i == 0) { visibleDC = tabNo; strTab.Append(tabNo); } else { strTab.Append("," + tabNo); } } } } if (strTab.ToString() != "") { pagePositions.Add(strTab); visibleDCs.Add(visibleDC); } strTab = new StringBuilder(); } } } private void SetDcWidth(string frameNo, string tlhw) { DcStruct dc = (DcStruct)dcs[Convert.ToInt32(frameNo) - 1]; string[] strTLHW = tlhw.Split(','); if (strTLHW.Length > 3) { dc.dcWidht = Convert.ToInt32(strTLHW[3].ToString()); dcs[Convert.ToInt32(frameNo) - 1] = dc; } } private string ReplaceSpecialCharsInHTML(string str) { str = str.Replace("&", "#amp:"); str = str.Replace("<", "#lt:"); str = str.Replace(">", "#gt:"); str = str.Replace("'", "#apos:"); //str = str.Replace("\"", """); return str; } /// /// function to update the dc list. /// /// private void XmlLoadDc(XmlNode dcNodes) { DcStruct dc = new DcStruct(); PopDcStruct pdc = new PopDcStruct(); dc.isallowaddrows = true; dc.isallowdeletrows = true; dc.DCHasDataRows = false; dc.isallowchange = true; dc.tabParentFields = new ArrayList(); dc.dcExpressionDeps = new StringBuilder(); foreach (XmlNode dcNode in dcNodes) { if (dcNode.Name == "a1") dc.name = dcNode.InnerText; else if (dcNode.Name == "a2") { string dcCaption = dcNode.InnerText; dcCaption = dcCaption.Replace("&&", "&"); dc.caption = dcCaption; } else if (dcNode.Name == "a5") dcTable.Add(dcNode.InnerText); else if (dcNode.Name == "a3") dc.frameno = int.Parse(dcNode.InnerText); else if (dcNode.Name == "a6") dc.isgrid = bool.Parse(dcNode.InnerText); else if (dcNode.Name == "a7") dc.isallowchange = bool.Parse(dcNode.InnerText); else if (dcNode.Name == "a17") dc.DcAllowEmpty = bool.Parse(dcNode.InnerText); else if (dcNode.Name == "a26") { if (dcNode.InnerText == string.Empty) dcNode.InnerText = "true"; dc.isallowaddrows = bool.Parse(dcNode.InnerText); } else if (dcNode.Name == "a27") { if (dcNode.InnerText == string.Empty) dcNode.InnerText = "true"; dc.isallowdeletrows = bool.Parse(dcNode.InnerText); } else if (dcNode.Name == "a9") { if (dcNode.Attributes["pop"] != null) { if (dcNode.Attributes["pop"].Value.ToString() == "t") { dc.ispopgrid = true; pdc = LoadXmlPopDc(pdc, dcNode); pdc.frameno = dc.frameno; if (pdc.caption != string.Empty) dc.caption = pdc.caption; popdcs.Add(pdc); } else { dc.ispopgrid = false; } } } else if (dcNode.Name == "a31") { if (dcNode.Attributes["tlhw"] != null) { string NonGridDcHgt = string.Empty; string[] dim = dcNode.Attributes["tlhw"].Value.Split(','); if (EnableOldTheme == "false") { NonGridDcHgt = Math.Floor((Convert.ToInt32(dim[2].ToString()) * 1.5)).ToString(); dc.dcHeight = Convert.ToInt32(NonGridDcHgt); } else { dc.dcHeight = Convert.ToInt32(Convert.ToInt32(dim[2].ToString()) * 1.15); } } } else if (dcNode.Name == "a59") dc.purpose = dcNode.InnerText; } dc.IsFormatGrid = false; dc.ShowAddBtn = true; dc.MultiSelect = true; dc.Action = string.Empty; dc.KeyColumn = string.Empty; dc.KeyColValues = new ArrayList(); dc.DispKeyColValues = new ArrayList(); dc.SubTotalColumns = new ArrayList(); dc.HideColumns = string.Empty; dc.Sql = string.Empty; dc.MapColumn = string.Empty; dc.MapParentCol = string.Empty; dc.SubTotalStyle = string.Empty; dc.HeaderStyle = string.Empty; dc.DisplayKeyCol = string.Empty; dc.DisplayTotalCol = string.Empty; dc.dcPList = dcPlistaddrow; LoadDCArray(dc, pdc); dcs.Add(dc); //For every dc add a field 'axp_recid + dcno' as a hidden field. CreateAxpRecIdFld(dc.frameno); } private void CreateAxpRecIdFld(int frameNo) { StringBuilder fldXml = new StringBuilder(); fldXml.Append(""); fldXml.Append(""); fldXml.Append("axp_recid" + frameNo + ""); fldXml.Append("axp_recid" + frameNo + ""); fldXml.Append("Character"); fldXml.Append("150"); fldXml.Append("Accept0"); fldXml.Append("0"); fldXml.Append(""); fldXml.Append("TrueTrueFalseFalseTrue"); fldXml.Append("TrueTrueFalse"); fldXml.Append(""); fldXml.Append(""); fldXml.Append("TrueTrue"); fldXml.Append(""); fldXml.Append(""); XmlDocument xmlD = new XmlDocument(); xmlD.LoadXml(fldXml.ToString()); XmlLoadField(xmlD.ChildNodes[0].ChildNodes[0]); } /// /// Function to construct the popDC and update its properties in the popDC structure PopDcStruct. /// /// /// /// private PopDcStruct LoadXmlPopDc(PopDcStruct pdc, XmlNode PopDcNodes) { pdc.PopCondition = string.Empty; foreach (XmlNode dcPopNode in PopDcNodes) { if (dcPopNode.Name == "a18") pdc.caption = dcPopNode.InnerText; else if (dcPopNode.Name == "a19") pdc.pdcno = int.Parse(dcPopNode.InnerText.ToString().Substring(2)); else if (dcPopNode.Name == "a20") pdc.pfields = dcPopNode.InnerText; else if (dcPopNode.Name == "a21") pdc.popfield = dcPopNode.InnerText; else if (dcPopNode.Name == "a23") { if (dcPopNode.Attributes["cond"] != null) pdc.PopCondition = dcPopNode.Attributes["cond"].Value; } else if (dcPopNode.Name == "a24") { pdc.pFirm = dcPopNode.Attributes["firm"].Value.ToString(); pdc.pAuto = dcPopNode.Attributes["auto"].Value.ToString(); pdc.pKeyCols = dcPopNode.Attributes["kcol"].Value.ToString(); string strSql = string.Empty; XmlNodeList sqlNodes = dcPopNode.ChildNodes; if (sqlNodes.Count > 0) { foreach (XmlNode sqlNode in dcPopNode) { strSql += sqlNode.InnerText; } } pdc.fillSql = string.Empty; if (strSql != string.Empty) pdc.fillSql = "1"; } else if (dcPopNode.Name == "a25") { if (dcPopNode.Attributes["disp"] != null) pdc.dispSummaryParent = dcPopNode.Attributes["disp"].Value; if (dcPopNode.Attributes["sum"] != null) pdc.dispSummaryField = dcPopNode.Attributes["sum"].Value; if (dcPopNode.Attributes["deli"] != null) pdc.summaryDelimiter = dcPopNode.Attributes["deli"].Value; } } return pdc; } /// /// function to update the javascript field array. /// /// private void LoadDCArray(DcStruct dc, PopDcStruct pdc) { StringBuilder DCArray = new StringBuilder(); DCArray.Append("DCName[" + DCNo + "]=\"" + dc.name + "\";DCCaption[" + DCNo + "]=\"" + ReplaceSpecialCharsInHTML(dc.caption) + "\";DCFrameNo[" + DCNo + "]=\"" + dc.frameno + "\";DCIsGrid[" + DCNo + "]=\"" + dc.isgrid + "\";DCIsPopGrid[" + DCNo + "]=\"" + dc.ispopgrid + "\";DCAllowEmpty[" + DCNo + "]=\"" + dc.DcAllowEmpty.ToString() + "\";DCHasDataRows[" + DCNo + "]=\"" + dc.DCHasDataRows.ToString() + "\";DcAllowAdd[" + DCNo + "]=\"" + dc.isallowaddrows.ToString() + "\";DCAllowChange[" + DCNo + "]=\"" + dc.isallowchange.ToString() + "\";"); DCNo++; if (dc.ispopgrid) { DCArray.Append("PopGridDCs[" + popDCNo + "]=\"" + dc.frameno + "\";PopParentDCs[" + popDCNo + "]=\"" + pdc.pdcno + "\";PopParentFlds[" + popDCNo + "]=\"" + pdc.pfields + "\";PopGridDCFirm[" + popDCNo + "]=\"" + pdc.pFirm + "\";PopCondition[" + popDCNo + "]=\"" + pdc.PopCondition + "\";"); DCArray.Append("PopSqlFill[" + popDCNo + "]=\"" + pdc.fillSql + "\";PopSummaryParent[" + popDCNo + "]=\"" + pdc.dispSummaryParent + "\";PopSummaryFld[" + popDCNo + "]=\"" + pdc.dispSummaryField + "\";PopSummDelimiter[" + popDCNo + "]=\"" + pdc.summaryDelimiter + "\";"); popDCNo++; } jsDCArray.Append(DCArray.ToString().Trim()); } /// /// function to update the javascript field array. /// /// private void LoadDCNewArray(DcStruct dc) { StringBuilder DCNewArray = new StringBuilder(); DCNewArray.Append("DCExpDeps[" + (dc.frameno - 1) + "]=\"" + dc.dcExpressionDeps.ToString() + "\";DcAcceptMRFlds[" + (dc.frameno - 1) + "]=\"" + dc.DCAcceptMRFields + "\";"); DCNo++; jsDCArray.Append(DCNewArray.ToString().Trim()); } /// /// Function to add dc format grid properties to the js arrays /// /// private void LoadFormatDcArray(DcStruct dc) { StringBuilder DCArray = new StringBuilder(); StringBuilder subTotCols = new StringBuilder(); for (int i = 0; i < dc.SubTotalColumns.Count; i++) { if (subTotCols.ToString() == "") subTotCols.Append(dc.SubTotalColumns[i].ToString()); else subTotCols.Append("," + dc.SubTotalColumns[i].ToString()); } DCArray.Append("DcIsFormatGrid[" + (dc.frameno - 1) + "]=\"" + dc.IsFormatGrid + "\";DcKeyColumns[" + (dc.frameno - 1) + "]=\"" + dc.KeyColumn + "\";DcKeyColValues[" + (dc.frameno - 1) + "]=\"" + dc.KeyColValues + "\";"); DCArray.Append("DcSubTotCols[" + (dc.frameno - 1) + "]=\"" + subTotCols + "\";DcMultiSelect[" + (dc.frameno - 1) + "]=\"" + dc.MultiSelect + "\";"); //DcMultiSelect jsDCArray.Append(DCArray.ToString().Trim()); } /// /// function to update the field list /// /// private void XmlLoadField(XmlNode fieldNodes, string fieldType = "") { fieldIndex++; List listSrchCols = null; if (srchCols != String.Empty) listSrchCols = srchCols.Split(',').ToList(); string fldFromApi = string.Empty; FieldStruct fld = new FieldStruct(); fld.fieldIndex = fieldIndex; string fldSearchSQL = string.Empty; fld.fieldSqlGridDeps = string.Empty; fld.fieldDepGridDcs = string.Empty; fld.isFieldSql = string.Empty; fld.fieldSqlQuery = string.Empty; fld.fieldSelAPI = string.Empty; fld.isFieldApi = string.Empty; fld.fieldValSeparator = string.Empty; fld.fldColor = string.Empty; fld.AdvSrchFlds = new ArrayList(); fld.AdvSrchFldsType = new ArrayList(); fld.FldRapidAllParents = string.Empty; fld.FldRapidAllRows = string.Empty; fld.fldType = fieldType; foreach (XmlNode fldNode in fieldNodes) { if (fldNode.Name == "a1") { fld.name = fldNode.InnerText; //To check if the field is a image and needs to be stored in the server folder. fldFromApi = string.Empty; if (fld.name.StartsWith(Constants.IMGPrefix)) { ContainsImage = true; fld.fieldIsImage = true; AxImageFields.Add(fld.name); } if (fld.name.StartsWith("axp_nga_")) { ContainsImage = true; fld.fieldIsImage = true; AxImageFields.Add(fld.name); AxAttachFields.Add(fld.name); } if (fld.name.ToLower().StartsWith("axpfile_") || fld.name.ToLower().StartsWith("axpfilepath_")) { AxpFileUploadFields.Add(fld.name); } if (fld.name.ToLower() == (Constants.AXPIMAGEPATH)) { isAxpImagePath = true; //fld.fieldIsImage = true; //AxImageFields.Add(fld.name); } if (fld.name.StartsWith("axp_gridattach_") || (fld.name.StartsWith("dc") && fld.name.ToLower().EndsWith("_image"))) { ContainsGridAttach = true; AxAttachFields.Add(fld.name); } if (fld.name.StartsWith("dc") && fld.name.ToLower().EndsWith("_referimages")) { ContainsGridRefer = true; AxAttachFields.Add(fld.name); } if (fld.name.ToLower().EndsWith("_imagepath")) AxAttachFields.Add(fld.name); } else if (fldNode.Name == "a2") { string fldCaption = fldNode.InnerText; fldCaption = fldCaption.Replace("&&", "&"); fld.caption = fldCaption; if (fld.caption == "") fld.caption = " "; } else if (fldNode.Name == "a3") { fld.datatype = fldNode.InnerText; if (fldNode.InnerText.ToLower() == "image") { ContainsImage = true; fld.fieldIsImage = true; AxImageFields.Add(fld.name); } } else if (fldNode.Name == "a4") fld.fldlength = int.Parse(fldNode.InnerText); else if (fldNode.Name == "a5") fld.flddecimal = int.Parse(fldNode.InnerText); else if (fldNode.Name == "a6") { fld.moe = fldNode.InnerText; if (fldNode.Attributes["apiname"] != null) fld.fldAcceptApi = fldNode.Attributes["apiname"].Value; else fld.fldAcceptApi = ""; if (fldNode.Attributes["fromapi"] != null) fldFromApi = fld.name + "^" + fldNode.Attributes["fromapi"].Value; } else if (fldNode.Name == "a7") fld = UpdateDetailsofMOE(fldNode, fld); else if (fldNode.Name == "a8") fld.visibility = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a9") fld.allowempty = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a10") fld.freadonly = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a11") { if (bool.Parse(fldNode.InnerText) == true) fldSetCarry.Add(fld.name); } else if (fldNode.Name == "a12") fld.savevalue = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a13") { fld.expr = fldNode.InnerText.Trim().Replace(Environment.NewLine, "").Replace("\n", "").Replace("\r", ""); if (fldFromApi != "" && fld.expr != "") { fldFromApi += "^" + fld.expr; fld.expr = string.Empty; } if (fld.name.ToUpper() == "AXP_HIDE_TOOLBAR") { if (fld.expr != string.Empty && fld.expr.Trim('{', '}').ToLower() == "t") hideToolBar = true; } } else if (fldNode.Name == "a14") fld.vexpr = fldNode.InnerText.Trim().Replace(Environment.NewLine, "").Replace("\n", "").Replace("\r", ""); else if (fldNode.Name == "a15") fld.allowduplicate = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a16") fld.onlyPositive = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a67") fld.tabStop = fldNode.InnerText == "" ? true : bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a17") fld.savenormal = bool.Parse(fldNode.InnerText); else if (fldNode.Name == "a49") fld = PatternCheck(fldNode, fld); else if (fldNode.Name == "a31") fld = FldDimensionCheck(fldNode, fld); else if (fldNode.Name == "a50") { if (fldNode.Attributes["minlength"] != null) fld.pwdminchar = int.Parse(fldNode.Attributes["minlength"].Value); if (fldNode.Attributes["expirydays"] != null) fld.pwdnodexpiry = int.Parse(fldNode.Attributes["expirydays"].Value); if (fldNode.Attributes["alphanumeric"] != null) fld.pwdalphanumeric = bool.Parse(fldNode.Attributes["alphanumeric"].Value); fld.pwdchar = fldNode.InnerText; } else if (fldNode.Name == "a51") fld.fieldHint = fldNode.InnerText; else if (fldNode.Name == "a52") fld.applycomma = fldNode.InnerText; else if (fldNode.Name == "a58") fld = SetValueFMT(fldNode, fld); else if (fldNode.Name == "a59") //murali fld.fieldPurpose = "";// fldNode.InnerText; else if (fldNode.Name == "a64") fldSearchSQL = fldNode.InnerText; else if (fldNode.Name == "a65") fld = SetTooltip(fldNode, fld); else if (fldNode.Name == "a66") fld = SetParents(fldNode, fld); else if (fldNode.Name == "a70") fld.tabletypeval = fldNode.InnerText.Replace("\"", """); if (ContainsGridAttach) { if (fldNode.Name == "a13" && fldNode.InnerText != "") { ContainsGridRefer = true; } } } if (fldFromApi != string.Empty) fldAcceptFromApi.Add(fldFromApi); //To check if add row limit has been given if (fld.name.ToLower().Contains("ax_rowlimit")) { int rowMaxVal; string fldExpr = fld.expr.ToString().Replace("{", ""); fldExpr = fldExpr.Replace("}", ""); if (int.TryParse(fldExpr, out rowMaxVal) && rowMaxVal > 1 && !AxRowLimit.Keys.Equals(fld.name)) AxRowLimit.Add(fld.name.ToLower(), rowMaxVal); } if (listSrchCols != null && listSrchCols.Count > 0) { //TODO: check if we can avoid the to lower check if (listSrchCols.Contains(fld.name.ToLower())) { lstSearchDataNames.Add(fld.name); lstSearchDataCaptions.Add(fld.caption); } } else { if ((fld.savevalue == true || (fld.savevalue == false && fldSearchSQL != string.Empty)) && fld.datatype != "Image" && (!fld.visibility) && (fld.pwdchar == "")) { lstSearchDataNames.Add(fld.name); lstSearchDataCaptions.Add(fld.caption); } } //Update the field count for the dc. if (!string.IsNullOrEmpty(tstVersion) && Int64.Parse(tstVersion) > 10000) { fld = SetRapidDependents(fld); } if (!fld.visibility) dcFldVisibleCount++; dcFldCount++; DcStruct dc = ((DcStruct)(dcs[dcs.Count - 1])); dc.fieldCount = dcFldCount; dc.visibleFldCount = dcFldVisibleCount; dcs[dcs.Count - 1] = dc; if (HttpContext.Current.Session["AxpFldMultiSelect"] != null && HttpContext.Current.Session["AxpFldMultiSelect"].ToString() != "") { bool isMultiSelect = false; var msFldList = (List)HttpContext.Current.Session["AxpFldMultiSelect"]; isMultiSelect = msFldList.AsEnumerable().Where(x => x.ToString().ToLower() == fld.name.ToLower()).Any(); if (isMultiSelect) { var MultiSelectSp = (List)HttpContext.Current.Session["AxpFldMultiSelSp"]; MultiSelectSp = MultiSelectSp.AsEnumerable().Where(x => x.ToString().ToLower().Split('♦')[0] == fld.name.ToLower()).Select(x => x.ToString().ToLower().Split('♦')[1]).ToList(); fld.fldMultiSelect = fld.name; fld.fldMultiSelectSep = MultiSelectSp[0]; } } //If field is part of formload exp deps, construct the component id here if (!string.IsNullOrEmpty(tstVersion) && Int64.Parse(tstVersion) > 10000) { UpdateRapidExpCompIds(fld.name, dc); } fld.order = dcFldCount; fld.fldframeno = dcs.Count; fld = LoadFieldArray(fld); flds.Add(fld); } private void UpdateRapidExpCompIds(string fldName, DcStruct dc) { if (rapidFLExpFlds.Count == 0) return; int rIdx = rapidFLExpFlds.IndexOf(fldName); if (rIdx != -1) { string compId = string.Empty; if (dc.isgrid) compId = fldName + "001F" + dc.frameno; else compId = fldName + "000F" + dc.frameno; rapidFLExpFlds[rIdx] = compId; } } private FieldStruct SetParents(XmlNode fldNode, FieldStruct fld) { string fmText = ""; fmText = fldNode.InnerText.ToString(); string[] depArray = null; if (fmText != "") depArray = fmText.Split(','); if (depArray != null) { for (int i = 0; i < depArray.Length; i++) { if (fld.fieldParents == null || fld.fieldParents == "") fld.fieldParents = depArray[i].ToString(); else fld.fieldParents += "," + depArray[i].ToString(); } } fld.fieldParents = cust.UpdateSqlGridParents(transId, fld.name, fld.fieldParents); string flParents = fld.fieldParents; fld.fieldParents = fld.fieldParents.Replace("~", ","); if (flParents != "" && flParents.Contains("~")) fld.ClientFldParents = flParents.Split('~')[0]; else fld.ClientFldParents = fld.fieldParents; return fld; } /// /// function to update the javascript field array. /// /// private FieldStruct LoadFieldArray(FieldStruct fld) { StringBuilder fieldArray = new StringBuilder(); if (((fld.datatype == "Numeric") && (fld.flddecimal > 0))) fld.fldlength = (int)fld.fldlength + 1; fldGlobal = fldNo; if (fldNo == 0) { dcNo = ((DcStruct)(dcs[dcs.Count - 1])).frameno; dcRange = fldNo.ToString(); } string allowEmpty = ""; if (fld.allowempty == true) allowEmpty = "T"; else allowEmpty = "F"; string applyComma = ""; if (fld.applycomma.ToLower() == "true") applyComma = "T"; else applyComma = "F"; string visible = ""; if (fld.visibility == true) visible = "T"; else visible = "F"; string onlyPositive = ""; if (fld.onlyPositive == true) onlyPositive = "T"; else onlyPositive = "F"; string tabStop = ""; if (fld.tabStop == true) tabStop = "T"; else tabStop = "F"; fieldArray.Append(" FNames[" + fldNo + "]=\"" + fld.name + "\";ExprPosArray[" + fldNo + "]=\"\";FLowerNames[" + fldNo + "]=\"" + fld.name.ToLower() + "\"; FDataType[" + fldNo + "]=\"" + fld.datatype + "\"; FTableTypeVal[" + fldNo + "]=\"" + fld.tabletypeval + "\"; FDecimal[" + fldNo + "]=\"" + fld.flddecimal + "\";FldValidateExpr[" + fldNo + "]=\"" + fld.vexpr.Replace("\"", "'") + "\";FDupDecimals[" + fldNo + "]=\"" + fld.flddecimal + "\";"); fieldArray.Append("FCaption[" + fldNo + "]=\"" + fld.caption + "\";FldsFrmLst[" + fldNo + "]=\"" + fld.fieldIsFrmList + "\";"); fieldArray.Append("FMoe[" + fldNo + "]=\"" + fld.moe + "\";"); fieldArray.Append("FMaxLength[" + fldNo + "]=\"" + fld.fldlength + "\";"); fieldArray.Append("FProps[" + fldNo + "]=\"" + applyComma + allowEmpty + visible + onlyPositive + tabStop + "\";"); fieldArray.Append("FldFrameNo[" + fldNo + "]=\"" + ((DcStruct)(dcs[dcs.Count - 1])).frameno + "\";"); fieldArray.Append("FToolTip[" + fldNo + "]=\"" + fld.tooltip + "\";"); fieldArray.Append("fDefList[" + fldNo + "]=\"" + fld.slist + "\";fExdefList[" + fldNo + "]=\"" + fld.elist + "\";ffillList[" + fldNo + "]=\"" + fld.flist + "\";fSfList[" + fldNo + "]=\"" + fld.sflist + "\";"); fieldArray.Append("FldDependents[" + fldNo + "]=\"" + fld.fieldDependents + "\";"); fieldArray.Append("FldParents[" + fldNo + "]=\"" + fld.fieldParents + "\";"); fieldArray.Append("ClientFldParents[" + fldNo + "]=\"" + fld.ClientFldParents + "\";"); fieldArray.Append("FldAutoSelect[" + fldNo + "]=\"" + fld.autoselect + "\";"); fieldArray.Append("FldIsSql[" + fldNo + "]=\"" + fld.isFieldSql + "\";"); fieldArray.Append("FldIsAPI[" + fldNo + "]=\"" + fld.isFieldApi + "\";"); fieldArray.Append("FldAlignType[" + fldNo + "]=\"" + fld.type + "\";"); fieldArray.Append("FldChkSeparator[" + fldNo + "]=\"" + fld.fieldValSeparator + "\";"); fieldArray.Append("FldMgsSeparator[" + fldNo + "]=\"" + fld.fldMultiSelectSep + "\";"); fieldArray.Append("FFieldType[" + fldNo + "]=\"" + fld.fldType + "\";"); fieldArray.Append("FFieldAcceptApi[" + fldNo + "]=\"" + fld.fldAcceptApi + "\";"); //Rapid field arrays fieldArray.Append("FldRapidDeps[" + fldNo + "]=\"" + fld.FldRapidDeps + "\";"); fieldArray.Append("FldRapidDepType[" + fldNo + "]=\"" + fld.FldRapidDepType + "\";"); fieldArray.Append("FldRapidExpDeps[" + fldNo + "]=\"" + fld.FldRapidExpDeps + "\";"); fieldArray.Append("FldRapidParents[" + fldNo + "]=\"" + fld.FldRapidParents + "\";"); fieldArray.Append("FldPurpose[" + fldNo + "]=\"" + utilObj.CheckSpecialCharacterPurpose(fld.fieldPurpose) + "\";"); if (dcNo != ((DcStruct)(dcs[dcs.Count - 1])).frameno || DcCnt == dcs.Count) { dcRange = dcRange + "," + (fldNo - 1).ToString(); fieldArray.Append("FldDcRange[" + DcCnt + "]=\"" + dcNo.ToString() + "~" + dcRange + "\";"); fldDcRange.Add(dcNo.ToString() + "~" + dcRange); dcRange = ""; DcCnt++; dcNo = ((DcStruct)(dcs[dcs.Count - 1])).frameno; dcRange = fldNo.ToString(); } if (!((DcStruct)(dcs[dcs.Count - 1])).isgrid) { fieldArray.Append("HTMLFldNames[" + fldNo + "]=\"" + fld.name + "000F0\";"); } else { fieldArray.Append("HTMLFldNames[" + fldNo + "]=\"" + fld.name + "001F" + ((DcStruct)(dcs[dcs.Count - 1])).frameno + "\";"); grfldNo++; } fldNo++; jsFieldArray.Append(fieldArray.ToString().Trim()); string gridType = string.Empty; string gridNo = string.Empty; if (((DcStruct)(dcs[dcs.Count - 1])).isgrid) { gridType = "GR."; gridNo = "F" + ((DcStruct)(dcs[dcs.Count - 1])).frameno; } else { gridType = "NG."; gridNo = "F0"; } if (!string.IsNullOrEmpty(fld.expr)) { string tempExpr; if ((fld.name.StartsWith("dc") && (fld.name.ToLower().EndsWith("_referimages") || fld.name.ToLower().EndsWith("_image") || fld.name.ToLower().EndsWith("_imagepath"))) && fld.expr.Contains(@"\") || fld.name == "axpattachmentpath") tempExpr = fld.expr.Replace(@"\", "\\\\"); // In order to avoid the skipping of backslash else if (fld.name.ToLower().StartsWith("axpfilepath_")) tempExpr = fld.expr.Replace(@"\", "\\\\\\\\"); else tempExpr = fld.expr.Replace("\"", "'"); jsExpressionArray.Append(" ExpFldNames[" + exprNo + "]=\"" + gridType + "" + fld.name + "." + gridNo + ".expr\";Expressions[" + exprNo + "]=\"" + tempExpr + "\";"); exprNo++; } return fld; } private string GetFldDependents(string result, string depList) { if (depList != null) { if (result == "") result = depList; else if (depList != "") result += "," + depList; } return result; } /// ///function to create and append javascript arrays for handling load single dc data for tabbed dc's /// public void CreateTabArrays() { for (int i = 0; i < tabDCs.Count; i++) { if (tabDCs[i].ToString() != "" && tabDCStatus[i].ToString() != "") { jsTabDCArray.Append("TabDCs[" + i + "]=\"" + tabDCs[i].ToString() + "\";TabDCStatus[" + i + "]=\"" + tabDCStatus[i] + "\";"); } else { break; } } for (int j = 0; j < pagePositions.Count; j++) { jsTabDCArray.Append("PagePositions[" + j + "]=\"" + pagePositions[j].ToString() + "\";VisibleDCs[" + j + "]=\"" + visibleDCs[j] + "\";"); } } /// /// function to handle the pattern for the field values. /// /// /// private FieldStruct PatternCheck(XmlNode patternNode, FieldStruct fld) { fld.pattern = patternNode.InnerText; string patName = string.Empty; if (!((DcStruct)(dcs[dcs.Count - 1])).isgrid) patName = "ng_" + fld.name; else patName = "gr_" + fld.name; if (!string.IsNullOrEmpty(fld.pattern)) { jsPatternArray.Append("PatternNames[" + patternNo + "]='" + patName + "';Patterns[" + patternNo + "]='" + fld.pattern + "';"); patternNo++; } return fld; } /// /// Update the dimensions of the field. /// /// /// private FieldStruct FldDimensionCheck(XmlNode dimensionNode, FieldStruct fld) { if (dimensionNode.Attributes["lbltlhw"] != null) fld.lbltlhw = dimensionNode.Attributes["lbltlhw"].Value.ToString(); else fld.lbltlhw = ""; if (dimensionNode.Attributes["lblfont"] != null) fld.fieldLabelCss = dimensionNode.Attributes["lblfont"].Value.ToString(); else fld.fieldLabelCss = ""; if (dimensionNode.Attributes["font"] != null) fld.fieldCtrlCss = dimensionNode.Attributes["font"].Value.ToString(); else fld.fieldCtrlCss = ""; if (dimensionNode.Attributes["tlhw"] != null) fld.fldtlhw = dimensionNode.Attributes["tlhw"].Value.ToString(); else fld.fldtlhw = ""; if (dimensionNode.Attributes["wlbltlhw"] != null) fld.plbltlhw = dimensionNode.Attributes["wlbltlhw"].Value.ToString(); else fld.plbltlhw = ""; if (dimensionNode.Attributes["wtlhw"] != null) fld.pfldtlhw = dimensionNode.Attributes["wtlhw"].Value.ToString(); else fld.pfldtlhw = ""; if (dimensionNode.Attributes["ctype"] != null) fld.ctype = dimensionNode.Attributes["ctype"].Value.ToString(); else fld.ctype = ""; if (dimensionNode.Attributes["sep"] != null) fld.fieldValSeparator = dimensionNode.Attributes["sep"].Value.ToString(); if (dimensionNode.Attributes["cwid"] != null) fld.cwid = dimensionNode.Attributes["cwid"].Value.ToString(); else fld.cwid = ""; if (dimensionNode.Attributes["type"] != null) fld.type = dimensionNode.Attributes["type"].Value.ToString(); else fld.type = ""; if (dimensionNode.Attributes["color"] != null) { fld.fldColor = dimensionNode.Attributes["color"].Value; if (fld.fldColor != string.Empty) { fld.fldColor = fld.fldColor.Substring(2); } } else fld.fldColor = ""; return fld; } /// /// Set the tooltip from the xml to tooltip variable of the field structure /// /// /// /// private FieldStruct SetTooltip(XmlNode fldNodes, FieldStruct fld) { foreach (XmlNode tlNode in fldNodes) { fld.tooltip += tlNode.InnerText + "/"; } return fld; } /// /// function to update sql,expression and fill dependent list. /// /// /// private FieldStruct SetValueFMT(XmlNode fmtNodes, FieldStruct fld) { fld.fieldDependents = string.Empty; foreach (XmlNode fmtNode in fmtNodes) { string fmText = ""; fmText = fmtNode.InnerText.ToString(); if (fmText != "") fld.fieldDependents += fmText; } //string strNewDeps = utilObj.IncludeDependents(transId, fld.name, fld.fieldDependents); //strNewDeps = utilObj.ExcludeDependents(transId, fld.name, strNewDeps); //fld.fieldDependents = strNewDeps; string fldDeps = GetSqlDependents(fld); string[] strDeps = fldDeps.Split('~'); fld.fieldSqlDeps = strDeps[0].ToString(); if (strDeps.Length > 1) fld.fieldExpDeps = strDeps[1].ToString(); return fld; } /// /// Function which returns the sql dependents for a given field. /// /// /// private string GetSqlDependents(FieldStruct fld) { string fldDeps = fld.fieldDependents; StringBuilder sqlDepFlds = new StringBuilder(); StringBuilder sqlExpFlds = new StringBuilder(); if (fldDeps != string.Empty) { string[] deps = fldDeps.Split(','); for (int i = 0; i < deps.Length; i++) { string depStr = deps[i].ToString(); //|| depStr.Substring(0,1) == "f" - NOTE - here fill dependents have not been added to the sql dep list if (depStr.Substring(0, 1) == "s") { if (sqlDepFlds.ToString() == string.Empty) sqlDepFlds.Append(depStr); else sqlDepFlds.Append("," + depStr); } else if (depStr.Substring(0, 1) == "e") { if (sqlExpFlds.ToString() == string.Empty) sqlExpFlds.Append(depStr); else sqlExpFlds.Append("," + depStr); } } } return sqlDepFlds.ToString() + "~" + sqlExpFlds.ToString(); } /// /// Update the moe details from the a7 node /// /// /// private FieldStruct UpdateDetailsofMOE(XmlNode moeDetailNodes, FieldStruct fld) { StringBuilder hashString = new StringBuilder(); bool isUpdate = false; ArrayList a26Array = new ArrayList(); ArrayList a26ArrayType = new ArrayList(); ArrayList a63Array = new ArrayList(); ArrayList a63ArrayType = new ArrayList(); string tmpMOE = fld.moe.ToUpper(); if (tmpMOE == moe.ACCEPT.ToString() || tmpMOE == moe.SELECT.ToString() || tmpMOE == moe.FILL.ToString()) isUpdate = true; if (isUpdate) { foreach (XmlNode moeDetailNode in moeDetailNodes) { if (tmpMOE == moe.ACCEPT.ToString()) { if (moeDetailNode.Name == "a22") { if (!string.IsNullOrEmpty(moeDetailNode.InnerText)) fld.selectmode = "From Master"; else fld.selectmode = string.Empty; if (moeDetailNode.Attributes["pcount"] != null) fld.pcount = int.Parse(moeDetailNode.Attributes["pcount"].Value); else fld.pcount = 0; if (moeDetailNode.ChildNodes.Count > 0 && fld.pcount == 0) { if (moeDetailNode.ChildNodes.Count == 1 && moeDetailNode.ChildNodes[0].InnerXml != "") { if (fromListFlds == "") fromListFlds = fld.name; else fromListFlds += "," + fld.name; } } if (moeDetailNode.ChildNodes.Count > 0 && moeDetailNode.ChildNodes[0].InnerText != "") fld.isFieldSql = "True"; if (moeDetailNode.Attributes["stype"] != null && moeDetailNode.Attributes["stype"].Value.ToLower() == "accept") { if (moeDetailNode.Attributes["url"] != null) fld.fieldSelAPI = moeDetailNode.Attributes["url"].Value; if (moeDetailNode.Attributes["mapname"] != null) fld.fieldSelAPIParams = moeDetailNode.Attributes["mapname"].Value; if (moeDetailNode.Attributes["restype"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["restype"].Value; if (moeDetailNode.Attributes["resformat"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["resformat"].Value; if (moeDetailNode.Attributes["paramstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["paramstr"].Value; if (moeDetailNode.Attributes["headerstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["headerstr"].Value; if (moeDetailNode.Attributes["reqstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["reqstr"].Value; } } } else if (tmpMOE == moe.SELECT.ToString()) { if (moeDetailNode.Name == "a22") { if (moeDetailNode.Attributes["param"] != null) { if (moeDetailNode.Attributes["param"].Value == "y") fld.refresh = 1; else fld.refresh = 0; } if (moeDetailNode.Attributes["txt"] != null) { if (moeDetailNode.Attributes["txt"].Value == "t") fld.editcombo = true; else fld.editcombo = false; } if (moeDetailNode.Attributes["firesql"] != null) { if (moeDetailNode.Attributes["firesql"].Value == "True") fld.firesql = true; else fld.firesql = false; } if (fld.firesql) fld.selectmode = string.Empty; else fld.selectmode = "From Master"; if (moeDetailNode.Attributes["pcount"] != null) fld.pcount = int.Parse(moeDetailNode.Attributes["pcount"].Value); else fld.pcount = 0; if (moeDetailNode.Attributes["mulselect"] != null && moeDetailNode.Attributes["mulselect"].Value == "true") fld.fldMultiSelect = fld.name; if (moeDetailNode.Attributes["mulsep"] != null) fld.fldMultiSelectSep = moeDetailNode.Attributes["mulsep"].Value; if (moeDetailNode.ChildNodes.Count > 0 && moeDetailNode.ChildNodes[0].InnerText != "") fld.isFieldSql = "True"; for (int i = 0; i < moeDetailNode.ChildNodes.Count; i++) { fld.fieldSqlQuery += " " + moeDetailNode.ChildNodes[i].InnerText; } if (moeDetailNode.Attributes["stype"] != null && moeDetailNode.Attributes["stype"].Value == "Select From API") { fld.isFieldApi = "true"; if (moeDetailNode.Attributes["url"] != null) fld.fieldSelAPI = moeDetailNode.Attributes["url"].Value; if (moeDetailNode.Attributes["mapname"] != null) fld.fieldSelAPIParams = moeDetailNode.Attributes["mapname"].Value; if (moeDetailNode.Attributes["restype"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["restype"].Value; if (moeDetailNode.Attributes["resformat"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["resformat"].Value; if (moeDetailNode.Attributes["paramstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["paramstr"].Value; if (moeDetailNode.Attributes["headerstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["headerstr"].Value; if (moeDetailNode.Attributes["reqstr"] != null) fld.fieldSelAPIParams += "♠" + moeDetailNode.Attributes["reqstr"].Value; } } else if (moeDetailNode.Name == "a23") { fld.autoselect = moeDetailNode.InnerText; } else if (moeDetailNode.Name == "a24") { fld.refreshOnSave = moeDetailNode.InnerText; } else if (moeDetailNode.Name == "a25") { foreach (XmlNode selectNodes in moeDetailNode) { if (fld.moeval == "") fld.moeval = selectNodes.InnerText; else fld.moeval += "," + selectNodes.InnerText; } if (fld.moeval != "" && fld.moeval != null) { if (fromListFlds == "") fromListFlds = fld.name; else fromListFlds += "," + fld.name; fld.fieldIsFrmList = true; } else fld.fieldIsFrmList = false; } } else if (tmpMOE == moe.FILL.ToString()) { if (moeDetailNode.Name == "a27") fld.srcfld = moeDetailNode.InnerText; else if (moeDetailNode.Name == "a28") fld.sqlfld = moeDetailNode.InnerText; } if (moeDetailNode.Name == "a26") { if ((moeDetailNode.Attributes["stype"] != null)) { if (moeDetailNode.Attributes["stype"].Value == "tstruct" | moeDetailNode.Attributes["stype"].Value == "sql") { a26Array.Add(fld.caption); a26ArrayType.Add(fld.datatype); } } } else if (moeDetailNode.Name == "a63") { foreach (XmlNode cnNode in moeDetailNode) { if ((cnNode.Attributes["cn"] != null)) { a63Array.Add(cnNode.Attributes["cn"].Value.Trim()); a63ArrayType.Add(""); } } } } //fld.AdvSrchFlds if (a63Array.Count == 0) { fld.AdvSrchFlds = a26Array; fld.AdvSrchFldsType = a26ArrayType; } else { fld.AdvSrchFlds = a63Array; fld.AdvSrchFldsType = a63ArrayType; } } return fld; } /// /// Update the fillgrid list. /// /// private void XmlLoadFillgrid(XmlNode fgNodes) { FGStruct fg = new FGStruct(); StringBuilder fgsql = new StringBuilder(); foreach (XmlNode fgNode in fgNodes) { if (fgNode.Name == "a1") { fg.fgName = fgNode.InnerText; } else if (fgNode.Name == "a4") { fg.fgcaption = fgNode.InnerText; } else if (fgNode.Name == "a5") { fgsql.Append(fgNode.Attributes["plist"].Value.ToString() + ""); fg.fgSqlParams = fgsql.ToString(); } else if (fgNode.Name == "a6") { fg.fgtargetdc = fgNode.InnerText; } else if (fgNode.Name == "a7") { fg.fgSqlFldName = new ArrayList(); fg.fgDcFldName = new ArrayList(); foreach (XmlNode mapNode in fgNode) { fg.fgDcFldName.Add(mapNode.Name); fg.fgSqlFldName.Add(mapNode.InnerText.ToLower()); } } else if (fgNode.Name == "a8") { fg.fgmultiselect = fgNode.InnerText; } else if (fgNode.Name == "a9") { fg.fgautoshow = fgNode.InnerText; } else if (fgNode.Name == "a10") { fg.fgSourceDC = fgNode.InnerText; } else if (fgNode.Name == "a17") { fg.fgValExpression = fgNode.InnerText; } else if (fgNode.Name == "a13" && fgNode.InnerText.ToLower() == "true") { fg.FGExecOnSave = fg.fgtargetdc; } else if (fgNode.Name == "a18") { if (fgNode.InnerText == "Initialize grid and add") fg.FGCondition = Constants.INIT; else if (fgNode.InnerText == "Add only when grid is empty") fg.FGCondition = Constants.AOWE; else if (fgNode.InnerText == "Append selected rows to grid" || fgNode.InnerText == "Append rows to grid") fg.FGCondition = Constants.APPEND; } } fgs.Add(fg); jsFieldArray.Append("FillAutoShow[" + fgCount + "]=\"" + ((FGStruct)(fgs[fgCount])).fgautoshow.ToString().ToLower() + "\";FillMultiSelect[" + fgCount + "]=\"" + ((FGStruct)(fgs[fgCount])).fgmultiselect.ToString().ToLower() + "\";FillParamDCs[" + fgCount + "]=\"" + ((FGStruct)(fgs[fgCount])).fgtargetdc.ToString() + "\";FillParamFld[" + fgCount + "]=\"" + ((FGStruct)(fgs[fgCount])).fgSqlParams.ToString() + "\";FillCondition[" + fgCount + "]=\"" + fg.FGCondition + "\";FillSourceDc[" + fgCount + "]=\"" + fg.fgSourceDC + "\";FillGridName[" + fgCount + "]=\"" + fg.fgName + "\";FillGridVExpr[" + fgCount + "]=\"" + fg.fgValExpression + "\";FillGridExecOnSave[" + fgCount + "]=\"" + fg.FGExecOnSave + "\";"); fgCount++; } /// /// Function to construct the Action buttons in the tstruct. /// /// /// private void XmlPageLoadButton(XmlNode btnNodes, string btnType) { if ((btnNodes.Attributes["cat"] != null) && (btnNodes.Attributes["cat"].Value == "btn")) { string caption = string.Empty; string task = string.Empty; string action = string.Empty; string hint = string.Empty; string dimension = string.Empty; string btnTop = string.Empty; string btnLeft = string.Empty; string btnHeight = string.Empty; string btnWidth = string.Empty; string image = string.Empty; string fileupload = string.Empty; string cancelBtn = string.Empty; string fmessage = string.Empty; string ftype = string.Empty; string btnId = string.Empty; string position = string.Empty; int frameNo = 0; if (btnNodes.Attributes["parent"] != null) { frameNo = Convert.ToInt32(btnNodes.Attributes["parent"].Value.Substring(3)); } caption = btnNodes.Attributes["caption"].Value; task = btnNodes.Attributes["task"].Value; action = btnNodes.Attributes["action"].Value; hint = btnNodes.Attributes["hint"].Value; dimension = btnNodes.Attributes["tlhw"].Value; image = btnNodes.Attributes["img"].Value; position = btnNodes.Attributes["position"].Value; if (btnNodes.Attributes["fileupload"] != null) { fileupload = btnNodes.Attributes["fileupload"].Value; if (btnNodes.Attributes["fmsg"] != null) fmessage = btnNodes.Attributes["fmsg"].Value; if (btnNodes.Attributes["ftype"] != null) ftype = btnNodes.Attributes["ftype"].Value; } if (btnNodes.Attributes["rem"] != null) { cancelBtn = btnNodes.Attributes["rem"].Value; } string divDirection = "left"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") { divDirection = "right"; } btnId = btnNodes.Name; if (dimension != string.Empty) { string[] tlhw = dimension.Split(','); if (EnableOldTheme == "true") btnTop = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.2)).ToString() + "px"; else btnTop = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.5)).ToString() + "px"; btnLeft = tlhw[1].ToString() + "px"; btnHeight = tlhw[2].ToString() + "px"; btnWidth = tlhw[3].ToString() + "px"; FieldStruct dummy = new FieldStruct(); dummy.visibility = false; dummy.fldlength = 15; dummy.fldFrameNo = frameNo; dummy.ctype = "button"; dummy.datatype = "special"; dummy.name = btnId; if (action != "") { btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append("
"); // btnHtml.Append(""); string btnFunction = string.Empty; if (!string.IsNullOrEmpty(fileupload)) { if (fileupload == "y") { btnFunction = " onclick='javascript:CallFileUploadAction(" + (char)34 + action + (char)34 + "," + (char)34 + fmessage + (char)34 + "," + (char)34 + ftype + (char)34 + ");' "; if (string.IsNullOrEmpty(image)) btnHtml.Append(""); else btnHtml.Append("" + caption + ""); } else if (fileupload == "a") { btnFunction = " onclick='javascript:AttachFiles();' "; if (string.IsNullOrEmpty(image)) btnHtml.Append(""); else btnHtml.Append("" + caption + ""); } else { if ((fileupload.IndexOf("\\") != -1)) { fileupload = fileupload.Replace("\\", "\\\\"); } btnFunction = " onclick='javascript:CallAction(" + (char)34 + action + (char)34 + "," + (char)34 + fileupload + (char)34 + ");' "; if (string.IsNullOrEmpty(image)) btnHtml.Append("
"); else btnHtml.Append("" + caption + ""); } } else { btnFunction = " onclick='javascript:CallAction(" + (char)34 + action + (char)34 + "," + (char)34 + fileupload + (char)34 + "," + (char)34 + string.Empty + (char)34 + "," + (char)34 + cancelBtn + (char)34 + ");' "; if (!string.IsNullOrEmpty(caption) && !string.IsNullOrEmpty(image)) { //Display Image with caption as hint. //btnHtml.Append("" + caption + ""); btnHtml.Append("" + caption + ""); } else if (!string.IsNullOrEmpty(image) && string.IsNullOrEmpty(caption)) { //Display only image //btnHtml.Append("" + hint + ""); btnHtml.Append("" + caption + ""); } else if (!string.IsNullOrEmpty(caption) & string.IsNullOrEmpty(image)) { //Display button with Caption btnHtml.Append("
"); } else { //throw error btnHtml.Append(""); } } btnHtml.Append("
"); } 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("" + caption + ""); btnHtml.Append("
"); } } pageActionButtons.Add(btnHtml.ToString()); pageActionDcNo.Add(dcs.Count.ToString()); btnHtml = new StringBuilder(); } } private void XmlPageLoadDWBButton(XmlDocument FormBtnNodes, int frameNo) { XmlNodeList formbtnlst = FormBtnNodes.SelectNodes("//root/dc" + frameNo); if (formbtnlst.Count > 0) { string colFldWidth = "", colFldGridStackItem = "", colDivInputPadding = ""; if (axdesignJObject.dcLayout != null && axdesignJObject.dcLayout != "" && axdesignJObject.dcLayout != "default") { colFldWidth = "
"; colFldGridStackItem = " colFldGridStackWidth "; colDivInputPadding = " colDivInputPadding "; } foreach (XmlNode formbtns in formbtnlst) { foreach (XmlNode btnNodes in formbtns) { XmlNode ficonNode = btnNodes.SelectSingleNode("icon"); if ((btnNodes.Attributes["cat"] != null) && (btnNodes.Attributes["cat"].Value == "btn")) { string caption = string.Empty; string task = string.Empty; string action = string.Empty; string hint = string.Empty; string dimension = string.Empty; string btnTop = string.Empty; string btnLeft = string.Empty; string btnHeight = string.Empty; string btnWidth = string.Empty; string image = string.Empty; string fileupload = string.Empty; string cancelBtn = string.Empty; string fmessage = string.Empty; string ftype = string.Empty; string btnId = string.Empty; string position = string.Empty; bool isGridBtn = false; string gridBtnPosition = string.Empty; bool script = false; caption = btnNodes.Attributes["caption"].Value; task = btnNodes.Attributes["task"].Value; action = btnNodes.Attributes["action"].Value; hint = btnNodes.Attributes["hint"].Value; dimension = btnNodes.Attributes["tlhw"].Value; image = btnNodes.Attributes["img"].Value; position = btnNodes.Attributes["position"].Value; script = btnNodes.Attributes["script"].Value.ToLower() == "true" ? true : false; string iconStyle = string.Empty; if (ficonNode != null) { if (ficonNode.SelectSingleNode("text") != null) { string ictext = ficonNode.SelectSingleNode("text").InnerText; string icaddclass = ficonNode.SelectSingleNode("addClass").InnerText; iconStyle = "" + ictext + ""; } else { iconStyle = ""; } } if (position.Split('~').Length > 1) { isGridBtn = true; gridBtnPosition = position.Split('~')[1]; } if (btnNodes.Attributes["fileupload"] != null) { fileupload = btnNodes.Attributes["fileupload"].Value; if (btnNodes.Attributes["fmsg"] != null) fmessage = btnNodes.Attributes["fmsg"].Value; if (btnNodes.Attributes["ftype"] != null) ftype = btnNodes.Attributes["ftype"].Value; } if (btnNodes.Attributes["rem"] != null) { cancelBtn = btnNodes.Attributes["rem"].Value; } string divDirection = "left"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") { divDirection = "right"; } btnId = btnNodes.Name; string designFontStyle = ""; if (axdesignJObject.buttonFieldFont != null && axdesignJObject.buttonFieldFont.Count > 0 && btnId != "") { var frbtnfld = axdesignJObject.buttonFieldFont.Where(elm => elm.id == btnId).ToList(); if (frbtnfld != null && frbtnfld.Count > 0) { designFontStyle = " style='" + frbtnfld[0].fontFamilly + "'"; } } if (dimension != string.Empty) { string[] tlhw = dimension.Split(','); if (EnableOldTheme == "true") btnTop = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.2)).ToString() + "px"; else btnTop = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.5)).ToString() + "px"; btnLeft = tlhw[1].ToString() + "px"; btnHeight = tlhw[2].ToString() + "px"; btnWidth = tlhw[3].ToString() + "px"; FieldStruct dummy = new FieldStruct(); dummy.visibility = false; dummy.fldlength = 15; dummy.fldFrameNo = frameNo; dummy.ctype = "button"; dummy.datatype = "special"; dummy.name = btnId; if (!isGridBtn) { if (action != "" && action != "Custom") { btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append(colFldWidth); btnHtml.Append("
"); string btnFunction = string.Empty; if (!string.IsNullOrEmpty(fileupload)) { if (fileupload == "y") { btnFunction = " onclick='javascript:CallFileUploadAction(" + (char)34 + action + (char)34 + "," + (char)34 + fmessage + (char)34 + "," + (char)34 + ftype + (char)34 + ");' "; if (string.IsNullOrEmpty(image)) btnHtml.Append("" + iconStyle + "" + caption + ""); else btnHtml.Append("" + caption + ""); } else if (fileupload == "a") { btnFunction = " onclick='javascript:AttachFiles();' "; if (string.IsNullOrEmpty(image)) btnHtml.Append("" + iconStyle + "" + caption + ""); else btnHtml.Append("" + caption + ""); } else { if ((fileupload.IndexOf("\\") != -1)) { fileupload = fileupload.Replace("\\", "\\\\"); } btnFunction = " onclick='javascript:CallAction(\"" + action + "\",\"" + fileupload + "\",\"\",\"\",\"\",\"\",\"" + script.ToString().ToLower() + "\");' "; if (string.IsNullOrEmpty(image)) btnHtml.Append(""); else btnHtml.Append("" + caption + ""); } } else { btnFunction = " onclick='javascript:CallAction(\"" + action + "\",\"" + fileupload + "\",\"\",\"" + cancelBtn + "\",\"\",\"\",\"" + script.ToString().ToLower() + "\");' "; if (!string.IsNullOrEmpty(caption) && !string.IsNullOrEmpty(image)) { //Display Image with caption as hint. btnHtml.Append("" + caption + ""); } else if (!string.IsNullOrEmpty(image) && string.IsNullOrEmpty(caption)) { //Display only image btnHtml.Append("" + caption + ""); } else if (!string.IsNullOrEmpty(caption) & string.IsNullOrEmpty(image)) { //Display button with Caption btnHtml.Append(""); } else { //throw error btnHtml.Append(""); } } if (colFldWidth != "") btnHtml.Append("
"); btnHtml.Append("
"); } else if (action == "Custom") { btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append("
"); btnHtml.Append(colFldWidth); btnHtml.Append("
"); string btnFunction = string.Empty; btnFunction = " onclick='javascript:" + btnId + "onclick();' "; if (string.IsNullOrEmpty(image)) //btnHtml.Append("" + iconStyle + "" + caption + ""); btnHtml.Append(""); else btnHtml.Append("" + caption + ""); 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(""); else btnHtml.Append("" + caption + ""); if (colFldWidth != "") btnHtml.Append("
"); btnHtml.Append("
"); } } else { if (gridBtnPosition == "rowlevel") { string btnFunction = string.Empty; if (action == "Custom") btnFunction = " onclick='javascript:" + btnId + "onclick(this);' "; else btnFunction = " onclick=javascript:CallAction('" + action + "','','','','','','" + script.ToString().ToLower() + "'); "; string gsbtn = "" + caption + ""; gridScriptButtons.Add("
♠
" + gsbtn + "
♠
1
" + gsbtn + "
"); gridScriptDcNo.Add(dcs.Count.ToString()); } else if (gridBtnPosition == "headerlevel") { string btnFunction = string.Empty; if (action == "Custom") btnFunction = " onclick='javascript:" + btnId + "onclick();' "; else btnFunction = " onclick=javascript:CallAction('" + action + "','','','','','','" + script.ToString().ToLower() + "'); "; gridHeaderScriptButtons.Add("check_box_outline_blank"); gridHeaderScriptDcNo.Add(dcs.Count.ToString()); } } } pageActionButtons.Add(btnHtml.ToString()); pageActionDcNo.Add(dcs.Count.ToString()); btnHtml = new StringBuilder(); } } } } } private string GetBtnFunction(string transId, string task) { switch (task) { case "new": return " onclick='javascript:NewTstruct();' "; case "save": return " onclick='javascript:FormSubmit();' "; case "search": return " onclick='javascript:OpenSearch(" + (char)34 + transId + (char)34 + ");' "; case "remove": return " onclick='javascript:DeleteTstruct();' "; case "print": return " onclick='javascript:OpenPrint(" + (char)34 + transId + (char)34 + ");' "; case "pdf": return " onclick='javascript:OpenPdfDocList();'"; case "view history": return " onclick='javascript:OpenHistory(" + (char)34 + transId + (char)34 + ");' "; case "listview": return " onclick='javascript:CallListView(" + (char)34 + transId + (char)34 + ");' "; case "attach": return " onclick='javascript:AttachFiles();' "; case "preview": return " onclick='javascript:OpenPrint(" + (char)34 + transId + (char)34 + ");' "; default: return " onclick='javascript:AlertNoAction();' "; } } /// /// Update the button list. /// /// /// private void XmlLoadButton(XmlNode btnNodes, string btnType) { foreach (XmlNode btnNode in btnNodes) { if ((btnNode.Attributes["cat"] != null) && (btnNode.Attributes["cat"].Value == "btn")) { ButtonStruct btn = new ButtonStruct(); btn.visible = "true"; if (btnNode.Attributes["caption"] != null) btn.caption = btnNode.Attributes["caption"].Value; else btn.caption = string.Empty; if (btnNode.Attributes["task"] != null) btn.task = btnNode.Attributes["task"].Value; else btn.task = string.Empty; if (btnNode.Attributes["action"] != null) btn.action = btnNode.Attributes["action"].Value; else btn.action = string.Empty; if (btnNode.Attributes["hint"] != null) btn.hint = btnNode.Attributes["hint"].Value; else btn.hint = ""; if (btnNode.Attributes["tlhw"] != null) btn.dimension = btnNode.Attributes["tlhw"].Value; else btn.dimension = string.Empty; if (btnNode.Attributes["img"] != null) btn.image = btnNode.Attributes["img"].Value; else btn.image = string.Empty; if (btnNode.Attributes["fileupload"] != null) { btn.fileupload = btnNode.Attributes["fileupload"].Value; if (btnNode.Attributes["fmessage"] != null) btn.fmessage = btnNode.Attributes["fmessage"].Value; if (btnNode.Attributes["ftype"] != null) btn.ftype = btnNode.Attributes["ftype"].Value; } if (btnNode.Attributes["rem"] != null) { btn.cancelBtn = btnNode.Attributes["rem"].Value; } //if the button is task button, needs to be added to the task button list if (btn.task == "tasks") { if (btnNode.ChildNodes.Count > 1) SortXMLElements(btnNode); XmlNodeList taskNodes = btnNode.ChildNodes; foreach (XmlNode taskNode in taskNodes) { if (taskNode.Name != "icon") { ButtonStruct tskBtn = new ButtonStruct(); tskBtn.caption = taskNode.Attributes["caption"].Value; tskBtn.action = taskNode.Attributes["action"].Value; tskBtn.task = taskNode.Attributes["task"].Value; if (taskNode.Attributes["fileupload"] != null) tskBtn.fileupload = taskNode.Attributes["fileupload"].Value; else tskBtn.fileupload = string.Empty; taskBtns.Add(tskBtn); } } // add the task button to the buttons list only if task button contains any // task if (taskBtns.Count > 0) { btns.Add(btn); } } else { btns.Add(btn); } } else if ((btnNode.Attributes["t"] != null) && (btnNode.Attributes["t"].Value == "img")) { string btnImage = string.Empty; string[] btnDim = "".Split(','); if (btnNode.Attributes["f"] != null) btnImage = btnNode.Attributes["f"].Value; if (btnImage.IndexOf("\\") != -1) btnImage = btnImage.Substring(btnImage.LastIndexOf("\\") + 1); if (!utilObj.IsImageAvailable(btnImage)) btnImage = string.Empty; if (btnNode.Attributes["tlhw"] != null) btnDim = btnNode.Attributes["tlhw"].Value.Split(','); string imgFrameNo = string.Empty; if (btnNode.Attributes["p"] != null) { imgFrameNo = btnNode.Attributes["p"].Value; imgFrameNo = imgFrameNo.Substring(3); } /*This code is commneted for now By Avi kant because while uploading image from desktop images is saving inside * c:\ folder which is not accesssable in Code which is showing empty Image */ //customImageHtml.Append(""); position: absolute; top:" + btnDim[0] + "px;height:" + btnDim[2] + ";width:" + btnDim[3] + "\" > "); //customImageHtml.Append(""); //customImageHtml.Append(""); //customImageHtml.Append("
"); //customLabels.Add(customImageHtml.ToString()); //customLblDcNo.Add(imgFrameNo); } } } /// /// load buttons for DWB toolbar. /// private ArrayList XmlLoadDWBButtons(XmlNode btnNodes) { ArrayList btnsArr = new ArrayList(); foreach (XmlNode btnNode in btnNodes) { ButtonStruct btn = new ButtonStruct(); IconStruct icon = new IconStruct(); btnApiStruct btnapi = new btnApiStruct(); XmlNode iconNode = btnNode.SelectSingleNode("icon"); ArrayList childnodes = new ArrayList(); if (btnNode.Name != "icon" && btnNode.Name != "x__heading") { if (btnNode.Attributes["caption"] != null) btn.caption = btnNode.Attributes["caption"].Value; else btn.caption = string.Empty; if (btnNode.Attributes["footer"] != null) btn.footer = btnNode.Attributes["footer"].Value; else btn.footer = string.Empty; if (btnNode.Attributes["visible"] != null) btn.visible = btnNode.Attributes["visible"].Value; else btn.visible = "true"; if (btnNode.Attributes["task"] != null) { btn.task = btnNode.Attributes["task"].Value; if (btn.task == "tasks") continue; } else btn.task = string.Empty; if (btnNode.Attributes["action"] != null) btn.action = btnNode.Attributes["action"].Value; else btn.action = string.Empty; if (btnNode.Attributes["hint"] != null) btn.hint = btnNode.Attributes["hint"].Value; else btn.hint = ""; if (btnNode.Attributes["key"] != null) btn.ID = btnNode.Attributes["key"].Value; else btn.ID = ""; if (btnNode.Attributes["folder"] != null) btn.isDrpDwn = btnNode.Attributes["folder"].Value.ToLower() == "true" ? true : false; else btn.isDrpDwn = false; if (btnNode.Attributes["script"] != null) btn.isScript = btnNode.Attributes["script"].Value.ToLower() == "true" ? true : false; else btn.isScript = false; if (iconNode != null) { if (iconNode.SelectSingleNode("text") != null) { icon.text = iconNode.SelectSingleNode("text").InnerText; icon.addclass = iconNode.SelectSingleNode("addClass").InnerText; btn.icon = icon; btn.image = ""; } else { icon.text = ""; icon.addclass = ""; btn.icon = icon; btn.image = iconNode.InnerText; } } else { icon.text = ""; icon.addclass = ""; btn.icon = icon; btn.image = ""; } if (btn.isDrpDwn && btnNode.ChildNodes.Count > 0) { btn.childBtns = new ArrayList(XmlLoadDWBButtons(btnNode)); } if (btnNode.Attributes["api"] != null && btnNode.Attributes["api"].Value != "") { btn.scriptApi = true; XmlNode apiNode = btnNode.SelectSingleNode("api"); btnapi.url = apiNode.SelectSingleNode("url").InnerText; btnapi.reqstr = apiNode.SelectSingleNode("reqstr").InnerText; btnapi.restype = apiNode.SelectSingleNode("restype").InnerText; btnapi.resformat = apiNode.SelectSingleNode("resformat").InnerText; btnapi.category = apiNode.SelectSingleNode("category").InnerText; btnapi.method = apiNode.SelectSingleNode("method").InnerText; btn.btnapi = btnapi; } else { btn.scriptApi = false; btnapi.url = ""; btnapi.reqstr = ""; btnapi.restype = ""; btnapi.resformat = ""; btnapi.category = ""; btnapi.method = ""; btn.btnapi = btnapi; } btnsArr.Add(btn); } } return btnsArr; } // Sort the Task Button Elements in ascending order based on Element name public static void SortXMLElements(XmlNode node) { bool changed = true; int num0, num1; while (changed) { changed = false; for (int i = 1; i < node.ChildNodes.Count; i++) { if (Int32.TryParse(node.ChildNodes[i].Name.ToLower().Replace("pop", ""), out num1) && Int32.TryParse(node.ChildNodes[i - 1].Name.ToLower().Replace("pop", ""), out num0) && num1 < num0) { node.InsertBefore(node.ChildNodes[i], node.ChildNodes[i - 1]); //Replace the nodes changed = true; } } } } /// /// Update the formcontrol javascript array to the string variable. /// /// private void XmlLoadJsFormcontrol(XmlNode actionNodes) { ActionStruct act = new ActionStruct(); StringBuilder formcontrol = new StringBuilder(); StringBuilder script_fc = new StringBuilder(); int formcontrolNo = 0, actNo = 0, srConNo = 0; XmlNode formcontrolTempNode1 = default(XmlNode); XmlNode formcontrolTempNode2 = default(XmlNode); foreach (XmlNode actionNode in actionNodes) { if (actionNode.Name == "formcontrol") { XmlNodeList formcontrolNode = actionNode.ChildNodes; for (int i = 0; i <= formcontrolNode.Count - 1; i++) { formcontrolTempNode1 = formcontrolNode.Item(i); XmlNodeList formcontrolChildNode = formcontrolTempNode1.ChildNodes; for (int j = 0; j <= formcontrolChildNode.Count - 2; j++) { formcontrolTempNode2 = formcontrolChildNode.Item(j); formcontrol.Append("Formcontrols[" + formcontrolNo + "] = " + "\"" + formcontrolTempNode2.InnerText + "\"; "); formcontrolNo += 1; } //Last node needs to be "e". so the array will end one node before and e is hardcoded after formcontrol.Append("Formcontrols[" + formcontrolNo + "]= " + "\"e\"; "); formcontrolNo += 1; } } else { if (actionNode.Attributes["formcontrol"] != null && actionNode.Attributes["formcontrol"].Value == "true") { string actstrname = string.Empty, actapplyon = string.Empty, actapply = string.Empty, actconname = string.Empty; if (actionNode.Attributes["sname"] != null) actstrname = actionNode.Attributes["sname"].Value.ToString(); if (actionNode.Attributes["apply"] != null) actapply = actionNode.Attributes["apply"].Value.ToString(); if (actionNode.Attributes["applyon"] != null) actapplyon = actionNode.Attributes["applyon"].Value.ToString(); if (actionNode.HasChildNodes) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(actionNode.OuterXml); XmlNode resultNode = xmlDoc.SelectSingleNode("//r1/param1/exprset"); foreach (XmlNode childNode in resultNode.ChildNodes) { actconname += childNode.InnerText.Replace("\"", "\'") + "~"; } if (actconname != string.Empty) actconname = actconname.TrimEnd('~'); } catch (Exception ex) { } } script_fc.Append("SFormControls[" + srConNo + "]=" + "\"" + actconname + "\"; "); script_fc.Append("SFCApply[" + srConNo + "]=" + "\"" + actapply + "\"; "); script_fc.Append("SFCFldNames[" + srConNo + "]=" + "\"" + actapplyon + "\"; "); script_fc.Append("SFCActionName[" + srConNo + "]=" + "\"" + actionNode.Name.ToString() + "\"; "); srConNo++; } else { act.actname = actionNode.Name.ToString(); if (actionNode.Attributes["sname"] != null) act.actstrname = actionNode.Attributes["sname"].Value.ToString(); if (actionNode.Attributes["apply"] != null) act.actapply = actionNode.Attributes["apply"].Value.ToString(); if (actionNode.Attributes["applyon"] != null) act.actapplyon = actionNode.Attributes["applyon"].Value.ToString(); if (actionNode.Attributes["desc"] != null) act.actdesc = actionNode.Attributes["desc"].Value.ToString(); if (actionNode.Attributes["validate"] != null) act.actvalidate = actionNode.Attributes["validate"].Value.ToString(); act.actweb = "no"; if (actionNode.Attributes["web"] != null && actionNode.Attributes["web"].Value != null) act.actweb = actionNode.Attributes["web"].Value.ToString(); if (actionNode.Attributes["rem"] != null) act.actRem = actionNode.Attributes["rem"].Value; else act.actRem = "n"; if (actionNode.Attributes["manrem"] != null) act.manRem = actionNode.Attributes["manrem"].Value; else act.manRem = "n"; if (actionNode.Attributes["apply"] != null && actionNode.Attributes["apply"].Value != null && Convert.ToString(actionNode.Attributes["apply"].Value) == "On Form Load") rapidFormLoadActionXML += actionNode.OuterXml; if (actionNode.HasChildNodes) { try { XmlNode node = actionNode.FirstChild; XmlNodeList lstRefresh = node.ChildNodes[0].ChildNodes; foreach (XmlNode ndRefresh in lstRefresh) { if (ndRefresh.Name == "Refresh") { act.actParRefresh = ndRefresh.InnerText; break; } } } catch (Exception ex) { } try { act.actSaveTask = ""; act.actScriptTask = ""; XmlNodeList chkSaveTask = actionNode.ChildNodes; foreach (XmlNode ndSave in chkSaveTask) { if (ndSave.Attributes["task"].Value.ToLower() == "save") { act.actSaveTask = "save"; break; } else if (ndSave.Attributes["task"].Value.ToLower() == "scripts") { XmlNode scrpList = ndSave.ChildNodes[0].FirstChild; foreach (XmlNode ndScrp in scrpList.ChildNodes) { if (ndScrp.InnerText.ToLower() == "save()") { act.actSaveTask = "save"; break; } else if (ndScrp.InnerText.ToLower().StartsWith("loadform(")) { act.actScriptTask = "loadform♠" + ndScrp.InnerText; break; } else if (ndScrp.InnerText.ToLower().StartsWith("loadformanddata(")) { act.actScriptTask = "loadformanddata♠" + ndScrp.InnerText; break; } else if (ndScrp.InnerText.ToLower().StartsWith("loadiview(")) { act.actScriptTask = "loadiview♠" + ndScrp.InnerText; break; } else if (ndScrp.InnerText.ToLower().StartsWith("loadpage(")) { act.actScriptTask = "loadpage♠" + ndScrp.InnerText; break; } else if (ndScrp.InnerText.ToLower().StartsWith("openpage(")) { act.actScriptTask = "openpage♠" + ndScrp.InnerText; break; } } break; } } } catch (Exception ex) { } } // check whether this action is used in any buttons, if so check for file upload and set it in the button for (int i = 0; i < btns.Count; i++) { ButtonStruct btn = (ButtonStruct)btns[i]; if (btn.action != act.actname) continue; if (actionNode.Attributes["fileupload"] != null) { btn.fileupload = actionNode.Attributes["fileupload"].Value; if (actionNode.Attributes["fmsg"] != null) btn.fmessage = actionNode.Attributes["fmsg"].Value; if (actionNode.Attributes["ftype"] != null) btn.ftype = actionNode.Attributes["ftype"].Value; btns.RemoveAt(i); btns.Insert(i, btn); } actions.Add(act); break; } // check whether this action is used in any buttons, if so check for file upload and set it in the button for (int i = 0; i < taskBtns.Count; i++) { ButtonStruct btn = (ButtonStruct)taskBtns[i]; if (btn.action != act.actname) continue; if (actionNode.Attributes["fileupload"] != null) { btn.fileupload = actionNode.Attributes["fileupload"].Value; if (actionNode.Attributes["fmsg"] != null) btn.fmessage = actionNode.Attributes["fmsg"].Value; if (actionNode.Attributes["ftype"] != null) btn.ftype = actionNode.Attributes["ftype"].Value; taskBtns.RemoveAt(i); taskBtns.Insert(i, btn); } actions.Add(act); break; } formcontrol.Append("tstActionName[" + actNo + "]= " + "\"" + act.actname + "\";actParRefresh[" + actNo + "]= " + "\"" + act.actParRefresh + "\";actSaveTask[" + actNo + "]= " + "\"" + act.actSaveTask + "\";actScriptTask[" + actNo + "]=" + "\"" + act.actScriptTask + "\";"); actNo++; } } } jsFormcontrolArray += formcontrol.ToString() + script_fc.ToString(); } /// /// Update hyperlink list /// /// private void XmlLoadHyperLink(XmlNode hlinkNodes) { StringBuilder hyperlnklist = new StringBuilder(); int hyperlnkNo = 0; foreach (XmlNode hlinkNode in hlinkNodes) { HLinkStruct hl = new HLinkStruct(); if (hlinkNode.Attributes["pop"] != null) { hl.hlpop = hlinkNode.Attributes["pop"].Value; hyperlnklist.Append("HLinkPop[" + hyperlnkNo + "] = " + "\"" + hlinkNode.Attributes["pop"].Value.ToString() + "\";"); } else { hl.hlpop = "-"; hyperlnklist.Append("HLinkPop[" + hyperlnkNo + "] = " + "\"-\";"); } if (hlinkNode.Attributes["sname"] != null) { hl.hlname = hlinkNode.Attributes["sname"].Value; hyperlnklist.Append("HLinkName[" + hyperlnkNo + "] = " + "\"" + hlinkNode.Attributes["sname"].Value.ToString() + "\";"); } else { hl.hlname = "-"; hyperlnklist.Append("HLinkName[" + hyperlnkNo + "] = " + "\"-\";"); } if (hlinkNode.Attributes["source"] != null) { hl.hlsource = hlinkNode.Attributes["source"].Value; hyperlnklist.Append("HLinkSource[" + hyperlnkNo + "] = " + "\"" + hlinkNode.Attributes["source"].Value.ToString() + "\";"); } else { hl.hlsource = "-"; hyperlnklist.Append("HLinkSource[" + hyperlnkNo + "] = " + "\"-\";"); } if (hlinkNode.Attributes["load"] != null) { hl.hlload = hlinkNode.Attributes["load"].Value; hyperlnklist.Append("HLinkLoad[" + hyperlnkNo + "] = " + "\"" + hlinkNode.Attributes["load"].Value.ToString() + "\";"); } else { hl.hlload = "-"; hyperlnklist.Append("HLinkLoad[" + hyperlnkNo + "] = " + "\"-\";"); } StringBuilder paramnm = new StringBuilder(); StringBuilder paramval = new StringBuilder(); foreach (XmlNode paramNode in hlinkNode) { if (paramnm.Length == 0) { paramnm.Append(paramNode.Attributes["n"].Value); paramval.Append(paramNode.Attributes["v"].Value); } else { paramnm.Append("~" + paramNode.Attributes["n"].Value); paramval.Append("~" + paramNode.Attributes["v"].Value); } } if (paramnm.Length != 0) { hl.hlparamname = paramnm.ToString(); hl.hlparamval = paramval.ToString(); hyperlnklist.Append("HLinkParamName[" + hyperlnkNo + "] = " + "\"" + hl.hlparamname + "\";"); hyperlnklist.Append("HLinkParamValue[" + hyperlnkNo + "] = " + "\"" + hl.hlparamval + "\";"); } else { hl.hlparamname = "-"; hl.hlparamval = "-"; hyperlnklist.Append("HLinkParamName[" + hyperlnkNo + "] = " + "\"-\";"); hyperlnklist.Append("HLinkParamValue[" + hyperlnkNo + "] = " + "\"-\";"); } hlnks.Add(hl); hyperlnkNo++; } if (hyperlnklist.ToString() != "") tstHyperLink = true; jsHyperlinkArray = hyperlnklist.ToString(); } /// /// function to create customized labels, the customized labels users can provide, different font /// styles like, bold, size, color /// /// private void XmlCreateCustomLabel(XmlNode customLabelNodes) { XmlNode nodeLabelExists = customLabelNodes.Attributes["t"]; if ((nodeLabelExists == null)) { customLabelHtml.Append(""); } else if (nodeLabelExists.Value == "lbl") { string LabelName = null; LabelName = customLabelNodes.Attributes["c"].Value; int frameNo = 0; if (customLabelNodes.Attributes["p"] != null) { frameNo = Convert.ToInt32(customLabelNodes.Attributes["p"].Value.Substring(3)); } if (string.IsNullOrEmpty(LabelName)) LabelName = customLabelNodes.InnerText.ToString(); if (LabelName.IndexOf("\n") != -1) LabelName = LabelName.Replace("\n", "
"); string Labeltlhw = null; Labeltlhw = ""; string Labeltop = null; string Labelleft = null; string Labelht = null; string Labelwidth = null; XmlNode nodeLabel = customLabelNodes.Attributes["tlhw"]; if ((nodeLabel == null)) Labeltlhw = ""; else Labeltlhw = nodeLabel.Value; string lblstyle = string.Empty; nodeLabel = customLabelNodes.Attributes["font"]; if ((nodeLabel == null)) lblstyle = ""; else lblstyle = nodeLabel.Value; string style = string.Empty; if (lblstyle == ",,," || string.IsNullOrEmpty(lblstyle)) style = "font-family:'Lato', sans-serif; font-size:14px; font-weight:normal; font-style:normal; color:#000000;"; else { string[] stylearr = lblstyle.Split(','); if (string.IsNullOrEmpty(stylearr[0])) style = "font-family:'Lato', sans-serif;"; else style = "font-family:" + stylearr[0].ToString() + ";"; if (string.IsNullOrEmpty(stylearr[1])) style += " font-size:14px;"; else style += " font-size:" + stylearr[1].ToString() + "pt;"; if (string.IsNullOrEmpty(stylearr[2])) style += " font-weight:normal; font-style:normal;"; else { string fontstyle = stylearr[2].ToString(); string fstyle = ""; if ((fontstyle.Substring(0, 1) == "t")) fstyle = " font-weight:bold;"; else fstyle = " font-weight:bold;"; if ((fontstyle.Substring(1, 1) == "t")) fstyle += "font-style:italic;"; else fstyle += "font-style:bold;"; if ((fontstyle.Substring(2, 1) == "t")) fstyle += "text-decoration:underline"; else fstyle += ""; if ((fontstyle.Substring(3, 1) == "t")) fstyle += " line-through;"; else fstyle += ";"; style += fstyle; } if (stylearr[3] == "clBlack") style += " color:#000000;"; else { if ((!string.IsNullOrEmpty(stylearr[3].ToString()))) style += " color:" + stylearr[3].ToString().Substring(2) + ";"; else style += " color:#000000;"; } } if (!(string.IsNullOrEmpty(Labeltlhw))) { string[] Labelsplitout = Labeltlhw.Split(','); if (EnableOldTheme == "true") { Labeltop = Math.Floor((Convert.ToInt32(Labelsplitout[0].ToString()) * 1.2)).ToString() + "px"; Labelleft = Math.Floor((Convert.ToInt32(Labelsplitout[1].ToString()) * 1.01)).ToString() + "px"; } else { Labeltop = Math.Floor((Convert.ToInt32(Labelsplitout[0].ToString()) * 1.6)).ToString() + "px"; Labelleft = Math.Floor((Convert.ToInt32(Labelsplitout[1].ToString()) * 1.07)).ToString() + "px"; } Labelht = Labelsplitout[2].ToString() + "px"; Labelwidth = Labelsplitout[3].ToString() + "px"; string divDirection = "left"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") { divDirection = "right"; } bool isHyper = false; int n = 0; for (n = 0; n <= hlnks.Count - 1; n++) { if (customLabelNodes.Name.ToLower() == ((HLinkStruct)(hlnks[n])).hlsource.ToString().ToLower()) { isHyper = true; break; } } FieldStruct dummy = new FieldStruct(); dummy.visibility = false; dummy.fldlength = 15; dummy.fldFrameNo = frameNo; if (isHyper) dummy.ctype = "hyperlink"; else dummy.ctype = "label"; dummy.datatype = "special"; dummy.name = customLabelNodes.Name; customLabelHtml.Append("
"); customLabelHtml.Append("
"); customLabelHtml.Append("
"); customLabelHtml.Append(""); if (isHyper) customLabelHtml.Append("" + LabelName + "
"); else customLabelHtml.Append("" + LabelName + "
"); customLabelHtml.Append(""); } customLabels.Add(customLabelHtml.ToString()); customLblDcNo.Add(dcs.Count.ToString()); customLabelHtml = new StringBuilder(); } } /// /// function to construct the dc html with field html. /// /// /// /// completed field html. private string GetFullDCHtml(int dcNo, string fieldhtml, string isTab) { colCount = 0; if (dcNo == 1) docHeight = 0; StringBuilder dcHtml = new StringBuilder(); string dcFields1 = string.Empty; string ngBorder = string.Empty; StringBuilder customLabel = new StringBuilder(); StringBuilder actionButton = new StringBuilder(); StringBuilder defaultColsHtml = new StringBuilder(); int gridwidth = 0; string divDirection = "left"; string divCollapse = "right"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") { divDirection = "right"; divCollapse = "left"; } 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"]); } for (int n = 0; n < customLblDcNo.Count; n++) { if (dcNo == Convert.ToInt32(customLblDcNo[n].ToString())) customLabel.Append(customLabels[n].ToString()); } for (int m = 0; m < pageActionDcNo.Count; m++) { if (dcNo == Convert.ToInt32(pageActionDcNo[m].ToString())) actionButton.Append(pageActionButtons[m].ToString()); } if (((DcStruct)(dcs[dcNo - 1])).isgrid) docHeight += 500; else docHeight += ((DcStruct)(dcs[dcNo - 1])).dcHeight; int VisibleFlds = ((DcStruct)(dcs[dcNo - 1])).visibleFldCount; for (int k = 0; k < flds.Count; k++) { FieldStruct fld = ((FieldStruct)(flds[k])); if (fld.fldframeno < dcNo) continue; if (fld.fldframeno > dcNo) break; if (fld.fldframeno == dcNo) { if (fld.visibility == false) { gridwidth += (fld.fldlength > 51 ? 400 : (fld.fldlength <= 15) ? 150 : (fld.fldlength * 8)); } } } if (((DcStruct)(dcs[dcNo - 1])).isallowdeletrows.ToString().ToLower() == "true") gridwidth = gridwidth + 80; else gridwidth = gridwidth + 40;//40 width for sl no column and 40 for delete button if (((DcStruct)(dcs[dcNo - 1])).isgrid) { string rowSrNoClass = string.Empty; if (IsFillGridCall) { rowSrNoClass = "gridtdclass"; } else { rowSrNoClass = "gridtdclass d-none"; } string dcRowone = ""; if (((DcStruct)(dcs[dcNo - 1])).ispopgrid) { if (((DcStruct)(dcs[dcNo - 1])).isallowdeletrows.ToString().ToLower() == "false") dcRowone = "
" + fieldhtml + "
"; else //delete grid row dcRowone = "
" + fieldhtml + "
"; } else { if (((DcStruct)(dcs[dcNo - 1])).isallowdeletrows.ToString().ToLower() == "false") { dcRowone = "
" + fieldhtml + "
"; } else { //delete grid row dcRowone = "
" + fieldhtml + "
"; } } StringBuilder gridHdHtml = new StringBuilder(); gridHdHtml.Append("
"); if (((DcStruct)(dcs[dcNo - 1])).isallowdeletrows.ToString().ToLower() == "true") { xywhGridStack(new FieldStruct { visibility = false, fldFrameNo = dcNo, name = ("uniqueThHead" + dcNo) }, true); if (((DcStruct)(dcs[dcNo - 1])).ispopgrid) { defaultColsHtml.Append("
S.no
"); colCount++; } else { defaultColsHtml.Append("
S.no
"); colCount++; } } else { if (((DcStruct)(dcs[dcNo - 1])).ispopgrid) defaultColsHtml.Append(""); else { xywhGridStack(new FieldStruct { visibility = false, fldFrameNo = dcNo, name = ("uniqueThHead" + dcNo) }, true); defaultColsHtml.Append("
S.no
"); 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("
" + dcBtns); gridHdHtml.Append("
"); string hideClass = "d-none"; gridHdHtml.Append("
" + dcRowone + "
Use Ctrl+Left arrow & Ctrl+Right arrow to navigate between record(s).
"); if (HttpContext.Current.Session["language"].ToString().ToLower() == "arabic") { gridHdHtml.Append("
"); gridHdHtml.Append(""); } else { gridHdHtml.Append("
"); gridHdHtml.Append("
"); } xywhGridStack(new FieldStruct { visibility = false, fldFrameNo = dcNo, name = ("uniqueEditDeleteAct" + dcNo) }, true); gridHdHtml.Append("
" + defaultColsHtml.ToString()); gridHdHtml.Append(gridHeadHtml.ToString() + "
"); StringBuilder gridHtml = new StringBuilder(); string gridButtons = string.Empty; if (((DcStruct)(dcs[dcNo - 1])).ispopgrid) { gridHdHtml.Append("
"); gridHdHtml.Append(""); } else { gridHdHtml.Append("
"); gridHdHtml.Append("
"); } gridHdHtml.Append("
"); gridHdHtml.Append("
"); gridHdHtml.Append("
"); string rowCountHtml = ""; string fullGridHtml1 = string.Empty; if (isTab == "true") { if (((DcStruct)(dcs[dcNo - 1])).isgrid) { fullGridHtml1 = "
"; if (!string.IsNullOrEmpty(((DcStruct)(dcs[dcNo - 1])).purpose)) fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "
" + ((DcStruct)(dcs[dcNo - 1])).purpose + "
";//murali else fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "";//murali } else { fullGridHtml1 = "
"; if (!string.IsNullOrEmpty(((DcStruct)(dcs[dcNo - 1])).purpose)) fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "
" + ((DcStruct)(dcs[dcNo - 1])).purpose + "
";//murali else fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "";//murali } } else if (((DcStruct)(dcs[dcNo - 1])).ispopgrid) { fullGridHtml1 = "
"; if (!string.IsNullOrEmpty(((DcStruct)(dcs[dcNo - 1])).purpose)) fullGridHtml1 += "
" + ((DcStruct)(dcs[dcNo - 1])).purpose + "
"; else fullGridHtml1 += ""; fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "
"; //murali } else { fullGridHtml1 = "
"; fullGridHtml1 += ""; fullGridHtml1 += gridHdHtml.ToString() + rowCountHtml + "
"; } 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 = "
"; else ngBorder = "
"; } else ngBorder = "
"; } } else ngBorder = "
"; } string ngFldHtml = ngBorder + fieldhtml + customLabel.ToString() + actionButton.ToString() + "
"; if (isTab == "true") { if (dcNo > 1) { dcHtml.Append("
"); dcHtml.Append(ngFldHtml + "
"); } else { //TODO: the primary dc can also be a tabbed dc dcHtml.Append("
"); dcHtml.Append(ngFldHtml + "
"); } } else { dcHtml.Append("
"); if (dcNo > 1 || tstLayout == Constants.TILE) { if (!string.IsNullOrEmpty(((DcStruct)(dcs[dcNo - 1])).purpose)) dcHtml.Append("
keyboard_arrow_up " + ((DcStruct)(dcs[dcNo - 1])).caption + "
" + ((DcStruct)(dcs[dcNo - 1])).purpose + "

");//muralli else dcHtml.Append("
" + ((DcStruct)(dcs[dcNo - 1])).caption + "

");//muralli } else if (dcNo == 1 && designMode) { dcHtml.Append("
" + ((DcStruct)(dcs[dcNo - 1])).caption + "
" + ((DcStruct)(dcs[dcNo - 1])).purpose + "

"); } dcHtml.Append(ngFldHtml + "
"); } } return dcHtml.ToString(); } #endregion #region Public Methods public string GetFillGridCaption(int dcNo, string isTab) { StringBuilder fgfieldArray = new StringBuilder(); string fgButCap = ""; if (fgs.Count > 0) { int cnt = 0; for (cnt = 0; cnt <= fgs.Count - 1; cnt++) { if (((DcStruct)(dcs[dcNo - 1])).name == ((FGStruct)(fgs[cnt])).fgtargetdc) { fgButCap = ((FGStruct)(fgs[cnt])).fgcaption; break; } } } return fgButCap; } /// /// Method to initialize the fields. It takes XML returned by AWS, parses and /// fills the arrays and fields. U /// /// public void Create(string xml) { xmlDoc.LoadXml(xml); FillTstructProperties(xmlDoc); XmlNodeList tstBaseDataNodes = default(XmlNodeList); tstBaseDataNodes = xmlDoc.DocumentElement.SelectNodes("//root"); XmlNodeList hyperLinkNode = xmlDoc.GetElementsByTagName("hyperlinks"); if (hyperLinkNode[0] != null) XmlLoadHyperLink(hyperLinkNode[0]); //Calling Runmode/design mode Api's //getDesignData(); if (HttpContext.Current.Session["IsCustomHtml"] == null || HttpContext.Current.Session["IsCustomHtml"].ToString() == string.Empty) getDesignDataPerf(); XmlDocument formbtnnode = new System.Xml.XmlDocument(); XmlNode toolbarcomps = xmlDoc.SelectSingleNode("//root/comps"); string pdcno = string.Empty; string strformbt = string.Empty; for (int i = toolbarcomps.ChildNodes.Count - 1; i < toolbarcomps.ChildNodes.Count; i--) { if (toolbarcomps.ChildNodes[i] == null) break; string newpdcno = string.Empty; string innerXML = string.Empty; if (toolbarcomps.ChildNodes[i].Attributes["position"] != null && toolbarcomps.ChildNodes[i].Attributes["position"].Value != "" && toolbarcomps.ChildNodes[i].Attributes["position"].Value.StartsWith("dc")) { newpdcno = toolbarcomps.ChildNodes[i].Attributes["position"].Value; innerXML = toolbarcomps.ChildNodes[i].OuterXml; newpdcno = newpdcno.Split('~')[0]; newpdcno = newpdcno.Substring(2); toolbarcomps.RemoveChild(toolbarcomps.ChildNodes[i]); } if (innerXML != string.Empty) { if (pdcno == string.Empty) { strformbt += ""; strformbt += innerXML; pdcno = newpdcno; } else if (pdcno == newpdcno) { strformbt += innerXML; } else if (pdcno != newpdcno) { strformbt += ""; strformbt += ""; strformbt += innerXML; pdcno = newpdcno; } } } if (strformbt != string.Empty) { strformbt += ""; formbtnnode.LoadXml("" + strformbt + ""); } foreach (XmlNode tstBaseDataNode in tstBaseDataNodes) { XmlNodeList tstChildDataNodes = default(XmlNodeList); tstChildDataNodes = tstBaseDataNode.ChildNodes; string category = string.Empty; foreach (XmlNode tstChildDataNode in tstChildDataNodes) { if (tstChildDataNode.Attributes["cat"] != null) category = tstChildDataNode.Attributes["cat"].Value.ToString(); else category = string.Empty; if (tstChildDataNode.Attributes["plist"] != null) dcPlistaddrow = tstChildDataNode.Attributes["plist"].Value.ToString(); else dcPlistaddrow = string.Empty; if (category == "dc") { dcFldCount = 0; dcFldVisibleCount = 0; XmlLoadDc(tstChildDataNode); if (formbtnnode.ChildNodes.Count > 0) { XmlPageLoadDWBButton(formbtnnode, DCNo); } } else if (category == "field") { string fieldType = string.Empty; if (tstChildDataNode.Attributes["fieldtype"] != null) fieldType = tstChildDataNode.Attributes["fieldtype"].Value.ToString(); else fieldType = string.Empty; //if (tstChildDataNode.Attributes["runtimecriteria"] != null && tstChildDataNode.Attributes["runtimecriteria"].Value == "T" && fldRuntimeCriteria == "F") // fldRuntimeCriteria = tstChildDataNode.Attributes["runtimecriteria"].Value.ToString(); XmlLoadField(tstChildDataNode, fieldType); } else if (category == "fillgrid") XmlLoadFillgrid(tstChildDataNode); else if (category == "btn") XmlPageLoadButton(tstChildDataNode, "btn"); else if (category == "comps") { if (tstChildDataNode.Attributes["dwbtb"] != null && tstChildDataNode.Attributes["dwbtb"].Value.ToString().ToLower() == "true") { dwbToolbar = true; //btns = new ArrayList(XmlLoadDWBButtons(tstChildDataNode)); btns = new ArrayList(XmlLoadDWBButtons(toolbarcomps)); } else XmlLoadButton(tstChildDataNode, "btn"); } else if (category == "tasks") XmlLoadButton(tstChildDataNode, "task"); else if (category == "hyperlinks") continue; else if (category == "actions") XmlLoadJsFormcontrol(tstChildDataNode); else if (category == "iframes") XmlLoadTabDcs(tstChildDataNode); else if (category == "gformat") { continue; //XmlLoadFormatDcs(tstChildDataNode); //Commented Bcoz this feature will be taken up later //Right now it will skip the GFormat node from the tstruct } else if (category != "") XmlCreateCustomLabel(tstChildDataNode); } } //XmlNodeList pdfListNode = xmlDoc.GetElementsByTagName(transId + "_pdflist"); //if (pdfListNode[0] != null) // pdfList = pdfListNode[0].OuterXml; if (HttpContext.Current.Session[transId + "_pdflist"] != null) { pdfList = HttpContext.Current.Session[transId + "_pdflist"].ToString(); HttpContext.Current.Session[transId + "_pdflist"] = null; } if (dcRange != "") { dcRange = dcRange + "," + (fldGlobal).ToString(); jsFieldArray.Append("FldDcRange[" + DcCnt + "]=\"" + dcNo.ToString() + "~" + dcRange + "\";"); fldDcRange.Add(dcNo.ToString() + "~" + dcRange); dcRange = ""; } if (fldSetCarry.Count > 0) { jsFieldArray.Append("FSetCarry=['" + string.Join("','", fldSetCarry.ToArray()) + "'];"); } if (AxpFileUploadFields.Count > 0) jsFieldArray.Append("AxpFileUploadFields=['" + string.Join("','", AxpFileUploadFields.ToArray()) + "'];"); FillNGSqlDepParents(); IsWsPerfDeleteGridRow(); FDR fastData = (FDR)HttpContext.Current.Session["FDR"]; fastDataFlds = fastData.GetRedisServerFields(this); fastData.GetFastDataRefEvents(this); } /// /// GridDC fields dependences are having Accept SQL or Select with AutoSelect true then only needs to call GridRowDelete service. /// private void IsWsPerfDeleteGridRow() { if (wsPerfFields != string.Empty) { string[] wsPerfFieldArr = wsPerfFields.Split(','); for (int i = 0; i < dcs.Count; i++) { DcStruct dc = (DcStruct)dcs[i]; if (dc.isgrid) { string[] dcRange = GetDcFieldRange(dc.frameno.ToString()).Split(','); int startIdx = Convert.ToInt32(dcRange[0]); int endIdx = Convert.ToInt32(dcRange[1]); for (int k = startIdx; k <= endIdx; k++) { FieldStruct fld = (FieldStruct)flds[k]; if (fld.fieldDependents == string.Empty) continue; string[] fldDeparray = fld.fieldDependents.Split(','); var isfldDepBound = fldDeparray.Where(fd => wsPerfFieldArr.Any(vd => fd == "s" + vd || fd == "e" + vd || fd == "f" + vd)).ToList(); if (isfldDepBound.Count > 0) { wsPerfGRDDcs.Add(dc.frameno.ToString()); break; } else { for (int j = 0; j < fldDeparray.Length; j++) { if (GetFieldDc(fldDeparray[j]) != dc.frameno) { wsPerfGRDDcs.Add(dc.frameno.ToString()); break; } } if (wsPerfGRDDcs.Count > 0 && wsPerfGRDDcs.IndexOf(dc.frameno.ToString()) != -1) break; } } } } } } private void SetRapidExpFlds() { if (rapidFLExpFlds.Count > 0) { rapidFormLoadExpFlds = string.Join(",", rapidFLExpFlds.Select(x => x.ToString()).ToArray()); if (rapidFormLoadExpFlds != string.Empty) rapidFormLoadJSON = "{\"evalexpr\":\"true\", \"flds\":\"" + rapidFormLoadExpFlds + "\"}"; } } private FieldStruct SetFieldGridSqlDeps(FieldStruct fld, DcStruct dc, int idx) { ArrayList fldDepGridDcs = new ArrayList(); StringBuilder strSqlDeps = new StringBuilder(); string strFldDeps = string.Empty; strFldDeps = fld.fieldSqlDeps; if (strFldDeps == "") strFldDeps = fld.fieldExpDeps; else if (fld.fieldExpDeps != string.Empty) strFldDeps += "," + fld.fieldExpDeps; if (!string.IsNullOrEmpty(strFldDeps)) { string[] strDeps = strFldDeps.Split(','); for (int i = 0; i < strDeps.Length; i++) { string fChar = strDeps[i].ToString().Substring(0, 1); string fName = strDeps[i].ToString().Substring(1); int dIdx = GetFieldIndex(fName); FieldStruct depFld = (FieldStruct)flds[dIdx]; DcStruct depDc = (DcStruct)dcs[depFld.fldframeno - 1]; if (!depDc.ispopgrid && depDc.isgrid && fld.fldframeno != depFld.fldframeno) { string depStr = depFld.name; //Stores the dep grid dcs for a given field if (fldDepGridDcs.IndexOf(depFld.fldframeno) == -1) { fldDepGridDcs.Add(depFld.fldframeno); depStr += "," + "axp_recid" + depFld.fldframeno; } //if (depFld.fieldParents != string.Empty && fChar != "e") here checking is dependece fields are sql or not if it is sql dependent adding else not adding if (depFld.fieldParents != string.Empty) { depStr += "," + depFld.fieldParents; } if (strSqlDeps.ToString() == string.Empty) strSqlDeps.Append(depStr); else strSqlDeps.Append("," + depStr); } } for (int j = 0; j < fldDepGridDcs.Count; j++) { if (fld.fieldDepGridDcs == string.Empty) fld.fieldDepGridDcs = fldDepGridDcs[j].ToString(); else fld.fieldDepGridDcs += "," + fldDepGridDcs[j].ToString(); } } fld.fieldDepGridDcs = cust.UpdateSqlDepGridDcs(transId, fld.name, fld.fieldDepGridDcs); //Hook to add or remove a given field's sql grid dependents fld.fieldSqlGridDeps = cust.UpdateSqlGridDependents(transId, fld.name, strSqlDeps.ToString()); //flds[idx] = fld; return fld; } /// /// This function will be called on a tabbed grid dc only /// all the tab grid dc parent fields will be stored in the array dc.tabParentFields. /// tabParentFields will have parent fields outside the current dc and parent dc is grid. /// /// /// private void FillTabGridParentFlds(DcStruct dc, FieldStruct fld) { if (string.IsNullOrEmpty(fld.fieldParents)) return; string[] parFlds = fld.fieldParents.Split(','); for (int i = 0; i < parFlds.Length; i++) { int idx = GetFieldIndex(parFlds[i].ToString()); if (idx != -1) { FieldStruct pFld = (FieldStruct)flds[idx]; DcStruct depDc = (DcStruct)dcs[pFld.fldframeno - 1]; if (depDc.isgrid && depDc.frameno != dc.frameno && dc.tabParentFields.IndexOf(pFld.name) == -1) { dc.tabParentFields.Add(pFld.name); } } } } /// /// This function will be called for every dc which has fillgrid /// Updates the tabParentFields with the fillsql params which are grid fields and outside the current dc. /// /// /// private void FillTabGridParentFlds(int frameNo, DcStruct dc) { int idx = GetFillGridIndex("dc" + frameNo.ToString()); if (idx != -1) { FGStruct fg = (FGStruct)fgs[idx]; if (fg.fgSqlParams != string.Empty) { string[] fgParFields = fg.fgSqlParams.Split(','); for (int i = 0; i < fgParFields.Length; i++) { int index = GetFieldIndex(fgParFields[i].ToString()); if (index != -1) { FieldStruct pFld = (FieldStruct)flds[index]; DcStruct depDc = (DcStruct)dcs[pFld.fldframeno - 1]; if (depDc.isgrid && depDc.frameno != dc.frameno && dc.tabParentFields.IndexOf(pFld.name) == -1) { dc.tabParentFields.Add(pFld.name); } } } } } } private void GetGridExpDependents(DcStruct dc, FieldStruct fld) { if (fld.fieldDependents != string.Empty) { string[] depFlds = fld.fieldDependents.Split(','); for (int j = 0; j < depFlds.Length; j++) { if (depFlds[j].ToString() != string.Empty) { string depName = depFlds[j].ToString().Substring(1); string fChar = depFlds[j].ToString().Substring(0, 1); if (fChar == "e") { int dIdx = GetFieldIndex(depName); if (dIdx != -1) { FieldStruct depFld = (FieldStruct)flds[dIdx]; DcStruct depDc = (DcStruct)dcs[depFld.fldframeno - 1]; if (dc.frameno < depDc.frameno) { if (dc.dcExpressionDeps.ToString() == "") dc.dcExpressionDeps.Append(depName); else dc.dcExpressionDeps.Append("," + depName); } } } } } } } /// /// Updates the dependents and their parents in the fields /// private void FillNGSqlDepParents() { ArrayList gridDcs = GetGridDcs(); for (int dcIdx = 0; dcIdx < dcs.Count; dcIdx++) { DcStruct dc = (DcStruct)dcs[dcIdx]; string[] dcRange = GetDcFieldRange(dc.frameno.ToString()).Split(','); int startIdx = Convert.ToInt32(dcRange[0]); int endIdx = Convert.ToInt32(dcRange[1]); bool isTabbedDc = Convert.ToBoolean(IsDcTab(dc.frameno)); int fIdx = 0; StringBuilder strDcMRFields = new StringBuilder(); for (int i = startIdx; i <= endIdx; i++) { TStructDef.FieldStruct fld = (TStructDef.FieldStruct)flds[i]; fIdx = i; if (fld.moe.ToUpper() == moe.ACCEPT.ToString() && fld.selectmode == "From Master") { if (strDcMRFields.ToString() == string.Empty) strDcMRFields.Append(fld.name); else strDcMRFields.Append("," + fld.name); } //if (isTabbedDc)//AXP-C-0000185, SQL parameter field is in griddc and its depending on other grid dc field so required tabParentFields fields. FillTabGridParentFlds(dc, fld); //THis function sets the grid sql dependents outside the current dc fld = SetFieldGridSqlDeps(fld, dc, i); if (dc.isgrid) { GetGridExpDependents(dc, fld); StringBuilder depParents = new StringBuilder(); if (fld.fieldSqlDeps != string.Empty) { string[] sqlDeps = fld.fieldSqlDeps.Split(','); for (int j = 0; j < sqlDeps.Length; j++) { string depName = sqlDeps[j].ToString().Substring(1); int dIdx = GetFieldIndex(depName); if (dIdx != -1) { FieldStruct depFld = (FieldStruct)flds[dIdx]; DcStruct depDc = (DcStruct)dcs[depFld.fldframeno - 1]; if (!depDc.isgrid) { //get the parents for non grid sql dependents and check for the fields in same dc string[] parFlds = depFld.fieldParents.Split(','); for (int k = 0; k < parFlds.Length; k++) { int parIdx = GetFieldIndex(parFlds[k].ToString()); if (parIdx != -1) { FieldStruct parFld = (FieldStruct)flds[parIdx]; DcStruct parDc = (DcStruct)dcs[parFld.fldframeno - 1]; if (parDc.frameno == dc.frameno) { if (depParents.ToString() == string.Empty) depParents.Append(parFld.name); else depParents.Append("," + parFld.name); } } else { //TODO: this is error condition when the parent field is not available in the tstruct. } } } } } } fld.fieldSqlDepParents = depParents.ToString(); } else { //Fill grid dependency for a non grid field ArrayList arrDepDcs = new ArrayList(); if (fld.fieldDependents != string.Empty) { string[] depFlds = fld.fieldDependents.Split(','); for (int j = 0; j < depFlds.Length; j++) { if (depFlds[j].ToString() != string.Empty) { string depName = depFlds[j].ToString().Substring(1); string prefix = depFlds[j].ToString().Substring(0, 1); if (prefix == "g" && depName.Substring(0, 2) == "dc") { int depDcNo = Convert.ToInt32(depName.Substring(2)); if (gridDcs.IndexOf(depDcNo) != -1 && arrDepDcs.IndexOf(depDcNo) == -1) arrDepDcs.Add(depDcNo); } else { int idx = GetFieldIndex(depName); if (idx != -1) { FieldStruct depFld = (FieldStruct)flds[idx]; if (gridDcs.IndexOf(depFld.fldframeno) != -1 && arrDepDcs.IndexOf(depFld.fldframeno) == -1) arrDepDcs.Add(depFld.fldframeno); } } } } StringBuilder strDepDcs = new StringBuilder(); for (int k = 0; k < arrDepDcs.Count; k++) { if (strDepDcs.ToString() == string.Empty) strDepDcs.Append(arrDepDcs[k].ToString()); else strDepDcs.Append("," + arrDepDcs[k].ToString()); } //TODO: this will store the dep fill grid dcs for a non grid field. //fld.fieldDepFillDcs = strDepDcs.ToString(); } } flds[fIdx] = fld; } FillTabGridParentFlds(dc.frameno, dc); //Update the sql fields in the dc. dc.DCAcceptMRFields = strDcMRFields.ToString(); //update the parent flds for tab dc dcs[dc.frameno - 1] = dc; LoadDCNewArray(dc); } } private ArrayList GetGridDcs() { ArrayList gridDcs = new ArrayList(); foreach (DcStruct dc in dcs) { if (dc.isgrid) gridDcs.Add(dc.frameno); } return gridDcs; } /// /// Function to generate the Tstruct Header Html. /// /// /// public string GetHeaderHtml(string Caption) { StringBuilder strHeader = new StringBuilder(); //string nextimg = "../AxpImages/icons/16x16/navigate_wtright.png"; //string previmg = "../AxpImages/icons/16x16/navigate_wtleft.png"; //Util.Util util = new Util.Util(); //string direction1 = "left"; //string direction2 = "righbreadcrumb-panelt"; //if (HttpContext.Current.Session["language"].ToString() == "ARABIC") //{ // direction1 = "right"; // direction2 = "left"; //} ////if (util.BreadCrumb && breadCrumStr == string.Empty) //// //headerHtml.Append("
" + breadCrumStr + Caption + "
"); ////else if //strHeader.Append(""); strHeader.Append("

" + Caption + "

"); return strHeader.ToString(); } /// /// Main function to construct Dc Html. /// /// /// public string GetDcHtml(int dcNo) { StringBuilder dcFinalHtml = new StringBuilder(); string fieldhtml = string.Empty; fldNo = 0; colCount = 0; fieldhtml = GetFieldHtml(dcNo); dcFinalHtml.Append(GetFullDCHtml(dcNo, fieldhtml, "false")); return dcFinalHtml.ToString(); } /// /// Function to construct dc as per page position /// /// /// public string GetPagePositionHtml(string dcNo) { StringBuilder dcFinalHtml = new StringBuilder(); string fieldhtml = string.Empty; if (dcNo.Contains(",")) { dcFinalHtml.Append(GetDCTabs(dcNo)); } else { if (IsDcFormatGrid(Convert.ToInt32(dcNo))) { TStructData tstData = new TStructData("", transId, "0", this); dcFinalHtml.Append(GetDefaultFormatGridHtml(Convert.ToInt32(dcNo), tstData, 1, "formatGrid", "false")); } else { fieldhtml = GetFieldHtml(Convert.ToInt32(dcNo)); if (tstLayout == Constants.TILE) { dcFinalHtml.Append("
"); } dcFinalHtml.Append(GetFullDCHtml(Convert.ToInt32(dcNo), fieldhtml, "false")); if (tstLayout == Constants.TILE) { dcFinalHtml.Append("
"); if ((Convert.ToInt32(dcNo) % 2) == 0) { dcFinalHtml.Append("
"); } } } } return dcFinalHtml.ToString(); } /// /// Function to construct dc as per page position in DesignMode /// /// /// public string GetPagePositionHtmlDesign(string dcNo) { StringBuilder dcFinalHtml = new StringBuilder(); string fieldhtml = string.Empty; if (dcNo.Contains(",")) { dcFinalHtml.Append(GetDCTabsDesign(dcNo)); } else { if (IsDcFormatGrid(Convert.ToInt32(dcNo))) { TStructData tstData = new TStructData("", transId, "0", this); //dcFinalHtml.Append(GetTabFullHTML(Convert.ToInt32(dcNo), 1, tstData, "false", "false")); dcFinalHtml.Append(GetDefaultFormatGridHtml(Convert.ToInt32(dcNo), tstData, 1, "formatGrid", "false")); } else { fieldhtml = GetFieldHtml(Convert.ToInt32(dcNo)); dcFinalHtml.Append(GetFullDCHtml(Convert.ToInt32(dcNo), fieldhtml, "false")); } } return dcFinalHtml.ToString(); } private int GetMaxTabDcsHgt(string[] dcNos) { int dcHeight = 0; for (int j = 0; j < dcNos.Length; j++) { int tabNo = Convert.ToInt32(dcNos[j]); DcStruct dc = (DcStruct)(dcs[tabNo - 1]); if (dcHeight < dc.dcHeight) dcHeight = dc.dcHeight; } return dcHeight; } /// /// Function to construct tabs for dc's. /// /// /// public string GetDCTabs(string dcNo) { StringBuilder tabHdrHtml = new StringBuilder(); StringBuilder tabInnerHtml = new StringBuilder(); string fieldhtml = string.Empty; string finalHtml = string.Empty; string strGridHtml = string.Empty; string[] dcNos = dcNo.Split(','); string tabAlign = "left"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") tabAlign = "right"; //write a function to get the max tab height maxDcHeight = GetMaxTabDcsHgt(dcNos); if (maxDcHeight < 250) maxDcHeight = 255; tabHdrHtml.Append("
"); for (int j = 0; j < dcNos.Length; j++) { int tabNo = Convert.ToInt32(dcNos[j]); tabDCs.Add(tabNo); tabFunction = string.Empty; DcStruct dc = (DcStruct)(dcs[tabNo - 1]); if (j == 0) { tabHdrHtml.Append("
    "); tabInnerHtml.Append("
    "); if (IsDcFormatGrid(tabNo)) { TStructData tstData = new TStructData("", transId, "0", this); strGridHtml = GetDefaultFormatGridHtml(tabNo, tstData, 1, "true", "false"); } else { fieldhtml = GetFieldHtml(tabNo); strGridHtml = "
    " + GetFullDCHtml(tabNo, fieldhtml, "true") + "
    "; } tabDCStatus.Add("1"); } else { tabDCStatus.Add("0"); } string activeClass = String.Empty; activeClass = j == 0 ? "active" : ""; tabHdrHtml.Append("
  • " + dc.caption + "
  • "); tabInnerHtml.Append("
    "); if (j == 0) tabInnerHtml.Append(strGridHtml); tabInnerHtml.Append("
    "); if (j == dcNos.Length - 1) { tabHdrHtml.Append("
"); tabInnerHtml.Append("
"); } } finalHtml = tabHdrHtml.ToString() + tabInnerHtml.ToString() + "
"; return finalHtml; } /// /// Function to construct tabs for dc's. /// /// /// public string GetDCTabsDesign(string dcNo) { StringBuilder tabHdrHtml = new StringBuilder(); StringBuilder tabInnerHtml = new StringBuilder(); string fieldhtml = string.Empty; string finalHtml = string.Empty; string strGridHtml = string.Empty; string[] dcNos = dcNo.Split(','); string tabAlign = "left"; if (HttpContext.Current.Session["language"].ToString() == "ARABIC") tabAlign = "right"; //write a function to get the max tab height maxDcHeight = GetMaxTabDcsHgt(dcNos); if (maxDcHeight < 250) maxDcHeight = 255; for (int j = 0; j < dcNos.Length; j++) { int tabNo = Convert.ToInt32(dcNos[j]); tabDCs.Add(tabNo); tabFunction = string.Empty; DcStruct dc = (DcStruct)(dcs[tabNo - 1]); if (j == 0) { // tabHdrHtml.Append("
    "); tabHdrHtml.Append("
    "); tabHdrHtml.Append(""); tabInnerHtml.Append("
    "); } } finalHtml = tabHdrHtml.ToString() + tabInnerHtml.ToString() + "
"; 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); 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 = "
"; colFldGridStackItem = " colFldGridStackWidth "; colDivInputPadding = " colDivInputPadding "; } if (colFldWidth == "") colFldWidth = "
"; dummyGridHeadHtml = new StringBuilder(); gridDcColwidth = 0; gridHeadHtml = new StringBuilder(); gridHiddenHtml = new StringBuilder(); string colSpan = string.Empty; string gridStackData = string.Empty; string lblBsClass = string.Empty; string lblBsIndex = string.Empty; string fldBsClass = string.Empty; Boolean isLastDcDate = false; int randomID = 10; StringBuilder fieldHtml = new StringBuilder(); lastDcHeight = 0; int gridInSlackGridX = 0; int gridInSlackGridY = 0; string layoutstyle = string.Empty; if (HttpContext.Current.Session["layoutstyle"] != null) { layoutstyle = HttpContext.Current.Session["layoutstyle"].ToString(); } for (int i = 0; i <= flds.Count - 1; i++) { FieldStruct fld = ((FieldStruct)(flds[i])); if (fld.fldframeno < dcNo) continue; if (fld.fldframeno > dcNo) break; if (fld.fldframeno == dcNo) { //As the following code is going to be called for each field, //its not made as method to avoid function call. string[] tlhw; if (fld.lbltlhw.ToString() != "") { tlhw = fld.lbltlhw.ToString().Split(','); if (EnableOldTheme == "false") { tlhw[0] = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.6)).ToString(); tlhw[2] = "30"; tlhw[1] = Math.Floor((Convert.ToInt32(tlhw[1].ToString()) * 1.07)).ToString(); tlhw[3] = Math.Floor((Convert.ToInt32(tlhw[3].ToString()) * 1.15)).ToString(); } else { tlhw[0] = Math.Floor((Convert.ToInt32(tlhw[0].ToString()) * 1.2)).ToString(); tlhw[1] = Math.Floor((Convert.ToInt32(tlhw[1].ToString()) * 1.0)).ToString(); } } else { tlhw = ",,,".Split(','); // Hack: directly entering the data to the tlhw throws error tlhw[0] = ""; tlhw[1] = ""; tlhw[2] = ""; tlhw[3] = ""; } string[] fldTlhw; if (fld.fldtlhw.ToString() != "") { fldTlhw = fld.fldtlhw.ToString().Split(','); if (EnableOldTheme == "false") { fldTlhw[0] = Math.Floor((Convert.ToInt32(fldTlhw[0].ToString()) * 1.6)).ToString(); fldTlhw[1] = Math.Floor((Convert.ToInt32(fldTlhw[1].ToString()) * 1.07)).ToString(); } else { fldTlhw[0] = Math.Floor((Convert.ToInt32(fldTlhw[0].ToString()) * 1.2)).ToString(); fldTlhw[1] = Math.Floor((Convert.ToInt32(fldTlhw[1].ToString()) * 1.0)).ToString(); } } else { fldTlhw = ",,,".Split(','); // Hack: directly entering the data to the tlhw throws error fldTlhw[0] = "0"; fldTlhw[1] = "0"; fldTlhw[2] = "0"; fldTlhw[3] = "0"; } if (fld.fldlength != 0) { lblBsClass = bsClassByDatawidth(fld.fldlength, i, fld); lblBsIndex = fld.fieldIndex.ToString(); } if (!fld.visibility) gridStackData = xywhGridStack(fld); string name = string.Empty; string hiddenName = string.Empty; string width = string.Empty; string fdwidth = "0"; int rndnumber = 0; Random randNum = new Random(); rndnumber = randNum.Next(100000, 1000000); fldNo = i; if (!fld.visibility) fdwidth = xywhGridStack(fld, true); if (isGrid) { name = fld.name + "001F" + fld.fldframeno; hiddenName = fld.name + "\" +nrno+\""; // for grid its column width width = fld.cwid; if (!fld.visibility) { if (width != "") gridDcColwidth += Convert.ToInt32(width); else gridDcColwidth += 1; } } else { name = fld.name + "000F" + fld.fldframeno; width = fldTlhw[3]; } if (width == "") width = "0"; else width = Convert.ToString(Convert.ToInt32(width) - 4); if (fld.caption.Contains("~")) fld.caption = fld.caption.Replace("~", "\n"); if (fld.visibility) { string cssAutoGen = string.Empty; if (fld.moe == "AutoGenerate") cssAutoGen = "class=\"autogen\""; if (name.StartsWith("axp_recid")) { fieldHtml.Append("
"); if (isGrid) gridHiddenHtml.Append("
"); } else { if (fld.name.ToLower().StartsWith("axpfilepath_") && cssAutoGen == "") { var endPart = name.Substring(12); cssAutoGen = "class=\"axpFilePath_" + endPart + " axpFilePathFld \""; } if (fld.moe == "Select") fieldHtml.Append("
"); else fieldHtml.Append("
"); if (isGrid) gridHiddenHtml.Append("
"); } if (fld.caption.Contains("~")) { gridHeadHtml.Append("
"); } else { gridHeadHtml.Append("
"); } } if (!fld.visibility) { randomID++; string popImg = string.Empty; string popImgHidden = string.Empty; int popwidth = 0; for (int x = 0; x < popdcs.Count; x++) { if (((DcStruct)(dcs[dcNo - 1])).frameno == ((PopDcStruct)(popdcs[x])).pdcno) { if (fld.name.ToLower() == ((PopDcStruct)(popdcs[x])).popfield.ToLower()) { popImgHidden = "
"; popImg = "
"; popwidth = Convert.ToInt32(width) - 20; break; } } } if (!isGrid) { if (fldTlhw[0] != "") lastDcHeight = Convert.ToInt32(fldTlhw[0]) + Convert.ToInt32(fldTlhw[2]); else if (fldTlhw[2] != "") lastDcHeight = Convert.ToInt32(fldTlhw[2]); } bool isHyper = false; int n = 0; for (n = 0; n <= hlnks.Count - 1; n++) { if (fld.name.ToString() == ((HLinkStruct)(hlnks[n])).hlsource.ToString().Substring(3)) { isHyper = true; break; } } string designFontStyle = ""; string designHyperLink = ""; if (!isGrid) { if (axdesignJObject.buttonFieldFont != null && axdesignJObject.buttonFieldFont.Count > 0) { var frbtnfld = axdesignJObject.buttonFieldFont.Where(elm => elm.id == name).ToList(); if (frbtnfld != null && frbtnfld.Count > 0) { designFontStyle = frbtnfld[0].fontFamilly; designHyperLink = frbtnfld[0].hyperlinkJson; } } } if (isGrid) { string allowemptycss = ""; if (!fld.allowempty && fld.caption != "") allowemptycss = " required "; colCount++; if (fld.caption.Contains("~")) { gridHeadHtml.Append("
"); } else if (fld.datatype.ToUpper() == "DATE/TIME") { gridHeadHtml.Append("
"); } else { gridHeadHtml.Append("
"); } if (isHyper) { gridHeadHtml.Append(""); } if (fld.name.ToUpper().IndexOf("AXPBUTTON") == -1) { if (fld.caption.Contains("~")) fld.caption = fld.caption.Replace("~", "\n"); gridHeadHtml.Append(fld.caption); } if (isHyper) { gridHeadHtml.Append(""); } // to handle the mandatory fields. //if (!fld.allowempty && fld.caption != "") //{ // gridHeadHtml.Append("*"); //} if (!string.IsNullOrEmpty(fld.fieldPurpose)) gridHeadHtml.Append(""); gridHeadHtml.Append("
"); } else { if (fld.ctype.ToUpper() != "CHECK BOX") { fieldHtml.Append("
" + (randomID - 10) + "
"); string color = "cursor: default;"; if (fld.fieldLabelCss != "") { //label font will be in the format "font-family,font-size,tttt,color". here the tttt-bold/italic/underline/strikeout string[] newCss = fld.fieldLabelCss.Split(','); string fontFamily = ""; string fontSize = ""; string textCss = ""; if (newCss.Length > 0) { if (newCss[0].ToString() != "") fontFamily = "font-family:" + newCss[0].ToString() + ";"; } if (newCss.Length > 1) { if (newCss[1].ToString() != "") fontSize = "font-size:" + newCss[1].ToString() + ";"; } if (newCss.Length > 2) { if (newCss[2].ToString() != "") { string fontStyle = newCss[2].ToString(); if (fontStyle.Substring(0, 1) == "t") textCss = "font-weight:bold;"; if (fontStyle.Substring(1, 1) == "t") textCss += "font-style:italic;"; if (fontStyle.Substring(2, 1) == "t") textCss += "text-decoration:underline;"; if (fontStyle.Substring(3) == "t") textCss += "text-decoration:overline;"; } } if (newCss.Length > 3) { if (newCss[3].ToString() != "") { string txtColor = newCss[3].ToString().Substring(2); textCss += " color:" + txtColor + "; "; } } if (newCss.Length >= 4) { //changes for lable colors string lblclr = fld.fieldLabelCss.Split(',').Last(); string[] lblFonts = fld.fieldLabelCss.Split(','); if (lblclr != "") color += " color:" + GetFieldColor(lblclr) + "; "; if (lblFonts[1] != "" && int.Parse(lblFonts[1]) >= 13) color += " font-size:" + lblFonts[1] + "px; "; if (lblFonts[2] != "") { if (lblFonts[0] != "" && lblFonts[2] != "ttff") color += " font-family:" + lblFonts[0] + "; "; if (lblFonts[2] == "tfff") color += " font-weight:Bold; "; else if (lblFonts[2] == "ftff") color += " font-style:Oblique; "; else if (lblFonts[2] == "ttff") color += " font-family:Bold Oblique; "; } } //TODO: the font family is not considered as the ui alignment is not proper in web. we can enable it in future. //fieldHtml.Append(""); } if (isHyper) fieldHtml.Append(""); else if (designHyperLink != "") fieldHtml.Append(""); if (fld.allowempty && fld.caption != "") fieldHtml.Append("
"); else fieldHtml.Append(""); } else { fieldHtml.Append("
" + (randomID - 10) + "
"); //label normal fieldHtml.Append("
"); //fieldHtml.Append("