当前位置: 首页>>代码示例>>C#>>正文


C# Collections.Hashtable类代码示例

本文整理汇总了C#中System.Collections.Hashtable的典型用法代码示例。如果您正苦于以下问题:C# Hashtable类的具体用法?C# Hashtable怎么用?C# Hashtable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Hashtable类属于System.Collections命名空间,在下文中一共展示了Hashtable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBmCodes

 public ActionResult GetBmCodes(string codes)
 {
     Hashtable ht = new Hashtable();
     string[] str = codes.Split(',');
     foreach (var temp in str)
     {
         switch (temp)
         {
             case "xtzylx":
                 ht.Add(temp, UtilCodeInfo.xtzylx);
                 break;
             case "xtzyzt":
                 ht.Add(temp, UtilCodeInfo.xtzyzt);
                 break;
             case "usRole":
                 ht.Add(temp, UtilCodeInfo.usRole);
                 break;
             case "usstate":
                 ht.Add(temp, UtilCodeInfo.usstate);
                 break;
             case "rolestate":
               //  ht.Add(temp, UtilCodeInfo.rolestate);
                 break;
             case "recode":
                 //ht.Add(temp, UtilCodeInfo.recode);
                 break;
         }
     }
     return Json(ht, JsonRequestBehavior.AllowGet);
 }
开发者ID:pjjwpc,项目名称:.netOA,代码行数:30,代码来源:BmInfoController.cs

示例2: loadParamFile

        public static Hashtable loadParamFile(string Filename)
        {
            Hashtable param = new Hashtable();

            StreamReader sr = new StreamReader(Filename);
            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();

                if (line.Contains("NOTE:"))
                {
                    CustomMessageBox.Show(line, "Saved Note");
                    continue;
                }

                if (line.StartsWith("#"))
                    continue;

                string[] items = line.Split(new char[] { ' ', ',', '\t' }, StringSplitOptions.RemoveEmptyEntries);

                if (items.Length != 2)
                    continue;

                string name = items[0];
                float value = 0;
                try
                {
                    value = float.Parse(items[1], System.Globalization.CultureInfo.InvariantCulture);// new System.Globalization.CultureInfo("en-US"));
                }
                catch (Exception ex) { log.Error(ex); throw new FormatException("Invalid number on param " + name + " : " + items[1].ToString()); }

                if (name == "SYSID_SW_MREV")
                    continue;
                if (name == "WP_TOTAL")
                    continue;
                if (name == "CMD_TOTAL")
                    continue;
                if (name == "FENCE_TOTAL")
                    continue;
                if (name == "SYS_NUM_RESETS")
                    continue;
                if (name == "ARSPD_OFFSET")
                    continue;
                if (name == "GND_ABS_PRESS")
                    continue;
                if (name == "GND_TEMP")
                    continue;
                if (name == "CMD_INDEX")
                    continue;
                if (name == "LOG_LASTFILE")
                    continue;
                if (name == "FORMAT_VERSION")
                    continue;

                param[name] = value;
            }
            sr.Close();

            return param;
        }
开发者ID:LeoTosti,项目名称:x-drone,代码行数:60,代码来源:ParamFile.cs

示例3: GenerateAuditHistory

        private IResponse GenerateAuditHistory(ICruiseRequest request)
        {
            var velocityContext = new Hashtable();
            var links = new List<IAbsoluteLink>();
            links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "Server", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerAuditHistoryServerPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            string sessionToken = request.RetrieveSessionToken(sessionRetriever);
            if (!string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["currentProject"] = request.ProjectName;
                AuditFilterBase filter = AuditFilters.ByProject(request.ProjectName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100, filter);
            }
            else
            {
                velocityContext["auditHistory"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100);
            }

            return viewGenerator.GenerateView(@"AuditHistory.vm", velocityContext);
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:28,代码来源:ServerAuditHistoryServerPlugin.cs

示例4: GetImportedDate

        public static Hashtable GetImportedDate(IList<VDMS.I.Entity.ShippingDetail> shippingList)
        {
            Hashtable data = new Hashtable();
            if ((shippingList == null) || shippingList.Count == 0) return data;

            List<string> listEngines = new List<string>();
            foreach (VDMS.I.Entity.ShippingDetail item in shippingList)
            {
                listEngines.Add(item.EngineNumber);
            }

            //IDao<Iteminstance, long> IISdao = DaoFactory.GetDao<Iteminstance, long>();
            //IISdao.SetCriteria(new ICriterion[] { Expression.In("Enginenumber", listEngines) });
            //IList listIIS = IISdao.GetAll();

            //foreach (Iteminstance item in listIIS)
            //{
            //    data.Add(item.Enginenumber, item.Importeddate);
            //}
            using( var db = new VehicleDataContext() )
            {
                var query = from ii in db.ItemInstances
                            where
                                listEngines.Contains(ii.EngineNumber)
                            select ii;
                foreach (var itemInstance in query)
                {
                    data.Add(itemInstance.EngineNumber, itemInstance.ImportedDate);
                }
                return data;
            }
        }
开发者ID:thaond,项目名称:vdms-sym-project,代码行数:32,代码来源:ItemHepler.cs

示例5: buttonResetSendTime_Click

        private void buttonResetSendTime_Click(object sender, EventArgs e)
        {

       
            Hashtable ht = new Hashtable();
            DateTime dtSelected = dtTradeDate.Value;
            if (comboAssetClass.SelectedIndex < 0)
            {
                MessageBox.Show("Please select asset class","Asset Class", MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }

            ht["destination"] = txtDestination.Text;
            ht["tradedateid"] = dtSelected.Year * 10000 + dtSelected.Month*100+dtSelected.Day;
            ht["assetclass"] = comboAssetClass.SelectedItem.ToString();

            DataSet ds = (DataSet)BrokerConnection.Request("SetResetTime", ht);

            if (ds != null && ds.Tables.Count > 0)
            {
                ds.Tables[0].TableName = "SetResetTime";
                MessageBox.Show(String.Format("Successfully updated {0} records",ds.Tables[0].Rows[0][0]),"Updated Records",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
                

           
        }
开发者ID:BrianGoff,项目名称:BITS,代码行数:27,代码来源:ContingencyRecoveryCtl.cs

示例6: CargarPermisos

 /// <summary>
 /// Carga una hashtable que contiene los permisos del usuario (menu desplegable)
 /// </summary>
 /// <returns></returns>
 public Hashtable CargarPermisos()
 {
     MedDAL.DAL.permisos_usuarios permisoUsuario;
     Hashtable htPermisos = new Hashtable();
     int count=1;
     char cPermiso;
     string[] listaPermisos = { "usuarios", "perfiles", 
                                "clientes", "vendedores", "proveedores", "estados", "municipios", "poblaciones", "colonias", 
                                "almacenes", "productos", "inventarios", 
                                "pedidos", "recetas", "remisiones", "facturas", 
                                "causes", "bitacora", 
                                "configuracion", "campos editables", "tipos", "cuentas x cobrar", 
                                "tipos de iva", "ensambles", "lineas de credito"};
        
     foreach (string permiso in listaPermisos) {
         permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, count);
         cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
         if (cPermiso!='N')
             htPermisos.Add(permiso, cPermiso);
         count++;
     }
     permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, 16);
     cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
     if (cPermiso != 'N')
         htPermisos.Add("facturas x receta", cPermiso);
     htPermisos.Add("reportes",'T');
     htPermisos.Add("cambiar contraseña", 'T');
     htPermisos.Add("movimientos", 'T');
     return htPermisos;
 }
开发者ID:jibarradelgado,项目名称:medicuri,代码行数:34,代码来源:BlLogin.cs

示例7: CheckConsistency

		private string CheckConsistency()
		{
			this.PrepareBones();
			Hashtable hashtable = new Hashtable();
			foreach (RagdollBuilder.BoneInfo boneInfo in this.bones)
			{
				if (boneInfo.anchor)
				{
					if (hashtable[boneInfo.anchor] != null)
					{
						RagdollBuilder.BoneInfo boneInfo2 = (RagdollBuilder.BoneInfo)hashtable[boneInfo.anchor];
						string result = string.Format("{0} and {1} may not be assigned to the same bone.", boneInfo.name, boneInfo2.name);
						return result;
					}
					hashtable[boneInfo.anchor] = boneInfo;
				}
			}
			foreach (RagdollBuilder.BoneInfo boneInfo3 in this.bones)
			{
				if (boneInfo3.anchor == null)
				{
					string result = string.Format("{0} has not been assigned yet.\n", boneInfo3.name);
					return result;
				}
			}
			return string.Empty;
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:27,代码来源:RagdollBuilder.cs

示例8: GetItemPriceModel

	    /// <summary>
	    ///     Gets the item price model.
	    /// </summary>
	    /// <param name="item">The item.</param>
	    /// <param name="lowestPrice">The lowest price.</param>
	    /// <param name="tags">Additional tags for promotion evaluation</param>
	    /// <returns>price model</returns>
	    /// <exception cref="System.ArgumentNullException">item</exception>
	    public PriceModel GetItemPriceModel(Item item, Price lowestPrice, Hashtable tags)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (lowestPrice == null)
            {
                return new PriceModel();
            }

            var price = lowestPrice.Sale ?? lowestPrice.List;
            var discount = _client.GetItemDiscountPrice(item, lowestPrice, tags);
            var priceModel = CreatePriceModel(price, price - discount, UserHelper.CustomerSession.Currency);
	        priceModel.ItemId = item.ItemId;
            //If has any variations
            /* performance too slow with this method, need to store value on indexing instead
	        if (CatalogHelper.CatalogClient.GetItemRelations(item.ItemId).Any())
	        {
	            priceModel.PriceTitle = "Starting from:".Localize();
	        }
             * */
            return priceModel;
        }
开发者ID:karpinskiy,项目名称:vc-community,代码行数:33,代码来源:MarketingHelper.cs

示例9: FillEventArgs

 private static void FillEventArgs(Hashtable mapArgs, Dictionary<string, string> additionalInfo)
 {
     if (additionalInfo == null)
     {
         for (int i = 0; i < 3; i++)
         {
             string str = (i + 1).ToString("d1", CultureInfo.CurrentCulture);
             mapArgs["AdditionalInfo_Name" + str] = "";
             mapArgs["AdditionalInfo_Value" + str] = "";
         }
     }
     else
     {
         string[] array = new string[additionalInfo.Count];
         string[] strArray2 = new string[additionalInfo.Count];
         additionalInfo.Keys.CopyTo(array, 0);
         additionalInfo.Values.CopyTo(strArray2, 0);
         for (int j = 0; j < 3; j++)
         {
             string str2 = (j + 1).ToString("d1", CultureInfo.CurrentCulture);
             if (j < array.Length)
             {
                 mapArgs["AdditionalInfo_Name" + str2] = array[j];
                 mapArgs["AdditionalInfo_Value" + str2] = strArray2[j];
             }
             else
             {
                 mapArgs["AdditionalInfo_Name" + str2] = "";
                 mapArgs["AdditionalInfo_Value" + str2] = "";
             }
         }
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:33,代码来源:EventLogLogProvider.cs

示例10: Put

        /// <summary>
        /// Puts new values into xively feed.
        /// </summary>
        /// <param name="ids">The ids.</param>
        /// <param name="values">The values.</param>
        /// <exception cref="System.ApplicationException">The xively server returned invalid status code.</exception>
        public void Put(string[] ids, object[] values)
        {
            var datastreams = new Hashtable[ids.Length];
            for (int i = 0; i < ids.Length; i++)
                datastreams[i] = new Hashtable
                                    {
                                        {"id",ids[i]},
                                        {"current_value",values[i]},
                                    };

            var json = new Hashtable
            {
                {"version","1.0.0"},
                {"datastreams",datastreams},
            };


            var request = new HttpRequest
            {
                Method = "PUT",
                Url = url,
                Content = JSON.JsonEncode(json),
            };

            request.AddHeader("X-ApiKey", apiKey);

            var response = httpClient.ExecuteRequest(request);

            if (response.StatusCode != 200)
                throw new ApplicationException("Xively server returned invalid status code : " + response.StatusCode);
        }
开发者ID:NicolasFatoux,项目名称:NfxLab.MicroFramework,代码行数:37,代码来源:XivelyClient.cs

示例11: Execute

        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(urlBuilder, request.ServerSpecifier, "Server Log", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier,
                request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(urlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerLogProjectPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ServerSpecifier, request.RetrieveSessionToken()));
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ProjectSpecifier, request.RetrieveSessionToken()));
            }

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:26,代码来源:ServerLogServerPlugin.cs

示例12: Execute

		public HtmlFragmentResponse Execute()
		{
			Hashtable velocityContext = new Hashtable();

			string serverName = request.ServerName;
			string categoryName = GetCategory();
            string projectName = request.ProjectName;
			string buildName = request.BuildName;

			velocityContext["serverName"] = serverName;
			velocityContext["categoryName"] = categoryName;
			velocityContext["projectName"] = projectName;
			velocityContext["buildName"] = buildName;

			velocityContext["farmLink"] = linkFactory.CreateFarmLink("Dashboard", FarmReportFarmPlugin.ACTION_NAME);

			if (serverName != string.Empty)
			{
				velocityContext["serverLink"] = linkFactory.CreateServerLink(request.ServerSpecifier, ServerReportServerPlugin.ACTION_NAME);
			}

            if (categoryName != string.Empty)
            {
                IServerSpecifier serverSpecifier;
                try
                {
                    serverSpecifier = request.ServerSpecifier;
                }
                catch (ThoughtWorks.CruiseControl.Core.CruiseControlException)
                {
                    serverSpecifier = null;
                }

                if (serverSpecifier != null)
                {
                    velocityContext["categoryLink"] = new GeneralAbsoluteLink(categoryName, linkFactory
                        .CreateServerLink(serverSpecifier, "ViewServerReport")
                        .Url + "?Category=" + HttpUtility.UrlEncode(categoryName));
                }
                else
                {
                    velocityContext["categoryLink"] = new GeneralAbsoluteLink(categoryName, linkFactory
                        .CreateFarmLink( "Dashboard", FarmReportFarmPlugin.ACTION_NAME )
                        .Url + "?Category=" + HttpUtility.UrlEncode(categoryName));
                }
            }


			if (projectName != string.Empty)
			{
				velocityContext["projectLink"] = linkFactory.CreateProjectLink(request.ProjectSpecifier,  ProjectReportProjectPlugin.ACTION_NAME);
			}

			if (buildName != string.Empty)
			{
				velocityContext["buildLink"] = linkFactory.CreateBuildLink(request.BuildSpecifier,  BuildReportBuildPlugin.ACTION_NAME);
			}

			return velocityViewGenerator.GenerateView("TopMenu.vm", velocityContext);
		}
开发者ID:robrich,项目名称:CruiseControl.NET,代码行数:60,代码来源:TopControlsViewBuilder.cs

示例13: Save_Click

 protected void Save_Click(object sender, EventArgs e)
 {
     string s = this.Session["dt_session_code"].ToString().ToLower();
     if (this.txtCode.Value.ToLower() != this.Session["dt_session_code"].ToString().ToLower())
     {
         this.txtCode.Focus();
         this.errorMsg.InnerHtml = "验证码输入不正确!";
     }
     else
     {
         int i = 0;
         if (this.txtUserName.Value != "Administrator")
         {
             Hashtable ht_User = new Hashtable();
             ht_User["User_Pwd"] = Md5Helper.MD5(this.txtUserPwd.Value, 32);
             i = system_idao.UpdateByHashtable("Base_UserInfo", "User_ID", RequestSession.GetSessionUser().UserId.ToString(), ht_User);
         }
         if (i > 0)
         {
             this.Session.Abandon();
             this.Session.Clear();
             base.Response.Write("<script>alert('登陆修改成功,请重新登陆');top.location.href='../../Index.htm'</script>");
         }
         else
         {
             this.errorMsg.InnerHtml = "修改登录密码失败";
         }
     }
 }
开发者ID:txy-cs,项目名称:NewSaas,代码行数:29,代码来源:UpdateUserPwd.aspx.cs

示例14: CreateInOutParamTypes

		protected override Type[] CreateInOutParamTypes(Uiml.Param[] parameters, out Hashtable outputPlaceholder)
		{
			outputPlaceholder = null;
			Type[] tparamTypes =  new Type[parameters.Length]; 
			int i=0;
			try
			{
				for(i=0; i<parameters.Length; i++)
				{
					tparamTypes[i] = Type.GetType(parameters[i].Type);
					int j = 0;
					while(tparamTypes[i] == null)	
						tparamTypes[i] = ((Assembly)ExternalLibraries.Instance.Assemblies[j++]).GetType(parameters[i].Type);
					//also prepare a placeholder when this is an output parameter
					if(parameters[i].IsOut)
					{
						if(outputPlaceholder == null)
							outputPlaceholder = new Hashtable();
						outputPlaceholder.Add(parameters[i].Identifier, null);
					}
				}
				return tparamTypes;
			}
				catch(ArgumentOutOfRangeException aore)
				{
					Console.WriteLine("Can not resolve type {0} of parameter {1} while calling method {2}",parameters[i].Type ,i , Call.Name);
					Console.WriteLine("Trying to continue without executing {0}...", Call.Name);
					throw aore;					
				}
		}
开发者ID:jozilla,项目名称:Uiml.net,代码行数:30,代码来源:LocalCaller.cs

示例15: ESData

 /// <summary>
 /// 構造
 /// </summary>
 protected ESData()
 {
     dict = new Hashtable();
     dict.Add("itemno", "物品編號");
     dict.Add("item", "產品");
     dict.Add("model", "型號");
 }
开发者ID:eddylin2015,项目名称:ES_TABLE,代码行数:10,代码来源:ES_DataLayer.cs


注:本文中的System.Collections.Hashtable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。