optimize
wet 2 years ago
parent 2fad550ade
commit 2051c65ce3

@ -2711,17 +2711,15 @@ namespace Myshipping.Application
{ {
var value = string.Empty; var value = string.Empty;
if (order.PKGS!=null) { if (order.PKGS!=null) {
if (Convert.ToInt32(order.PKGS.ToString().Split('.')[1]) == 0) { if (order.PKGS.ToString().Split('.').Count() > 1)
value = order.PKGS.ToString().Split('.')[0]; {
value = string.Format("{0:F2}", order.PKGS);
} }
else { else {
value = string.Format("{0:F2}", order.PKGS); value = order.PKGS.ToString().Split('.')[0];
} }
} }
ICell cell = row.GetCell(_cellNum - 1); ICell cell = row.GetCell(_cellNum - 1);
if (cell != null) if (cell != null)
{ {
@ -2739,15 +2737,15 @@ namespace Myshipping.Application
var value = string.Empty; var value = string.Empty;
if (order.KGS != null) if (order.KGS != null)
{ {
if (Convert.ToInt32(order.KGS.ToString().Split('.')[1]) == 0) if (order.KGS.ToString().Split('.').Count() > 1)
{ {
value = order.KGS.ToString().Split('.')[0]; value = string.Format("{0:F2}", order.KGS);
} }
else else
{ {
value = string.Format("{0:F2}", order.KGS); value = order.KGS.ToString().Split('.')[0];
} }
} }
ICell cell = row.GetCell(_cellNum - 1); ICell cell = row.GetCell(_cellNum - 1);
if (cell != null) if (cell != null)
@ -2767,15 +2765,15 @@ namespace Myshipping.Application
var value = string.Empty; var value = string.Empty;
if (order.CBM != null) if (order.CBM != null)
{ {
if (Convert.ToInt32(order.CBM.ToString().Split('.')[1]) == 0) if (order.CBM.ToString().Split('.').Count() > 1)
{ {
value = order.CBM.ToString().Split('.')[0]; value = string.Format("{0:F2}", order.CBM);
} }
else else
{ {
value = string.Format("{0:F2}", order.CBM); value = order.CBM.ToString().Split('.')[0];
} }
} }
ICell cell = row.GetCell(_cellNum - 1); ICell cell = row.GetCell(_cellNum - 1);
if (cell != null) if (cell != null)

Loading…
Cancel
Save