protected void BindListView(string selectOrder = "dept_name") { SqlDataSource1.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource1.ProviderName = "System.Data.OracleClient"; SqlDataSource1.SelectCommand = DataProvider.Departments.fillListView(selectOrder); ListView1.DataSourceID = "SqlDataSource1"; ListView1.DataBind(); }
private void BindListView(string selectOrder = "to_number(trans_id) desc") { SqlDataSource1.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource1.ProviderName = "System.Data.OracleClient"; SqlDataSource1.SelectCommand = DataProvider.DeleteInformationPage.getGeneralInfo(selectOrder); ListView1.DataSourceID = "SqlDataSource1"; ListView1.DataBind(); }
protected void BindListView() { SqlDataSource1.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource1.ProviderName = "System.Data.OracleClient"; SqlDataSource1.SelectCommand = DataProvider.DiscDeptWard.addWardsToListView(DeptNameLabel.Text); ListView1.DataSourceID = "SqlDataSource1"; ListView1.DataBind(); }
/// <summary> /// Execute create, update, delete and other non-selecting queries /// </summary> /// <param name="query"></param> /// <returns></returns> public static int executeQuery(string query) { using (OracleConnection con = new OracleConnection(HospitalClass.getConnectionString())) { using (OracleCommand cmd = new OracleCommand(query, con)) { con.Open(); cmd.CommandType = CommandType.Text; //default return(cmd.ExecuteNonQuery()); } } }
public void BindSearchListView() { SearchDiv.Visible = true; SearchUserIdLabel.Text = ""; SearchNameLabel.Text = ""; SearchStatusLabel.CssClass = "error"; if (SearchBox.Text.Trim().Length == 11 && ((SearchBox.Text.Trim().ToUpper().StartsWith("DC") && RoleList.SelectedIndex == 0) || SearchBox.Text.Trim().ToUpper().StartsWith("ST") && RoleList.SelectedIndex == 1)) { SearchListView.Visible = true; SqlDataSource2.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource2.ProviderName = "System.Data.OracleClient"; if (RoleList.SelectedIndex == 0) { SqlDataSource2.SelectCommand = DataProvider.DoctorStaffHistory.fillListViewDoc(SearchBox.Text.Trim().ToUpper()); } else { SqlDataSource2.SelectCommand = DataProvider.DoctorStaffHistory.fillListViewStf(SearchBox.Text.Trim().ToUpper()); } SearchListView.DataSourceID = "SqlDataSource2"; SearchListView.DataBind(); if (SearchListView.Items.Count == 0) { SearchStatusLabel.Text = "Not found"; } else { completeAction(); } } else { SearchListView.Visible = false; if (SearchBox.Text.Trim().Length == 0) { SearchStatusLabel.Text = "No value entered"; } else if (SearchBox.Text.Trim().ToUpper().StartsWith("DC")) { SearchStatusLabel.Text = "Invalid staff id"; } else if (SearchBox.Text.Trim().ToUpper().StartsWith("ST")) { SearchStatusLabel.Text = "Invalid doctor id"; } else { SearchStatusLabel.Text = "Invalid employee Id"; } } }
/// <summary> /// Sends a picture encoded as a byte array to the database /// </summary> /// <param name="query"></param> /// <param name="a"></param> /// <returns></returns> public static int sendPictureToDatabase(string query, byte[] a) { using (OracleConnection con = new OracleConnection(HospitalClass.getConnectionString())) { using (OracleCommand cmd = new OracleCommand(query, con)) { con.Open(); cmd.Parameters.AddWithValue("image", a); int rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected); } } }
/// <summary> /// Executes a procedure with given input values as a generic string list /// </summary> /// <param name="procedureName"></param> /// <param name="values"></param> /// <returns></returns> public static int executeProcedure(string procedureName, List <string> values) { using (OracleConnection con = new OracleConnection(HospitalClass.getConnectionString())) { using (OracleCommand cmd = new OracleCommand(procedureName, con)) { con.Open(); cmd.CommandType = CommandType.StoredProcedure; for (int i = 1; i <= values.Count; i++) { cmd.Parameters.AddWithValue("param" + i, values[i - 1]).Direction = ParameterDirection.Input; } int rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected); } } }
protected void BindListView() { SqlDataSource1.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource1.ProviderName = "System.Data.OracleClient"; if (RoleList.SelectedIndex == 0) { SqlDataSource1.SelectCommand = DataProvider.DoctorStaffHistory.fillListViewDoc(); NameLabel.Text = "Work History (All Doctors)"; HeadLabel.Text = "Doctor's Employment History"; } else { SqlDataSource1.SelectCommand = DataProvider.DoctorStaffHistory.fillListViewStf(); NameLabel.Text = "Work History (All Staff)"; HeadLabel.Text = "Staff's Employment History"; } ListView1.DataSourceID = "SqlDataSource1"; ListView1.DataBind(); }
public void BindSearchListView() { SearchDiv.Visible = true; SearchUserIdLabel.Text = ""; SearchNameLabel.Text = ""; SearchStatusLabel.CssClass = "error"; if (SearchBox.Text.Trim().Length == 11 && SearchBox.Text.Trim().ToUpper().StartsWith("PAT")) { SearchListView.Visible = true; SqlDataSource2.ConnectionString = HospitalClass.getConnectionString().Substring(0, 60); SqlDataSource2.ProviderName = "System.Data.OracleClient"; SqlDataSource2.SelectCommand = DataProvider.Patients.fillListView(SearchBox.Text.Trim().ToUpper()); SearchListView.DataSourceID = "SqlDataSource2"; SearchListView.DataBind(); if (SearchListView.Items.Count == 0) { SearchStatusLabel.Text = "Not found"; } else { completeAction(); } } else { SearchListView.Visible = false; if (SearchBox.Text.Trim().Length == 0) { SearchStatusLabel.Text = "No value entered"; } else { SearchStatusLabel.Text = "Invalid patient id"; } } }
//To show that implicit conversion occurs for object datatypes public static int executeProc(string procedureName, object[] values) { using (OleDbConnection con = new OleDbConnection("Provider=OraOLEDB.Oracle;" + HospitalClass.getConnectionString())) { using (OleDbCommand cmd = new OleDbCommand(procedureName, con)) { con.Open(); cmd.CommandType = CommandType.StoredProcedure; for (int i = 1; i <= values.Length; i++) { cmd.Parameters.AddWithValue("param" + i, values[i - 1]).Direction = ParameterDirection.Input; } int rowsAffected = cmd.ExecuteNonQuery(); return(rowsAffected); } } }