修改金额
This commit is contained in:
166
NX.ERP.U8/Account/Accinformation.cs
Normal file
166
NX.ERP.U8/Account/Accinformation.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Dapper;
|
||||
namespace NX.ERP.U8.Account
|
||||
{
|
||||
|
||||
|
||||
public class Accinfo
|
||||
{
|
||||
private string name;
|
||||
private string caption;
|
||||
private string value;
|
||||
|
||||
public string Name { get => name; set => name = value; }
|
||||
public string Caption { get => caption; set => caption = value; }
|
||||
public string Value { get => value; set => this.value = value; }
|
||||
}
|
||||
public class Accinformation
|
||||
{
|
||||
|
||||
private IDictionary<string, Accinfo> Infos;
|
||||
private void LoadFormation()
|
||||
{
|
||||
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||
{
|
||||
var strSql = "SELECT cname as name,ccaption as caption,cvalue as value FROM accinformation WITH(NOLOCK) WHERE cname IN ('iQuanDecDgt','iExchRateDecDgt','iNumDecDgt','iRateDecDgt','iPriceDecDgt','iCurrencyDigits','iStrsPriDecDgt','iStrsQuanDecDgt','iVolumeDecDgt','iWeightDecDgt','iKLPoint','iBillPrice')";
|
||||
var list = conn.Query<Accinfo>(strSql, null);
|
||||
this.Infos = new Dictionary<string, Accinfo>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
Infos.Add(item.Name, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
public int BillPrice
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iBillPrice"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int iExchRateDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iExchRateDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int NumDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iNumDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
public int StrsPriDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iStrsPriDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int StrsQuanDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iStrsQuanDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int VolumeDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iVolumeDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
public int iWeightDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iWeightDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int iCurrencyDigits
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iCurrencyDigits"));
|
||||
}
|
||||
}
|
||||
public int PriceDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iPriceDecDgt"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int QuanDecDgt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iQuanDecDgt"));
|
||||
}
|
||||
}
|
||||
public int KLPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.Parse(GetValue("iKLPoint"));
|
||||
}
|
||||
}
|
||||
private string GetValue(string Name)
|
||||
{
|
||||
if (this.Infos == null)
|
||||
{
|
||||
this.LoadFormation();
|
||||
}
|
||||
if (Infos.TryGetValue(Name, out var accinfo))
|
||||
{
|
||||
return accinfo.Value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public double FormatMoney(double currMoney)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Math.Round(currMoney, this.iCurrencyDigits);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public decimal FormatMoney(decimal currMoney)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Math.Round(currMoney, this.iCurrencyDigits);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user