當前位置: 首頁>>代碼示例>>C#>>正文


C# Model.Dictionary類代碼示例

本文整理匯總了C#中Model.Dictionary的典型用法代碼示例。如果您正苦於以下問題:C# Dictionary類的具體用法?C# Dictionary怎麽用?C# Dictionary使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Dictionary類屬於Model命名空間,在下文中一共展示了Dictionary類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Model.Dictionary類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。