C# (CSharp) Класс System.Collections. Hashtable Code Examples

C# (CSharp) System.Collections.Hashtable - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Collections.Hashtable, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Наследование: System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback, System.ICloneable
Пример #1
0
 /// <summary>
 /// 構造
 /// </summary>
 protected ESData()
 {
     dict = new Hashtable();
     dict.Add("itemno", "物品編號");
     dict.Add("item", "產品");
     dict.Add("model", "型號");
 }
 private CollaboratingWorkbooksEnvironment(String[] workbookNames, WorkbookEvaluator[] evaluators, int nItems)
 {
     Hashtable m = new Hashtable(nItems * 3 / 2);
     Hashtable uniqueEvals = new Hashtable(nItems * 3 / 2);
     for (int i = 0; i < nItems; i++)
     {
         String wbName = workbookNames[i];
         WorkbookEvaluator wbEval = evaluators[i];
         if (m.ContainsKey(wbName))
         {
             throw new ArgumentException("Duplicate workbook name '" + wbName + "'");
         }
         if (uniqueEvals.ContainsKey(wbEval))
         {
             String msg = "Attempted To register same workbook under names '"
                 + uniqueEvals[(wbEval) + "' and '" + wbName + "'"];
             throw new ArgumentException(msg);
         }
         uniqueEvals[wbEval]=wbName;
         m[wbName] = wbEval;
     }
     UnhookOldEnvironments(evaluators);
     //HookNewEnvironment(evaluators, this); - moved to Setup method above
     _unhooked = false;
     _evaluators = evaluators;
     _evaluatorsByName = m;
 }
Пример #3
0
	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;					
			}
	}
        /// <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);
        }
        /// <summary>
        /// 新增基本檔資料(使用交易)
        /// </summary>
        /// <param name="htParams">放入輸入的參數</param>
        /// <param name="DBT">交易變數</param>
        /// <returns>回傳影響筆數</returns>
        public void doCreate(Hashtable htParams,
                            DbTransaction DBT
                            )
        {
            try
            {
                DbCommand cmd = db.GetStoredProcCommand("PKG_VDS_ALO_PATTERNSPEC_DETL.ADD_PATTERNSPEC_DETL");
                db.AddInParameter(cmd, "ID", DbType.VarNumeric, htParams["ID"]);
                db.AddInParameter(cmd, "PID", DbType.VarNumeric, htParams["PID"]);
                db.AddInParameter(cmd, "vCreateDate", DbType.Date, htParams["CREATEDATE"]);
                db.AddInParameter(cmd, "vCreateUID", DbType.String, htParams["CREATEUID"]);
                db.AddInParameter(cmd, "vUpdateDate", DbType.Date, htParams["UPDATEDATE"]);
                db.AddInParameter(cmd, "vUpdateUID", DbType.String, htParams["UPDATEUID"]);
                db.AddInParameter(cmd, "nSTART_RANKQTY", DbType.VarNumeric, htParams["START_RANKQTY"]);
                db.AddInParameter(cmd, "nEND_RANKQTY", DbType.VarNumeric, htParams["END_RANKQTY"]);
                db.AddInParameter(cmd, "nADJ_QTY", DbType.VarNumeric, htParams["ADJ_QTY"]);

                int ProcessRecord = (DBT == null) ? db.ExecuteNonQuery(cmd) : db.ExecuteNonQuery(cmd, DBT);

                if (ProcessRecord == 0)
                {
                    throw new Exception("輸入資料失敗!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("呼叫VDS_ALO_PATTERNSPEC_DETL_DBO.doCreate()發生錯誤,錯誤訊息:"
                                    + OracleExceptionProcess.OracleExceptionStringCut(ex.Message));
            }
        }
		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);
		}
        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);
        }
Пример #8
0
 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);
 }
Пример #9
0
	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;
	}
Пример #10
0
        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;
        }
        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);
        }
Пример #12
0
        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;
            }
        }
Пример #13
0
        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);
            }
                

           
        }
Пример #14
0
 /// <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;
 }
Пример #15
0
 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 = "修改登录密码失败";
         }
     }
 }
Пример #16
0
 public ETClient(Edge e)
 {
   _sync = new object();
   _sent_blocks = new Hashtable();
   _e = e;
   _e.Subscribe(this, null );
 }
Пример #17
0
        private void LoadSettings()
        {
            moduleId = WebUtils.ParseInt32FromQueryString("mid", moduleId);
            pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId);
            module = GetModule(moduleId, Forum.FeatureGuid);
            settings = ModuleSettings.GetModuleSettings(moduleId);
            config = new ForumConfiguration(settings);

            forumList.Config = config;
            forumList.ModuleId = moduleId;
            forumList.PageId = pageId;
            forumList.SiteRoot = SiteRoot;
            forumList.ImageSiteRoot = ImageSiteRoot;
            //forumList.IsEditable = IsEditable;

            forumListAlt.Config = config;
            forumListAlt.ModuleId = moduleId;
            forumListAlt.PageId = pageId;
            forumListAlt.SiteRoot = SiteRoot;
            forumListAlt.ImageSiteRoot = ImageSiteRoot;
            //forumListAlt.IsEditable = IsEditable;

            if (displaySettings.UseAltForumList)
            {
                forumList.Visible = false;
                forumListAlt.Visible = true;
            }

            AddClassToBody("editforumsubscriptions");
        }
Пример #18
0
 public JsonObject GetDiskInfo()
 {
   try
   {
     var diskinfo = new JsonObject();
     var volumes = new ArrayList();
     foreach (var vi in VolumeInfo.GetVolumes())
     {
       var v = new Hashtable();
       v.Add("root", vi.RootDirectory);
       v.Add("size", vi.TotalSize);
       v.Add("free", vi.TotalFreeSpace);
       v.Add("formatted", vi.IsFormatted);
       v.Add("volumeid", vi.VolumeID);
       v.Add("content", GetRootFolderInfo(vi.RootDirectory));
       volumes.Add(v);
     }
     diskinfo.Add("volumes", volumes);
     return diskinfo;
   }
   catch (Exception ex)
   {
     var error = new JsonObject();
     error.Add("error", ex.ToString());
     error.Add("stacktrace", ex.StackTrace);
     return error;
   }
 }
Пример #19
0
        ///
        public LogRMC(string[] filenames)
        {
            Hashtable methods = new Hashtable();
            methods["StatusInvalid"] = false;
            methods["NullValues"]    = false;
            methods["InvalidCoords"] = false;
            methods["ValidChecksum"] = false;

            LogRMC[] rmcLogs = new LogRMC[filenames.Length];

            for (int i = 0; i < filenames.Length; i++)
            {
                rmcLogs[i] = new LogRMC();
                rmcLogs[i].ReadFile(filenames[i]);
                rmcLogs[i].Clean(methods);
            }

            Array.Sort(rmcLogs);

            this.logBegin = rmcLogs[0].logBegin;
            this.logEnd   = rmcLogs[0].logEnd;
            this.rmcData  = new ArrayList();

            foreach (LogRMC rmc in rmcLogs)
            {
                if (this.logBegin > rmc.logBegin)
                    this.logBegin = rmc.logBegin;

                if (this.logEnd < rmc.logEnd)
                    this.logEnd = rmc.logEnd;

                foreach (Hashtable fields in rmc.rmcData)
                    this.rmcData.Add(this.GetRMCSentence(fields));
            }
        }
Пример #20
0
        public void Insert()
        {
            TableBatchOperation batchOperation = new TableBatchOperation();
            Hashtable barcode = new Hashtable();
            StringBuilder sb = new StringBuilder();
            for (int i = id; i < id + 100 && i < Program._DATA_TABLE.Rows.Count; i++)
            {
                if (!barcode.ContainsKey(Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim()))
                {
                    try
                    {
                        sb.Append(Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim() + "|");
                        ShopBarcodeEntity data = new ShopBarcodeEntity(Program._DATA_TABLE.Rows[i]["Shop"].ToString().Trim(), Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim());
                        data.OrderNo = Program._DATA_TABLE.Rows[i]["BillNumber"].ToString().Trim();
                        data.Product = Program._DATA_TABLE.Rows[i]["Product"].ToString().Trim().PadLeft(8, '0');
                        data.Cost = double.Parse(Program._DATA_TABLE.Rows[i]["SellPrice"].ToString().Trim());
                        data.SellFinished = false;
                        batchOperation.InsertOrMerge(data);
                        barcode[Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim()] = true;
                    }
                    catch { }
                }
            }

            try
            {
                Program._RECORD++;
                Console.WriteLine("Insert Record {0}-{1}\t\tTotal {2} Records", id + 1, id + 100, Program._RECORD*100);
                Program._CLOUD_TABLE.ExecuteBatch(batchOperation);
            }
            catch (Exception e)
            {
                Program.WriteErrorLog("Record " + (id + 1) + "-" + (id + 100) + " Error \n" + sb.ToString() + "\n" + e.Message + "\n" + e.StackTrace);
            }
        }
Пример #21
0
		public void Constructor_SendInDictionaryWithNonStringKey_ThrowsArgumentException() {
			var attributeValueCollection = A.Fake<IAttributeValueCollection>();
			var dictionary = new Hashtable();
			dictionary.Add(new object(), attributeValueCollection);

			Assert.Throws<ArgumentException>(() => new AttributeCollection(dictionary));
		}
        } // HttpChannel

        public HttpChannel(IDictionary properties, 
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();
        
            // divide properties up for respective channels
            if (properties != null)
            {            
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;
                    case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); 
                                    clientData["secure"] = entry.Value;
                                    serverData["secure"] = entry.Value;
                                    break;
                    default: 
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
Пример #23
0
	    /// <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;
        }
Пример #24
0
 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] = "";
             }
         }
     }
 }
Пример #25
0
 public MainForm()
 {
     InitializeComponent();
     context = SynchronizationContext.Current;
     actions = new List<ActionEntry>();
     schedualeList = new Hashtable();
 }
Пример #26
0
        static void Main() {
#if EASYTEST
			DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication =
                new SecuritySystemExampleWindowsFormsApplication();
            const string connectionString = "tcp://localhost:1426/DataServer";
            winApplication.ConnectionString = connectionString;
            try {
                var t = new Hashtable{{"secure", true}, {"tokenImpersonationLevel", "impersonation"}};
                var channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                var clientDataServer = (IDataServer) Activator.GetObject(
                    typeof (RemoteSecuredDataServer), connectionString);
                var securityClient =
                    new ServerSecurityClient(clientDataServer, new ClientInfoFactory()){IsSupportChangePassword = true};
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                        e.ObjectSpaceProvider =
                            new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                    };
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Пример #27
0
        internal XmlQueryContext(XmlQueryRuntime runtime, object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList, WhitespaceRuleLookup wsRules) {
            this.runtime = runtime;
            this.dataSources = dataSources;
            this.dataSourceCache = new Hashtable();
            this.argList = argList;
            this.wsRules = wsRules;

            if (defaultDataSource is XmlReader) {
                this.readerSettings = new QueryReaderSettings((XmlReader) defaultDataSource);
            }
            else {
                // Consider allowing users to set DefaultReaderSettings in XsltArgumentList
                // readerSettings = argList.DefaultReaderSettings;
                this.readerSettings = new QueryReaderSettings(new NameTable());
            }

            if (defaultDataSource is string) {
                // Load the default document from a Uri
                this.defaultDataSource = GetDataSource(defaultDataSource as string, null);

                if (this.defaultDataSource == null)
                    throw new XslTransformException(Res.XmlIl_UnknownDocument, defaultDataSource as string);
            }
            else if (defaultDataSource != null) {
                this.defaultDataSource = ConstructDocument(defaultDataSource, null, null);
            }
        }
Пример #28
0
        /// <summary>
        /// Create a new person entity and set
        /// the given values on it.
        /// </summary>
        /// <param name="values">The values which the person entity should be created with.</param>
        public PersonEntity(Hashtable values)
            : this()
        {
            Contract.Requires(values != null);

            this.ValueObject.SetValues(values);
        }
        public void Init()
        {
            tblSettings = new Hashtable();
              tblSettings.Add("LogPath", "Test LogPath");
              tblSettings.Add("LogToFile", "false");
              tblSettings.Add("LogErrorsOnly", "false");
              tblSettings.Add("ProxyServer", "http://localhost/");
              tblSettings.Add("ProxyUser", "ProxyUser");
              tblSettings.Add("ProxyPassword", "ProxyPassword");
              tblSettings.Add("ProxyDomain", "ProxyDomain");
              tblSettings.Add("MaskCredentials", "false");
              tblSettings.Add("Timeout", "20");
              tblSettings.Add("RetryCount", "5");

              tblSettings.Add("OAuth2ClientId", "OAuth2ClientId");
              tblSettings.Add("OAuth2ClientSecret", "OAuth2ClientSecret");
              tblSettings.Add("OAuth2ServiceAccountEmail", "OAuth2ServiceAccountEmail");
              tblSettings.Add("OAuth2PrnEmail", "OAuth2PrnEmail");
              tblSettings.Add("OAuth2JwtCertificatePath", "OAuth2JwtCertificatePath");
              tblSettings.Add("OAuth2JwtCertificatePassword", "OAuth2JwtCertificatePassword");
              tblSettings.Add("OAuth2AccessToken", "OAuth2AccessToken");
              tblSettings.Add("OAuth2RefreshToken", "OAuth2RefreshToken");
              tblSettings.Add("OAuth2Scope", "OAuth2Scope");
              tblSettings.Add("OAuth2RedirectUri", "OAuth2RedirectUri");
              tblSettings.Add("OAuth2Mode", "SERVICE_ACCOUNT");

              tblSettings.Add("Email", "Email");
              tblSettings.Add("Password", "Password");
              tblSettings.Add("AuthToken", "AuthToken");
              tblSettings.Add("EnableGzipCompression", "false");
        }
Пример #30
0
        public static string FormatTagsTable(Hashtable tags)
        {
            if (tags == null || tags.Count == 0)
            {
                return null;
            }

            StringBuilder resourcesTable = new StringBuilder();

            var tagsDictionary = TagsConversionHelper.CreateTagDictionary(tags, false);

            int maxNameLength = Math.Max("Name".Length, tagsDictionary.Max(tag => tag.Key.Length));
            int maxValueLength = Math.Max("Value".Length, tagsDictionary.Max(tag => tag.Value.Length));

            string rowFormat = "{0, -" + maxNameLength + "}  {1, -" + maxValueLength + "}\r\n";
            resourcesTable.AppendLine();
            resourcesTable.AppendFormat(rowFormat, "Name", "Value");
            resourcesTable.AppendFormat(rowFormat,
                GeneralUtilities.GenerateSeparator(maxNameLength, "="),
                GeneralUtilities.GenerateSeparator(maxValueLength, "="));

            foreach (var tag in tagsDictionary)
            {
                if (tag.Key.StartsWith(ExcludedTagPrefix))
                {
                    continue;
                }

                resourcesTable.AppendFormat(rowFormat, tag.Key, tag.Value);
            }

            return resourcesTable.ToString();
        }