本文整理汇总了C#中BLL.Dictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Add方法的具体用法?C# Dictionary.Add怎么用?C# Dictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLL.Dictionary
的用法示例。
在下文中一共展示了Dictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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("程序异常");
}
}
示例2: 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);
}
示例3: Add
/// <summary> 添加日志
/// </summary>
/// <param name="item"></param>
/// <param name="currAccDbName"></param>
/// <returns></returns>
public static bool Add(UserFunctionOPLog item, string currAccDbName)
{
Dictionary<string, string> DicParam = new Dictionary<string, string>();
DicParam.Add("user_id", item.userOP.UserID);
DicParam.Add("u_f_log_id", System.Guid.NewGuid().ToString());
DicParam.Add("com_id", item.com_id);
DicParam.Add("access_time", item.access_time.ToString());
DicParam.Add("fun_id", item.fun_id.ToString());
return DBHelper.Submit_AddLog("添加用户菜单日志", currAccDbName, "tl_user_function_log", "", "", DicParam);
}
示例4: BindDropTypeList
public void BindDropTypeList()
{
Dictionary<string, string> list = new Dictionary<string, string>();
list.Add("限时购", "1");
list.Add("正常商品", "2");
typeList.DataSource = list;
typeList.DataValueField = "value";
typeList.DataTextField = "key";
typeList.DataBind();
}
示例5: 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;
}
}
示例6: 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);
}
示例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: ReadRecord
/// <summary>
/// 从XML文件中读取记录
/// </summary>
public static Dictionary<int, string[]> ReadRecord(string filePath)
{
Dictionary<int, string[]> his = new Dictionary<int, string[]>();
if (File.Exists(PATH))
{
XDocument xd = XDocument.Load(PATH);
//Enumerable
var query = xd.DescendantNodes().Where(e =>
{
XElement xel = e as XElement;
if (xel != null)
{
XElement word = xel.Element("word");
XElement meaning = xel.Element("meaning");
XAttribute id = xel.Attribute("id");
if (word != null && meaning != null && id != null)
{
return true;
}
}
return false;
});
foreach (XElement xe in query)
{
his.Add(Convert.ToInt32(xe.Attribute("id").Value), new string[] { xe.Element("word").Value, xe.Element("meaning").Value });
}
}
return his;
}
示例9: 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;
}
示例10: Save
public IList<DJ_ProductRoute> Save()
{
int dayNo = Convert.ToInt32(lblDayNo.Text);
Dictionary<EnterpriseType, IList<string>> entDictionary = new Dictionary<EnterpriseType, IList<string>>();
List<string> entNames = new List<string>();
foreach (RepeaterItem item in rptEditScenics.Items)
{
if (!entDictionary.ContainsKey(EnterpriseType.景点))
{
entDictionary.Add(EnterpriseType.景点, new List<string>());
}
TextBox tbxScenic = item.FindControl("tbxEntEdit") as TextBox;
string scenicName = CommonLibrary.StringHelper.TrimAll(tbxScenic.Text);
entDictionary[EnterpriseType.景点].Add(scenicName);
entNames.Add(scenicName);
}
foreach (RepeaterItem itemHotel in rptEditHotels.Items)
{
if (!entDictionary.ContainsKey(EnterpriseType.宾馆))
{
entDictionary.Add(EnterpriseType.宾馆, new List<string>());
}
TextBox tbxHotel = itemHotel.FindControl("tbxEntEdit") as TextBox;
string hotelName = CommonLibrary.StringHelper.TrimAll(tbxHotel.Text);
entDictionary[EnterpriseType.宾馆].Add(hotelName);
entNames.Add(hotelName);
}
string errMsg;
Routes.Clear();
IList<DJ_ProductRoute> routes = bllDJRoute.CreateRouteFromNameList(dayNo, entDictionary, out errMsg);
foreach (DJ_ProductRoute pj in routes)
{
Routes.Add(pj);
}
RoutesChangedEventArgs args = new RoutesChangedEventArgs();
args.ProductRoutes = Routes;
OnRoutesChanged(args);
LoadData();
return Routes;
}
示例11: btnSaveRoute_Click
protected void btnSaveRoute_Click(object sender, EventArgs e)
{
int dayNo =Convert.ToInt32( rblDayNo.Text);
Dictionary<EnterpriseType, IList<string>> entDictionary = new Dictionary<EnterpriseType, IList<string>>();
List<string> entNames = new List<string>();
foreach (RepeaterItem item in rptEditScenics.Items)
{
if (!entDictionary.ContainsKey(EnterpriseType.景点))
{
entDictionary.Add(EnterpriseType.景点, new List<string>());
}
TextBox tbxScenic = item.FindControl("tbxEntEdit") as TextBox;
string scenicName = CommonLibrary.StringHelper.TrimAll(tbxScenic.Text);
entDictionary[EnterpriseType.景点].Add(scenicName);
entNames.Add(scenicName);
}
foreach (RepeaterItem itemHotel in rptEditHotels.Items)
{
if (!entDictionary.ContainsKey(EnterpriseType.宾馆))
{
entDictionary.Add(EnterpriseType.宾馆, new List<string>());
}
TextBox tbxHotel = itemHotel.FindControl("tbxEntEdit") as TextBox;
string hotelName = CommonLibrary.StringHelper.TrimAll(tbxHotel.Text);
entDictionary[EnterpriseType.宾馆].Add(hotelName);
entNames.Add(hotelName);
}
string errMsg;
bllRoute.SaveFromNameList(CurrentGroup, dayNo, entDictionary, out errMsg);
bllGroup.Save(CurrentGroup);
LoadData();
pnlEditRoute.Visible = false;
if (string.IsNullOrEmpty(errMsg))
{
errMsg = "操作成功";
}
ShowNotification(errMsg);
//ScriptManager.RegisterStartupScript(this, this.GetType(), "s", "alert('" + lblMsg_SaveRoute.Text + "')", true);
// btnAddRoute.Visible = true;
}
示例12: Add
/// <summary> 添加文件日志
/// </summary>
/// <param name="item"></param>
/// <param name="currAccDbName"></param>
/// <returns></returns>
public static bool Add(UserFileOPLog item, string currAccDbName)
{
Dictionary<string, string> DicParam = new Dictionary<string, string>();
DicParam.Add("ClientUserID", item.userOP.UserID);
DicParam.Add("OPName", item.userOP.OPName);
DicParam.Add("LogID", System.Guid.NewGuid().ToString());
DicParam.Add("FileName", item.FileName.Replace('\'', '"'));
DicParam.Add("FilePath", item.FilePath.Replace('\'', '"'));
DicParam.Add("sTimeTicks", item.sTimeTicks.ToString());
DicParam.Add("eTimeTicks", item.eTimeTicks.ToString());
DicParam.Add("exeResult", item.exeResult ? "1" : "0");
return DBHelper.Submit_AddLog("添加文件日志", currAccDbName, "tl_ClientUserFile", "", "", DicParam);
}
示例13: Add
/// <summary> 添加日志
/// </summary>
/// <param name="item"></param>
/// <param name="currAccDbName"></param>
/// <returns></returns>
public static bool Add(UserOPLog item, string currAccDbName)
{
Dictionary<string, string> DicParam = new Dictionary<string, string>();
DicParam.Add("ClientUserID", item.userOP.UserID);
DicParam.Add("OPName", item.userOP.OPName);
DicParam.Add("LogID", System.Guid.NewGuid().ToString());
DicParam.Add("SQLStr", item.sqlStr.Replace('\'','"'));
DicParam.Add("paramsStr", item.sqlParams.Replace('\'', '"'));
DicParam.Add("OPTime", item.timeTicks.ToString());
DicParam.Add("exeResult", item.exeResult ? "1" : "0");
return DBHelper.Submit_AddLog("添加日志", currAccDbName, "tl_ClientUser", "", "", DicParam);
}
示例14: CalculateValues
private static IDictionary<IDomainEntity, decimal> CalculateValues(Portfolio portfolio, IDictionary<string, decimal> quotes)
{
var results = new Dictionary<IDomainEntity, 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;
results.Add(position, value);
}
catch (KeyNotFoundException)
{
results.Add(position, -1M);
}
}
}
return results;
}
示例15: UserLogin
public static DataSet UserLogin(LoginInput loginO, string currAccDbName, string IPStr)
{
Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
ParamObj paraO1 = new ParamObj();
paraO1.name = "land_name";
paraO1.size = 40;
paraO1.type = SysDbType.VarChar;
paraO1.value = loginO.username;
ParamObj paraO2 = new ParamObj();
paraO2.name = "password";
paraO2.size = 40;
paraO2.type = SysDbType.VarChar;
paraO2.value = loginO.pwd;
ParamObj paraO3 = new ParamObj();
paraO3.name = "login_time";
paraO3.type = SysDbType.BigInt;
paraO3.value = System.DateTime.Now.ToUniversalTime().Ticks;
ParamObj paraO4 = new ParamObj();
paraO4.name = "computer_ip";
paraO4.size = 40;
paraO4.type = SysDbType.VarChar;
paraO4.value = IPStr;
ParamObj paraO5 = new ParamObj();
paraO5.name = "computer_name";
paraO5.size = 40;
paraO5.type = SysDbType.NVarChar;
paraO5.value = loginO.ComputerName;
ParamObj paraO6 = new ParamObj();
paraO6.name = "computer_mac";
paraO6.size = 40;
paraO6.type = SysDbType.VarChar;
paraO6.value = loginO.MAC;
ParamObj paraO7 = new ParamObj();
paraO7.name = "login_Id";
paraO7.size = 40;
paraO7.type = SysDbType.VarChar;
paraO7.value = loginO.Login_Id;
dic.Add("land_name", paraO1);
dic.Add("password", paraO2);
dic.Add("login_time", paraO3);
dic.Add("computer_ip", paraO4);
dic.Add("computer_name", paraO5);
dic.Add("computer_mac", paraO6);
dic.Add("login_Id", paraO7);
SQLObj sqlObj = new SQLObj();
sqlObj.cmdType = System.Data.CommandType.StoredProcedure;
sqlObj.sqlString = "ServerUserLogin";
sqlObj.Param = dic;
DataSet ds = DBHelper.GetDataSet("服务器端用户登录", currAccDbName, sqlObj);
return ds;
}