/// <summary> /// The GetAllPages method returns a SqlDataReader containing all of the /// pages for a specific portal module from database. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="cultureCode">The culture code.</param> /// <param name="version">The version.</param> /// <returns></returns> public SqlDataReader GetLocalizedPages(int moduleID, int cultureCode, WorkFlowVersion version) { SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetEnhancedLocalizedHtml", myConnection); myCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); SqlParameter parameterCultureCode = new SqlParameter("@CultureCode", SqlDbType.Int, 4); parameterCultureCode.Value = cultureCode; myCommand.Parameters.Add(parameterCultureCode); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); return(result); }
/// <summary> /// The GetSingleEnhancedLink method returns a SqlDataReader containing details /// about a specific link from the EnhancedLinks database table. /// </summary> /// <param name="itemID"></param> /// <param name="version"></param> /// <returns></returns> public SqlDataReader GetSingleEnhancedLink(int itemID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = PortalSettings.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetSingleEnhancedLink", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterItemID = new SqlParameter("@ItemID", SqlDbType.Int, 4); parameterItemID.Value = itemID; myCommand.Parameters.Add(parameterItemID); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // Execute the command myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return(result); }
/// <summary> /// The GetArticlesAll method returns a SqlDataReader containing all of the /// Articles for a specific portal module from the announcements /// database (including expired one). /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A SQL data reader. /// </returns> public SqlDataReader GetArticlesAll(int moduleId, WorkFlowVersion version) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; var command = new SqlCommand("rb_GetArticlesAll", connection) { // Mark the Command as a SPROC CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the data reader return(result); }
/// <summary> /// The GetHtmlText method returns a SqlDataReader containing details /// about a specific item from the HtmlText database table. /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A sql data reader /// </returns> public SqlDataReader GetHtmlText(int moduleId, WorkFlowVersion version) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; // Mark the Command as a SPROC var command = new SqlCommand("rb_GetHtmlText", connection) { CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] // Date: 6/2/2003 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return result; }
/// <summary> /// Get Single Milestones /// </summary> /// <param name="itemId"> /// The ItemID /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A SqlDataReader /// </returns> /// <remarks> /// change by [email protected] in order to support workflow /// Date: 20030324 /// </remarks> public SqlDataReader GetSingleMilestones(int itemId, WorkFlowVersion version) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; var command = new SqlCommand("rb_GetSingleMilestones", connection) { // Mark the Command as a SPROC CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterItemId = new SqlParameter("@ItemID", SqlDbType.Int) { Value = itemId }; command.Parameters.Add(parameterItemId); // Change by [email protected] on 20030324 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the data reader return(result); }
/// <summary> /// Return the specified document content from datatable /// </summary> /// <param name="itemID">The item ID.</param> /// <param name="version">The version.</param> /// <returns>The SqlDataReader</returns> public SqlDataReader GetDocumentContent(int itemID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetDocumentContent", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterItemID = new SqlParameter("@ItemID", SqlDbType.Int, 4); parameterItemID.Value = itemID; myCommand.Parameters.Add(parameterItemID); // Change by [email protected] // Date: 7/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return result; }
/// <summary> /// GetMilestones /// </summary> /// <returns>A SqlDataReader</returns> // change by [email protected] in order to support workflow // Date: 20030324 public SqlDataReader GetMilestones(int ModuleID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = PortalSettings.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetMilestones", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int); parameterModuleID.Value = ModuleID; myCommand.Parameters.Add(parameterModuleID); // Change by [email protected] on 20030324 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return(result); }
/// <summary> /// The GetLinks method returns a SqlDataReader containing all of the /// links for a specific portal module from the announcements /// database. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="version">The version.</param> /// <returns></returns> public SqlDataReader GetLinks(int moduleID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetLinks", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); // Change by [email protected] // Date: 7/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return(result); }
/// <summary> /// The GetDocuments method returns a DataSet containing all of the /// documents for a specific portal module from the documents datatable. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="version">The version.</param> /// <returns>The required DataSet</returns> public DataSet GetDocuments(int moduleID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlDataAdapter myCommand = new SqlDataAdapter("rb_GetDocuments", myConnection); // Mark the Command as a SPROC myCommand.SelectCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.SelectCommand.Parameters.Add(parameterModuleID); // Change by [email protected] // Date: 7/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.SelectCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Create and Fill the DataSet DataSet myDataSet = new DataSet(); try { myCommand.Fill(myDataSet); } finally { myConnection.Close(); //by Manu fix close bug #2 } // Return the DataSet return myDataSet; }
/// <summary> /// Get Html Text String /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <param name="mobileSummary"> /// The mobile Summary. /// </param> /// <param name="mobileDetails"> /// The mobile Details. /// </param> /// <returns> /// The get html text string. /// </returns> public string GetHtmlTextString( int moduleId, WorkFlowVersion version, out string mobileSummary, out string mobileDetails) { var strDesktopHtml = string.Empty; // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_GetHtmlText", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] // Date: 6/2/2003 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command connection.Open(); using (var result = command.ExecuteReader(CommandBehavior.CloseConnection)) { try { if (result.Read()) { strDesktopHtml = result["DesktopHtml"].ToString(); mobileSummary = result["MobileSummary"].ToString(); mobileDetails = result["MobileDetails"].ToString(); } else { mobileSummary = string.Empty; mobileDetails = string.Empty; } } finally { // Close the datareader result.Close(); } } } return(strDesktopHtml); }
/// <summary> /// The get last modified. /// </summary> /// <param name="moduleId"> /// The module id. /// </param> /// <param name="version"> /// The version. /// </param> /// <param name="email"> /// The email. /// </param> /// <param name="timestamp"> /// The timestamp. /// </param> public static void GetLastModified( int moduleId, WorkFlowVersion version, ref string email, ref DateTime timestamp) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; // Mark the Command as a SPROC var command = new SqlCommand("rb_GetLastModified", connection) { CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); var parameterEmail = new SqlParameter("@LastModifiedBy", SqlDbType.NVarChar, 256) { Direction = ParameterDirection.Output }; command.Parameters.Add(parameterEmail); var parameterDate = new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 8) { Direction = ParameterDirection.Output }; command.Parameters.Add(parameterDate); connection.Open(); try { command.ExecuteNonQuery(); email = Convert.IsDBNull(parameterEmail.Value) ? string.Empty : (string)parameterEmail.Value; timestamp = Convert.IsDBNull(parameterDate.Value) ? DateTime.MinValue : (DateTime)parameterDate.Value; } finally { connection.Close(); } }
/// <summary> /// The BindData method is used to obtain details of a message /// from the Articles table, and update the page with /// the message content. /// </summary> private void BindData() { WorkFlowVersion Version = Request.QueryString["wversion"] == "Staging" ? WorkFlowVersion.Staging : WorkFlowVersion.Production; // Obtain the selected item from the Articles table ArticlesDB Article = new ArticlesDB(); SqlDataReader dr = Article.GetSingleArticle(ItemID, Version); try { // Load first row from database if (dr.Read()) { // Update labels with message contents Title.Text = dr["Title"].ToString(); //[email protected] 5/24/04 added subtitle to ArticlesView. if (dr["Subtitle"].ToString().Length > 0) { Subtitle.Text = "(" + dr["Subtitle"].ToString() + ")"; } StartDate.Text = ((DateTime)dr["StartDate"]).ToShortDateString(); Description.Text = Server.HtmlDecode(dr["Description"].ToString()); CreatedDate.Text = ((DateTime)dr["CreatedDate"]).ToShortDateString(); CreatedBy.Text = dr["CreatedByUser"].ToString(); // 15/7/2004 added localization by Mario Endara [email protected] if (CreatedBy.Text == "unknown") { CreatedBy.Text = General.GetString("UNKNOWN", "unknown"); } //Chris Farrell, [email protected], 5/24/2004 if (!bool.Parse(moduleSettings["MODULESETTINGS_SHOW_MODIFIED_BY"].ToString())) { CreatedLabel.Visible = false; CreatedDate.Visible = false; OnLabel.Visible = false; CreatedBy.Visible = false; } } } finally { // close the datareader dr.Close(); } }
/// <summary> /// The Page_Load event handler on this Page is used to /// obtain obtain the contents of a document from the /// Documents table, construct an HTTP Response of the /// correct type for the document, and then stream the /// document contents to the response. It uses the /// Rainbow.DocumentDB() data component to encapsulate /// the data access functionality. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { if (ItemID != -1) { // Obtain Document Data from Documents table DocumentDB documents = new DocumentDB(); // Change by [email protected] // Date: 7/2/2003 WorkFlowVersion version = Request.QueryString["wversion"] == "Staging" ? WorkFlowVersion.Staging : WorkFlowVersion.Production; // End Change [email protected] // Change by [email protected] // Date: 7/2/2003 // Original: // SqlDataReader dBContent = documents.GetDocumentContent(ItemID); SqlDataReader dBContent = documents.GetDocumentContent(ItemID, version); // End Change [email protected] try { dBContent.Read(); // Serve up the file by name // [email protected]. FIX: FileName does not exist // Response.AppendHeader("content-disposition", "filename=" + (string)dBContent["FileName"]); Response.AppendHeader("content-disposition", "filename=" + (string)dBContent["FileNameUrl"]); // set the content type for the Response to that of the // document to display. For example. "application/msword" // Change for translate extension-files to exact contentType // Response.ContentType = (string) dBContent["ContentType"]; Response.ContentType = giveMeContentType((string)dBContent["ContentType"]); // output the actual document contents to the response output stream Response.OutputStream.Write((byte[])dBContent["Content"], 0, (int)dBContent["ContentSize"]); } finally { dBContent.Close(); //by Manu, fixed bug 807858 } // end the response Response.End(); } }
/// <summary> /// Gets the HTML text string. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="version">The version.</param> /// <returns></returns> public string GetHtmlTextString(int moduleID, WorkFlowVersion version) { string strDesktopHtml = string.Empty; // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_GetHtmlText", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); // Change by [email protected] // Date: 6/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command myConnection.Open(); using (SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection)) { try { if (result.Read()) { strDesktopHtml = result["DesktopHtml"].ToString(); } } finally { // Close the datareader result.Close(); } } } } return strDesktopHtml; }
/// <summary> /// GetHtmlTextString /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="version">The version.</param> /// <returns></returns> public string GetHtmlTextString(int moduleID, WorkFlowVersion version) { string strDesktopHtml = string.Empty; // Create Instance of Connection and Command Object using (SqlConnection myConnection = Config.SqlConnectionString) { using (SqlCommand myCommand = new SqlCommand("rb_GetHtmlText", myConnection)) { // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); // Change by [email protected] // Date: 6/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command myConnection.Open(); using (SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection)) { try { if (result.Read()) { strDesktopHtml = result["DesktopHtml"].ToString(); } } finally { // Close the datareader result.Close(); } } } } return(strDesktopHtml); }
/// <summary> /// The GetPicture function is used to get all the Pictures in the module /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="page">The page.</param> /// <param name="recordsPerPage">The records per page.</param> /// <param name="version">The version.</param> /// <returns></returns> public DataSet GetPicturesPaged(int moduleID, int page, int recordsPerPage, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlDataAdapter myCommand = new SqlDataAdapter("rb_GetPicturesPaged", myConnection); myCommand.SelectCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.SelectCommand.Parameters.Add(parameterModuleID); SqlParameter parameterPage = new SqlParameter("@Page", SqlDbType.Int, 4); parameterPage.Value = page; myCommand.SelectCommand.Parameters.Add(parameterPage); SqlParameter parameterRecordsPerPage = new SqlParameter("@RecordsPerPage", SqlDbType.Int, 4); parameterRecordsPerPage.Value = recordsPerPage; myCommand.SelectCommand.Parameters.Add(parameterRecordsPerPage); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)version; myCommand.SelectCommand.Parameters.Add(parameterWorkflowVersion); // Create and Fill the DataSet DataSet myDataSet = new DataSet(); try { myCommand.Fill(myDataSet); } finally { myConnection.Close(); //by Manu fix close bug #2 } // return the DataSet return(myDataSet); }
public static void GetLastModified(int moduleID, WorkFlowVersion Version, ref string Email, ref DateTime Timestamp) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetLastModified", myConnection); // Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int)Version; myCommand.Parameters.Add(parameterWorkflowVersion); SqlParameter parameterEmail = new SqlParameter("@LastModifiedBy", SqlDbType.NVarChar, 256); parameterEmail.Direction = ParameterDirection.Output; myCommand.Parameters.Add(parameterEmail); SqlParameter parameterDate = new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 8); parameterDate.Direction = ParameterDirection.Output; myCommand.Parameters.Add(parameterDate); myConnection.Open(); try { myCommand.ExecuteNonQuery(); Email = Convert.IsDBNull(parameterEmail.Value) ? string.Empty : (string)parameterEmail.Value; Timestamp = Convert.IsDBNull(parameterDate.Value) ? DateTime.MinValue : (DateTime)parameterDate.Value; } finally { myConnection.Close(); } }
/// <summary> /// The GetHtmlText method returns a SqlDataReader containing details /// about a specific item from the HtmlText database table. /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <param name="versionsModule"> /// The versionsModule. /// </param> /// <returns> /// A sql data reader /// </returns> public SqlDataReader GetHtmlText(int moduleId, WorkFlowVersion version, int versionsModule) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; // Mark the Command as a SPROC var command = new SqlCommand("rb_GetHtmlText", connection) { CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] // Date: 6/2/2003 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); var moduleVersion = new SqlParameter("@VersionNo", SqlDbType.Int, 4) { Value = versionsModule }; command.Parameters.Add(moduleVersion); // End Change [email protected] // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the datareader return(result); }
/// <summary> /// Get Milestones /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A SqlDataReader /// </returns> /// <remarks> /// change by [email protected] in order to support workflow /// Date: 20030324 /// </remarks> public SqlDataReader GetMilestones(int moduleId, WorkFlowVersion version) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; var command = new SqlCommand("rb_GetMilestones", connection) { // Mark the Command as a SPROC CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] on 20030324 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the data reader return result; }
/// <summary> /// The GetAllPages method returns a SqlDataReader containing all of the /// pages for a specific portal module from database. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="cultureCode">The culture code.</param> /// <param name="version">The version.</param> /// <returns></returns> public SqlDataReader GetLocalizedPages(int moduleID, int cultureCode, WorkFlowVersion version) { SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetEnhancedLocalizedHtml", myConnection); myCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.Parameters.Add(parameterModuleID); SqlParameter parameterCultureCode = new SqlParameter("@CultureCode", SqlDbType.Int, 4); parameterCultureCode.Value = cultureCode; myCommand.Parameters.Add(parameterCultureCode); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int) version; myCommand.Parameters.Add(parameterWorkflowVersion); myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); return result; }
/// <summary> /// Fills all MDF settings. Returns true if no problems reading and /// parsing all MDF settings. /// </summary> /// <param name="pmc">The PMC.</param> /// <param name="itemTableName">Name of the item table.</param> /// <param name="titleFieldName">Name of the title field.</param> /// <param name="selectFieldList">The select field list.</param> /// <param name="searchFieldList">The search field list.</param> /// <returns></returns> public bool Populate(PortalModuleControl pmc, string itemTableName, string titleFieldName, string selectFieldList, string searchFieldList) { bool PopulateDone; try { _applyMDF = bool.Parse(pmc.Settings[NameApplyMDF].ToString()); string ds = pmc.Settings[NameDataSource].ToString(); if (ds == DataSourceType.This.ToString()) _dataSource = DataSourceType.This; else if (ds == DataSourceType.All.ToString()) _dataSource = DataSourceType.All; else if (ds == DataSourceType.List.ToString()) _dataSource = DataSourceType.List; _maxHits = int.Parse(pmc.Settings[NameMaxHits].ToString()); _moduleList = pmc.Settings[NameModuleList].ToString(); _allNotInList = bool.Parse(pmc.Settings[NameAllNotInList].ToString()); _sortField = pmc.Settings[NameSortField].ToString(); _sortDirection = pmc.Settings[NameSortDirection].ToString(); _searchString = pmc.Settings[NameSearchString].ToString(); _searchField = pmc.Settings[NameSearchField].ToString(); _mobileOnly = bool.Parse(pmc.Settings[NameMobileOnly].ToString()); if (_dataSource == DataSourceType.This) _moduleList = pmc.ModuleID.ToString(); if (_moduleList == "" && _dataSource == DataSourceType.List) { // Create data to lazy user that forgot to enter data in field Module List _moduleList = pmc.ModuleID.ToString(); } if (pmc.SupportsWorkflow) { _supportsWorkflow = pmc.SupportsWorkflow; _workflowVersion = pmc.Version; } _itemTableName = itemTableName; _titleFieldName = titleFieldName; _selectFieldList = selectFieldList; _searchFieldList = searchFieldList; _portalID = pmc.PortalID; UsersDB u = new UsersDB(); SqlDataReader dr = u.GetSingleUser(PortalSettings.CurrentUser.Identity.Email); if (dr.Read()) _userID = Int32.Parse(dr["UserID"].ToString()); PopulateDone = true; } catch (Exception) { PopulateDone = false; } return PopulateDone; }
public string GetHtmlTextString(int moduleId, WorkFlowVersion version) { var strDesktopHtml = string.Empty; // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) { using (var command = new SqlCommand("rb_GetHtmlText", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] // Date: 6/2/2003 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); //Add by [email protected] // Date: 12/23/2014 // Get published version content int publishedVersion = 1; SqlDataReader sqlDatard = this.GetHtmlTextRecord(moduleId); if (sqlDatard.HasRows) { while (sqlDatard.Read()) { if (Convert.ToBoolean(sqlDatard["Published"])) { publishedVersion = Convert.ToInt32(sqlDatard["VersionNo"]); break; } } } // Added by Ashish - Connection Pool Issues if (sqlDatard != null) { sqlDatard.Close(); } var moduleVersion = new SqlParameter("@VersionNo", SqlDbType.Int, 4) { Value = publishedVersion }; command.Parameters.Add(moduleVersion); // End Change [email protected] // Execute the command connection.Open(); using (var result = command.ExecuteReader(CommandBehavior.CloseConnection)) { try { if (result.Read()) { strDesktopHtml = result["DesktopHtml"].ToString(); } } finally { // Close the datareader result.Close(); } } } } return(strDesktopHtml); }
/// <summary> /// The Page_Load event handler on this Page is used to /// obtain obtain the contents of a picture from the /// Pictures table, construct an HTTP Response of the /// correct type for the picture, and then stream the /// picture contents to the response. It uses the /// Rainbow.PictureDB() data component to encapsulate /// the data access functionality. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack && ModuleID > 0 && ItemID > 0) { // Obtain a single row of picture information PicturesDB pictures = new PicturesDB(); WorkFlowVersion version = Request.QueryString["wversion"] == "Staging" ? WorkFlowVersion.Staging : WorkFlowVersion.Production; SqlDataReader dr = pictures.GetSinglePicture(ItemID, version); PictureItem pictureItem; XmlDocument metadata = new XmlDocument(); try { // Read first row from database if (dr.Read()) { pictureItem = (PictureItem) Page.LoadControl(Path.ApplicationRoot + "/Design/PictureLayouts/" + moduleSettings["ImageLayout"]); metadata.LoadXml((string)dr["MetadataXml"]); XmlAttribute albumPath = metadata.CreateAttribute("AlbumPath"); albumPath.Value = ((SettingItem)moduleSettings["AlbumPath"]).FullPath; XmlAttribute itemID = metadata.CreateAttribute("ItemID"); itemID.Value = ((int)dr["ItemID"]).ToString(); XmlAttribute moduleID = metadata.CreateAttribute("ModuleID"); moduleID.Value = ModuleID.ToString(); XmlAttribute wVersion = metadata.CreateAttribute("WVersion"); wVersion.Value = version.ToString(); if (dr["PreviousItemID"] != DBNull.Value) { XmlAttribute previousItemID = metadata.CreateAttribute("PreviousItemID"); previousItemID.Value = ((int)dr["PreviousItemID"]).ToString(); metadata.DocumentElement.Attributes.Append(previousItemID); } if (dr["NextItemID"] != DBNull.Value) { XmlAttribute nextItemID = metadata.CreateAttribute("NextItemID"); nextItemID.Value = ((int)dr["NextItemID"]).ToString(); metadata.DocumentElement.Attributes.Append(nextItemID); } metadata.DocumentElement.Attributes.Append(albumPath); metadata.DocumentElement.Attributes.Append(itemID); metadata.DocumentElement.Attributes.Append(moduleID); metadata.DocumentElement.Attributes.Append(wVersion); if (version == WorkFlowVersion.Production) { XmlNode modifiedFilenameNode = metadata.DocumentElement.SelectSingleNode("@ModifiedFilename"); XmlNode thumbnailFilenameNode = metadata.DocumentElement.SelectSingleNode("@ThumbnailFilename"); modifiedFilenameNode.Value = modifiedFilenameNode.Value.Replace(".jpg", ".Production.jpg"); thumbnailFilenameNode.Value = thumbnailFilenameNode.Value.Replace(".jpg", ".Production.jpg"); } pictureItem.Metadata = metadata; pictureItem.DataBind(); Picture.Controls.Add(pictureItem); } } catch { lblError.Visible = true; Picture.Visible = false; return; } finally { // Close datareader dr.Close(); } DataBind(); } }
/// <summary> /// The GetEvents method returns a DataSet containing all of the /// events for a specific portal module from the events /// database. /// NOTE: A DataSet is returned from this method to allow this method to support /// both desktop and mobile Web UI. /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="version">The version.</param> /// <returns></returns> public DataSet GetEvents(int moduleID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlDataAdapter myCommand = new SqlDataAdapter("rb_GetEvents", myConnection); // Mark the Command as a SPROC myCommand.SelectCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.SelectCommand.Parameters.Add(parameterModuleID); // Change by [email protected] // Date: 7/2/2003 SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int) version; myCommand.SelectCommand.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Create and Fill the DataSet DataSet myDataSet = new DataSet(); try { myCommand.Fill(myDataSet); } finally { myConnection.Close(); //by Manu fix close bug #2 } // Return the DataSet return myDataSet; }
/// <summary> /// The GetPicture function is used to get all the Pictures in the module /// </summary> /// <param name="moduleID">The module ID.</param> /// <param name="page">The page.</param> /// <param name="recordsPerPage">The records per page.</param> /// <param name="version">The version.</param> /// <returns></returns> public DataSet GetPicturesPaged(int moduleID, int page, int recordsPerPage, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlDataAdapter myCommand = new SqlDataAdapter("rb_GetPicturesPaged", myConnection); myCommand.SelectCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleID = new SqlParameter("@ModuleID", SqlDbType.Int, 4); parameterModuleID.Value = moduleID; myCommand.SelectCommand.Parameters.Add(parameterModuleID); SqlParameter parameterPage = new SqlParameter("@Page", SqlDbType.Int, 4); parameterPage.Value = page; myCommand.SelectCommand.Parameters.Add(parameterPage); SqlParameter parameterRecordsPerPage = new SqlParameter("@RecordsPerPage", SqlDbType.Int, 4); parameterRecordsPerPage.Value = recordsPerPage; myCommand.SelectCommand.Parameters.Add(parameterRecordsPerPage); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int) version; myCommand.SelectCommand.Parameters.Add(parameterWorkflowVersion); // Create and Fill the DataSet DataSet myDataSet = new DataSet(); try { myCommand.Fill(myDataSet); } finally { myConnection.Close(); //by Manu fix close bug #2 } // return the DataSet return myDataSet; }
/// <summary> /// The GetSingleArticle method returns a SqlDataReader containing details /// about a specific Article from the Articles database table. /// </summary> /// <param name="itemId"> /// The item ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <returns> /// A SQL data reader. /// </returns> public SqlDataReader GetSingleArticle(int itemId, WorkFlowVersion version) { // Create Instance of Connection and Command Object var connection = Config.SqlConnectionString; var command = new SqlCommand("rb_GetSingleArticle", connection) { // Mark the Command as a SPROC CommandType = CommandType.StoredProcedure }; // Add Parameters to SPROC var parameterItemId = new SqlParameter("@ItemID", SqlDbType.Int, 4) { Value = itemId }; command.Parameters.Add(parameterItemId); var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // Execute the command connection.Open(); var result = command.ExecuteReader(CommandBehavior.CloseConnection); // Return the data reader return result; }
/// <summary> /// Fills all MDF settings. Returns true if no problems reading and /// parsing all MDF settings. /// </summary> /// <param name="pmc">The PMC.</param> /// <param name="itemTableName">Name of the item table.</param> /// <param name="titleFieldName">Name of the title field.</param> /// <param name="selectFieldList">The select field list.</param> /// <param name="searchFieldList">The search field list.</param> /// <returns></returns> public bool Populate(PortalModuleControl pmc, string itemTableName, string titleFieldName, string selectFieldList, string searchFieldList) { bool PopulateDone; try { _applyMDF = bool.Parse(pmc.Settings[NameApplyMDF].ToString()); string ds = pmc.Settings[NameDataSource].ToString(); if (ds == DataSourceType.This.ToString()) { _dataSource = DataSourceType.This; } else if (ds == DataSourceType.All.ToString()) { _dataSource = DataSourceType.All; } else if (ds == DataSourceType.List.ToString()) { _dataSource = DataSourceType.List; } _maxHits = int.Parse(pmc.Settings[NameMaxHits].ToString()); _moduleList = pmc.Settings[NameModuleList].ToString(); _allNotInList = bool.Parse(pmc.Settings[NameAllNotInList].ToString()); _sortField = pmc.Settings[NameSortField].ToString(); _sortDirection = pmc.Settings[NameSortDirection].ToString(); _searchString = pmc.Settings[NameSearchString].ToString(); _searchField = pmc.Settings[NameSearchField].ToString(); _mobileOnly = bool.Parse(pmc.Settings[NameMobileOnly].ToString()); if (_dataSource == DataSourceType.This) { _moduleList = pmc.ModuleID.ToString(); } if (_moduleList == "" && _dataSource == DataSourceType.List) { // Create data to lazy user that forgot to enter data in field Module List _moduleList = pmc.ModuleID.ToString(); } if (pmc.SupportsWorkflow) { _supportsWorkflow = pmc.SupportsWorkflow; _workflowVersion = pmc.Version; } _itemTableName = itemTableName; _titleFieldName = titleFieldName; _selectFieldList = selectFieldList; _searchFieldList = searchFieldList; _portalID = pmc.PortalID; UsersDB u = new UsersDB(); SqlDataReader dr = u.GetSingleUser(PortalSettings.CurrentUser.Identity.Email); if (dr.Read()) { _userID = Int32.Parse(dr["UserID"].ToString()); } PopulateDone = true; } catch (Exception) { PopulateDone = false; } return(PopulateDone); }
/// <summary> /// The GetSinglePicture function is used to Get a single Picture /// from the database for display/edit /// </summary> /// <param name="itemID">The item ID.</param> /// <param name="version">The version.</param> /// <returns></returns> public SqlDataReader GetSinglePicture(int itemID, WorkFlowVersion version) { // Create Instance of Connection and Command Object SqlConnection myConnection = Config.SqlConnectionString; SqlCommand myCommand = new SqlCommand("rb_GetSinglePicture", myConnection); myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterItemID = new SqlParameter("@ItemID", SqlDbType.Int, 4); parameterItemID.Value = itemID; myCommand.Parameters.Add(parameterItemID); SqlParameter parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4); parameterWorkflowVersion.Value = (int) version; myCommand.Parameters.Add(parameterWorkflowVersion); // Execute the command myConnection.Open(); SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // return the datareader return result; }
/// <summary> /// Get Html Text String /// </summary> /// <param name="moduleId"> /// The module ID. /// </param> /// <param name="version"> /// The version. /// </param> /// <param name="mobileSummary"> /// The mobile Summary. /// </param> /// <param name="mobileDetails"> /// The mobile Details. /// </param> /// <returns> /// The get html text string. /// </returns> public string GetHtmlTextString( int moduleId, WorkFlowVersion version, out string mobileSummary, out string mobileDetails) { var strDesktopHtml = string.Empty; // Create Instance of Connection and Command Object using (var connection = Config.SqlConnectionString) using (var command = new SqlCommand("rb_GetHtmlText", connection)) { // Mark the Command as a SPROC command.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4) { Value = moduleId }; command.Parameters.Add(parameterModuleId); // Change by [email protected] // Date: 6/2/2003 var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4) { Value = (int)version }; command.Parameters.Add(parameterWorkflowVersion); // End Change [email protected] // Execute the command connection.Open(); using (var result = command.ExecuteReader(CommandBehavior.CloseConnection)) { try { if (result.Read()) { strDesktopHtml = result["DesktopHtml"].ToString(); mobileSummary = result["MobileSummary"].ToString(); mobileDetails = result["MobileDetails"].ToString(); } else { mobileSummary = string.Empty; mobileDetails = string.Empty; } } finally { // Close the datareader result.Close(); } } } return strDesktopHtml; }