0
するために、我々は、C#MVCモデルウェブアプリケーション ブロブデータはコード次のOracleから受信し、統合を持っている我々は、#MVCモデルのWebアプリブロブデータCを有するコンバートSystem.Byte []の文字列または画像フォーマット
foreach (DataRow oRow in oDataTable.Rows)
{
Rel oUnitData = new Rel();
if (!string.IsNullOrEmpty(oRow["LOG_SNAP"].ToString()))
oUnitData.imgdisp = oRow["LOG_SNAP"].ToString();
lUnitData.Add(oUnitData);
}
and for display using javascript file in that datatables
following part of code
{ data: 'imgdisp', "render": function (data) {
var str = data
var base64string = Convert.ToBase64String(str);
return '<img src="data:image/jpeg;base64,+ base64_decode(str)+">';
}
Java Script Code
------------------------------------------------
function LoadImageDispData() {
var jsontext = JSON.stringify({
});
$.ajax({
url: '/Rel_ProjectStatusUpdate.aspx/LoadImageDisp',
data: jsontext,
type: 'POST',
async: true,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (result) {
if (result.d != null) {
oTableData = $("#tbl_imagedisp").dataTable().fnDestroy();
oTableData = $("#tbl_imagedisp").DataTable({
data: result.d,
responsive: true,
"bAutoWidth": true,
"bPaginate": true,
"bInfo": true,
"bFilter": true,
"aoColumns": [
{ data: 'imgdisp', "render": function (data) {
var str = data
var base64string = Convert.ToBase64String(str);
alert(base64string);
return '<img src="data:image/jpeg;base64,+ base64_encode($str)+">';
}
}
],
"columnDefs": [
{ "visible": false, "targets": [] },
{ className: "dt-left", "targets": [] },
{ className: "dt-center", "targets": [] },
{ className: "dt-right", "targets": [] }
],
//"order": [[1, 'asc']],
dom: 'Bfrtip',
buttons: ['copy', 'excel'],
"aLengthMenu": [[25, 50, 75, -1], [25, 50, 75, "All"]],
"iDisplayLength": 25,
"bAutoWidth": true,
"language": {
//
// "zeroRecords": "Nothing found - sorry",
// "infoEmpty": "No records available"
"emptyTable": "No data available in table"
}
});
}
else {
}
}
});
}
Data Base Layer Code
----------------------------------------
public DataTable GetImageDisp()
{
DataTable oDataTable = new DataTable();
try
{
LoggingManager.LogDetails("WebSiteModel-Begin GetImageDisp");
List<OracleParameter> lParameterList = new List<OracleParameter>();
lParameterList.Add(new OracleParameter("O_IMGDATA", OracleDbType.RefCursor, ParameterDirection.Output));
oDataTable = this.GetDataTableREL("REL_GET_IMAGEDISP", lParameterList);
if (oDataTable != null)
LoggingManager.LogDetails("WebSiteModel-End GetImageDisp", string.Format("GetImageDisp Data Count:{0}", oDataTable.Rows.Count));
else
LoggingManager.LogDetails("WebSiteModel-End GetImageDisp", string.Format("GetImageDisp Data Count:null"));
}
catch (Exception oException)
{
LoggingManager.LogDetails("WebSiteModel-Exception GetImageDisp", oException);
ExceptionManager.LogSiteException(oException, "DrishtiCane.Model.WebSite.Implementation.WebSiteModel::GetImageDisp");
}
return oDataTable;
}
Business Layer
--------------------------------
public List<Rel> GetImageDisp()
{
DataTable oDataTable = null;
List<Rel> lUnitData = new List<Rel>();
try
{
LoggingManager.LogDetails("WebSiteIntegration-Begin GetImageDisp");
oIWebSiteModel = this.ModelFactory.CreateObject<IWebSiteModel>();
oDataTable = oIWebSiteModel.GetImageDisp();
if (oDataTable != null)
{
if (oDataTable.Rows != null && oDataTable.Rows.Count > 0)
{
foreach (DataRow oRow in oDataTable.Rows)
{
Rel oUnitData = new Rel();
if (!string.IsNullOrEmpty(oRow["LOG_SNAP"].ToString()))
oUnitData.imgdisp = oRow["LOG_SNAP"].ToString();
lUnitData.Add(oUnitData);
}
}
else
lUnitData = null;
}
else
lUnitData = null;
if (lUnitData != null)
LoggingManager.LogDetails("WebSiteIntegration-End GetImageDisp", string.Format("GetImageDisp Data Count:{0}", lUnitData.Count));
else
LoggingManager.LogDetails("WebSiteIntegration-End GetImageDisp", string.Format("GetImageDisp Data Count:null"));
// LoggingManager.LogDetails("End GetSubCMasterData", string.Format("Legend List Count:{0}", lVillageMasterList.Count));
}
catch (Exception oException)
{
LoggingManager.LogDetails("WebSiteIntegration-Exception GetImageDisp", oException);
ExceptionManager.LogSiteException(oException, "DrishtiCane.Integration.WebSite.Implementation.WebSiteIntegration::GetImageDisp");
}
return lUnitData;
}
Code Behind .aspx file
-----------------------------------------
[WebMethod(EnableSession = true)]
public static List<Rel> LoadImageDisp()
{
List<Rel> lDatalist = new List<Rel>();
try
{
IControlViewController oIControlViewController = oContollerFactory.CreateObject<IControlViewController>();
lDatalist = oIControlViewController.GetImageDisp();
}
catch (Exception oException)
{
ExceptionManager.LogSiteException(oException, "DrishtiCane.SiteView.Report:LoadImageDisp");
}
return lDatalist;
}
ありますオラクルから受信し、コードに続く統合があります
ありがとう、私は元の質問を編集し、完全なコードplzを追加しました。 –