Một số module có sẵn

1. Module Data
Sinh ra dữ liệu JSON, XML

Đường dẫn đầy đủ:
/module/data/?file=đường_dẫn_file_xml&obj=đối_tượng&type= Kiểu_dữ_liệu_trả_về &where=điều_kiện&

file: đường dẫn hay tên đối tượng truy cập
obj:loại đối tượng lấy
  - Để trống lấy file xml đường dẫn phải đầy đủ
 - xml_data : lấy từ thư mục xml_data (có thể kết nối với SQL nếu đối tượng cho phép)
sort=sắp_xếp&distinct=cột
Kiểu_dữ_liệu_trả_về : json, xml  để trống mặc định là json
điều_kiện: lọc dữ liệu, ví dụ: Lop='10'
sắp_xếp: Lop asc
Distinct: tên cột nhóm lại

 

* Lấy file XML

Ví dụ:   /module/data/?file=/app_data/xml_data/hoso.xml&where=Lop='1'

 

* Lấy file XML trong xml_Data có cấu hình

Ví dụ:

/module/data/?file=ChungTu_NoiDung_DM.xml&obj=xml_data&distinct=Nhom

 

 * Lấy dữ liệu từ produce SQL
Đường dẫn: 
/module/data/?obj=sql_pr&file=tên_pr&src=cns_sql&type= Kiểu_dữ_liệu_trả_về&para=lệnh_para&where=điều_kiện&sort=sắp_xếp

cns_sql: lệnh kết nối SQL

lệnh_para:tungay,2023/1/1,dt;denngay,2023/12/31,dt
   
dt là kiểu datetime
        * Các kiểu khác: i là interget, n kiểu nvarchar, f kiểu float

Kiểu_dữ_liệu_trả_về : json, xml  để trống mặc định là json
điều_kiện: lọc dữ liệu, ví dụ: Lop='10'
sắp_xếp: Lop asc


Ví dụ:   /module/data/Default.aspx?file=AUC_st_Get_BanHang&obj=sql_pr&src=cnSQL&para=tungay,2023/1/1,dt;denngay,2023/12/31,dt

Ví dụ code lấy dữ liệu từ produce hiển thị ra HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-sanitize.js"></script>
<div class="" ng-app="myApp"  ng-controller="myCtrl">
<button type="button" id="btNapLai" ng-click="loadData()" class="btn btn-danger">Nạp lại</button>
<div ng-repeat="x in hanghoa">
Tên: {{x.Ten_HangHoa}}
</div>
</div>
<script>
var app = angular.module("myApp", ['ngSanitize']);
app.controller('myCtrl', function($scope, $http, $interval){
//==== start
$scope.loadData = function () {       
        $scope.loading=true;
        loadding_show("Đang tải..");
       

        var url=  "/module/data/Default.aspx?file=AUC_st_Get_HangHoa_DS&obj=sql_pr&src=cnSQL";
        //alert(url);
        //$http
        $http({
            method : "GET",
            url : url
        }).then(function mySuccess(response)
        {
      //  alert( JSON.stringify(response )  );
                $scope.hanghoa= response.data.Table;
                loadding_hide();
         }//then
         ,function myError(response)
         {
            alert( "LỖI:"+ response.statusText );
         }
        ); //$http
  }
  $scope.loadData();
  $interval(function () {
      $scope.loadData();
  }, 3000);
    
});//start app.controller
</script>


 Chú ý: * Nếu trả về DataSet thì tên table lần lượt là
Table
Table1
Table2
...

 

 

 

 

Mục liên quan: