Core Docs

Cấu trúc dự án

Bạn chỉ cần làm việc trong TMS.UI. Đây là bản đồ những file/thư mục bạn sẽ đụng đến.

Bạn làm việc ở đâu?

99% thời gian bạn chỉ chạm vào TMS.UI/Business/. Phần còn lại của repo là framework — đừng sửa trừ khi thật sự cần.

E:\softek\coreui\
├── TMS.UI\              ← BẠN VIẾT CODE Ở ĐÂY
│   └── Business\        ← các màn hình của app

├── TMS.API\             ← backend của TMS app (DTO, controller)

├── Core\                ← framework FE (đừng đụng)
└── Core.API\            ← framework BE (đừng đụng)

TMS.UI/Business/ — quy ước thư mục

Mỗi domain = 1 thư mục. Bên trong đặt class *BL.cs cho mỗi màn hình:

TMS.UI/Business/
├── Authentication/
│   ├── LoginBL.cs
│   └── PolicyEditorBL.cs

├── Freight/                          ← domain "Vận chuyển"
│   ├── CoordinationContainerBL.cs    ← màn hình list điều phối container
│   ├── CoordinationTruckBL.cs        ← màn hình list điều phối xe
│   ├── DriverContainerDetailBL.cs    ← popup chi tiết tài xế-container
│   └── DriverTruckDetailBL.cs        ← popup chi tiết tài xế-xe

└── Menu/
    └── MenuBL.cs

Quy ước đặt tên: <Entity>BL.cs cho màn hình list (kế thừa TabEditor); <Entity>DetailBL.cs cho editor (kế thừa PopupEditor).

File 1 màn hình điển hình

using Core.Components.Forms;
using Core.Components.Extensions;
using Core.Components;
using TMS.API.Models;

namespace TMS.UI.Business.Freight
{
    public class CustomerListBL : TabEditor
    {
        public CustomerListBL() : base(nameof(Customer))
        {
            Title = "Khách hàng";
            Icon  = "icons/customers.png";
            DOMContentLoaded += AfterRendered;
        }

        private void AfterRendered()
        {
            // truy cập widget sau khi DOM sẵn sàng
            var grid = this.FindComponentByName<GridView>("Grid");
            if (grid != null) grid.DblClick = OnRowDblClick;
        }

        private void OnRowDblClick(object row)
        {
            var customer = (Customer)row;
            this.OpenTab("Customer_" + customer.Id, "CustomerEditor",
                () => new CustomerDetailBL { Entity = customer }, popup: true);
        }

        // Method được wire vào button có Events="ExportExcel" (config DB)
        public void ExportExcel(object arg)
        {
            // ...
        }
    }
}

Cấu hình DB — quản lý ở đâu?

Không phải ở source code. Truy cập trong app đang chạy:

Màn hình quản lýMục đích
Quản lý FeatureTạo/sửa row Feature (tên màn hình, icon, entity).
Detail FeatureTrong 1 feature: thêm/sửa ComponentGroup (section) + Component (field).
Quản lý MenuThêm menu trỏ vào class C# bạn viết.
Quản lý quyềnPhân quyền đọc/ghi cho mỗi row Feature/Component.

Cấu hình UI từ DB cho chi tiết các field.

Build & chạy

cd E:\softek\coreui\TMS.UI
dotnet build

dotnet build Bridge.NET compile C# ra JavaScript. File JS xuất ra static folder của TMS.API. Sau đó chạy backend TMS.API rồi mở browser → app.

Chạy dev / build chi tiết.

Bạn KHÔNG cần biết

Dưới đây là internals của framework — không nằm trong tài liệu này, không cần đọc để làm việc:

  • Core/Components/EditableComponent.cs — class cha của mọi widget.
  • Core/MVVM/Observable<T>, Html builder.
  • Core/Components/Forms/EditForm.cs — base của TabEditor/PopupEditor.
  • Bridge.NET runtime, vòng đời render, scoped CSS injection…

Khi cần feature mới mà framework chưa hỗ trợ → báo team Core, không tự sửa source Core/.

Core Docs · Astro · Core.API/wwwRoot/docs