");
}
else if (task != "tasks")
{
btnHtml.Append("
");
btnHtml.Append("");
btnHtml.Append("
");
btnHtml.Append("");
string btnFunction = string.Empty;
btnFunction = GetBtnFunction(transId, task);
//TODO: provide the button like any other case, on click it should alert "No task defined"
//This button can be added for customisation, hence need not display the above.\
if (string.IsNullOrEmpty(image))
btnHtml.Append("");
else
btnHtml.Append("");
btnHtml.Append("
");
else
btnHtml.Append("");
if (colFldWidth != "")
btnHtml.Append("
");
btnHtml.Append("
");
}
else if (task != "tasks")
{
btnHtml.Append("
");
btnHtml.Append("");
btnHtml.Append("
");
btnHtml.Append(colFldWidth);
btnHtml.Append("");
string btnFunction = string.Empty;
btnFunction = GetBtnFunction(transId, task);
//TODO: provide the button like any other case, on click it should alert "No task defined"
//This button can be added for customisation, hence need not display the above.\
if (string.IsNullOrEmpty(image))
btnHtml.Append("
");
colCount++;
}
}
string dcBtns = GetGridButtonHtml(dcNo.ToString());
//TODO: need to fix the calculation of colcount, the same code is there in GetTabFullDcHtml
colCount = 100;
gridHdHtml.Append("
";
}
dcHtml.Append(fullGridHtml1 + "");
}
else
{
// innermost div for all non grid dcs.
// lastDcHeight is used if there is a calendar control in the last Dc, So this
// was affecting the dcheight to overcome this there is check where the the greater height isa set as dcheight
if (dcNo == dcs.Count)
{
if (((DcStruct)(dcs[dcNo - 1])).dcHeight > lastDcHeight)
{
lastDcHeight = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
}
//commented because form-horizontal was affecting ui.. previously added by anand.. checking need to be done after removing.
ngBorder = "
";
}
else
{
int tstHieght = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
if (isTab == "true")
{
if (((DcStruct)(dcs[dcNo - 1])).isgrid)
ngBorder = "
";
else
{
string visibledc = GetVisibleDCs();
string[] arrVisibleDc = visibledc.Split(',');
int pos = Array.IndexOf(arrVisibleDc, "dc" + dcNo);
if (pos > -1)
{
if (EnableOldTheme == "true")
ngBorder = "
";
return finalHtml;
}
///
/// Gets the tab inner html for the currently clicked tabbed DC.
///
///
///
public string GetTabHtml(string DcNo)
{
int tabNo = 0;
if (DcNo != "")
tabNo = Convert.ToInt32(DcNo);
string fieldhtml = string.Empty;
string finalHtml = string.Empty;
fieldhtml = GetFieldHtml(tabNo);
finalHtml = (GetFullDCHtml(tabNo, fieldhtml, "true"));
return finalHtml;
}
///
/// Function to check if the field is checkbox in grid.
///
///
///
private Boolean IsGridCheckBox(string[] moeValue)
{
bool chkBox = false;
if (moeValue.Length <= 3)
{
StringBuilder tmpStr = new StringBuilder();
for (int cnt = 0; cnt < moeValue.Length; cnt++)
{
tmpStr.Append(moeValue[cnt].ToLower());
}
chkBox = tmpStr.ToString() == "yesno" || tmpStr.ToString() == "noyes" ? true : false;
}
return chkBox;
}
///
/// Function to return the currently visible DC's in the tstruct.
///
///
public string GetVisibleDCs()
{
int i = 0; string strDc = string.Empty;
for (i = 0; i < visibleDCs.Count; i++)
{
if (i == 0)
{
strDc = "dc" + visibleDCs[i].ToString();
}
else
{
strDc += "," + "dc" + visibleDCs[i].ToString();
}
}
return strDc;
}
///
/// Function to construct the field's id from the arrays.
///
///
/// The Component field ID of the given field name.
public string GetFieldID(string fieldName)
{
string fieldId = "";
int dcNo = 0;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name == fieldName)
{
dcNo = fld.fldframeno;
break;
}
}
bool IsGrid = false;
for (int j = 0; j < dcs.Count; j++)
{
DcStruct dc = (DcStruct)dcs[j];
if (dc.frameno == dcNo)
{
IsGrid = dc.isgrid;
break;
}
}
if (IsGrid)
fieldId = fieldName + "001F" + dcNo;
else
fieldId = fieldName + "000F" + dcNo;
return fieldId;
}
///
/// Function to get the index of the given field from the fields in the tstruct.
///
///
///
public int GetFieldIndex(string fieldName)
{
int fieldIndex = -1;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToUpper() == fieldName.ToUpper())
{
fieldIndex = i;
break;
}
}
return fieldIndex;
}
public int GetFieldDc(string fieldName)
{
int dcNo = 0;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToLower() == fieldName.ToLower())
{
dcNo = fld.fldframeno;
break;
}
}
return dcNo;
}
public string GetFieldParents(string fieldName)
{
string fieldParents = string.Empty;
for (int i = 0; i < flds.Count; i++)
{
FieldStruct fld = (FieldStruct)flds[i];
if (fld.name.ToLower() == fieldName.ToLower())
{
fieldParents = fld.fieldParents;
break;
}
}
return fieldParents;
}
public int GetButtonIndex(string btnName)
{
int btnIndex = -1;
for (int i = 0; i < btns.Count; i++)
{
ButtonStruct invbtn = (ButtonStruct)btns[i];
if (invbtn.ID.ToUpper() == btnName.ToUpper())
{
btnIndex = i;
break;
}
}
return btnIndex;
}
public string GetColumnWidth(string dcNo, string columnName)
{
string colWidth = defaultColWidth;
for (int i = 0; i < fldDcRange.Count; i++)
{
string[] fldRange = fldDcRange[i].ToString().Split('~');
if (dcNo == fldRange[0].ToString())
{
string[] dcIndex = fldRange[1].Split(',');
int startIndex = Convert.ToInt32(dcIndex[0].ToString());
int endIndex = Convert.ToInt32(dcIndex[1].ToString());
for (int j = startIndex; j <= endIndex; j++)
{
FieldStruct fld = (FieldStruct)flds[j];
if (fld.caption.ToLower() == columnName.ToLower())
{
string fldWidth = fld.cwid;
if (fldWidth != "" && Convert.ToInt32(fldWidth) > -1)
{
if (Convert.ToInt32(colWidth) > 130) colWidth = "100";
colWidth = fldWidth;
break;
}
}
}
}
}
return colWidth;
}
#region GetJScriptArrays
///
/// Function to Get the javascript dependency arrays and write it on to the response
///
///
public string GetJScriptArrays(TStructDef strObj)
{
string tst_Scripts = string.Empty;
StringBuilder strJSArray = new StringBuilder();
strJSArray.Append(strObj.jsFieldArray);
strJSArray.Append(strObj.jsFormcontrolArray);
strJSArray.Append(strObj.jsHyperlinkArray);
strJSArray.Append(strObj.jsPatternArray);
strJSArray.Append(strObj.jsExpressionArray);
strJSArray.Append(strObj.jsDCArray);
strJSArray.Append(strObj.jsTabDCArray);
strJSArray.Append(strObj.jsRuleDefArray);
string tstructDetails = "var tstructName='" + strObj.transId + "';var tstructCaption='" + ReplaceSpecialCharsInHTML(strObj.tstCaption) + "';var tstructAttachment='" + strObj.tstAttachment + "';var tstructCancelled='" + strObj.tstCancelled + "';var tstructUpdateOn='" + strObj.tstUpdateOn + "';var tstructUpdatedBy='" + strObj.tstUpdateBy + "';var tstructReadonly='" + strObj.tstReadOnly + "';var tstructWorkflow='" + strObj.tstWorkflow + "';";
string listFlds = "AxFromLstFlds='" + fromListFlds + "';";
string dcNum = "TotalDCs='" + strObj.dcs.Count + "';";
tst_Scripts = "";
tst_Scripts = tst_Scripts.Replace("\n", "");
return tst_Scripts;
}
///
/// Function to return the tab event by generating the script for tab container.
///
///
///
public string GenerateTabScript(TStructDef strObj)
{
StringBuilder dcScript = new StringBuilder();
dcScript.Append("");
}
}
dcScript.Append("}");
//return tabScript.ToString() + dcScript.ToString();
return dcScript.ToString();
}
public Boolean IsDcGrid(int dcNo)
{
Boolean isGrid = false;
for (int i = 0; i < dcs.Count; i++)
{
DcStruct dcStr = (DcStruct)dcs[i];
if (dcStr.frameno == dcNo)
{
if (dcStr.isgrid)
isGrid = true;
else
isGrid = false;
}
}
return isGrid;
}
#endregion
#endregion
#region Field HTML
///
/// function to construct the field html for a particular dc. It doesnot contains the outer
/// part of the DC like outer border, DC header, ADD, Fill.
/// It iterates throug the complete fields, check whether it belongs the DC by checking the
/// frame no. Then it constructs the HTML string for that field and appended to the DC HTML.
///
///
///
/// returns the field html.
private string GetFieldHtml(int dcNo)
{
//NOTE: Assigning javascript functions for grid and non-grid fields's is done seperately,
//as the grid field javascript functions are written into the hidden field through the variable gridHiddenHtml.
//The difference for grid functions is usage of \"+quo+\" instead of \".
//The hidden field is used to store the dummy row value,
//the value assigned to hidden field will be written within double quotes and hence we use \"+quo+\" to write a double quote in the HTML.
colCount = 0;
Boolean isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid;
DcStruct dc = (DcStruct)(dcs[dcNo - 1]);
if (isGrid)
{
dcArrayNo++;
}
string divDirection = "left";
if (HttpContext.Current.Session["language"].ToString() == "ARABIC")
{
divDirection = "right";
}
int fcwidth = 0;
string colFldCaption = "", colFldWidth = "", colFldGridStackItem = "", colDivInputPadding = "";
if (!isGrid && (axdesignJObject.dcLayout != null && axdesignJObject.dcLayout != "" && axdesignJObject.dcLayout != "default"))
{
fcwidth = int.Parse(axdesignJObject.fieldCaptionWidth);
fcwidth = fcwidth / 10;
colFldCaption = "col-sm-" + fcwidth + "";
fcwidth = 12 - fcwidth;
colFldWidth = "
";
}
}
}
else
{
dcRowone = rowHTML;
if (rowHTML == "" && fillGridRowHTML != "")
dcRowone = fillGridRowHTML;
}
dcOtherRows.Append(dcRowone);
serialNo++;
}
}
//int rowCount = rowCnt + 1;
tabHTML = GetFullTabDCHTML(dcNo, dcOtherRows.ToString(), isTab, rowCnt.ToString(), fillGriddcRowone);
return tabHTML;
}
//This function returns the dhtml and thier pop grid dc's html.
public string GetTabDcHTML(int dcNo, TStructData tstDataObj, string IsTabDisabled)
{
if (tstDataObj.recordID.ToString() != "0" && ((DcStruct)(dcs[dcNo - 1])).isgrid)
{
IsFillGridCall = true;
}
string result = string.Empty;
//To check if the tab dc contains any pop grid and store the popGrid dc number in subGridDcs.
ArrayList subGridDcs = new ArrayList();
for (int i = 0; i < popdcs.Count; i++)
{
if (dcNo == ((PopDcStruct)(popdcs[i])).pdcno)
{
subGridDcs.Add(((PopDcStruct)(popdcs[i])).frameno);
}
}
StringBuilder popGridDcHTML = new StringBuilder();
for (int j = 0; j < subGridDcs.Count; j++)
{
int rowCnt = GetRowCount(Convert.ToInt32(subGridDcs[j]), tstDataObj);
if (popGridDcHTML.ToString() == "")
popGridDcHTML.Append(subGridDcs[j] + "♣" + rowCnt + "*?*" + GetTabFullHTML(Convert.ToInt32(subGridDcs[j]), rowCnt, tstDataObj, "false", IsTabDisabled));
else
popGridDcHTML.Append("*Tab*" + subGridDcs[j] + "♣" + rowCnt + "*?*" + GetTabFullHTML(Convert.ToInt32(subGridDcs[j]), rowCnt, tstDataObj, "false", IsTabDisabled));
dcOtherRows = new StringBuilder();
}
colCount = 0;
//If HasDataRows=no flRowCnt should be 0 else should be total row count
int flRowCnt = 0;
if (IsFillGridCall)
{
if (((DcStruct)(dcs[dcNo - 1])).DCHasDataRows)
flRowCnt = GetRowCount(dcNo, tstDataObj);
}
else
flRowCnt = GetRowCount(dcNo, tstDataObj);
//Construct the result in the format of dcno♣rowCount + "*?*" + TabDcHTML + "*Tab*" + popGridDcHTMl + "*Tab*" + next pop grid dcs...
int rCnt = GetRowCount(dcNo, tstDataObj);
string isTab = IsDcTab(dcNo);
result = dcNo + "♣" + flRowCnt + "*?*" + GetTabFullHTML(dcNo, rCnt, tstDataObj, isTab, IsTabDisabled) + "*Tab*" + popGridDcHTML;
dcOtherRows = new StringBuilder();
if (tstDataObj.recordID.ToString() != "0" && ((DcStruct)(dcs[dcNo - 1])).isgrid)
{
IsFillGridCall = false;
}
return result;
}
private string IsDcTab(int dcNo)
{
string isTab = "false";
for (int i = 0; i < pagePositions.Count; i++)
{
if (pagePositions[i].ToString().Contains(","))
{
string[] tabContainers = pagePositions[i].ToString().Split(',');
for (int j = 0; j < tabContainers.Length; j++)
{
if (tabContainers[j].ToString() == dcNo.ToString())
{
isTab = "true";
break;
}
}
if (isTab == "true")
break;
}
}
return isTab;
}
public int GetRowCount(int dcNo, TStructData tstData)
{
int rCnt = 0;
if (tstData.dcRowCntVals != null)
{
for (int i = 0; i < tstData.dcRowCntVals.Count; i++)
{
string[] dcNumber = tstData.dcRowCntVals[i].ToString().Split('~');
//dcNumber[0] = dcNumber[0].Replace("dc", "");
string arrDcNo = dcNumber[0].Substring(2);
if (arrDcNo == dcNo.ToString())
{
rCnt = Convert.ToInt32(dcNumber[1]);
break;
}
}
}
if (rCnt == 0)
rCnt = 1;
return rCnt;
}
///
/// function to construct the field html for a particular dc. It doesnot contains the outer
/// part of the DC like outer border, DC header, ADD, Fill.
/// It iterates throug the complete fields, check whether it belongs the DC by checking the
/// frame no. Then it constructs the HTML string for that field and appended to the DC HTML.
///
///
///
/// returns the field html.
private string GetTabFieldHtml(int dcNo, TStructData tstData, string IsTabDisabled, string rowNo, string keyColValue, ArrayList keyCols, ArrayList keyRowNos)
{
//NOTE: Assigning javascript functions for grid and non-grid fields's is done seperately,
//as the grid field javascript functions are written into the hidden field through the variable gridHiddenHtml.
//The difference for grid functions is usage of \"+quo+\" instead of \".
//The hidden field is used to store the dummy row value,
//the value assigned to hidden field will be written within double quotes and hence we use \"+quo+\" to write a double quote in the HTML.
string divDirection = "left";
if (HttpContext.Current.Session["language"].ToString() == "ARABIC")
{
divDirection = "right";
}
Boolean isGrid = ((DcStruct)(dcs[dcNo - 1])).isgrid;
DcStruct dc = (DcStruct)(dcs[dcNo - 1]);
if (isGrid)
{
dcArrayNo++;
}
int fcwidth = 0;
string colFldCaption = "", colFldWidth = "", colFldGridStackItem = "", colDivInputPadding = "";
if (!isGrid && (axdesignJObject.dcLayout != null && axdesignJObject.dcLayout != "" && axdesignJObject.dcLayout != "default"))
{
fcwidth = int.Parse(axdesignJObject.fieldCaptionWidth);
fcwidth = fcwidth / 10;
colFldCaption = "col-sm-" + fcwidth + "";
fcwidth = 12 - fcwidth;
colFldWidth = "
";
}
else
{
// innermost div for all non grid dcs.
// lastDcHeight is used if there is a calendar control in the last Dc, So this
// was affecting the dcheight to overcome this there is check where the the greater height isa set as dcheight
if (dcNo == dcs.Count - 1)
{
if (((DcStruct)(dcs[dcNo - 1])).dcHeight > lastDcHeight)
{
lastDcHeight = ((DcStruct)(dcs[dcNo - 1])).dcHeight;
}
ngBorder = "