|
|
using DSWeb.Common.DB;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace DSWeb.Common.Helper
|
|
|
{
|
|
|
public static class EnumHelper
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 获取枚举值的description文本
|
|
|
/// </summary>
|
|
|
/// <param name="type"></param>
|
|
|
/// <param name="strVal"></param>
|
|
|
/// <returns></returns>
|
|
|
public static string GetDescription(Type type, string strVal)
|
|
|
{
|
|
|
System.Reflection.FieldInfo field = type.GetField(strVal);
|
|
|
if (field != null)
|
|
|
{
|
|
|
var attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
|
|
|
if (attribute != null)
|
|
|
{
|
|
|
return attribute.Description;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return string.Empty;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取枚举所有项的名称(name)和显示文本(description)
|
|
|
/// </summary>
|
|
|
/// <param name="type"></param>
|
|
|
/// <returns></returns>
|
|
|
public static Dictionary<string, string> GetEnumList(Type type)
|
|
|
{
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
foreach (int val in Enum.GetValues(type))
|
|
|
{
|
|
|
string strName = Enum.GetName(type, val);//获取名称
|
|
|
string desp = GetDescription(type, strName);
|
|
|
dic.Add(strName, desp);
|
|
|
}
|
|
|
|
|
|
return dic;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static class ModelHelper
|
|
|
{
|
|
|
public static ch_fee_md getchfeeHelper() {
|
|
|
var feeShou = new ch_fee_md();
|
|
|
//2021-12-31,要求下列字段不能为空,填写0或false
|
|
|
feeShou.COMMISSIONRATE = 0;
|
|
|
feeShou.AUDITSTATUS = 0;
|
|
|
feeShou.LINENUM = 0;
|
|
|
feeShou.ISDEBIT = false;
|
|
|
feeShou.ISOPEN = false;
|
|
|
feeShou.ACCTAXRATE = 0;
|
|
|
feeShou.ISVOU = false;
|
|
|
feeShou.TAX = 0;
|
|
|
feeShou.PREAMOUNT = 0;
|
|
|
feeShou.ISACC = false;
|
|
|
feeShou.CUSTDUI = false;
|
|
|
|
|
|
feeShou.SETTLEMENT = 0;
|
|
|
feeShou.ORDERAMOUNT = 0;
|
|
|
feeShou.ORDERINVOICE = 0;
|
|
|
feeShou.ORDERINVSETTLEMENT = 0;
|
|
|
feeShou.ORDERSETTLEMENT = 0;
|
|
|
feeShou.INVOICE = 0;
|
|
|
feeShou.TAXRATE = 0;
|
|
|
feeShou.ISADVANCEDPAY = false;
|
|
|
feeShou.ISINVOICE = false;
|
|
|
feeShou.ISCRMORDERFEE = false;
|
|
|
feeShou.TAXUNITPRICE = 0;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
feeShou.NOTAXAMOUNT = 0;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
|
|
|
return feeShou;
|
|
|
}
|
|
|
}
|
|
|
}
|