本文整理汇总了C#中Model.Dictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Add方法的具体用法?C# Dictionary.Add怎么用?C# Dictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model.Dictionary
的用法示例。
在下文中一共展示了Dictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UCSalePlanView_SaveEvent
void UCSalePlanView_SaveEvent(object sender, EventArgs e)
{
try
{
gvPurchasePlanList.EndEdit();
List<SysSQLString> listSql = new List<SysSQLString>();
SysSQLString sysStringSql = new SysSQLString();
sysStringSql.cmdType = CommandType.Text;
Dictionary<string, string> dic = new Dictionary<string, string>();//参数
string sql1 = string.Format(@" Update tb_parts_sale_plan Set [email protected]_suspend,[email protected]_reason,[email protected]_by,
[email protected]_name,[email protected]_time,[email protected],[email protected]_name where [email protected]_plan_id;");
dic.Add("is_suspend", chkis_suspend.Checked ? "0" : "1");//选中(中止):0,未选中(不中止):1
dic.Add("suspend_reason", txtsuspend_reason.Caption.Trim());
dic.Add("update_by", GlobalStaticObj.UserID);
dic.Add("update_name", GlobalStaticObj.UserName);
dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
dic.Add("operators", GlobalStaticObj.UserID);
dic.Add("operator_name", GlobalStaticObj.UserName);
dic.Add("sale_plan_id", planId);
sysStringSql.sqlString = sql1;
sysStringSql.Param = dic;
listSql.Add(sysStringSql);
foreach (DataGridViewRow dr in gvPurchasePlanList.Rows)
{
string is_suspend = "1";
if (dr.Cells["is_suspend"].Value == null)
{ is_suspend = "1"; }
if ((bool)dr.Cells["is_suspend"].EditedFormattedValue)
{ is_suspend = "0"; }
else
{ is_suspend = "1"; }
sysStringSql = new SysSQLString();
sysStringSql.cmdType = CommandType.Text;
dic = new Dictionary<string, string>();
dic.Add("is_suspend", is_suspend);
dic.Add("sale_plan_id", planId);
dic.Add("parts_code", dr.Cells["parts_code"].Value.ToString());
string sql2 = "Update tb_parts_sale_plan_p set [email protected]_suspend where [email protected]_plan_id and [email protected]_code;";
sysStringSql.sqlString = sql2;
sysStringSql.Param = dic;
listSql.Add(sysStringSql);
}
if (DBHelper.BatchExeSQLStringMultiByTrans("修改采购计划单", listSql))
{
MessageBoxEx.Show("保存成功!");
uc.BindgvSalePlanList();
deleteMenuByTag(this.Tag.ToString(), uc.Name);
}
else
{
MessageBoxEx.Show("保存失败!");
}
}
catch (Exception ex)
{
MessageBoxEx.Show("操作失败!");
}
}
示例2: QueryMain
/// <summary>
/// 查询主表
/// </summary>
public JsonResult QueryMain(string OrderNoOrGoodsCode, DateTime CheckTimeS, DateTime CheckTimeE)
{
int page = int.Parse(Request["page"].ToString());
int rows = int.Parse(Request["rows"].ToString());
int total = 0;
VenderUser model = (VenderUser)Session["UserInfo"];
string where = " rt.flag in(20 ,40,90,100) ";//and rt.venderid=" + model.VENDERID;
//管理员测试数据放开
if (model.VUSERCODE != "system")
{
where += " and rt.venderid=" + model.VENDERID;
}
if (!string.IsNullOrEmpty(OrderNoOrGoodsCode))
{
where += " and rt.sheetid='" + OrderNoOrGoodsCode + "'";
}
if (CheckTimeS != null)
{
where += " and rt.EditDate> to_date('" + CheckTimeS + "','yyyy-mm-dd hh24:mi:ss')";
}
if (CheckTimeE != null)
{
where += " and rt.EditDate< to_date('" + CheckTimeE + "','yyyy-mm-dd hh24:mi:ss')";
}
BPurchaseOut ogc = new BPurchaseOut();
var result = ogc.GetPurchaseInMain(page, rows, out total, where);
Dictionary<string, object> json = new Dictionary<string, object>();
json.Add("total", total);
json.Add("rows", result);
return Json(json, JsonRequestBehavior.AllowGet);
}
示例3: UCPurchasePlanOrderView_InvalidOrActivationEvent
/// <summary> 激活/作废
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void UCPurchasePlanOrderView_InvalidOrActivationEvent(object sender, EventArgs e)
{
string strmsg = string.Empty;
List<SysSQLString> listSql = new List<SysSQLString>();
SysSQLString sysStringSql = new SysSQLString();
sysStringSql.cmdType = CommandType.Text;
Dictionary<string, string> dic = new Dictionary<string, string>();//参数
dic.Add("purchase_order_yt_id", purchase_order_yt_id);//单据ID
dic.Add("update_by", GlobalStaticObj.UserID);//修改人Id
dic.Add("update_name", GlobalStaticObj.UserName);//修改人姓名
dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());//修改时间
if (orderstatus != Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
{
strmsg = "作废";
dic.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString());//单据状态编号
dic.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.Invalid, true));//单据状态名称
}
else
{
strmsg = "激活";
string order_status = string.Empty;
string order_status_name = string.Empty;
DataTable dvt = DBHelper.GetTable("获得宇通采购订单的前一个状态", "tb_parts_purchase_order_2_BackUp", "order_status,order_status_name", "purchase_order_yt_id='" + purchase_order_yt_id + "'", "", "order by update_time desc");
if (dvt != null && dvt.Rows.Count > 0)
{
DataRow dr = dvt.Rows[0];
order_status = CommonCtrl.IsNullToString(dr["order_status"]);
if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
{
DataRow dr1 = dvt.Rows[1];
order_status = CommonCtrl.IsNullToString(dr1["order_status"]);
order_status_name = CommonCtrl.IsNullToString(dr1["order_status_name"]);
}
}
order_status = !string.IsNullOrEmpty(order_status) ? order_status : Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString();
if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString())
{ order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true); }
else if (order_status == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
{ order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true); }
dic.Add("order_status", order_status);//单据状态
dic.Add("order_status_name", order_status_name);//单据状态名称
}
sysStringSql.sqlString = "update tb_parts_purchase_order_2 set [email protected]_status,[email protected]_status_name,[email protected]_by,[email protected]_name,[email protected]_time where [email protected]_order_yt_id";
sysStringSql.Param = dic;
listSql.Add(sysStringSql);
if (MessageBoxEx.Show("确认要" + strmsg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
{
return;
}
if (DBHelper.BatchExeSQLStringMultiByTrans("更新单据状态为" + strmsg + "", listSql))
{
MessageBoxEx.Show("" + strmsg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
uc.BindgvYTPurchaseOrderList();
deleteMenuByTag(this.Tag.ToString(), uc.Name);
}
else
{
MessageBoxEx.Show("" + strmsg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例4: ToDictionary
public Dictionary<string, string> ToDictionary()
{
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("LayerThickness", layer_thickness.ToString());
dict.Add("LayerMaterialName", layer_material_name);
dict.Add("LayerMaterialType", layer_material_type);
return dict;
}
示例5: Add
public void Add(string remarks)
{
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("@userid", _userid);
data.Add("@action", "Created A New Record");
data.Add("@entrydate", DateTime.Now);
data.Add("@remarks", remarks);
SpWithParam("add_audit_trail", data);
}
示例6: Get_ViewModelShouldCollaborate_WithGenresRetriever
public void Get_ViewModelShouldCollaborate_WithGenresRetriever()
{
var testGenres = new Dictionary<string, string>();
testGenres.Add("genres/123", "aaa");
testGenres.Add("genres/234", "aaa");
testGenres.Add("genres/345", "bbb");
genreRetriever.Stub(r => r.GetAll()).Return(testGenres);
var result = endpoint.Get(new UpdateBookLinkModel() {Id = "Irrelevant"});
result.ShouldHaveGenres(testGenres);
}
示例7: GetVisitData
public static Dictionary<int, List<Visit>> GetVisitData(string path)
{
Dictionary<int, List<Visit>> data = new Dictionary<int, List<Visit>>();
Random r = new Random();
foreach (string row in File.ReadLines(path))
{
string[] split = row.Split(',');
if (split.Length > 0)
{
int id = int.Parse(split[0]);
Visit visit = new Visit(id, r.Next(1, 10), int.Parse(split[2]), DateTime.Parse(split[1]));
if (data.ContainsKey(id))
{
data[id].Add(visit);
}
else
{
data.Add(id, new List<Visit>(){visit});
}
}
}
return data;
}
示例8: AskAnswer
public IAnswer AskAnswer(IQuestion question)
{
var j = 0;
var choices = new Dictionary<char,IChoice>();
question.Choices.ForEach(c => choices.Add((char)('a' + j++), c));
var answerChar = '\0';
do
{
Console.Clear();
Console.WriteLine("Question: {0}", question.QuestionString);
foreach (var choice in choices)
{
Console.WriteLine("{0}. {1}", choice.Key, choice.Value.ChoiceText);
}
Console.Write("\nAnswer: ");
var readLine = Console.ReadLine();
if (readLine == null) continue;
if (new[] { "back", "b", "oops", "p", "prev" }.Contains(readLine.ToLower()))
{
return question.CreateAnswer(Choice.PREVIOUS_ANSWER);
}
answerChar = readLine[0];
} while (!choices.ContainsKey(answerChar));
return question.CreateAnswer(choices[answerChar]);
}
示例9: GetPhotosAsync
public async Task<PhotosResponse> GetPhotosAsync(Photoset photoset, User user, Preferences preferences, int page,
IProgress<ProgressUpdate> progress) {
var progressUpdate = new ProgressUpdate {
OperationText = "Getting list of photos...",
ShowPercent = false
};
progress.Report(progressUpdate);
var methodName = GetPhotosetMethodName(photoset.Type);
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage,
preferences.PhotosPerPage.ToString(CultureInfo.InvariantCulture)
}, {
ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
}
};
var isAlbum = photoset.Type == PhotosetType.Album;
if (isAlbum) {
extraParams.Add(ParameterNames.PhotosetId, photoset.Id);
}
var photosResponse = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);
return photosResponse.GetPhotosResponseFromDictionary(isAlbum);
}
示例10: SetParams
// sets parameters for insert/update
private Dictionary<string, object> SetParams(Roles department)
{
Dictionary<string, object> result = new Dictionary<string, object>();
result.Add("@departmentName", department.Name);
return result;
}
示例11: CreateSchemas
protected override IReadOnlyDictionary<string, ScimSchema> CreateSchemas()
{
var schemas = new Dictionary<string, ScimSchema>();
foreach (var std in ServerConfiguration.GetSchemaTypeDefinitions(ScimVersion.One))
{
var attributeDefinitions = new List<ScimAttributeSchema>();
foreach (var ad in std.AttributeDefinitions.Values)
{
attributeDefinitions.Add(ad.ToScimAttributeSchema());
}
schemas.Add(
std.Name,
SetResourceVersion(
new ScimSchema1(
std.Schema + ":" + std.Name,
std.Name,
std.Description,
attributeDefinitions)));
var rtd = std as IScimResourceTypeDefinition;
if (rtd != null)
{
foreach (var extension in rtd.SchemaExtensions)
{
attributeDefinitions = new List<ScimAttributeSchema>();
foreach (var ad in extension.ExtensionDefinition.AttributeDefinitions.Values)
{
attributeDefinitions.Add(ad.ToScimAttributeSchema());
}
schemas.Add(
extension.Schema,
SetResourceVersion(
new ScimSchema1(
extension.Schema,
extension.ExtensionDefinition.Name,
extension.ExtensionDefinition.Description,
attributeDefinitions)));
}
}
}
return schemas;
}
示例12: Initialize
public static void Initialize()
{
VideoMedias = new ObservableCollection<IMedia>();
AudioMedias = new ObservableCollection<IMedia>();
ImageMedias = new ObservableCollection<IMedia>();
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonPictures));
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic));
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.CommonVideos));
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic));
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
loadFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
all = new Dictionary<Medias, ObservableCollection<IMedia>>();
all.Add(Medias.VIDEO, VideoMedias);
all.Add(Medias.AUDIO, AudioMedias);
all.Add(Medias.IMAGE, ImageMedias);
}
示例13: Index
public ActionResult Index()
{
ViewBag.Origem = new Origem().Lista(null);
ViewBag.Origem.Insert(0, new OrigemModel() { Id = 0, Nome = "" });
ViewBag.Profissao = new Profissao().Lista(null);
ViewBag.Profissao.Insert(0, new ProfissaoModel() { Id = 0, Nome = "" });
Dictionary<int, string> lista = new Dictionary<int, string>();
lista.Add(0, "");
lista.Add(1, "Sim");
lista.Add(2, "Não");
ViewBag.SimNaoTodos = lista;
PF pfData = new PF();
List<PFModel> model = pfData.Filtro50(null, null, null, null, null);
return View(model);
}
示例14: OnActionExecuting
public static string _host = ".kerlaii.com";//从数据库动态获取
public void OnActionExecuting(ActionExecutingContext filterContext)
{
bool isajax = filterContext.HttpContext.Request.IsAjaxRequest();
UserPC user = filterContext.HttpContext.Session["user"] as UserPC;
string host = filterContext.HttpContext.Request.Url.Host;
string key = host.Replace(_host, "");
//本地调试,模拟e0001企业 opera
if (host.ToLower() == "localhost") { key = "e0001"; }
EnterpriseBll bll = new EnterpriseBll();
string[] keys = bll.GetAllEnteriseKey();
if (key !="opera" && !keys.Contains(key))
{
filterContext.Result = new HttpNotFoundResult();
return;
//没有该企业
}
filterContext.HttpContext.Session["enterpriseKey"] = key;
if (check)
{
if (user == null)
{
ReturnData<string> ret = new ReturnData<string>();
if (isajax)
{
ret.Status = false;
Dictionary<string, object> Identify = new Dictionary<string, object>();
Identify.Add("expired", true);
ret.Identify = Identify;
filterContext.Result = new ContentResult()
{
Content = ret.GetJson()
};
return;
}
//跳转页面
filterContext.Result = new ContentResult()
{
Content = "<script>window.top.location.href ='/';</script>"
};
return ;
}
LogAdapter.Write(user.UserBasic.EnterpriseID+" "+key, LogAdapter.LogMode.ERROR);
//当前用户不是当前企业
if (user.UserBasic.EnterpriseID != key)
{
filterContext.HttpContext.Response.Redirect("/Login");
}
}
}
示例15: GetAliasList
public Dictionary<string, ChannelAliasModel> GetAliasList()
{
var res = new Dictionary<string, ChannelAliasModel>();
foreach (var item in ItemList)
{
var temp = item.GetAlias();
res.Add(temp.ChannelName, temp);
}
return res;
}