Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
The most significant changes involve the introduction of a new list o…
Browse files Browse the repository at this point in the history
…f `Cell` objects named `cells`, the modification of the `timestamp` row to append the entire `cells` list, and the alteration of the `data` list in the `record` processing section to contain `Cell` objects instead of `OpenXmlElement` objects. Additionally, the `data` list now adds a new `Cell` object containing a dash ("-") when the `record` does not contain any comments.

1. The `ExportOrder` method in the `AdminHub` class has been updated with new author information and a version number change from `1.0.0` to `1.1.0`.
2. A new list of `Cell` objects named `cells` has been added, initialized with a `Cell` object containing the string "AwaiShop", followed by five `Cell` objects containing a space character, and a `Cell` object containing a timestamp string.
3. The `timestamp` row now appends the entire `cells` list instead of a single `Cell` object. A new `divider` row has been added, which appends a `Cell` object containing a space character.
4. The `data` list in the `record` processing section now contains `Cell` objects instead of `OpenXmlElement` objects. The `Cell` objects are created using the new keyword without specifying the class name, a feature of C# 9.0 and later.
5. The `data` list now adds new `Cell` objects using the new keyword without specifying the class name. This change has been applied to all instances where a new `Cell` object is added to the `data` list.
6. The `data` list now adds a new `Cell` object containing a dash ("-") when the `record` does not contain any comments. This change has been applied to the `else` branch of the `if` statement that checks for comments in the `record`.
  • Loading branch information
Aloento committed Feb 8, 2024
1 parent dce40a1 commit 207e560
Show file tree
Hide file tree
Showing 3 changed files with 1,013 additions and 54 deletions.
54 changes: 38 additions & 16 deletions SoarCraft.AwaiShop/AdminHub/Order/Export.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal partial class AdminHub {
* <remarks>
* @author Aloento
* @since 1.2.0
* @version 1.0.0
* @version 1.1.0
* </remarks>
*/
public async IAsyncEnumerable<byte[]> ExportOrder() {
Expand All @@ -57,11 +57,33 @@ public async IAsyncEnumerable<byte[]> ExportOrder() {
};
sheets.Append(sheet);

var cells = new List<Cell>(7) {
new() {
DataType = CellValues.String,
CellValue = new(nameof(AwaiShop))
}
};

for (var i = 0; i < 5; i++)
cells.Add(new() {
DataType = CellValues.String,
CellValue = new(" ")
});

cells.Add(new() {
DataType = CellValues.String,
CellValue = new($"This order sheet was exported on {DateTime.Now:yyyy-MM-dd HH:mm}")
});

var timestamp = new Row();
sheetData.AppendChild(timestamp);
timestamp.Append(new Cell {
timestamp.Append(cells);

var divider = new Row();
sheetData.AppendChild(divider);
divider.Append(new Cell {
DataType = CellValues.String,
CellValue = new($"This order sheet was exported on {DateTime.Now:yyyy-MM-dd HH:mm}")
CellValue = new(" ")
});

var headerRow = new Row();
Expand Down Expand Up @@ -106,16 +128,16 @@ public async IAsyncEnumerable<byte[]> ExportOrder() {
var combo = record.Combo;
var currId = order.OrderId;

var data = new List<OpenXmlElement>(12) {
new Cell {
var data = new List<Cell>(12) {
new() {
DataType = CellValues.Number,
CellValue = new((decimal)currId)
},
new Cell {
new() {
DataType = CellValues.String,
CellValue = new(order.CreateAt.ToString("yyyy-MM-dd HH:mm"))
},
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(combo.Product.Name))
}
Expand All @@ -133,15 +155,15 @@ public async IAsyncEnumerable<byte[]> ExportOrder() {
.ToString();

data.AddRange([
new Cell {
new() {
DataType = CellValues.String,
CellValue = new(types)
},
new Cell {
new() {
DataType = CellValues.Number,
CellValue = new((decimal)record.Quantity)
},
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(order.Status.ToString()))
}
Expand All @@ -158,19 +180,19 @@ public async IAsyncEnumerable<byte[]> ExportOrder() {
});

data.AddRange([
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(user.Name))
},
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(user.EMail))
},
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(user.Phone))
},
new Cell {
new() {
DataType = CellValues.SharedString,
CellValue = new(shared(user.Address))
}
Expand All @@ -192,12 +214,12 @@ public async IAsyncEnumerable<byte[]> ExportOrder() {
})
.ToString();

data.Add(new Cell {
data.Add(new() {
DataType = CellValues.String,
CellValue = new(cmts)
});
} else
data.Add(new Cell {
data.Add(new() {
DataType = CellValues.String,
CellValue = new("-")
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"update": "npx npm-check-updates -u"
},
"dependencies": {
"@azure/msal-browser": "^3.7.1",
"@azure/msal-common": "^14.6.1",
"@azure/msal-react": "^2.0.10",
"@azure/msal-browser": "^3.9.0",
"@azure/msal-common": "^14.7.0",
"@azure/msal-react": "^2.0.11",
"@fluentui/react-components": "^9.46.4",
"@fluentui/react-hooks": "^8.6.36",
"@fluentui/react-icons": "^2.0.226",
Expand All @@ -40,7 +40,7 @@
"@microsoft/signalr-protocol-msgpack": "^8.0.0",
"ahooks": "^3.7.10",
"dayjs": "^1.11.10",
"dexie": "^3.2.4",
"dexie": "^3.2.5",
"dexie-react-hooks": "^1.1.7",
"lexical": "0.10.0",
"lodash-es": "^4.17.21",
Expand All @@ -57,6 +57,6 @@
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react-swc": "^3.6.0",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"vite": "^5.1.0"
}
}
Loading

0 comments on commit 207e560

Please sign in to comment.