-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dcaf85
commit 28a2041
Showing
28 changed files
with
692 additions
and
93 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...licationDBContext/ApplicationDBContext.md → ...pleTableDBContext/SimpleTableDBContext.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
|
||
|
||
# ApplicationDBContext | ||
# SimpleTableDBContext | ||
|
||
```mermaid | ||
erDiagram | ||
|
2 changes: 1 addition & 1 deletion
2
...rateDataForTest.Angular/src/app/Admin/Generated/Models/ApplicationDBContext/Department.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nerateDataForTest.Angular/src/app/Admin/Generated/Models/ApplicationDBContext/Employee.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/GenerateDataForTest.Angular/src/app/Admin/Generated/Models/ApplicationDBContext/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
266 changes: 266 additions & 0 deletions
266
...rateDataForTest.Angular/src/app/Admin/Generated/Models/SimpleTableDBContext/Department.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,266 @@ | ||
//this was autogenerated by a tool. Do not modify! Use partial | ||
import JsonStreamDecoder from "../../../Common/asyncEnumerable"; | ||
import { HttpClient } from "@angular/common/http";; | ||
import { MatTableDataSource } from "@angular/material/table"; | ||
import { concatMap, delay, map,Observable,of,scan } from "rxjs"; | ||
import { environment } from "src/environments/environment";; | ||
import {Component, Injectable , OnInit } from "@angular/core";; | ||
|
||
|
||
|
||
export class SimpleTableDBContext_Department_Table | ||
{ | ||
|
||
baseUrl:string = ''; | ||
constructor(cc: Partial<SimpleTableDBContext_Department_Table> | null = null) { | ||
|
||
if (cc != null) { | ||
// Object.keys(tilt).forEach((key) => { | ||
// (this as any)[key] = (tilt as any)[key]; | ||
// }); | ||
Object.assign(this,cc); | ||
} | ||
} | ||
|
||
public iddepartment : number = 0; | ||
public name : string = ''; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SimpleTableDBContext_Department_Table_Interaction { | ||
baseUrl:string = environment.url; | ||
constructor(private http: HttpClient) { | ||
} | ||
|
||
|
||
public getAllCount():Observable<number>{ | ||
|
||
var data=this.http.get<number>(this.baseUrl+'AdvancedSearch_SimpleTableDBContext_Department/GetAllCount') | ||
return data; | ||
} | ||
/* | ||
public getSearchSimple(searchData:SearchData ):Observable<SimpleTableDBContext_Department_Table[]>{ | ||
var url= this.baseUrl+'AdvancedSearch_SimpleTableDBContext_Department/'; | ||
url+=`GetSearchSimple?ColumnName=${searchData.ColumnName}&Operator=${searchData.Operator}&Value=${searchData.Value}`; | ||
var data=JsonStreamDecoder.fromFetchStream<SimpleTableDBContext_Department_Table>(url) | ||
.pipe( | ||
map(it=>new SimpleTableDBContext_Department_Table(it)), | ||
concatMap((x:SimpleTableDBContext_Department_Table,index:number)=>{ | ||
if((index+1) % 100 === 0) | ||
return of<SimpleTableDBContext_Department_Table>(x).pipe(delay(5*1000)); | ||
else | ||
return of<SimpleTableDBContext_Department_Table>(x); | ||
}), | ||
scan((acc:SimpleTableDBContext_Department_Table[],value:SimpleTableDBContext_Department_Table)=>[...acc, value] as SimpleTableDBContext_Department_Table[], [] as SimpleTableDBContext_Department_Table[]), | ||
); | ||
return data as Observable<SimpleTableDBContext_Department_Table[]>; | ||
} | ||
*/ | ||
public getAll():Observable<SimpleTableDBContext_Department_Table[]>{ | ||
//var data=ajax.getJSON(this.baseUrl+'AdvancedSearch_SimpleTableDBContext_Department/GetAll') | ||
//.pipe( | ||
// map(response => { | ||
// return response as SimpleTableDBContext_Department_Table[]; | ||
// }) | ||
// ); | ||
var data=JsonStreamDecoder.fromFetchStream<SimpleTableDBContext_Department_Table>(this.baseUrl+'AdvancedSearch_SimpleTableDBContext_Department/GetAll') | ||
.pipe( | ||
map(it=>new SimpleTableDBContext_Department_Table(it)), | ||
concatMap((x:SimpleTableDBContext_Department_Table,index:number)=>{ | ||
if((index+1) % 100 === 0) | ||
return of<SimpleTableDBContext_Department_Table>(x).pipe(delay(5*1000)); | ||
else | ||
return of<SimpleTableDBContext_Department_Table>(x); | ||
}), | ||
|
||
scan((acc:SimpleTableDBContext_Department_Table[],value:SimpleTableDBContext_Department_Table)=>[...acc, value] as SimpleTableDBContext_Department_Table[], [] as SimpleTableDBContext_Department_Table[]), | ||
|
||
); | ||
return data as Observable<SimpleTableDBContext_Department_Table[]>; | ||
|
||
} | ||
} | ||
//let inputValueSearch_Department = ''; | ||
@Component({ | ||
selector: 'app-tabledata-Department', | ||
//templateUrl: './Department-gui.component.html', | ||
template: `here will be {{nameTable}} from {{nameDB}} | ||
<span *ngIf="nrRecords!=null">Nr records: {{nrRecords}}</span> | ||
<p></p> | ||
<button mat-raised-button color="primary" (click)="showAllClickHandler()">Show all</button> | ||
<span *ngIf="dataTable!=null">Loaded {{dataTable!.length}} records</span> | ||
<div *ngIf="dataTable!=null"> | ||
<mat-table #table [dataSource]="dataSource!" matSort> | ||
<ng-container matColumnDef="rowIndex"> | ||
<th mat-header-cell *matHeaderCellDef> Index </th> | ||
<td mat-cell *matCellDef="let element;index as i;"> {{ i +1 }} </td> | ||
</ng-container> | ||
<ng-container matColumnDef="iddepartment"> | ||
<mat-header-cell *matHeaderCellDef mat-sort-header> IDDepartment </mat-header-cell> | ||
<mat-cell *matCellDef="let element"> {{element.iddepartment}} </mat-cell> | ||
</ng-container> | ||
<ng-container matColumnDef="name"> | ||
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell> | ||
<mat-cell *matCellDef="let element"> {{element.name}} </mat-cell> | ||
</ng-container> | ||
<mat-header-row *matHeaderRowDef="columns"></mat-header-row> | ||
<mat-row *matRowDef="let row; columns: columns;"></mat-row> | ||
</mat-table> | ||
`, | ||
//styleUrls: ['./Department-gui.component.css'] | ||
}) | ||
|
||
export class TableData_Department implements OnInit | ||
{ | ||
public nameTable = 'Department'; | ||
public nameDB = 'SimpleTableDBContext'; | ||
constructor(private interaction:SimpleTableDBContext_Department_Table_Interaction){ | ||
} | ||
public dataTable:SimpleTableDBContext_Department_Table[] | null = null; | ||
public dataTableFiltered:SimpleTableDBContext_Department_Table[] | null = null; | ||
public dataSource : MatTableDataSource<SimpleTableDBContext_Department_Table> | null = null; | ||
public nrRecords:number|null=null; | ||
ngOnInit(): void { | ||
this.interaction.getAllCount().subscribe(it=>{this.nrRecords=it;}); | ||
} | ||
public showAllClickHandler(){ | ||
this.interaction.getAll().subscribe( | ||
it=>{ | ||
this.dataTable=it; | ||
this.dataTableFiltered=it; | ||
this.dataSource=new MatTableDataSource(it); | ||
} | ||
|
||
); | ||
} | ||
|
||
public columns : string[] =[ | ||
|
||
'rowIndex' | ||
|
||
,'iddepartment' | ||
|
||
,'name' | ||
|
||
|
||
]; | ||
|
||
/* | ||
const filterData = (val: string, data: SimpleTableDBContext_Department_Table[]) => { | ||
if (val == null || val === '') { | ||
setDataTableFiltered(data); | ||
return; | ||
} | ||
if (data == null) { | ||
setDataTableFiltered(null); | ||
return; | ||
} | ||
val = val.toLowerCase(); | ||
var f = data.filter(it => { | ||
if (it.iddepartment != null) | ||
if (it.iddepartment.toString().toLowerCase().includes(val)) | ||
return true; | ||
if (it.name != null) | ||
if (it.name.toString().toLowerCase().includes(val)) | ||
return true; | ||
return false; | ||
}); | ||
setDataTableFiltered(f); | ||
} | ||
useEffect(()=>{ | ||
document.title = nameTable+" - "+nameDB; | ||
}) | ||
const [isLoadingNrRec, errorNrRect, nrRecords]= useRxObs(interaction.getAllCount()); | ||
const showAllClickHandler=()=>{ | ||
setDataTable(null); | ||
setLoading(true); | ||
interaction.getAll().subscribe({ | ||
next: (data:SimpleTableDBContext_Department_Table[])=>{ | ||
setDataTable(data); | ||
filterData(inputValueSearch_Department, data); | ||
}, | ||
complete:()=>{ setLoading(false);} | ||
} | ||
) | ||
}; | ||
const searchSimple=(searchData: SearchData)=>{ | ||
if(!searchData.IsValid()){ | ||
window.alert("Invalid search data"); | ||
return; | ||
} | ||
setDataTable(null); | ||
setLoading(true); | ||
interaction.getSearchSimple(searchData).subscribe({ | ||
next: (data:SimpleTableDBContext_Department_Table[])=>{ | ||
setDataTable(data); | ||
filterData(inputValueSearch_Department, data); | ||
}, | ||
complete:()=>{ setLoading(false);} | ||
} | ||
) | ||
}; | ||
useEffect(()=>{ | ||
if (typeof showAll==="boolean" && showAll){ | ||
showAllClickHandler(); | ||
} | ||
else{ | ||
//console.log('basd',searchSimpleData,searchSimpleData != null && typeof searchSimpleData !== "boolean" && searchSimpleData.IsValid()); | ||
if (searchSimpleData != null && typeof searchSimpleData !== "boolean" && searchSimpleData.IsValid()) | ||
searchSimple(searchSimpleData); | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
},[]); | ||
return ( | ||
<> | ||
Table {nameTable} | ||
{isLoadingNrRec && <Spin />} | ||
{errorNrRect && <> - error loading data </>} | ||
{nrRecords != null && <> - {nrRecords} records</>} | ||
<p></p> | ||
<Button type="primary" loading={loading} onClick={showAllClickHandler}>Load All Department</Button> | ||
<Link to="/Admin/Databases/SimpleTableDBContext/tables/Department/search/showall" target={"_blank"}>Direct Link</Link> | ||
<DatabaseTableSelector DBName={nameDB} TableName={nameTable} loadingData={loading} searchSimple={searchSimple} /> <div> | ||
{dataTable == null && "no data loaded"} | ||
{dataTable !=null && | ||
<> | ||
Number rows loaded {dataTable?.length} {loading && <Spin />} / filtered {dataTableFiltered?.length} / Search -{inputValueSearch_Department}- | ||
{true && | ||
<Input placeholder="SearchHere" onChange={(e) => { | ||
inputValueSearch_Department=(e.target.value); | ||
filterData(inputValueSearch_Department, dataTable!); | ||
} | ||
} /> | ||
} | ||
<Table pagination= {false} dataSource={dataTableFiltered!} columns={columns} />; | ||
</> | ||
} | ||
</div> | ||
</> | ||
) | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
...Models/ApplicationDBContext/Department.cs → ...Models/SimpleTableDBContext/Department.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.