本文整理汇总了C#中Model.Dictionary类的典型用法代码示例。如果您正苦于以下问题:C# Dictionary类的具体用法?C# Dictionary怎么用?C# Dictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dictionary类属于Model命名空间,在下文中一共展示了Dictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:64,代码来源:UCYTView.cs
示例2: 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("操作失败!");
}
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:60,代码来源:UCSalePlanView.cs
示例3: FolderInfo
public FolderInfo()
{
dicVectorFile = new Dictionary<string, string>();
UploadResult = new StringBuilder();
WaitUploadFilesCount = 0;
SucessfulUploadFilesCount = 0;
}
开发者ID:ufo20020427,项目名称:FileUpload,代码行数:7,代码来源:FolderInfo.cs
示例4: Main
private static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: Importer [directory to process]");
return;
}
string directory = args[0];
if (!Directory.Exists(directory))
{
Console.WriteLine("{0} does not exists", directory);
return;
}
Dictionary<Guid, Post> posts = new Dictionary<Guid, Post>();
IDictionary<string, Category> categories = new Dictionary<string, Category>();
List<Comment> comments = new List<Comment>();
AddPosts(categories, directory, posts);
foreach (string file in Directory.GetFiles(directory, "*feedback*.xml"))
{
IList<Comment> day_comments = ProcessComments(file, posts);
comments.AddRange(day_comments);
}
Console.WriteLine("Found {0} posts in {1} categories with {2} comments", posts.Count, categories.Count, comments.Count);
SaveToDatabase(categories, posts.Values, comments);
}
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:25,代码来源:Program.cs
示例5: 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;
}
开发者ID:patpaquette,项目名称:Cheo-visits,代码行数:27,代码来源:DataLoader.cs
示例6: Load
private void Load()
{
this.UiTypes = new Dictionary<UIType, IUIFactory>();
Assembly[] assemblies = Game.EntityEventManager.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
object[] attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false);
if (attrs.Length == 0)
{
continue;
}
UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute;
if (this.UiTypes.ContainsKey(attribute.Type))
{
throw new GameException($"已经存在同类UI Factory: {attribute.Type}");
}
IUIFactory iIuiFactory = Activator.CreateInstance(type) as IUIFactory;
if (iIuiFactory == null)
{
throw new GameException("UI Factory没有继承IUIFactory");
}
this.UiTypes.Add(attribute.Type, iIuiFactory);
}
}
}
开发者ID:egametang,项目名称:Egametang,代码行数:30,代码来源:UIComponent.cs
示例7: 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);
}
开发者ID:hanlixin8888,项目名称:Web.Provider,代码行数:37,代码来源:PurchaseOutController.cs
示例8: GetCoverPhotoAsync
public async Task<Photoset> GetCoverPhotoAsync(User user, Preferences preferences, bool onlyPrivate) {
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage, "1"
}, {
ParameterNames.Page, "1"
}, {
ParameterNames.PrivacyFilter, onlyPrivate ? "5" : "1"
// magic numbers: https://www.flickr.com/services/api/flickr.people.getPhotos.html
}
};
var photosetsResponseDictionary = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(Methods.PeopleGetPhotos, extraParams);
var photo = photosetsResponseDictionary.GetPhotosResponseFromDictionary(false).Photos.FirstOrDefault();
return photo != null
? new Photoset(null, null, null, null, 0, 0, 0,
onlyPrivate ? "All Photos" : "All Public Photos", "",
onlyPrivate ? PhotosetType.All : PhotosetType.Public,
photo.SmallSquare75X75Url)
: null;
}
开发者ID:qinhongwei,项目名称:flickr-downloadr-gtk,代码行数:28,代码来源:LandingLogic.cs
示例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);
}
开发者ID:qinhongwei,项目名称:flickr-downloadr-gtk,代码行数:33,代码来源:BrowserLogic.cs
示例10: AddDictionary
public int AddDictionary(Dictionary model)
{
string cmdText = @"
DECLARE @NEWID INT
INSERT INTO [Dictionary] (Cname,ParentId,IsChild,Remarks) values (@Cname,@ParentId,@IsChild,@Remarks)
SET @[email protected]@IDENTITY
SELECT @NEWID";
SqlParameter[] parameters =
{
SqlParamHelper.MakeInParam("@Cname",SqlDbType.VarChar,100,model.Cname),
SqlParamHelper.MakeInParam("@ParentId",SqlDbType.Int,4,model.ParentId),
SqlParamHelper.MakeInParam("@IsChild",SqlDbType.Bit,1,model.IsChild),
SqlParamHelper.MakeInParam("@Remarks",SqlDbType.VarChar,120,model.Remarks)
};
int id = 0;
using (IDataReader dataReader = SqlHelper.ExecuteReader(WriteConnectionString,CommandType.Text,cmdText,parameters)){
if(dataReader.Read()){
object obj = dataReader[0];
if(obj != null && obj != DBNull.Value){
id = Convert.ToInt32(obj);
}
}
}
return id;
}
开发者ID:liuyouying,项目名称:MVC,代码行数:25,代码来源:DictionaryRepository.cs
示例11: GetRecommendations
public static List<Movie> GetRecommendations(List<Movie> all, Dictionary<int, int> newRanks, List<Tuple<int, int, float>> oldRanks)
{
int newUserId = 0;
Ratings ratings = new Ratings();
foreach (var r in oldRanks)
{
ratings.Add(r.Item1, r.Item2, r.Item3);
if (r.Item1 > newUserId) newUserId = r.Item1;
}
// this makes us sure that the new user has a unique id (bigger than all other)
newUserId = newUserId + 1;
foreach (var k in newRanks)
{
ratings.Add(newUserId, k.Key, (float)k.Value);
}
var engine = new BiPolarSlopeOne();
// different algorithm:
// var engine = new UserItemBaseline();
engine.Ratings = ratings;
engine.Train(); // warning: this could take some time!
return all.Select(m =>
{
m.Rank = engine.Predict(newUserId, m.Id); // do the prediction!
return m;
}).ToList();
}
开发者ID:jitsolutions,项目名称:dotnet-recommend,代码行数:34,代码来源:Engine.cs
示例12: 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]);
}
开发者ID:robinkanters,项目名称:quiz-challenge,代码行数:33,代码来源:Program.cs
示例13: GetIPSiteTypeDictionary
public static Dictionary<SiteType, IEnumerable<string>> GetIPSiteTypeDictionary()
{
Dictionary<SiteType, IEnumerable<string>> dic = new Dictionary<SiteType, IEnumerable<string>>();
List<string> tpolist = new List<string>();
List<string> weclist = new List<string>();
List<string> cdwlist = new List<string>();
foreach (EnvironmentSettings a in EnvironmentConfigSection.EnvironmentSettingCollection)
{
if (!string.IsNullOrEmpty(a.TPO))
{
tpolist.Add(a.TPO);
}
if (!string.IsNullOrEmpty(a.WebCenter))
{
weclist.Add(a.WebCenter);
}
if (!string.IsNullOrEmpty(a.ConsumerDirect))
{
cdwlist.Add(a.ConsumerDirect);
}
}
dic.Add(SiteType.TPO, tpolist);
dic.Add(SiteType.WBC, weclist);
dic.Add(SiteType.CDW, cdwlist);
return dic;
}
开发者ID:caogenyan,项目名称:DEVTool,代码行数:27,代码来源:EnvironmentMnager.cs
示例14: GetCreatedAtRouteNegotiatedContentResult
public CreatedAtRouteNegotiatedContentResult<IEnumerable<Figure>> GetCreatedAtRouteNegotiatedContentResult()
{
IDictionary<string, object> route = new Dictionary<string, object>();
route["controller"] = "Figure";
route["action"] = "GetAll";
return new CreatedAtRouteNegotiatedContentResult<IEnumerable<Figure>>("DefaultApi", route, FigureManager.Figures, this);
}
开发者ID:BarlowDu,项目名称:WebAPI,代码行数:7,代码来源:FigureController.cs
示例15: GetPhotosetsAsync
public async Task<PhotosetsResponse> GetPhotosetsAsync(string methodName, User user, Preferences preferences, int page,
IProgress<ProgressUpdate> progress) {
var progressUpdate = new ProgressUpdate {
OperationText = "Getting list of albums...",
ShowPercent = false
};
progress.Report(progressUpdate);
var extraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}, {
ParameterNames.SafeSearch, preferences.SafetyLevel
}, {
ParameterNames.PerPage, "21"
}, {
ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
}
};
var photosetsResponseDictionary = (Dictionary<string, object>)
await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);
return photosetsResponseDictionary.GetPhotosetsResponseFromDictionary();
}
开发者ID:qinhongwei,项目名称:flickr-downloadr-gtk,代码行数:25,代码来源:LandingLogic.cs
示例16: HomeModule
public HomeModule()
{
int pagesize = 5;
Dictionary<string, object> dic = new Dictionary<string, object>();
Get["/"] = P =>
{
dic["ip"] = CommonHelper.GetIPAddress(Request.UserHostAddress);
dic["nav"]= CreatNavHtml(1, pagesize);
IEnumerable<Weblog> list = WeBlogService.GetPageWeblog(1, pagesize);
dic["data"] = list;
return View["Home", dic];
};
Get["/page_{pageindex}"] = p =>
{
IEnumerable<Weblog> list = WeBlogService.GetPageWeblog(p.pageindex, pagesize);
dic["ip"] = CommonHelper.GetIPAddress(Request.UserHostAddress);
dic["data"] = list;
dic["nav"] = CreatNavHtml(p.pageindex, pagesize);
return View["Home", dic];
};
Get["/Error"] = p =>
{
return View["Error"];
};
}
开发者ID:flycd,项目名称:MyWeb,代码行数:32,代码来源:HomeModule.cs
示例17: PopulateUserInfo
public async Task<User> PopulateUserInfo(User user) {
var exraParams = new Dictionary<string, string> {
{
ParameterNames.UserId, user.UserNsId
}
};
dynamic userWithUserInfo = await this._oAuthManager.MakeAuthenticatedRequestAsync(Methods.PeopleGetInfo, exraParams);
var userInfo = (Dictionary<string, object>) userWithUserInfo["person"];
user.Info = new UserInfo {
Id = user.UserNsId,
IsPro = Convert.ToBoolean(userInfo["ispro"]),
IconServer = userInfo["iconserver"].ToString(),
IconFarm = int.Parse(userInfo["iconfarm"].ToString()),
PathAlias =
userInfo["path_alias"] == null
? string.Empty
: userInfo["path_alias"].ToString(),
Description = userInfo.GetSubValue("description").ToString(),
PhotosUrl = userInfo.GetSubValue("photosurl").ToString(),
ProfileUrl = userInfo.GetSubValue("profileurl").ToString(),
MobileUrl = userInfo.GetSubValue("mobileurl").ToString(),
PhotosCount = int.Parse(((Dictionary<string, object>) userInfo["photos"]).GetSubValue("count").ToString())
};
return user;
}
开发者ID:qinhongwei,项目名称:flickr-downloadr-gtk,代码行数:29,代码来源:UserInfoLogic.cs
示例18: SetInfo
public void SetInfo(Dictionary<string, string> SystemInfo)
{
foreach (KeyValuePair<string, string> pair in SystemInfo)
{
properties.Info.Add(pair.Key, pair.Value);
}
}
开发者ID:karthikbhatnagar,项目名称:extentreports,代码行数:7,代码来源:SystemInfo.cs
示例19: Init
public static void Init(int capacity)
{
for (int i = 0; i < capacity; i++)
{
Dictionary<string, IssueRecEntity> item = new Dictionary<string, IssueRecEntity>();
recEntity.Add(item);
}
}
开发者ID:qbollen,项目名称:PMSIface,代码行数:8,代码来源:Manage.cs
示例20: 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;
}
开发者ID:rexghadaffi,项目名称:Casio,代码行数:9,代码来源:RolesContext.cs
注:本文中的Model.Dictionary类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论