C#方法收藏:更新于2009-10-19
using System;
using System.Collections.Generic;
using System.Text;
namespace KuiDiPrint.tools.tableclass
{
class mytool
{
public mytool()
{ }
#region 四舍五入算法
/// <summary>
/// 四舍五入算法
/// </summary>
/// <param name="v">要进行处理的数据</param>
/// <param name="x">保留的小数位数</param>
/// <returns>四舍五入后的结果</returns>
public double Round(double v, int x)
{
bool isNegative = false;
//如果是负数
if (v < 0)
{
isNegative = true;
v = -v;
}
int IValue = 1;
for (int i = 1; i <= x; i++)
{
IValue = IValue * 10;
}
double Int = Math.Floor(v * IValue + 0.5);
v = Int / IValue;
if (isNegative)
{
v = -v;
}
return v;
}
public string printConvertKDpay(string kdpay)
{
string abcd_str = "";
switch (kdpay)
{
case "寄件人付現":
abcd_str = "A";
break;
case "收件人付現":
abcd_str = "B";
break;
case "寄件人月結":
abcd_str = "C";
break;
case "收件人月結":
abcd_str = "C";
break;
default:
abcd_str = "-";
break;
}
return abcd_str;
}
#endregion
}
}
using System.Collections.Generic;
using System.Text;
namespace KuiDiPrint.tools.tableclass
{
class mytool
{
public mytool()
{ }
#region 四舍五入算法
/// <summary>
/// 四舍五入算法
/// </summary>
/// <param name="v">要进行处理的数据</param>
/// <param name="x">保留的小数位数</param>
/// <returns>四舍五入后的结果</returns>
public double Round(double v, int x)
{
bool isNegative = false;
//如果是负数
if (v < 0)
{
isNegative = true;
v = -v;
}
int IValue = 1;
for (int i = 1; i <= x; i++)
{
IValue = IValue * 10;
}
double Int = Math.Floor(v * IValue + 0.5);
v = Int / IValue;
if (isNegative)
{
v = -v;
}
return v;
}
public string printConvertKDpay(string kdpay)
{
string abcd_str = "";
switch (kdpay)
{
case "寄件人付現":
abcd_str = "A";
break;
case "收件人付現":
abcd_str = "B";
break;
case "寄件人月結":
abcd_str = "C";
break;
case "收件人月結":
abcd_str = "C";
break;
default:
abcd_str = "-";
break;
}
return abcd_str;
}
#endregion
}
}
ubb变html _ubb转html (ubb2html)
增加一个编辑器!库的文件同部更新
