private string ProcessOsqlGetAppData(ChecksumInfoItem item, RenderArgDomainValue renderArgumentValue, string conn, OsqlXml osqlXml) { string osqlData = string.Empty; foreach (var osqlItem in osqlXml.OsqlXmlItems) { if (string.Compare(osqlItem.DomainName, renderArgumentValue.Name, true) == 0) { osqlData = GetDataAgrumentValueWithDBType(item, osqlItem.Osql, renderArgumentValue, conn); } } return(osqlData); }
public string GetDataAgrumentValueFromAppDB(ChecksumInfoItem item, string osql, RenderArgDomainValue renderArgumentValue, string conn) { string osqlData = string.Empty; //Retrieve data from Application database XmlReader xmlReader = null; try { SqlCommand command = new SqlCommand(); command.CommandText = osql;//osqlQuery always not null or empty. if (item.RenderArgument != null && renderArgumentValue != null) { for (int i = 0; i < item.RenderArgument.Parameters.Count; i++) { RenderParameterSchema sxParam = item.RenderArgument.Parameters[i]; SqlParameter sqlParameter = CoreRenderHelper.CreateSqlParamForAnArgument(sxParam, renderArgumentValue); command.Parameters.Add(sqlParameter); } } //Add System Supplier param SystemParameter systemParameter = item.SystemParameter; AddSystemSupplier(ref command, systemParameter); //Add Watermark string command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PdwWatermark, "WaterMark", SqlDbType.NVarChar)); //Add param RenderArgumentX , RenderArgumentY AddParamRenderArgumentXY(ref command, renderArgumentValue, item); string connectionStr = base.GetConnectionString(conn.Trim()); xmlReader = ExecuteXmlReader(connectionStr, command); } catch (SqlException ex) { throw ex; } #region Transfer data to StringBuilder object XmlDocument xDoc = new XmlDocument(); xDoc.Load(xmlReader); xmlReader.Close(); osqlData = xDoc.InnerXml; #endregion return(osqlData); }
public bool ValidateRenderArgumentDomainValue(ChecksumInfoItem csItem, RenderArgDomainValue domainRenderArgValue, ref string msg) { bool isValid = true; if (domainRenderArgValue == null) { isValid = false; msg += "RenderArgumentDomainValue is null or empty !!!"; } //Validate RenderArgument value before render document isValid &= ValidateRenderArgValue(csItem.RenderArgument, domainRenderArgValue, ref msg); //Validate RenderArgumentX value, RenderArgumentY value before Render Document isValid &= ValidateRenderArgumentXYValueBeforeRender(csItem.RenderArgument, domainRenderArgValue, ref msg); return(isValid); }
private string GetDataAgrumentValueWithDBType(ChecksumInfoItem item, string osqlStr, RenderArgDomainValue renderArgumentValue, string conn) { DBType dbtype = (DBType)Utility.GetDBType(item.DBType); switch (dbtype) { case DBType.Sql2008: { Sql08GetDataAgrumentDao dao = new Sql08GetDataAgrumentDao(); string osqlData = dao.GetDataAgrumentValueFromAppDB(item, osqlStr, renderArgumentValue, conn); return(osqlData); } case DBType.Orc10g: default: throw new NotSupportedException(); } }
private void AddParamRenderArgumentXY(ref SqlCommand command, RenderArgDomainValue renderArgumentValue, ChecksumInfoItem item) { if (item.RenderArgument.RenderArgumentX) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.RenderArgumentX, string.Format("{0}", renderArgumentValue.RenderArgumentX), SqlDbType.NVarChar)); } if (item.RenderArgument.RenderArgumentY) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.RenderArgumentY, string.Format("{0}", renderArgumentValue.RenderArgumentY), SqlDbType.NVarChar)); } }