本文整理汇总了C#中BLL.Dictionary类的典型用法代码示例。如果您正苦于以下问题:C# Dictionary类的具体用法?C# Dictionary怎么用?C# Dictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dictionary类属于BLL命名空间,在下文中一共展示了Dictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDataByBarcode
/// <summary>
/// 使用条码获取数据,可能返回OPListForSpecimen单个字符串、正常数据、“”;
/// </summary>
/// <param name="barcode">条码</param>
/// <returns>Json格式的字符串(包含有隐藏域文件)</returns>
public string GetDataByBarcode(string barcode)
{
//01.创建字典
Dictionary<string, string> oPListForSpecimen = new Dictionary<string, string>();
//02.调用方法获取数据并将数据转换成字典
oPListForSpecimen = GetOPListForSpecimenByBarcodeAndToDic(barcode);
string result = "";
if (oPListForSpecimen != null)//链接无错误
{
if (oPListForSpecimen.Count > 0)//有获取到数据
{
//03.调用方法将字典转换成JSON数据
if (oPListForSpecimen["KeepSpecimenSign"]=="N")
{
oPListForSpecimen["KeepSpecimenSign"] = "";
}
if (oPListForSpecimen.Keys.Contains("OPListForSpecimen"))
{
string value = "";
if (oPListForSpecimen.TryGetValue("OPListForSpecimen", out value))
{
result = "{\"OPListForSpecimen:\":\"" + value + "\"}";
}
}
else if (oPListForSpecimen.Count > 1)
{
// result = ConvertDicToJsonStr(oPListForSpecimen);
result = FpJsonHelper.DictionaryToJsonString(oPListForSpecimen);
}
}
}
return result;
}
示例2: AddTopic
public AddTopic()
{
InitializeComponent();
button1.BackColor = Color.FromArgb(255, 80, 151, 228);
button2.BackColor = Color.FromArgb(255, 80, 151, 228);
addDetail.BackColor = Color.FromArgb(255, 80, 151, 228);
delDetail.BackColor = Color.FromArgb(255, 80, 151, 228);
button1.ForeColor = Color.White;
button2.ForeColor = Color.White;
addDetail.ForeColor = Color.White;
delDetail.ForeColor = Color.White;
if (agreementService == null)
{
agreementService = AgreementService.getInstance();
}
if (strWheres == null)
{
strWheres = new Dictionary<string, string>();
}
topicCategory.Items.Clear();
topicCategory.DataSource = Bll.getAllCourses().Tables[0];
topicCategory.DisplayMember = "TCZ_NAME";
topicCategory.ValueMember = "TCZ_ID";
topicType.Items.Clear();
topicType.DataSource = Constant.getTopicType();
topicType.DisplayMember = "name";
topicType.ValueMember = "id";
}
示例3: abc
public string abc()
{
dt.Clear();
ProductAdminBLL bll = new ProductAdminBLL();
dt = bll.Categories();
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
return serializer.Serialize(rows);
}
示例4: ImportDataToFpAndRetunFpResult
/// <summary>
/// 提交数据到FP并返回FP处理的结果
/// </summary>
/// <param name="sampleSourceTypeName">样本源类型名称</param>
/// <param name="sampleSourceName">样本源名称</param>
/// <param name="patientId">样本源唯一标识</param>
/// <param name="sampleSourceDescription">样本源描述</param>
/// <param name="hiddenEncodeStr">隐藏域中的加密字段</param>
/// <returns></returns>
public string ImportDataToFpAndRetunFpResult(string sampleSourceTypeName, string sampleSourceName, string patientId, string sampleSourceDescription, string hiddenEncodeStr)
{
Dictionary<string, string> sampleSourceNameAndDesDic = sampleSouce.GetSampleSourceTypeNameAndDecToDic();
if (sampleSourceNameAndDesDic.Keys.Contains(sampleSourceTypeName))//系统中有此样本源
{
//01.接受前台页面发送回来的数据,并将数据转换成字典
Dictionary<string, string> oPListForSpecimenDic = new Dictionary<string, string>();
oPListForSpecimenDic = DecodeHiddenEncodeStr(hiddenEncodeStr);
if (oPListForSpecimenDic.Count > 0)//解码成功()
{
//02.获取用户自定义字段集合(根据指定的样本源类型名称)
//03.获取配置文件中的字段匹配字典
//04.根据用户自定义字段字典和字段匹配字典生成需要导入到Fp中的字段字典
Dictionary<string, string> sampleSourceFieldsDic = new Dictionary<string, string>();
sampleSourceFieldsDic = MathcSampleSourceFieldsWithConfigFile(sampleSourceTypeName, sampleSourceName, sampleSourceDescription, oPListForSpecimenDic);
//06.调用API提交数据到Fp
string result = sampleSouce.ImportSampleSourceDataToFp(sampleSourceTypeName, sampleSourceFieldsDic);
return result;
}
else
{
//解析前台页面中的隐藏数据失败(隐藏域数据解析错误?-->加密出错??-->数据来源错误?)
return "DecodError";
}
}
else
{
//样本源类型不存在
return "sampleSourceNameNotExist";
}
}
示例5: GetSingleValue
/// <summary> 查询单个字段的值(一般求最大,最小值)
/// <param name="opName">操作名</param>
/// <param name="tableName">表名</param>
/// <param name="field">单个查询字段</param>
/// <param name="orderBy">排序字段,多个以“,”分割</param>
/// </summary>
/// <returns>返回Value</returns>
public static string GetSingleValue(string opName, string currAccDbName, string tableName, string field, string where, string orderBy)
{
StringBuilder strBuilder = new StringBuilder();
strBuilder.Append("select " + field);
if (!string.IsNullOrEmpty(tableName))
{
strBuilder.Append(" from " + tableName);
if (!string.IsNullOrEmpty(where))
{
strBuilder.Append(" where " + where);
}
if (!string.IsNullOrEmpty(orderBy))
{
strBuilder.Append(" order by " + orderBy);
}
}
Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
UserIDOP userOp = new UserIDOP() { UserID = GlobalStaticObj_Server.Instance.UserID, OPName = opName };
string connString = LocalVariable.GetConnString(currAccDbName, ConfigConst.ConnectionStringReadonly);
object obj = DbCommon.Instance.ExecuteNonQueryReturnObjectNoTrans(connString, CommandType.Text, strBuilder.ToString(), dic, userOp);
if (obj == null)
{
return "";
}
return obj.ToString();
}
示例6: loadData
public void loadData(Dictionary<string, string> strWheres)
{
int startIndex = pageCtrl.StartIndex;
int pageSize = pageCtrl.PageSize;
DataSet ds = implCourses.getSounds(strWheres, startIndex, pageSize);
pageCtrl.bs.DataSource = ds.Tables[0];
}
示例7: GetReport
public string GetReport(Portfolio portfolio, IEnumerable<Category> categories, IEnumerable<CategoryWeight> weights)
{
var reportBuilder = new StringBuilder();
var quotes = GetQuotes(portfolio);
var valuesDict = CalculateValues(portfolio, quotes);
var weightsList = weights.ToList();
//DebugPrint(reportBuilder, valuesDict);
var total = valuesDict.Values.Where(v => v > 0M).Sum();
reportBuilder.AppendLine(string.Format("Portfolio: {0}", portfolio.Name));
foreach (var category in categories)
{
Dictionary<string, decimal> calculations = new Dictionary<string, decimal>();
foreach (var kvpair in valuesDict)
{
var weight = weightsList.Single(w => w.Security.Symbol.Equals(kvpair.Key) && w.Value.Category == category);
if (calculations.ContainsKey(weight.Value.Name))
calculations[weight.Value.Name] += kvpair.Value;
else
calculations.Add(weight.Value.Name, kvpair.Value);
}
reportBuilder.AppendLine(string.Format("\r\n{0}", category.Name));
foreach (var kvpair in calculations.OrderByDescending(kv => kv.Value))
{
reportBuilder.AppendLine(String.Format("{0}: {1:N1}%", kvpair.Key, kvpair.Value / total * 100M));
}
}
return reportBuilder.ToString();
}
示例8: CalculateValues
private static IDictionary<string, decimal> CalculateValues(Portfolio portfolio, IDictionary<string, decimal> quotes)
{
var results = new Dictionary<string, decimal>();
foreach (var account in portfolio.Accounts)
{
foreach (var position in account.Positions)
{
try
{
var price = quotes[position.Security.Symbol];
var value = price * position.Shares;
if (results.ContainsKey(position.Security.Symbol))
results[position.Security.Symbol] += value;
else
results.Add(position.Security.Symbol, value);
}
catch (KeyNotFoundException)
{
results.Add(position.Security.Symbol, -1M);
}
}
}
return results;
}
示例9: UpdateWith
// This method already feels like it needs to be broken up...
// Also needs to have atomicity added.
public void UpdateWith(IEnumerable<Transaction> transactions)
{
var transactionList = transactions.ToList();
if (transactionList.Any(t => !t.Valid()))
throw new Exception("One or more transactions are invalid.");
var updates = new Dictionary<Account, AccountUpdate>();
foreach (var transactionAccount in transactionList.Select(t => t.Account).Distinct())
{
var account = _portfolio.Accounts.Single(a => a.Name.Equals(transactionAccount.Name, StringComparison.InvariantCultureIgnoreCase));
var transactionsForAccount = transactionList.Where(t => t.Account.Name.Equals(account.Name, StringComparison.InvariantCultureIgnoreCase))
.OrderBy(t => t.Date);
var update = CalculateAccountUpdate(transactionsForAccount, account);
updates.Add(transactionAccount, update);
}
foreach (var kvPair in updates)
{
kvPair.Key.Positions = kvPair.Value.Positions;
kvPair.Key.Transactions = kvPair.Value.Transactions;
}
}
示例10: GetValues
private static IDictionary<DateTime, IDictionary<IDomainEntity, decimal>> GetValues(Portfolio portfolio, IDictionary<DateTime, IDictionary<string, decimal>> priceDates)
{
var results = new Dictionary<DateTime, IDictionary<IDomainEntity, decimal>>();
foreach (var date in priceDates.Keys)
{
var values = new Dictionary<IDomainEntity, decimal>();
results[date] = values;
var prices = priceDates[date];
foreach (var account in portfolio.Accounts)
{
foreach (var position in account.Positions)
{
try
{
var price = prices[position.Security.Symbol];
var value = price*position.Shares;
values.Add(position, value);
}
catch (KeyNotFoundException)
{
values.Add(position, -1M);
}
}
}
}
return results;
}
示例11: btnSummit_Click
/// <summary> 提交
/// </summary>
private void btnSummit_Click(object sender, EventArgs e)
{
errProvider.Clear();
try
{
if (string.IsNullOrEmpty(txtusername.Caption))
{
Validator.SetError(errProvider, txtusername, "请录入姓名");
return;
}
if (string.IsNullOrEmpty(txtoldpwd.Caption))
{
Validator.SetError(errProvider, txtoldpwd, "请录入旧密码");
return;
}
//Utility.Security.Secret.MD5(
if (txtoldpwd.Caption.Trim() != GlobalStaticObj_Server.Instance.PassWord)
{
Validator.SetError(errProvider, txtoldpwd, "旧密码验证错误,请录入正确的旧密码");
return;
}
if (string.IsNullOrEmpty(txtnewpwd.Caption))
{
Validator.SetError(errProvider, txtnewpwd, "请录入新密码");
return;
}
if (string.IsNullOrEmpty(txtnewpwd_again.Caption))
{
Validator.SetError(errProvider, txtnewpwd_again, "请再次录入新密码");
return;
}
if (txtnewpwd.Caption.Trim() != txtnewpwd_again.Caption.Trim())
{
Validator.SetError(errProvider, txtnewpwd_again, "两次录入新密码不一致");
return;
}
//string md5Pwd = Utility.Security.Secret.MD5(txtnewpwd.Caption.Trim());
Dictionary<string, string> dicFileds = new Dictionary<string, string>();
dicFileds.Add("land_name", txtloginid.Caption.Trim());
dicFileds.Add("password", txtnewpwd.Caption.Trim());
bool flag = DBHelper.Submit_AddOrEdit("修改用户名和密码", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_user", "user_id", GlobalStaticObj_Server.Instance.UserID, dicFileds);
if (flag)
{
GlobalStaticObj_Server.Instance.PassWord = txtnewpwd.Caption.Trim();
MessageBoxEx.ShowInformation("修改成功");
this.DialogResult = DialogResult.OK;
}
else
{
MessageBoxEx.ShowWarning("修改失败");
}
}
catch (Exception ex)
{
GlobalStaticObj_Server.GlobalLogService.WriteLog("个人设置", ex);
MessageBoxEx.ShowWarning("程序异常");
}
}
示例12: DeleteFactory
/// <summary>
/// 删除缓存
/// </summary>
/// <param name="billNumber">单据号</param>
/// <param name="billType">单据类型</param>
/// <param name="operate">操作类型</param>
public static void DeleteFactory(string billNumber, DataSources.EnumBillType billType, DataSources.EnumOperateObj operate)
{
string sql = "delete tb_factory_temp where [email protected] and [email protected] and [email protected]";
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("billNumber", billNumber);
dic.Add("billType", billType.ToString());
dic.Add("opType", operate.ToString("d"));
DBHelper.ExtNonQuery("删除云平台缓存", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sql, System.Data.CommandType.Text, dic);
}
示例13: UCOrganizeAddOrEdit_SaveEvent
/// <summary> 保存
/// </summary>
void UCOrganizeAddOrEdit_SaveEvent(object sender, EventArgs e)
{
if (this.cmbCompany.SelectedIndex == 0)
{
Validator.SetError(errProvider, cmbCompany, "请选择所属公司");
return;
}
if (tbCode.Caption.Length == 0)
{
Validator.SetError(errProvider, tbCode, "请填写组织编码");
return;
}
if (tbName.Caption.Length == 0)
{
Validator.SetError(errProvider, tbName, "请填写组织名称");
return;
}
Dictionary<string, string> dicFileds = new Dictionary<string, string>();
dicFileds.Add("com_id", this.cmbCompany.SelectedValue.ToString());
dicFileds.Add("parent_id", this.cmbOrganize.SelectedValue.ToString());
dicFileds.Add("org_code", this.tbCode.Caption.Trim());
dicFileds.Add("org_name", this.tbName.Caption.Trim());//公司全名
dicFileds.Add("contact_name", this.tbContract.Caption.Trim());//联系人
dicFileds.Add("contact_telephone", this.tbTelephone.Caption.Trim());
dicFileds.Add("remark", this.tbRemark.Caption.Trim());
dicFileds.Add("update_by", GlobalStaticObj_Server.Instance.UserID);
dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
string pkName = "";
string pkValue = "";
if (windowStatus == WindowStatus.Add)
{
dicFileds.Add("org_id", Guid.NewGuid().ToString());
dicFileds.Add("enable_flag", "1");//1为未删除状态
dicFileds.Add("status", DataSources.EnumStatus.Start.ToString("d"));//启用
dicFileds.Add("create_by", GlobalStaticObj_Server.Instance.UserID);
dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
}
else
{
pkName = "org_id";
pkValue = drRecord["org_id"].ToString();
}
bool bln = DBHelper.Submit_AddOrEdit("添加组织档案", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "tb_organization", pkName, pkValue, dicFileds);
if (bln)
{
MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
uc.BindData();
deleteMenuByTag(this.Tag.ToString(), uc.Name);
}
else
{
MessageBoxEx.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例14: DoSubCode
//已经关注的用户扫描二维码参数
public void DoSubCode(Dictionary<string, string> model)
{
SText mT = new SText();
mT.Content = ReadXml.Menu();
mT.FromUserName = ReadXml.ReadModel("ToUserName", model);
mT.ToUserName = ReadXml.ReadModel("FromUserName", model);
mT.MsgType = "text";
mT.CreateTime = long.Parse(ReadXml.ReadModel("CreateTime", model));
ReadXml.ResponseToEnd(DALWei.SendText(mT));
}
示例15: getAuthorityRelation
public static Dictionary<string, string> getAuthorityRelation()
{
Dictionary<string, string> authorityRelation = new Dictionary<string, string>();
DataTable dt = DAL.Authority.getAuthorityTable();
foreach (DataRow dr in dt.Rows)
{
authorityRelation.Add(dr[0].ToString(), dr[1].ToString());
}
return authorityRelation;
}