using BaseOUDAL;
using YLErp.DBModels.Consts;
using YLErp.Helpers;
using YLErp.Model.Enum;
using YLErp.Models;
using YLErp.Modules.ReportModule;
namespace YLErp.Modules.SystemModule
{
//自ylerpweb项目移入
///
/// 客户数据Model
///
public class ClientDataModelV1
{
public static List GetAllOpenClient(bool isContainClosed = false)
{
var query = DataCacheProvider.GetClientDataSource().AsQueryable();
query = isContainClosed
? query.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户")
: query.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠");
return query.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
public static List GetAllOpenClientNumber(bool isContainClosed = false)
{
var query = DataCacheProvider.GetClientDataSource().AsQueryable();
query = isContainClosed
? query.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户")
: query.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠");
return query.Select(m => new SelectItem
{
Text = m.Number,
Value = m.id.ToString()
}).ToList();
}
public static List GetAllOpenaccountClient(int? parentId, int excludeId = 0)
{
var query = DataCacheProvider.GetClientDataSource().AsQueryable();
if (query.Count() == 0)
{
query = DbContextFactory.GetClientDbContext(null).client;
}
query = query.Where(s => s.ProcessStatus == "已开户");
if (excludeId > 0)
{
query = query.Where(s => s.id != excludeId);
}
var res = query.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
if (parentId.HasValue && parentId != 0 && !res.Any(c => c.Value == parentId.ToString()))
{
var parentdata = DataCacheProvider.GetClientDataSource().GetData(parentId ?? 0);
res.Add(new SelectItem { Text = parentdata.Name, Value = parentdata.id.ToString() });
}
return res;
}
public static string GetParentName(int? clientid)
{
if (clientid == null || clientid < 1)
{
return null;
}
using (var db = DbContextFactory.GetClientDbContext(null))
{
return db.client.Where(m => m.id == clientid).Select(m => m.Name).FirstOrDefault();
}
}
public static List GetAllClient()
{
var clients = DataCacheProvider.GetClientDataSource().AsQueryable()
.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户");
return clients.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
public static List GetAllTrsClient()
{
var clients = DataCacheProvider.GetClientDataSource().AsQueryable()
.Where(s => (s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户")&&s.BusinessUseType=="1");
return clients.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
public static List GetAllTrsClient(int accountId)
{
using var yldb = DbContextFactory.GetYLDbContext();
var clients = DataCacheProvider.GetClientDataSource().AsQueryable()
.Where(s => (s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户") && s.BusinessUseType == "1");
var accountClients = yldb.trs_account_manage_detail.Where(x => x.account_id != accountId).AsNoTracking().Select(s => s.client_id).ToList();
clients = clients.Where(x => !accountClients.Contains(x.id));
return clients.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
///
/// 获取变更字段列表
///
///
public static List GetChangeColumnList()
{
List list = new List();
list.Add(new SelectItem { Text = "客户名称", Value = "客户名称" });
return list;
}
public static List GetAllSellclient()
{
//接受高风险服务的客户被认为是卖方
return DataCacheProvider.GetClientDataSource().AsQueryable()
.Where(s => (s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠") && s.RiskServiceDegree == 5)
.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
public static List GetAllClientOrderByNumber()
{
return DataCacheProvider.GetClientDataSource().AsQueryable()
.Where(s => s.ProcessStatus == "已开户" || s.ProcessStatus == "已休眠" || s.ProcessStatus == "已销户")
.OrderBy(c => c.Number)
.Select(m => new SelectItem
{
Text = m.Name,
Value = m.id.ToString()
}).ToList();
}
///
/// 只显示“全部”“已开户”“已销户”“已休眠”
///
public static List GetProcessStatusForQuery()
{
return new List
{
new SelectItem{ Text = "全部", Value = "全部" },
new SelectItem{ Text = "已开户", Value = "已开户" },
new SelectItem{ Text = "已销户", Value = "已销户" },
new SelectItem{ Text = "已休眠", Value = "已休眠" }
};
}
///
/// 只显示“全部”“未提交”“未开户”
///
public static List GetPendingStatusForQuery()
{
return new List
{
new SelectItem { Text = "全部", Value = "全部" },
new SelectItem { Text = "未提交", Value = "未提交" },
new SelectItem { Text = "未开户", Value = "未开户" },
};
}
///
/// 只显示“全部”“未开户”“已销户”
///
public static List GetPendingAppprovalStatusForQuery()
{
return new List
{
new SelectItem { Text = "全部", Value = "全部" },
new SelectItem { Text = "未开户", Value = "未开户" },
new SelectItem { Text = "已销户", Value = "已销户" }
};
}
public static List GetApprovalStatusForQuery()
{
return new List
{
new SelectItem { Text = "全部", Value = "全部" },
new SelectItem { Text = "无", Value = "无" },
new SelectItem { Text = "审批中", Value = "审批中" },
new SelectItem { Text = "已拒绝", Value = "已拒绝" },
new SelectItem { Text = "审批通过", Value = "审批通过" }
};
}
public static List GetOpenApprovalStatusForQuery()
{
return new List
{
new SelectItem { Text = "全部", Value = "全部" },
new SelectItem { Text = "无", Value = "无" },
new SelectItem { Text = "审批中", Value = "审批中" },
new SelectItem { Text = "已拒绝", Value = "已拒绝" }
};
}
///
/// 权益类签署版本
///
public static List getSignTypes()
{
return BLL.DictionaryBLL.GetList("权益类签署版本", false);
}
///
/// 文件类型
///
public static List getFileTypes()
{
return BLL.DictionaryBLL.GetList("文件类型", false);
}
///
///
///
public static List getMainProtocols(int ClientId, List clients = null, List selectItems = null)
{
using (var clientdb = DbContextFactory.GetClientDbContext(null))
{
if (selectItems == null)
{
selectItems = new List();
}
if (PS.Config.Is东莞)
{
clients = new List();
if (clients.Contains(ClientId))
{
return selectItems;
}
clients.Add(ClientId);
selectItems.AddRange(getMainProtocolsByClientId(ClientId));
var client = clientdb.client.Where(l => l.id == ClientId).FirstOrDefault();
if (client != null && client.ParentId > 0)
{
return getMainProtocols(client.ParentId, clients, selectItems);
}
else
{
return selectItems;
}
}
else
{
selectItems.AddRange(getMainProtocolsByClientId(ClientId));
return selectItems;
}
}
}
public static List getMainProtocolsByClientId(int ClientId)
{
using (var clientdb = DbContextFactory.GetClientDbContext(null))
{
var mainProtocals = clientdb.client_file.Where(o => o.ApprovalOrder < 1 && ClientId == o.ClientId
&& o.FileTypeName == ConsGlobal.ClientFileType.MainProtocol
&& o.OptState != ConsReport.OptFlagsEnum.D && o.IsValid)
.Select(O => O.ProtocolNumber).ToArray();
return mainProtocals.Where(n => !string.IsNullOrWhiteSpace(n)).Select(n => new SelectItem { Value = n, Text = n }).ToList();
}
}
public static List getSideProtocols(string mainProtocol)
{
var sideProtocalNumbers = new List();
using (var clientdb = new ClientDBContext())
{
var mainProtocols = clientdb.client_file.Where(o => o.ApprovalOrder < 1 && o.FileTypeName == ConsGlobal.ClientFileType.EnhanceProtocol && o.OptState != ConsReport.OptFlagsEnum.D && o.IsValid).Select(O => new { O.ProtocolNumber, O.MainProtocolNumber });
if (!string.IsNullOrWhiteSpace(mainProtocol))
{
mainProtocols = mainProtocols.Where(o => o.MainProtocolNumber == mainProtocol && o.ProtocolNumber != null && o.ProtocolNumber != "");
}
sideProtocalNumbers.AddRange(mainProtocols.Select(o => o.ProtocolNumber));
}
return sideProtocalNumbers;
}
public static List PendingMarginCallPaymentStatus()
{
return new List
{
new SelectItem { Value = "0", Text = "正常" },
new SelectItem { Value = "1", Text = "冻结" }
};
}
public static List GetAllCustomerNature()
{
return new List {
new SelectItem
{
Text = CustomerNatureEnum.期货风险管理子公司.ToString(),
Value = ((int)CustomerNatureEnum.期货风险管理子公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.证券公司.ToString(),
Value = ((int)CustomerNatureEnum.证券公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.保险公司.ToString(),
Value = ((int)CustomerNatureEnum.保险公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.公募基金.ToString(),
Value = ((int)CustomerNatureEnum.公募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.私募基金.ToString(),
Value = ((int)CustomerNatureEnum.私募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.商业银行.ToString(),
Value = ((int)CustomerNatureEnum.商业银行).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.投资公司.ToString(),
Value = ((int)CustomerNatureEnum.投资公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.产业客户.ToString(),
Value = ((int)CustomerNatureEnum.产业客户).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.自然人.ToString(),
Value = ((int)CustomerNatureEnum.自然人).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.其他.ToString(),
Value = ((int)CustomerNatureEnum.其他).ToString()
}
};
}
public static List GetCustomerNatureByClientType(string clientType)
{
if (clientType == ClientTypeEnum.机构.ToString() || string.IsNullOrWhiteSpace(clientType))
{
return new List {
new SelectItem
{
Text = CustomerNatureEnum.期货风险管理子公司.ToString(),
Value = ((int)CustomerNatureEnum.期货风险管理子公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.证券公司.ToString(),
Value = ((int)CustomerNatureEnum.证券公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.保险公司.ToString(),
Value = ((int)CustomerNatureEnum.保险公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.公募基金.ToString(),
Value = ((int)CustomerNatureEnum.公募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.私募基金.ToString(),
Value = ((int)CustomerNatureEnum.私募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.商业银行.ToString(),
Value = ((int)CustomerNatureEnum.商业银行).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.投资公司.ToString(),
Value = ((int)CustomerNatureEnum.投资公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.产业客户.ToString(),
Value = ((int)CustomerNatureEnum.产业客户).ToString(),
Selected = true
},
new SelectItem
{
Text = CustomerNatureEnum.其他.ToString(),
Value = ((int)CustomerNatureEnum.其他).ToString()
}
};
}
else if (clientType == ClientTypeEnum.产品.ToString())
{
return new List {
new SelectItem
{
Text = CustomerNatureEnum.证券公司.ToString(),
Value = ((int)CustomerNatureEnum.证券公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.保险公司.ToString(),
Value = ((int)CustomerNatureEnum.保险公司).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.公募基金.ToString(),
Value = ((int)CustomerNatureEnum.公募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.私募基金.ToString(),
Value = ((int)CustomerNatureEnum.私募基金).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.商业银行.ToString(),
Value = ((int)CustomerNatureEnum.商业银行).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.其他.ToString(),
Value = ((int)CustomerNatureEnum.其他).ToString()
}
};
}
else
{
return new List {
new SelectItem
{
Text = CustomerNatureEnum.自然人.ToString(),
Value = ((int)CustomerNatureEnum.自然人).ToString()
},
new SelectItem
{
Text = CustomerNatureEnum.其他.ToString(),
Value = ((int)CustomerNatureEnum.其他).ToString()
}
};
}
}
public static string GetCustomerNatureName(int? CustomerNature)
{
return CustomerNature == null ? "" : System.Enum.Parse(typeof(CustomerNatureEnum), CustomerNature.Value.ToString()).ToString();
}
///
/// 交易目的
///
public static List GetAllTransactionTarget()
{
var AllTransactionTarget = new List {
new SelectItem
{
Text = TransactionTargetEnum.投资.ToString(),
Value = TransactionTargetEnum.投资.ToString()
},
new SelectItem
{
Text = TransactionTargetEnum.套利.ToString(),
Value = TransactionTargetEnum.套利.ToString()
},
new SelectItem
{
Text = TransactionTargetEnum.套保.ToString(),
Value = TransactionTargetEnum.套保.ToString()
},
new SelectItem
{
Text = TransactionTargetEnum.风险管理.ToString(),
Value = TransactionTargetEnum.风险管理.ToString()
}
};
if (PS.Config.Company == Configuration.CompanyEnum.海通)
{
AllTransactionTarget.Add(new SelectItem
{
Text = TransactionTargetEnum.投机.ToString(),
Value = TransactionTargetEnum.投机.ToString()
});
}
else if (PS.Config.Company == Configuration.CompanyEnum.海通)
{
AllTransactionTarget.Add(AllTransactionTarget[0]);
AllTransactionTarget[0] = new SelectItem
{
Text = TransactionTargetEnum.投机.ToString(),
Value = TransactionTargetEnum.投机.ToString()
};
}
return AllTransactionTarget;
}
public static string GetTransactionTarget(int? transactionTarget)
{
if (transactionTarget == 1)
{
return "投资";
}
if (transactionTarget == 2)
{
return "套利";
}
if (transactionTarget == 3)
{
return "套保";
}
if (transactionTarget == 4)
{
return "投机";
}
return null;
}
public static List GetAllFundsSource()
{
var AllFundsSource = new List {
new SelectItem
{
Text = FundsSourceEnum.自有.ToString(),
Value = ((int)FundsSourceEnum.自有).ToString()
},
new SelectItem
{
Text = FundsSourceEnum.其他.ToString(),
Value = ((int)FundsSourceEnum.其他).ToString()
}
};
return AllFundsSource;
}
public static string GetFundsSource(int? fundsSource)
{
if (fundsSource == 1)
{
return "自有";
}
if (fundsSource == 2)
{
return "其他";
}
return null;
}
public static string GetIsRealControl(int? isRealControl)
{
if (isRealControl == 1)
{
return "是";
}
if (isRealControl == 2)
{
return "否";
}
return null;
}
///
/// 投资经验
///
public static List GetAllInvestmentTerm()
{
return new List
{
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(InvestmentTermEnum.partone),
Value = ((int)InvestmentTermEnum.partone).ToString()
},
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(InvestmentTermEnum.parttwo),
Value = ((int)InvestmentTermEnum.parttwo).ToString()
},
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(InvestmentTermEnum.partthree),
Value = ((int)InvestmentTermEnum.partthree).ToString()
},
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(InvestmentTermEnum.partfour),
Value = ((int)InvestmentTermEnum.partfour).ToString()
}
};
}
public static List GetAllInvestmentExperience()
{
return new List
{
new SelectItem
{
Text = InvestmentExperienceEnum.有限.ToString(),
Value = InvestmentExperienceEnum.有限.ToString()
},
new SelectItem
{
Text = InvestmentExperienceEnum.一般.ToString(),
Value = InvestmentExperienceEnum.一般.ToString()
},
new SelectItem
{
Text = InvestmentExperienceEnum.丰富.ToString(),
Value = InvestmentExperienceEnum.丰富.ToString()
},
new SelectItem
{
Text = InvestmentExperienceEnum.非常丰富.ToString(),
Value = InvestmentExperienceEnum.非常丰富.ToString()
}
};
}
public static List GetAllRiskPreference()
{
return new List
{
new SelectItem
{
Text = RiskPreferenceEnum.低风险.ToString(),
Value = RiskPreferenceEnum.低风险.ToString()
},
new SelectItem
{
Text = RiskPreferenceEnum.中风险.ToString(),
Value = RiskPreferenceEnum.中风险.ToString()
},
new SelectItem
{
Text = RiskPreferenceEnum.高风险.ToString(),
Value = RiskPreferenceEnum.高风险.ToString()
}
};
}
public static List GetAllRuleT0orT1()
{
return new List
{
new SelectItem
{
Text = "T+0",
Value = "T+0"
},
new SelectItem
{
Text = "T+1",
Value = "T+1"
}
};
}
public static string GetInvestment(int? InvestmentTerm)
{
if (InvestmentTerm == 1)
{
return "0年-1年";
}
if (InvestmentTerm == 2)
{
return "1年-5年";
}
if (InvestmentTerm == 3)
{
return "5年以上";
}
return null;
}
public static string GetMarginOptionTypeName(int? marginOptionType)
{
if (marginOptionType == (int)MarginOptionEnum.单向追保)
{
return MarginOptionEnum.单向追保.ToString();
}
if (marginOptionType == (int)MarginOptionEnum.双向追保)
{
return MarginOptionEnum.双向追保.ToString();
}
if (marginOptionType == (int)MarginOptionEnum.对手方单向追保)
{
return MarginOptionEnum.对手方单向追保.ToString();
}
if (marginOptionType == (int)MarginOptionEnum.其他)
{
return MarginOptionEnum.其他.ToString();
}
return null;
}
public static List GetMarginOptionType()
{
return new List {
new SelectItem
{
Text = MarginOptionEnum.单向追保.ToString(),
Value = ((int)MarginOptionEnum.单向追保).ToString()
},
new SelectItem
{
Text = MarginOptionEnum.双向追保.ToString(),
Value = ((int)MarginOptionEnum.双向追保).ToString()
},
new SelectItem
{
Text = MarginOptionEnum.对手方单向追保.ToString(),
Value = ((int)MarginOptionEnum.对手方单向追保).ToString()
},
new SelectItem
{
Text = MarginOptionEnum.其他.ToString(),
Value = ((int)MarginOptionEnum.其他).ToString()
}
};
}
///
/// 交易种类
///
public static List GetAllDerivativesInvestmentVarieties()
{
return new List {
new SelectItem
{
Text = DerivativesInvestmentVarietiesEnum.场外互换.ToString(),
Value = ((int)DerivativesInvestmentVarietiesEnum.场外互换).ToString()
}
};
}
public static string GetDerivativesInvestmentVarieties(int? derivativesInvestmentVarieties)
{
if (derivativesInvestmentVarieties == 1)
{
return "场外期权";
}
if (derivativesInvestmentVarieties == 2)
{
return "场外互换";
}
if (derivativesInvestmentVarieties == 3)
{
return "远期";
}
if (derivativesInvestmentVarieties == 4)
{
return "其他";
}
return null;
}
///
///
///
public static List GetAllExpectedReturn()
{
return new List {
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(ExpectedReturnEnum.partone),
Value = ((int)ExpectedReturnEnum.partone).ToString()
},
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(ExpectedReturnEnum.parttwo),
Value = ((int)ExpectedReturnEnum.parttwo).ToString()
},
new SelectItem
{
Text = EnumHelper.GetDescriptionByName(ExpectedReturnEnum.partthree),
Value = ((int)ExpectedReturnEnum.partthree).ToString()
}
};
}
public static string GetExpectedReturn(int? expectedReturn)
{
if (expectedReturn == 1)
{
return "5%-10%";
}
if (expectedReturn == 2)
{
return "10%-50%";
}
if (expectedReturn == 3)
{
return "50%以上";
}
return null;
}
///
/// 不良诚信记录
///
public static List GetAllBadFaithRecord()
{
return new List {
new SelectItem
{
Text = BadFaithRecordEnum.无.ToString(),
Value = ((int)BadFaithRecordEnum.无).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.中国人民银行征信中心.ToString(),
Value = ((int)BadFaithRecordEnum.中国人民银行征信中心).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.最高人民法院失信被执行人名单.ToString(),
Value = ((int)BadFaithRecordEnum.最高人民法院失信被执行人名单).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.工商行政管理机构.ToString(),
Value = ((int)BadFaithRecordEnum.工商行政管理机构).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.税务管理机构.ToString(),
Value = ((int)BadFaithRecordEnum.税务管理机构).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.监管机构.ToString(),
Value = ((int)BadFaithRecordEnum.监管机构).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.自律组织.ToString(),
Value = ((int)BadFaithRecordEnum.自律组织).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.其他组织.ToString(),
Value = ((int)BadFaithRecordEnum.其他组织).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.投资者在期货经营机构从事投资活动时产生的违约失信行为记录.ToString(),
Value = ((int)BadFaithRecordEnum.投资者在期货经营机构从事投资活动时产生的违约失信行为记录).ToString()
},
new SelectItem
{
Text = BadFaithRecordEnum.过度维权等不当行为信息.ToString(),
Value = ((int)BadFaithRecordEnum.过度维权等不当行为信息).ToString()
}
};
}
public static string GetBadFaithRecord(int? badFaithRecord)
{
if (badFaithRecord == 1)
{
return "无";
}
if (badFaithRecord == 2)
{
return "中国人民银行征信中心";
}
if (badFaithRecord == 3)
{
return "最高人民法院失信被执行人名单";
}
if (badFaithRecord == 4)
{
return "工商行政管理机构";
}
if (badFaithRecord == 5)
{
return "税务管理机构";
}
if (badFaithRecord == 6)
{
return "监管机构";
}
if (badFaithRecord == 7)
{
return "自律组织";
}
if (badFaithRecord == 8)
{
return "其他组织";
}
if (badFaithRecord == 9)
{
return "投资者在期货经营机构从事投资活动时产生的违约失信行为记录";
}
if (badFaithRecord == 10)
{
return "过度维权等不当行为信息";
}
return null;
}
public static List GetAppropriatenessDegree()
{
return new List {
new SelectItem
{
Text = AppropriatenessDegreeEnum.C1.ToString(),
Value = ((int)AppropriatenessDegreeEnum.C1).ToString()
},
new SelectItem
{
Text = AppropriatenessDegreeEnum.C2.ToString(),
Value = ((int)AppropriatenessDegreeEnum.C2).ToString()
},
new SelectItem
{
Text = AppropriatenessDegreeEnum.C3.ToString(),
Value = ((int)AppropriatenessDegreeEnum.C3).ToString()
},
new SelectItem
{
Text = AppropriatenessDegreeEnum.C4.ToString(),
Value = ((int)AppropriatenessDegreeEnum.C4).ToString()
},
new SelectItem
{
Text = AppropriatenessDegreeEnum.C5.ToString(),
Value = ((int)AppropriatenessDegreeEnum.C5).ToString()
}
};
}
public static string GetAppropriatenessDegree(int? appropriatenessDegree)
{
if (appropriatenessDegree == 1)
{
return "C1";
}
if (appropriatenessDegree == 2)
{
return "C2";
}
if (appropriatenessDegree == 3)
{
return "C3";
}
if (appropriatenessDegree == 4)
{
return "C4";
}
if (appropriatenessDegree == 5)
{
return "C5";
}
return null;
}
public static List GetRiskServiceDegree()
{
return new List {
new SelectItem
{
Text = RiskServiceDegreeEnum.R1.ToString(),
Value = ((int)RiskServiceDegreeEnum.R1).ToString()
},
new SelectItem
{
Text = RiskServiceDegreeEnum.R2.ToString(),
Value = ((int)RiskServiceDegreeEnum.R2).ToString()
},
new SelectItem
{
Text = RiskServiceDegreeEnum.R3.ToString(),
Value = ((int)RiskServiceDegreeEnum.R3).ToString()
},
new SelectItem
{
Text = RiskServiceDegreeEnum.R4.ToString(),
Value = ((int)RiskServiceDegreeEnum.R4).ToString()
},
new SelectItem
{
Text = RiskServiceDegreeEnum.R5.ToString(),
Value = ((int)RiskServiceDegreeEnum.R5).ToString()
}
};
}
public static string GetRiskServiceDegree(int? riskServiceDegree)
{
if (riskServiceDegree == 1)
{
return "R1";
}
if (riskServiceDegree == 2)
{
return "R2";
}
if (riskServiceDegree == 3)
{
return "R3";
}
if (riskServiceDegree == 4)
{
return "R4";
}
if (riskServiceDegree == 5)
{
return "R5";
}
return null;
}
public static List GetYesOrNoItems(bool forBooleanValue = false)
{
if (forBooleanValue)
{
return new List {
new SelectItem { Text = "是", Value = "True" },
new SelectItem { Text = "否", Value = "False" }
};
}
return new List {
new SelectItem { Text = "是", Value = "1" },
new SelectItem { Text = "否", Value = "0" }
};
}
public static List GetYesOrNo()
{
return new List {
new SelectItem { Text = "否", Value = "0" },
new SelectItem { Text = "是", Value = "1" }
};
}
public static string GetYesOrNo(bool isEvaluate)
{
return isEvaluate ? "是" : "否";
}
public static string GetYesOrNo(int? isEvaluate)
{
return isEvaluate == 1 ? "是" : "否";
}
///
/// 适当性评估人
///
public static List GetAppropriatenessAssessor(bool checkStatus = true)
{
var appropriatenessAssessor = RoleRight.GetSystemUserByFunction("担任适当性评估人", checkStatus);
return appropriatenessAssessor != null && appropriatenessAssessor.Any()
? appropriatenessAssessor.Select(x => new SelectItem { Text = x.Name, Value = x.Id.ToString() }).ToList()
: new List();
}
///
/// 适当性评估人
///
public static string GetAppropriatenessAssessorName(int id)
{
using (var db = DbContextFactory.GetErpBaseContext())
{
return db.SystemUsers.FirstOrDefault(x => x.Id == id)?.Name ?? string.Empty;
}
}
public static List GetAllCustomerManager()
{
using (var db = DbContextFactory.GetErpBaseContext())
{
var customerManager = db.SystemUsers.Where(a => a.State == 0 && (a.AccountPost & (int)AccountPostEnum.客户经理) > 0).AsQueryable();
if (customerManager.Any())
{
return customerManager.Select(a => new SelectItem { Text = a.Name, Value = a.Id.ToString() }).ToList();
}
else
{
return new List();
}
}
}
///
/// 获取所有卖方权利金交割日类型
///
public static List GetAllSellerRightDeliveryDayType()
{
return new List
{
new SelectItem { Text = "交易日", Value = "0" },
new SelectItem { Text = "行权日", Value = "1" }
};
}
public static List GetAllLicenseType()
{
return new List
{
new SelectItem {
Text = LicenseTypeEnum.营业执照.ToString(),
Value = LicenseTypeEnum.营业执照.ToString()
},
new SelectItem {
Text = LicenseTypeEnum.产品编号.ToString(),
Value = LicenseTypeEnum.产品编号.ToString()
},
new SelectItem {
Text = LicenseTypeEnum.身份证.ToString(),
Value = LicenseTypeEnum.身份证.ToString()
}
};
}
public static List GetAllInstitutionalAttributes()
{
return new List
{
new SelectItem {
Text = InstitutionalAttributesEnum.国有.ToString(),
Value = InstitutionalAttributesEnum.国有.ToString()
},
new SelectItem {
Text = InstitutionalAttributesEnum.民营.ToString(),
Value = InstitutionalAttributesEnum.民营.ToString()
},
new SelectItem {
Text = InstitutionalAttributesEnum.外商.ToString(),
Value = InstitutionalAttributesEnum.外商.ToString()
},
new SelectItem {
Text = InstitutionalAttributesEnum.其他.ToString(),
Value = InstitutionalAttributesEnum.其他.ToString()
}
};
}
public static List GetAllClientType()
{
var AllClientType = new List
{
new SelectItem {
Text = ClientTypeEnum.机构.ToString(),
Value = ClientTypeEnum.机构.ToString()
},
new SelectItem {
Text = ClientTypeEnum.产品.ToString(),
Value = ClientTypeEnum.产品.ToString()
}
};
if (PS.Config.Is国泰君安)
{
AllClientType.Add(new SelectItem
{
Text = ClientTypeEnum.自然人.ToString(),
Value = ClientTypeEnum.自然人.ToString()
});
}
return AllClientType;
}
//评估有效期
//增加扩展项时,请同步去ClientLinqExtendService.GetEvaluateDate()方法中增加解析case;
public static List GetEvaluateOfValidity()
{
return new List
{
new SelectItem { Text = "3个月", Value = "3个月" },
new SelectItem { Text = "6个月", Value = "6个月" },
new SelectItem { Text = "12个月", Value = "12个月" },
new SelectItem { Text = "长期", Value = "长期" }
};
}
//适当性客户分类
public static List GetProperClientClass()
{
if (PS.Config.Is方顿)
{
return new List
{
new SelectItem {
Text = ProperClientClassEnum.特殊专业投资者.ToString(),
Value = ProperClientClassEnum.特殊专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.一般专业投资者.ToString(),
Value = ProperClientClassEnum.一般专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.经转化的专业投资者.ToString(),
Value = ProperClientClassEnum.经转化的专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.普通投资者.ToString(),
Value = ProperClientClassEnum.普通投资者.ToString()
}
};
}
return new List
{
new SelectItem {
Text = ProperClientClassEnum.金融机构专业投资者.ToString(),
Value = ProperClientClassEnum.金融机构专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.一般机构专业投资者.ToString(),
Value = ProperClientClassEnum.一般机构专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.自然人专业投资者.ToString(),
Value = ProperClientClassEnum.自然人专业投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.一般机构普通投资者.ToString(),
Value = ProperClientClassEnum.一般机构普通投资者.ToString()
},
new SelectItem {
Text = ProperClientClassEnum.自然人普通投资者.ToString(),
Value = ProperClientClassEnum.自然人普通投资者.ToString()
}
};
}
///
/// 个人客户风险承受能力等级
///
public static List GetEndureLevel()
{
return new List
{
new SelectItem { Text = "C1", Value = "C1" },
new SelectItem { Text = "C2", Value = "C2" },
new SelectItem { Text = "C3", Value = "C3" },
new SelectItem { Text = "C4", Value = "C4" },
new SelectItem { Text = "C5", Value = "C5" },
};
}
public static List GetAppropriatenessList()
{
using (var basedb = DbContextFactory.GetErpBaseContext())
{
var query = from dic in basedb.Dictionaries
join items in basedb.DictionaryItems on dic.Id equals items.DictId
where dic.Name == "适当性评级"
select new SelectItem
{
Text = items.Name,
Value = items.IndexNum.ToString()
};
return query.ToList();
}
}
public static List GetAllInvestorType()
{
return new List {
new SelectItem
{
Text = InvestorTypeEnum.工业.ToString(),
Value = ((int)InvestorTypeEnum.工业).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.农业.ToString(),
Value = ((int)InvestorTypeEnum.农业).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.商业贸易.ToString(),
Value = ((int)InvestorTypeEnum.商业贸易).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.多元化集团公司.ToString(),
Value = ((int)InvestorTypeEnum.多元化集团公司).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.房地产.ToString(),
Value = ((int)InvestorTypeEnum.房地产).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.投资或咨询公司.ToString(),
Value = ((int)InvestorTypeEnum.投资或咨询公司).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.财务公司.ToString(),
Value = ((int)InvestorTypeEnum.财务公司).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.信托.ToString(),
Value = ((int)InvestorTypeEnum.信托).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.保险公司.ToString(),
Value = ((int)InvestorTypeEnum.保险公司).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.证券集合理财.ToString(),
Value = ((int)InvestorTypeEnum.证券集合理财).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.证券自营.ToString(),
Value = ((int)InvestorTypeEnum.证券自营).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.基金专户理财.ToString(),
Value = ((int)InvestorTypeEnum.基金专户理财).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.封闭式基金.ToString(),
Value = ((int)InvestorTypeEnum.封闭式基金).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.QFII.ToString(),
Value = ((int)InvestorTypeEnum.QFII).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.保本基金.ToString(),
Value = ((int)InvestorTypeEnum.保本基金).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.证券定向理财.ToString(),
Value = ((int)InvestorTypeEnum.证券定向理财).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.开放式基金_不包括ETF.ToString(),
Value = ((int)InvestorTypeEnum.开放式基金_不包括ETF).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.ETF.ToString(),
Value = ((int)InvestorTypeEnum.ETF).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.企业年金.ToString(),
Value = ((int)InvestorTypeEnum.企业年金).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.社保基金.ToString(),
Value = ((int)InvestorTypeEnum.社保基金).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.银行自营.ToString(),
Value = ((int)InvestorTypeEnum.银行自营).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.银行理财.ToString(),
Value = ((int)InvestorTypeEnum.银行理财).ToString()
},
new SelectItem
{
Text = InvestorTypeEnum.期货风险管理子公司.ToString(),
Value = ((int)InvestorTypeEnum.期货风险管理子公司).ToString()
}
};
}
///
/// 客户等级
///
public static List GetAllclientlevel(int selectedId = 0)
{
var ClientLevels = DataCacheProvider.GetClientLevelDataSource().AsQueryable()
.Where(n => n.ValidState != ConsGlobal.InValid)
.Select(n => new SelectItem
{
Text = n.LevelName,
Value = n.id + "",
Selected = selectedId == n.id
}).ToList();
if (ClientLevels.Count == 0)
{
ClientLevels = DbContextFactory.GetClientDbContext(null).clientlevel.AsQueryable()
.Where(n => n.ValidState != ConsGlobal.InValid)
.Select(n => new SelectItem
{
Text = n.LevelName,
Value = n.id + "",
Selected = selectedId == n.id
}).ToList();
}
return ClientLevels;
}
public static List GetAllCurrency()
{
using (var db = DbContextFactory.GetYLDbContext())
{
var list = new List();
var currencyCodes = db.currency.Select(o => o.CurrencyCode);
foreach (var item in currencyCodes)
{
list.Add(new SelectItem
{
Value = item,
Text = item
});
}
return list;
}
}
///
/// 客户等级名称
///
public static string GetLevelName(int? id)
{
if (id == null || id < 1)
{
return null;
}
using (var db = DbContextFactory.GetClientDbContext(null))
{
return db.clientlevel.Where(m => m.id == id.Value).Select(m => m.LevelName).FirstOrDefault();
}
}
public static List GetClearingAgency()
{
var result = new List();
foreach (var item in ConsReport.ClearingAgencyMap)
{
if (item.Key != "甲方" && item.Key != "乙方")
{
result.Add(new SelectItem() { Text = item.Key, Value = item.Key });
}
}
return result;
}
///
/// 适当性评估过期状态
///
public static List GetAssessmentExpiredStatusForQuery()
{
return new List
{
new SelectItem{ Text = "全部", Value = "" },
new SelectItem{ Text = "30日内过期", Value = "30" },
new SelectItem{ Text = "已过期", Value = "1" },
};
}
///
/// 互换对冲方式
///
public static List GetSwapHedgingType()
{
return new List
{
new SelectItem { Text = "全部", Value = "" },
new SelectItem { Text = "手动对冲", Value = "0" },
new SelectItem { Text = "自动对冲", Value = "1" },
};
}
///
/// 交易种类
///
public static List GetAllDerivativesInvestmentVarietiesForCredit()
{
return new List {
new SelectItem
{
Text = DerivativesInvestmentVarietiesEnum.场外互换.ToString(),
Value = ((int)DerivativesInvestmentVarietiesEnum.场外互换).ToString()
}
};
}
///
/// 互换类型
///
public static List GetSwapTypes()
{
return new List {
new SelectItem
{
Text = SwapTypeEnum.普通.ToString(),
Value = SwapTypeEnum.普通.ToString()
},
new SelectItem
{
Text = SwapTypeEnum.多空组合.ToString(),
Value = SwapTypeEnum.多空组合.ToString()
}
};
}
///
/// 电子盘登录用户名称列表
///
public static List GetAllClientUserNames(int selectedId = 0)
{
using (var db = DbContextFactory.GetClientDbContext(null))
{
return db.ClientUser.Select(t => new SelectItem
{
Text = t.LoginName,
Value = t.LoginName,
Selected = selectedId == t.id
}).ToList();
}
}
///
/// 审批组
///
///
public static List GetApprovalgroups()
{
using (var db = DbContextFactory.GetErpBaseContext())
{
return db.approvalgroups.Select(n => new SelectItem
{
Text = n.groupName,
Value = n.id + "",
}).ToList();
}
}
}
}