private void AddSystemSupplier(ref SqlCommand command, SystemParameter systemParameter) { if (systemParameter.HasTemplateId) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.TemplateID, "TemplateID", SqlDbType.NVarChar)); } if (systemParameter.HasTemplateName) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.TemplateName, "TemplateName", SqlDbType.NVarChar)); } if (systemParameter.HasTemplateVersion) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.TemplateVersion, "TemplateVersion", SqlDbType.NVarChar)); } if (systemParameter.HasComputerName) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.ComputerName, "CreatedOn", SqlDbType.NVarChar)); } if (systemParameter.HasUserId) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.UserId, "CreatedBy", SqlDbType.NVarChar)); } if (systemParameter.HasRenderRequestID) { command.Parameters.Add(CoreRenderHelper.CreateAppSqlParam("@" + FrameworkConstants.PluginSystemInfo.RenderRequestID, "RenderID", SqlDbType.NVarChar)); } }
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); }
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)); } }