using System;
using System.Web.UI;
namespace framework_business
{
[Serializable]
///
/// Summary description for surfaceBase
///
public abstract class ISurfaceBase : System.Web.UI.UserControl
{
//protected override void Render(HtmlTextWriter writer)
//{
// base.Render(htmlwriter);
// string html = htmlwriter.InnerWriter.ToString().Trim();
// bool isAsync = !html.StartsWith("<");
// if (!isAsync)
// {
// StringBuilder sb = MyPageBase._TrimHtml(html);
// writer.Write(sb.ToString());
// }
// else
// {
// StringBuilder sb = new StringBuilder();
// int startIx = 0;
// while (true)
// {
// int x = html.IndexOf("|updatePanel|", startIx);
// if (x > -1)
// {
// int xS = html.LastIndexOf("\r\n", x);
// xS = (xS < 0 ? 0 : xS);
// int xE = html.IndexOf("\r\n", x) + 2;
// string header = html.Substring(xS, xE - xS);
// header = header.Trim().TrimStart('|', ' ');
// string sLen = header.Substring(0, header.IndexOf('|'));
// int cLen = int.Parse(sLen);
// string content = html.Substring(xE - 2, cLen);
// content = MyPageBase._TrimHtml(content).ToString().Trim();
// startIx = xE - 2 + cLen;
// cLen = content.Length + 4;
// header = (xS > 0 ? "|" : string.Empty) +
// cLen.ToString() +
// header.Substring(header.IndexOf('|'));
// sb.AppendLine(header);
// sb.AppendLine(content);
// }
// else
// {
// string stateData = html.Substring(startIx);
// sb.Append(stateData.Trim());
// writer.Write(sb.ToString());
// break;
// }
// }
// }
//}
//private static StringBuilder _TrimHtml(string source)
//{
// StringBuilder sb = new StringBuilder();
// source = source.Trim();
// using (StringReader sr = new StringReader(source))
// {
// string data = string.Empty;
// while (data != null)
// {
// data = sr.ReadLine();
// if (data != null)
// {
// data = data.TrimStart(' ', '\t');
// if (data != string.Empty) sb.AppendLine(data);
// }
// }
// }
// return sb;
//}
#region Properites
///
/// Object Entity
///
public dynamic Entity
{
get
{
if (ViewState["entity"] == null)
return null;
else
return (dynamic)ViewState["entity"];
}
set
{
ViewState["entity"] = value;
}
}
public oSurface SurfaceApp
{
get
{
if (ViewState["surfaceApp"] == null)
return null;
else
return (oSurface)ViewState["surfaceApp"];
}
set
{
ViewState["surfaceApp"] = value;
}
}
public int SurfaceAppItemId
{
get
{
if (ViewState["surfaceAppItemId"] == null)
return 0;
else
return (int)ViewState["surfaceAppItemId"];
}
set
{
ViewState["surfaceAppItemId"] = value;
}
}
public string ActiveTabPanel
{
get
{
if (ViewState["surfaceTabPanel"] == null)
return String.Empty;
else
return ViewState["surfaceTabPanel"].ToString();
}
set
{
ViewState["surfaceTabPanel"] = value;
}
}
public oSurfaceItem SurfaceAppItem
{
get
{
if (ViewState["surfaceAppItem"] == null)
return null;
else
return (oSurfaceItem)ViewState["surfaceAppItem"];
}
set
{
ViewState["surfaceAppItem"] = value;
}
}
public int SurfaceAppGridEditTypeId
{
get
{
if (ViewState["surfaceAppGridEditTypeId"] == null)
return 0;
else
return (int)ViewState["surfaceAppGridEditTypeId"];
}
set
{
ViewState["surfaceAppGridEditTypeId"] = value;
}
}
//CVH 2016-07-22 Used when surface is grid field on parent surface
public int ParentSurfaceId
{
get
{
if (ViewState["parentSurfaceId"] == null)
return 0;
else
return (int)ViewState["parentSurfaceId"];
}
set
{
ViewState["parentSurfaceId"] = value;
}
}
public int ParentSurfaceItemId
{
get
{
if (ViewState["parentSurfaceItemId"] == null)
return 0;
else
return (int)ViewState["parentSurfaceItemId"];
}
set
{
ViewState["parentSurfaceItemId"] = value;
}
}
public int ChildParentSurfaceId
{
get
{
if (ViewState["childparentSurfaceId"] == null)
return 0;
else
return (int)ViewState["childparentSurfaceId"];
}
set
{
ViewState["childparentSurfaceId"] = value;
}
}
public int ChildParentSurfaceItemId
{
get
{
if (ViewState["childparentSurfaceItemId"] == null)
return 0;
else
return (int)ViewState["childparentSurfaceItemId"];
}
set
{
ViewState["childparentSurfaceItemId"] = value;
}
}
public bool IsChildSurface
{
get
{
if (ViewState["isChildSurface"] == null)
return false;
else
return (bool)ViewState["isChildSurface"];
}
set
{
ViewState["isChildSurface"] = value;
}
}
public bool IsSubChildSurface
{
get
{
if (ViewState["isSubChildSurface"] == null)
return false;
else
return (bool)ViewState["isSubChildSurface"];
}
set
{
ViewState["isSubChildSurface"] = value;
}
}
public int RowLimit
{
get
{
if (ViewState["rowLimit"] == null)
return 0;
else
return (int)ViewState["rowLimit"];
}
set
{
ViewState["rowLimit"] = value;
}
}
public oSurfaceItem ChildAppItem
{
get
{
if (ViewState["childAppItem"] == null)
return null;
else
return (oSurfaceItem)ViewState["childAppItem"];
}
set
{
ViewState["childAppItem"] = value;
}
}
public bool ChildIsView
{
get
{
if (ViewState["childIsView"] == null)
return false;
else
return (bool)ViewState["childIsView"];
}
set
{
ViewState["childIsView"] = value;
}
}
public bool ChildIsNew
{
get
{
if (ViewState["childIsNew"] == null)
return false;
else
return (bool)ViewState["childIsNew"];
}
set
{
ViewState["childIsNew"] = value;
}
}
public bool ChildIsClone
{
get
{
if (ViewState["childIsClone"] == null)
return false;
else
return (bool)ViewState["childIsClone"];
}
set
{
ViewState["childIsClone"] = value;
}
}
public bool IsClone
{
get
{
if (ViewState["isClone"] == null)
return false;
else
return (bool)ViewState["isClone"];
}
set
{
ViewState["isClone"] = value;
}
}
#endregion
public ISurfaceBase()
{
//
// TODO: Add constructor logic here
//
}
abstract public void ReloadControl(oSurfaceItem item, bool isView, bool isNew, bool isPersisting = false);
abstract public void SaveControl(bool finish, bool draft, bool closing);
}
}