protected void Page_Load(object sender, EventArgs e) { //Set the SQL connection AppData = new ETLComponents.AppConfig(); conn = new SqlConnection(); conn.ConnectionString = AppData.ConnectionString; }
private void LoadRecentImports() { //Get the connection string from an App Config object ETLComponents.AppConfig Appdata = new ETLComponents.AppConfig(); SqlConnection conn = new SqlConnection(Appdata.ConnectionString); string commandText = "SELECT TOP 8 H.ProcessName,S.StatusName,H.StartTime,H.EndTime,H.RowsInserted,H.RowsDeleted FROM [Project].[dbo].[JobRunHistory] H JOIN [dbo].[JobStatus] S ON H.StatusId = S.StatusID ORDER BY H.StartTime DESC; "; SqlCommand comm = new SqlCommand(); comm.Connection = conn; comm.CommandText = commandText; StringBuilder tableBuilder = new StringBuilder(); tableBuilder.AppendLine("<table border = 1><tr><th>Process Name</th><th>Status</th><th>Start Time</th><th>End Time</th><th>Rows Inserted</th><th>Rows Deleted</th></tr>"); try { conn.Open(); using (SqlDataReader reader = comm.ExecuteReader()) { while (reader.Read()) { tableBuilder.Append("<tr>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["ProcessName"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["StatusName"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["StartTime"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["EndTime"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["RowsInserted"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("<td>"); tableBuilder.Append(reader["RowsDeleted"].ToString()); tableBuilder.Append("</td>"); tableBuilder.Append("</tr>"); } } conn.Close(); } catch (Exception) { throw; } tableBuilder.Append("</table>"); lit_RecentImportsTable.Text = tableBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //Use the connection string from the app data object to connect to the back end DB AppData = new ETLComponents.AppConfig(); conn.ConnectionString = AppData.ConnectionString; if (!IsPostBack) { PopulateDeleteProcessDataGrid(); } }
protected void Page_Load(object sender, EventArgs e) { //Set the SQL connection AppData = new ETLComponents.AppConfig(); conn = new SqlConnection(); conn.ConnectionString = AppData.ConnectionString; if (!IsPostBack) { //Set the options for the role dropdown list EnterRoleOptions(); } }
protected void Page_Load(object sender, EventArgs e) { //Set the SQL connection AppData = new ETLComponents.AppConfig(); conn = new SqlConnection(); conn.ConnectionString = AppData.ConnectionString; if (!IsPostBack) { //When the page first loads enter the user details in the gridview PopulateUserDetails(); } }
protected void Page_Load(object sender, EventArgs e) { //Establish the connection strings appdata = new ETLComponents.AppConfig(); //Connect to back end Database conn.ConnectionString = appdata.ConnectionString; Code = new ETLComponents.Program(conn); if (!IsPostBack) { InputConversionNames(); drp_Datasets.Width = 175; } }
protected void Page_Load(object sender, EventArgs e) { appData = new ETLComponents.AppConfig(); if (!Page.IsPostBack) { InputConversionNames(); DateTime lastWeek = DateTime.Today.AddDays(-60); cal_StartDate.TodaysDate = lastWeek; cal_StartDate.SelectedDate = cal_StartDate.TodaysDate; DateTime today = DateTime.Today; cal_EndDate.TodaysDate = today; cal_EndDate.SelectedDate = cal_EndDate.TodaysDate; } }
private void PopulateErrorLogsTable() { StringBuilder tableText = new StringBuilder(); SqlConnection conn = new SqlConnection(); SqlCommand comm = new SqlCommand(); string commandText = " SELECT ProcessName, StartTime, LogName FROM [Project].[dbo].[JobRunHistory] WHERE LogName IS NOT NULL ORDER BY StartTime DESC"; //retrieve back end DB connection details appData = new ETLComponents.AppConfig(); //Connect to BackEnd DB conn.ConnectionString = appData.ConnectionString; string processName, startTime, logLocation; comm.Connection = conn; comm.CommandText = commandText; tableText.Append("<table border = '" + "1" + "' cellpadding = '" + "2" + "'><tr><th>Process Name </th><th>Start Time</th><th>Log File</th></tr >"); try { comm.Connection.Open(); using (SqlDataReader reader = comm.ExecuteReader()) { while (reader.Read()) { processName = reader["ProcessName"].ToString(); startTime = reader["StartTime"].ToString(); logLocation = reader["LogName"].ToString(); tableText.Append("<tr><td>" + processName + "</td><td>" + startTime + "</td><td><a href='ErrorLogsContent.aspx?logName=" + logLocation + "'>Open Log</a></td></tr>"); } } comm.Connection.Close(); } catch (Exception) { throw; } tableText.Append("</table>"); ErrorLogsTable.Text = tableText.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //Get connection details for back end DB appData = new ETLComponents.AppConfig(); conn.ConnectionString = appData.ConnectionString; if (!Page.IsPostBack) { updateInfo = (string)Session["UpdateInfo"]; //Removing the update statement 2018-08-27 //lbl_UpdateInfo.InnerText = updateInfo; //reset the update information updateInfo = ""; //Create a list of import process and add to the drop downlist InputConversionNames(); } }
protected void Page_Load(object sender, EventArgs e) { //Set the SQL connection Conn to use the Back End DB AppData = new ETLComponents.AppConfig(); conn.ConnectionString = AppData.ConnectionString; DataProperties = (Dictionary <string, string>)Session["DataProperties"]; if (!IsPostBack) { ViewState["RefUrl"] = Request.UrlReferrer.ToString(); } c_Names = (List <string>)(Session["ColumnNames"]); c_Order = (List <string>)(Session["ColumnOrder"]); c_DataTypes = (List <string>)(Session["DataTypes"]); lst_PrimaryKeys = (List <string>)(Session["PrimaryKeys"]); c_MinLenth = (List <string>)(Session["MinLength"]); c_MaxLength = (List <string>)(Session["MaxLength"]); c_Nullable = (List <string>)(Session["NullPermitted"]); c_NullAction = (List <string>)(Session["NullAction"]); c_ReplaceValue = (List <string>)(Session["ReplacementValue"]); DisplaySourceDetails(); DisplayDestinationDetails(); DisplayMetaData(); DisplayPrimaryKeys(); //If the import type is direct connect - check if look back options need to be displayed if (DataProperties["Import Type"].Equals("Direct Connect")) { if (DataProperties.ContainsKey("Lookback Option")) { if (DataProperties["Lookback Option"].Equals("Yes")) { DisplayLookBackOption(); } } } }
//This method will check if the name already exists private bool CheckIfNameAlreadyExists(string datasetName) { bool exists = false; int count = 0; string commandText = "SELECT COUNT(*) FROM [dbo].[Program_DataProperties] WHERE DataSetName = @DataSetName"; //Create an SQL Connection object SqlConnection conn = new SqlConnection(); //Pull the back end DB connection from the AppData object AppData = new ETLComponents.AppConfig(); conn.ConnectionString = AppData.ConnectionString; //Create an SQL Command to quer the back end database SqlCommand comm = new SqlCommand(commandText, conn); comm.Parameters.AddWithValue("@DataSetName", datasetName); comm.Parameters["@DataSetName"].SqlDbType = System.Data.SqlDbType.NVarChar; try { conn.Open(); count = Convert.ToInt32(comm.ExecuteScalar()); conn.Close(); } catch (Exception) { throw; } //If the count is more than 0 it means that a record with the same process name already exists if (count > 0) { exists = true; } return(exists); }