ContainsKey() public méthode

public ContainsKey ( Object key ) : bool
key Object
Résultat bool
        public FileTag(Hashtable options)
        {
            StatusEvent.FireStatusError(this, statusEvent, Globalisation.GetString(""));
            if (options.ContainsKey("Db"))
            {
                this.Db = (MyDatabase)options["Db"];
            }

            if (options.ContainsKey("Form"))
            {
                this.Form = (Form1)options["Form"];
            }

            if (options.ContainsKey("listview"))
            {
                this.ListView = (ListView)options["listview"];
                this.ListView.MouseDown += new MouseEventHandler(mouseDown_ListView);

                this.ListView.OwnerDraw = true;
                this.ListView.DrawItem += new DrawListViewItemEventHandler(ListView_DrawItem);
            }

            if (options.ContainsKey("infopanel"))
            {
                this.Infopanel = (RichTextBox)options["infopanel"];
            }

            if (options.ContainsKey("GridFile"))
            {
                this.GridFile = (GridFile)options["GridFile"];
                this.GridFileListView = this.GridFile.GetListView();
                //this.GridFileListView.MouseDown += new MouseEventHandler(mouseDown_LoadTag);
                this.GridFileListView.SelectedIndexChanged += new System.EventHandler(this.center_listview_SelectedIndexChanged);
            }
        }
Exemple #2
0
        public void TestCtorDictionarySingle()
        {
            // No exception
            var hash = new Hashtable(new Hashtable(), 1f);
            // No exception
            hash = new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable()), 1f), 1f), 1f), 1f);

            // []test to see if elements really get copied from old dictionary to new hashtable
            Hashtable tempHash = new Hashtable();
            // this for assumes that MinValue is a negative!
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                tempHash.Add(i, i);
            }

            hash = new Hashtable(tempHash, 1f);

            // make sure that new hashtable has the elements in it that old hashtable had
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                Assert.True(hash.ContainsKey(i));
                Assert.True(hash.ContainsValue(i));
            }

            //[]make sure that there are no connections with the old and the new hashtable
            tempHash.Clear();
            for (long i = long.MinValue; i < long.MinValue + 100; i++)
            {
                Assert.True(hash.ContainsKey(i));
                Assert.True(hash.ContainsValue(i));
            }
        }
Exemple #3
0
        /// <summary>
        /// 记帐金额统计
        /// </summary>
        /// <param name="Flag">1-记帐单记帐 0-无记帐单记帐</param>
        /// <param name="has">无记帐病人身份ID</param>
        /// <param name="dr">数据源</param>
        /// <returns></returns>
        private double dblSbmny(int Flag, System.Collections.Hashtable has, ref DataRow dr)
        {
            double db = 0;

            if (dr["acctsum_mny"].ToString() == string.Empty)
            {
                return(db);
            }

            if (Flag == 1)
            {
                if (!has.ContainsKey(dr["paytypeid_chr"].ToString()))
                {
                    db = Convert.ToDouble(dr["acctsum_mny"].ToString());
                }
            }
            else
            {
                if (has.ContainsKey(dr["paytypeid_chr"].ToString()))
                {
                    db = Convert.ToDouble(dr["acctsum_mny"].ToString());
                }
            }
            return(db);
        }
        private void ProcessAssembly(Assembly assembly)
        {
            if (assembly.IsDynamic || mAssemblies.ContainsKey(assembly.GetName().Name))
            {
                return;
            }

            mAssemblies.Add(assembly.GetName().Name, assembly);

            AssemblyName[] refAssemblies = assembly.GetReferencedAssemblies();
            bool           found         = false;

            foreach (var item in refAssemblies)
            {
                if (string.Compare(item.Name, mProtoInterface, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                {
                    found = true;
                    break;
                }
            }

            //Doesn't reference ProtoInterface.
            if (!found)
            {
                return;
            }

            InitializeExtensionApp(assembly);
        }
        public LoginResponse Login (Hashtable request, UserAccount account, IAgentInfo agentInfo, string authType,
                                   string password, out object data)
        {
            data = null;

            string ip = "";
            string version = "";
            string platform = "";
            string mac = "";
            string id0 = "";

            if (request != null) {
                ip = request.ContainsKey ("ip") ? (string)request ["ip"] : "";
                version = request.ContainsKey ("version") ? (string)request ["version"] : "";
                platform = request.ContainsKey ("platform") ? (string)request ["platform"] : "";
                mac = request.ContainsKey ("mac") ? (string)request ["mac"] : "";
                id0 = request.ContainsKey ("id0") ? (string)request ["id0"] : "";
            }

            string message;
            if (!m_module.CheckUser (account.PrincipalID, ip,
                    version,
                    platform,
                    mac,
                    id0, out message)) {
                return new LLFailedLoginResponse (LoginResponseEnum.Indeterminant, message, false);
            }
            return null;
        }
Exemple #6
0
        protected override Hashtable DoExtraProcess(Hashtable h)
        {
            if (!h.Contains("T_SU"))
            {
                h.Add("T_SU",0);
            }
            if (!h.ContainsKey("01_SU"))
            {
                h.Add("01_SU",0);
            }
            if (!h.ContainsKey("02_SU"))
            {
                h.Add("02_SU", 0);
            }
            if (!h.ContainsKey("03_SU"))
            {
                h.Add("03_SU", 0);
            }
            if (!h.ContainsKey("04_SU"))
            {
                h.Add("04_SU", 0);
            }

            return h;
        }
Exemple #7
0
        static void Main(string[] args)
        {
            Hashtable hashtable = new Hashtable();

            for (int i = 0; i < 1000000; i++)
            {
                hashtable[i.ToString("0000000")] = i;

            }
            Stopwatch s1 = Stopwatch.StartNew();
            var r1 = hashtable.ContainsKey("09999");
            var r2 = hashtable.ContainsKey("30000");
            s1.Stop();
            Console.WriteLine("{0}", s1.Elapsed);

            Dictionary<string, int> dictionary = new Dictionary<string, int>();
            for (int i = 0; i < 1000000; i++)
            {
                dictionary.Add(i.ToString("000000"), i);
            }

            Stopwatch s2 = Stopwatch.StartNew();
            var r3 = dictionary.ContainsKey("09999");
            var r4 = dictionary.ContainsKey("30000");
            s2.Stop();
            Console.WriteLine("{0}", s2.Elapsed);
        }
Exemple #8
0
 public ZenElementTypes(Hashtable def)
 {
     if (def == null) return;
     if (def.ContainsKey("empty")) ParseSet(empty, (string)def["empty"]);
     if (def.ContainsKey("block_level")) ParseSet(block_level, (string)def["block_level"]);
     if (def.ContainsKey("inline_level")) ParseSet(inline_level, (string)def["inline_level"]);
 }
        /// <summary>
        /// Get the next item from the queue which is not in the provided exclusion list.  
        /// Return null if the queue is empty or if there are no qualifying items.
        /// </summary>
        /// <returns></returns>
        public SendParameters Dequeue(Hashtable exclusionList, Guid currentSlide)
        {
            lock (this) {
                ClientQueue bestClient = null;
                SendParameters bestMessage = null;
                foreach (ClientQueue cq in m_QueueList.Values) {
                    //Block student messages when sending public messages.
                    if ((exclusionList.ContainsKey(cq.Id)) && (cq.IsPublicNode) && !((ReferenceCounter)exclusionList[cq.Id]).IsZero)
                        return cq.Dequeue(currentSlide);

                    if (m_DisabledClients.ContainsKey(cq.Id))
                        continue;
                    if (((exclusionList.ContainsKey(cq.Id)) && (((ReferenceCounter)exclusionList[cq.Id]).IsZero)) ||
                        (!exclusionList.ContainsKey(cq.Id))) {
                        SendParameters thisSp = cq.Peek(currentSlide);
                        if (thisSp != null) {
                            if (thisSp.CompareTo(bestMessage, currentSlide) < 0) {
                                bestMessage = thisSp;
                                bestClient = cq;
                            }
                        }
                    }
                }
                if (bestClient != null) {
                    //Trace.WriteLine("Dequeue: best message tag: " + bestMessage.Tags.SlideID.ToString() +
                    //    "; current slide=" + currentSlide.ToString() +
                    //    "; seq number=" + bestMessage.SequenceNumber.ToString(), this.GetType().ToString());
                    return bestClient.Dequeue(currentSlide);
                }
            }
            return null;
        }
Exemple #10
0
		/// <summary> Returns a value cast to a specific type
		/// *
		/// </summary>
		/// <param name="aBrc">- The BRERuleContext object
		/// </param>
		/// <param name="aMap">- The Map of parameters from the XML
		/// </param>
		/// <param name="aStep">- The step that it is on
		/// </param>
		/// <returns> The value cast to the specified type
		/// 
		/// </returns>
		public object ExecuteRule(IBRERuleContext aBrc, Hashtable aMap, object aStep)
		{
			bool staticCall = false;
			if (!aMap.ContainsKey(OBJECTID))
			{
				if (!aMap.ContainsKey(TYPE))
					throw new BRERuleException("Parameter 'Type' or 'ObjectId' not found");
				else staticCall = true;
			}
			if (!aMap.ContainsKey(MEMBER))
			{
				throw new BRERuleException("Parameter 'Member' not found");
			}
			else
			{
				if (staticCall)
					return Reflection.ClassCall((string)aMap[TYPE],
						                           (string)aMap[MEMBER],
						                           GetArguments(aMap));
				else
					return Reflection.ObjectCall(aBrc.GetResult(aMap[OBJECTID]).Result,
						                           (string)aMap[MEMBER],
						                           GetArguments(aMap));
			}
		}
        /// <summary>
        /// Add a new Word/File pair to the Catalog
        /// </summary>
        public bool Add(string word, File infile, int position)
        {
            word                 = word.UnicodeToCharacter();
            infile.Url           = infile.Url.UnicodeToCharacter();
            infile.Description   = infile.Description.UnicodeToCharacter();
            infile.KeywordString = infile.KeywordString.UnicodeToCharacter();
            infile.Title         = infile.Title.UnicodeToCharacter();

            // ### Keep a list of all the files we catalog [v7]
            if (!_FileIndex.ContainsKey(infile))
            {
                _FileIndex.Add(infile, _FileIndex.Count);
                if (infile.IndexId < 0)
                {
                    infile.IndexId = _FileIndex.Count - 1;  // zero based
                }
            }
            // ### Make sure the Word object is in the index ONCE only
            if (_Index.ContainsKey(word))
            {
                Word theword = (Word)_Index[word];      // get Word from Index, then add this file reference to the Word
                theword.Add(infile, position);
            }
            else
            {
                Word theword = new Word(word, infile, position);        // create a new Word object and add to Index
                _Index.Add(word, theword);
            }
            _SerializePreparationDone = false;  // adding to the catalog invalidates 'serialization preparation'
            return(true);
        }
Exemple #12
0
        public void TestGetKeyValueList()
        {
            var dic1 = new SortedList();

            for (int i = 0; i < 100; i++)
                dic1.Add("Key_" + i, "Value_" + i);

            var ilst1 = dic1.GetKeyList();
            var hsh1 = new Hashtable();

            DoIListTests(dic1, ilst1, hsh1, DicType.Key);

            Assert.False(hsh1.Count != 2
                || !hsh1.ContainsKey("IsReadOnly")
                || !hsh1.ContainsKey("IsFixedSize"), "Error, KeyList");


            dic1 = new SortedList();
            for (int i = 0; i < 100; i++)
                dic1.Add("Key_" + i, "Value_" + i);

            ilst1 = dic1.GetValueList();
            hsh1 = new Hashtable();
            DoIListTests(dic1, ilst1, hsh1, DicType.Value);

            Assert.False(hsh1.Count != 2
                || !hsh1.ContainsKey("IsReadOnly")
                || !hsh1.ContainsKey("IsFixedSize"), "Error, ValueList");
        }
Exemple #13
0
        public DataSet GetPromotionDs(Hashtable paramHash)
        {
            string sql = @"select pm.SysNo,pm.PromotionName,pm.CreateTime,pm.status, su.username as username
                        from Promotion_Master pm
                        left join sys_user su on pm.CreateUserSysNo=su.sysno
                        where 1=1 @DateFrom @DateTo @status @KeyWords ";
              if (paramHash.ContainsKey("DateFrom"))
              {
              sql = sql.Replace("@DateFrom", "and pm.CreateTime>=" + Util.ToSqlString(paramHash["DateFrom"].ToString()));
              }
              else
              {
              sql = sql.Replace("@DateFrom", "");
              }
              if (paramHash.ContainsKey("DateTo"))
              {
              sql = sql.Replace("@DateTo", "and pm.CreateTime<=" + Util.ToSqlEndDate(paramHash["DateTo"].ToString()));
              }
              else
              {
              sql = sql.Replace("@DateTo", "");
              }
              if (paramHash.ContainsKey("Status"))
              {
              sql = sql.Replace("@status", "and pm.status=" + Util.ToSqlString(paramHash["Status"].ToString()));
              }
              else
              {
              sql = sql.Replace("@status", "");
              }
              if (paramHash.ContainsKey("KeyWords"))
              {
              string[] keys = (Util.TrimNull(paramHash["KeyWords"].ToString())).Split(' ');
              if (keys.Length == 1)
              {
                  sql = sql.Replace("@KeyWords", "and pm.PromotionName like " + Util.ToSqlLikeString(paramHash["KeyWords"].ToString()));
              }
              else
              {
                  string t = "";
                  for (int i = 0; i < keys.Length; i++)
                  {
                      t += "and pm.PromotionName like" + Util.ToSqlLikeString(keys[i]);

                  }
                  sql = sql.Replace("@KeyWords", t);

              }
              }
              else
              {
              sql = sql.Replace("@KeyWords", "");
              }

              if (paramHash == null || paramHash.Count == 0)
              sql = sql.Replace("select", "select top 50 ");
              sql = sql + "order by pm.sysno desc";

              return SqlHelper.ExecuteDataSet(sql);
        }
        public string ExportExcel(System.Collections.Hashtable filters, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            EurofarSampleCollectionObject ds = new EurofarSampleCollectionObject();

            string client        = null;
            string season        = null;
            string description   = null;
            string sampleOrderUD = null;

            if (filters.ContainsKey("season") && !string.IsNullOrEmpty(filters["season"].ToString()))
            {
                season = filters["season"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("client") && !string.IsNullOrEmpty(filters["client"].ToString()))
            {
                client = filters["client"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("description") && !string.IsNullOrEmpty(filters["description"].ToString()))
            {
                description = filters["description"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("sampleOrderUD") && !string.IsNullOrEmpty(filters["sampleOrderUD"].ToString()))
            {
                sampleOrderUD = filters["sampleOrderUD"].ToString().Replace("'", "''");
            }

            try
            {
                System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter();
                adap.SelectCommand             = new System.Data.SqlClient.SqlCommand("EurofarSampleCollectionMng_function_SampleProduct", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString()));
                adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
                adap.SelectCommand.Parameters.AddWithValue("@SortedBy", null);
                adap.SelectCommand.Parameters.AddWithValue("@SortedDirection", null);
                adap.SelectCommand.Parameters.AddWithValue("@Client", client);
                adap.SelectCommand.Parameters.AddWithValue("@Season", season);
                adap.SelectCommand.Parameters.AddWithValue("@Desciption", description);
                adap.SelectCommand.Parameters.AddWithValue("@SampleOrderUD", sampleOrderUD);

                adap.TableMappings.Add("Table", "SampleProduct");
                adap.Fill(ds);

                ds.AcceptChanges();

                return(Library.Helper.CreateReportFileWithEPPlus2(ds, "EurofarSampleCollectionRpt"));
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
                return(string.Empty);
            }
        }
Exemple #15
0
        protected void ImportParticipant(EventPageBase ep, string[] participantFields, string[] keys)
        {
            string email = "";
            Hashtable fieldsHashtable = new Hashtable();
            if(participantFields.Count() == keys.Count())
            for (int i = 0; i < keys.Count(); i++)
            {
                if(!fieldsHashtable.ContainsKey(keys[i]))
                    fieldsHashtable.Add(keys[i].ToLower(), participantFields[i]);
            }

            if (fieldsHashtable.ContainsKey("email"))
                email = fieldsHashtable["email"].ToString();
            else
                return;
            if(string.IsNullOrEmpty(email))
                return;

            XForm xform = ep.RegistrationForm;

            XFormData xFormData = xform.CreateFormData();

            PopulateChildNodeRecursive(fieldsHashtable, xFormData.Data.ChildNodes);
           

            string xformstring = xFormData.Data.InnerXml;
            StatusLiteral.Text += "Adding participant: " + email+"<br/>";
            AttendRegistrationEngine.GenerateParticipation(ep.ContentLink, email, false, xformstring,
                "Imported participant from text");
        }
Exemple #16
0
 private static char FirstNonRepeatedChar(string str)
 {
     char[] cArr = str.ToCharArray();
     Hashtable h = new Hashtable();
     // Build hashtable - Key = Char ; Value = Count (#of times Char occures in string)
     for (int i = 0; i < cArr.Length; ++i)
     {
         if (!h.ContainsKey(cArr[i]))
         {
             h.Add(cArr[i], 1);
         }
         else
         {
             int count = (int)h[cArr[i]];
             h[cArr[i]] = count + 1;
         }
     }
     for (int i = 0; i < cArr.Length; ++i)
     {
         if(h.ContainsKey(cArr[i]))
         {
             if((int)h[cArr[i]] == 1)
                 return cArr[i];
         }
     }
     return '0';
 }
 /// <summary>
 /// Get the next item from the queue which is not in the provided exclusion list.  
 /// Return null if the queue is empty or if there are no qualifying items.
 /// </summary>
 /// <returns></returns>
 public SocketSendParameters Dequeue(Hashtable exclusionList, Guid currentSlide)
 {
     lock (this) {
         SocketQueue bestSocketQueue = null;
         SocketSendParameters bestMessage = null;
         foreach (SocketQueue sq in m_QueueList.Values) {
             if (((exclusionList.ContainsKey(sq.Socket)) && (((ReferenceCounter)exclusionList[sq.Socket]).IsZero)) ||
                 (!exclusionList.ContainsKey(sq.Socket))) {
                 SocketSendParameters thisSp = sq.Peek(currentSlide);
                 if (thisSp != null) {
                     if (thisSp.CompareTo(bestMessage, currentSlide) < 0) {
                         bestMessage = thisSp;
                         bestSocketQueue = sq;
                     }
                 }
             }
         }
         if (bestSocketQueue != null) {
             //Trace.WriteLine("Dequeue: best message tag: " + bestMessage.Tags.SlideID.ToString() +
             //    "; current slide=" + currentSlide.ToString() +
             //    "; seq number=" + bestMessage.SequenceNumber.ToString(), this.GetType().ToString());
             return bestSocketQueue.Dequeue(currentSlide);
         }
     }
     return null;
 }
        /// <summary>
        /// Read a simple config file and returns its variables as a Hashtable.
        /// </summary>
        public static Hashtable ReadConfig(string configPath)
        {
            if (configPath == null) configPath = "";
            if (cache.ContainsKey(configPath)) return cache[configPath];

            Hashtable config = new Hashtable();
            if (File.Exists(configPath))
            {
                string[] lines = File.ReadAllLines(configPath);
                foreach (string line in lines)
                {
                    if (line.StartsWith("#")) continue;
                    string[] entry = line.Trim().Split(new char[] { '=' }, 2);
                    if (entry.Length < 2) continue;
                    config[entry[0].Trim()] = entry[1].Trim();
                }
            }

            // default values
            if (!config.ContainsKey("java.home")) config["java.home"] = "";

            string args = "-Xmx384m -Dsun.io.useCanonCaches=false";
            if (config.ContainsKey("java.args")) args = config["java.args"] as string;
            if (args.IndexOf("-Duser.language") < 0)
                args += " -Duser.language=en -Duser.region=US";
            config["java.args"] = args;

            cache[configPath] = config;
            return config;
        }
Exemple #19
0
		public static int LinerComplex(string str)
		{
			Hashtable T = new Hashtable () ;
			Hashtable B = new Hashtable () ;
			Hashtable C = new Hashtable () ;
			C .Add (0,1) ;
			B .Add (0,1) ;
			int m = -1 , N = 0 , L = 0 ; //上述步骤完成初始化
			while (N < str.Length )
			{ //计算离差
				int d = str [N ] == '0' ? 0 : 1 ;
				int i = 1 ;
				#region
				while (i <= L ) 
				{					
					if (C .ContainsKey (i ))
					{
						if (str [N-i ] == '1') 
							d += 1 ;  //则ci = 1 
					}
				    i++ ;
				}
				d = d % 2;
				if ( d ==1 ) 
				{
					T = (Hashtable )C.Clone() ;
					foreach (DictionaryEntry k in B )
					{
						if ((int )k .Value == 1)
						{
							int temp = (int )k .Key + N - m ;
							if (C .ContainsKey (temp ))
							{
								C .Remove (temp ) ;
							}
							else
							{
								C .Add (temp ,1 ) ;
							}
						}
					}
					if (L <= (int )Math .Floor (N *0.5) )
					{
						L = N +1 -L ;
						m = N ;
						B =(Hashtable ) T.Clone() ;
					}				
				}
				#endregion
//			    Console.Write("L = {0}  ;", L);
//                foreach (DictionaryEntry j in C )
//                {
//                    Console.Write( j.Key  +" ;");
//                }
//			    Console.WriteLine();
				N ++ ;
			}
			return L ;
		}
        /// <summary>
        /// Parse arguments.
        /// </summary>
        /// <param name="args">Argument array from Main() method.</param>
        /// <returns>Hashtable of parsed arguments.</returns>
        private static Hashtable ArgumentParse(string[] args)
        {
            Hashtable Return = new Hashtable();

            string Key;
            bool ReadPort = false;
            bool ResetMessage = false;
            foreach (String arg in args)
            {
                if (arg.StartsWith("-") || arg.StartsWith("/"))
                {
                    Key = arg.Substring(1, arg.Length - 1).ToLower();

                    if (Key.Equals("on"))
                    {
                        if (!Return.ContainsKey(PARAMETER_BACKLIGHT))
                            Return.Add(PARAMETER_BACKLIGHT, true);
                    }
                    else if (Key.Equals("off"))
                    {
                        if (!Return.ContainsKey(PARAMETER_BACKLIGHT))
                            Return.Add(PARAMETER_BACKLIGHT, false);
                    }
                    else if (Key.StartsWith("p"))
                    {
                        if (!Return.ContainsKey(PARAMETER_PORT))
                            ReadPort = true;
                    }

                    ResetMessage = true;
                }
                else if (ReadPort)
                {
                    Return.Add(PARAMETER_PORT, arg);
                    ReadPort = false;
                }
                else
                {
                    if (ResetMessage)
                    {
                        if (Return.ContainsKey(PARAMETER_TEXT))
                            Return.Remove(PARAMETER_TEXT);

                        ResetMessage = false;
                    }

                    if (!Return.ContainsKey(PARAMETER_TEXT))
                    {
                        Return.Add(PARAMETER_TEXT, new StringBuilder(arg));
                    }
                    else
                    {
                        ((StringBuilder)Return[PARAMETER_TEXT]).Append(" ").Append(arg);
                    }
                }
            }

            return Return;
        }
Exemple #21
0
 public static void FilterUserInfoHtml(Hashtable info)
 {
     if (info.ContainsKey("Nickname")) info["Nickname"] = HtmlUtil.ReplaceHtml(info["Nickname"].ToString());
     if (info.ContainsKey("Tel")) info["Tel"] = HtmlUtil.ReplaceHtml(info["Tel"].ToString());
     if (info.ContainsKey("Mobile")) info["Mobile"] = HtmlUtil.ReplaceHtml(info["Mobile"].ToString());
     if (info.ContainsKey("HomePage")) info["HomePage"] = HtmlUtil.ReplaceHtml(info["HomePage"].ToString());
     if (info.ContainsKey("Remark")) info["Remark"] = HtmlUtil.ReplaceHtml(info["Remark"].ToString());
 }
		public Statement Replace(Hashtable resourceMap) {
			return new Statement(
				!resourceMap.ContainsKey(Subject) ? Subject : (Entity)resourceMap[Subject],
				!resourceMap.ContainsKey(Predicate) ? Predicate : (Entity)resourceMap[Predicate],
				!resourceMap.ContainsKey(Object) ? Object : (Resource)resourceMap[Object],
				!resourceMap.ContainsKey(Meta) ? Meta : (Entity)resourceMap[Meta]
				);
		}
Exemple #23
0
 public void RegisterXObject(XObject obj)
 {
     if (xObjects.ContainsKey(obj.ID))
     {
         throw new XObjectException("Duplicate XObject key \r\n" + obj.ID + "\r\n");
     }
     xObjects.Add(obj.ID, obj);
 }
Exemple #24
0
 public override DataTable GetShemalAndData( Hashtable hash,out int totalCount)
 {
     return IocObject.Data.GetQueryView(
         this.PortalKey,
         hash,
         hash.ContainsKey("pageSize") ? int.Parse(hash["pageSize"].ToString()) : 100000,
         hash.ContainsKey("pageIndex") ? int.Parse(hash["pageIndex"].ToString()) : 1, out totalCount);
 }
Exemple #25
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                fileName = openFileDialog1.FileName;
                BinaryReader br = new BinaryReader(File.Open(openFileDialog1.FileName, FileMode.Open));
                TextWriter tr = new StreamWriter(File.Open(fileName+".dat",FileMode.Create));
                Hashtable offset = new Hashtable();
                Hashtable links  = new Hashtable();

                long num = 0;
                int cur_offset = 0;
                int previous = 0;
                try
                {
                    tr.Write("# extrait du fichier" + fileName+"\n");
                    tr.Write("graph [\n");
                    tr.Write("\tcomment \"generated by viewer\" \n");
                    tr.Write("\tdirected 1\n");
                    //tr.Write("\tid 42\n");
                    //tr.Write("\tlabel "Hello, I am a graph"
                    while (true)
                    {
                        cur_offset = br.ReadInt32();
                        if (cur_offset < 0x70000000 || previous < 0x70000000)
                        {
                            if (!offset.ContainsKey(cur_offset.ToString("X")))
                            {
                                offset.Add(cur_offset.ToString("X"), num);
                                tr.Write("node [\n");
                                tr.Write("       id " + num.ToString() + "\n");
                                tr.Write("        label \"" + cur_offset.ToString("X") + "\" \n");
                                tr.Write("]\n");
                                num++;
                            }

                            if (!links.ContainsKey(cur_offset.ToString("X") + "to" + previous.ToString("X")) && (previous != cur_offset) && offset.ContainsKey(previous.ToString("X")))
                            {
                                links.Add(cur_offset.ToString("X") + "to" + previous.ToString("X"), null);
                                tr.Write("\tedge [\n");
                                tr.Write("\t    source " + offset[previous.ToString("X")] + "\n");
                                tr.Write("\t    target " + offset[cur_offset.ToString("X")] + "\n");
                                tr.Write("\t]\n");
                            }
                        }
                        previous = cur_offset;
                    }

                }
                catch (Exception )
                {

                }
                tr.Write("]\n");
                tr.Close();
                br.Close();
            }
        }
Exemple #26
0
        public object CustomFunction(int userId, string identifier, System.Collections.Hashtable input, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success };
            int? offerSeasonDetailID = null;
            switch (identifier.ToLower())
            {
                //
                // overview
                //
                case "getoverviewdata":
                    if (!input.ContainsKey("id"))
                    {
                        notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id!" };
                        return null;
                    }
                    offerSeasonDetailID = Convert.ToInt32(input["offerSeasonDetailID"]);
                    return bll.GetOverviewData(Convert.ToInt32(input["id"]), offerSeasonDetailID, out notification);

                // 
                // price comparison
                //
                case "getitemtocomparedata":
                    if (!input.ContainsKey("id"))
                    {
                        notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id!" };
                        return null;
                    }
                    offerSeasonDetailID = Convert.ToInt32(input["offerSeasonDetailID"]);
                    return bll.GetItemToCompareData(Convert.ToInt32(input["id"]), offerSeasonDetailID,  out notification);

                case "getcomparableitemdata":
                    if (!input.ContainsKey("filters"))
                    {
                        notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow filters!" };
                        return null;
                    }
                    return bll.GetComparableItemData((Hashtable)input["filters"], out notification);

                case "getbestcomparableitemdata":
                    if (!input.ContainsKey("filters"))
                    {
                        notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow filters!" };
                        return null;
                    }
                    return bll.GetBestComparableItemData((Hashtable)input["filters"], out notification);

                case "getpriceofferhistory":
                    if (!input.ContainsKey("id"))
                    {
                        notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Unknow id!" };
                        return null;
                    }
                    return bll.GetPriceOfferHistory(Convert.ToInt32(input["id"]), out notification);
            }

            notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Error, Message = "Custom function's identifier not matched" };
            return null;
        }
        public static DataTable GetSubStorageProduct(SubStorageProductModel model, int PageIndex, int PageSize, string OrderBy, ref int PageCount, Hashtable htPara)
        {

            int length = htPara.Count;
            string EFSql = string.Empty;
            if (htPara.ContainsKey("EFIndex") && htPara.ContainsKey("EFDesc"))
            {
                EFSql = " AND pi." + htPara["EFIndex"] + " LIKE '" + htPara["EFDesc"] + "' ";
                length = length - 2;
            }


            SqlParameter[] paras = new SqlParameter[length + 2];
            int index = 0;
            paras[index] = new SqlParameter("@DeptID", SqlDbType.Int);
            paras[index++].Value = model.DeptID;
            paras[index] = new SqlParameter("@CompanyCD", SqlDbType.VarChar);
            paras[index++].Value = model.CompanyCD;
            string tmpSql = string.Empty;
            if (htPara.ContainsKey("SubStoreName"))
            {
                tmpSql += " AND di.DeptName LIKE @SubStoreName ";
                paras[index] = new SqlParameter("@SubStoreName", SqlDbType.VarChar);
                paras[index++].Value = htPara["SubStoreName"];
            }
            StringBuilder sbSql = new StringBuilder();
            sbSql.Append("SELECT ssp.*,( SELECT di.DeptName FROM officedba.DeptInfo as di  WHERE di.ID=ssp.DeptID  " + tmpSql + " )  as DetpName,  pi.SellPrice");
            sbSql.Append(" ,pi.ProductName ,pi.ProdNo,pi.Specification,pi.IsBatchNo,(select ct.CodeName from officedba.CodeUnitType as ct where ct.ID=pi.UnitID  ) as UnitName,pi.UnitID ");
            sbSql.Append(" ,(SELECT sps.SendPriceTax FROM officedba.SubProductSendPrice AS sps where sps.DeptID=ssp.DeptID AND sps.CompanyCD=ssp.CompanyCD AND sps.ProductID=ssp.ProductID) AS BackPrice ");
            sbSql.Append(@" FROM officedba.SubStorageProduct as ssp  
                            inner join officedba.ProductInfo as pi on pi.ID=ssp.ProductID AND pi.CheckStatus=1 ");
            sbSql.Append(" where ssp.DeptID=@DeptID AND ssp.CompanyCD=@CompanyCD ");
            if (htPara.ContainsKey("ProductName"))
            {
                sbSql.Append(" AND pi.ProductName LIKE @ProductName ");
                paras[index] = new SqlParameter("@ProductName", SqlDbType.VarChar);
                paras[index++].Value = htPara["ProductName"];
            }
            if (htPara.ContainsKey("ProdNo"))
            {
                sbSql.Append(" AND pi.ProdNo LIKE @ProdNo");
                paras[index] = new SqlParameter("@ProdNo", SqlDbType.VarChar);
                paras[index++].Value = htPara["ProdNo"];
            }

            if (htPara.ContainsKey("Specification"))
            {
                sbSql.Append(" AND pi.Specification LIKE @Specification");
                paras[index] = new SqlParameter("@Specification", SqlDbType.VarChar);
                paras[index++].Value = htPara["Specification"];
            }

            /*追加扩展属性查询*/
            sbSql.Append(EFSql);

            return SqlHelper.CreateSqlByPageExcuteSql(sbSql.ToString(), PageIndex, PageSize, OrderBy, paras, ref PageCount);

        }
        public PlayerCountry(Hashtable data)
        {
            if (data == null) {
                return;
            }

            name = data.ContainsKey ("name") ? (string)data["name"] : null;
            code = data.ContainsKey ("code") ? (string)data["code"] : null;
        }
Exemple #29
0
        public override IEnumerable <DTO.ClientPaymentMng.ClientPaymentSearch> GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out DTO.Framework.Notification notification)
        {
            notification = new DTO.Framework.Notification()
            {
                Type = DTO.Framework.NotificationType.Success
            };
            totalRows = 0;

            string Season            = string.Empty;
            string ProformaInvoiceNo = string.Empty;
            string ClientUD          = string.Empty;
            string ClientNM          = string.Empty;
            int    SaleID            = 0;

            if (filters.ContainsKey("Season"))
            {
                Season = filters["Season"].ToString();
            }
            if (filters.ContainsKey("ProformaInvoiceNo"))
            {
                ProformaInvoiceNo = filters["ProformaInvoiceNo"].ToString();
            }
            if (filters.ContainsKey("ClientUD"))
            {
                ClientUD = filters["ClientUD"].ToString();
            }
            if (filters.ContainsKey("ClientNM"))
            {
                ClientNM = filters["ClientNM"].ToString();
            }
            if (filters.ContainsKey("SaleID") && filters["SaleID"] != null)
            {
                SaleID = Convert.ToInt32(filters["SaleID"].ToString());
            }


            //try to get data
            try
            {
                using (ClientPaymentMngEntities context = CreateContext())
                {
                    totalRows = context.ClientPaymentMng_function_SearchClientPayment(orderBy, orderDirection, Season, ProformaInvoiceNo, ClientUD, ClientNM, SaleID).Count();
                    var result = context.ClientPaymentMng_function_SearchClientPayment(orderBy, orderDirection, Season, ProformaInvoiceNo, ClientUD, ClientNM, SaleID);
                    return(converter.DB2DTO_ClientPaymentSearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()));
                }
            }
            catch (Exception ex)
            {
                notification.Type    = DTO.Framework.NotificationType.Error;
                notification.Message = ex.Message;
                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
                return(new List <DTO.ClientPaymentMng.ClientPaymentSearch>());
            }
        }
		/// <summary>
		/// This method will import / update a list of videos into the Brightcove Video Library
		/// </summary>
		/// <param name="Videos">
		/// The Videos to import / update
		/// </param>
		/// <returns>
		/// returns a list of the new videos imported
		/// </returns>
		public static UpdateInsertPair<VideoItem> ImportToSitecore(this AccountItem account, List<BCVideo> Videos, UpdateType utype) {

			UpdateInsertPair<VideoItem> uip = new UpdateInsertPair<VideoItem>();

			//set all BCVideos into hashtable for quick access
			Hashtable ht = new Hashtable();
			foreach (VideoItem exVid in account.VideoLib.Videos) {
				if (!ht.ContainsKey(exVid.VideoID.ToString())) {
					//set as string, Item pair
					ht.Add(exVid.VideoID.ToString(), exVid);
				}
			}

			//Loop through the data source and add them
			foreach (BCVideo vid in Videos) {

				try {
					//remove access filter
					using (new Sitecore.SecurityModel.SecurityDisabler()) {

						VideoItem currentItem;

						//if it exists then update it
						if (ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE))) {
							currentItem = (VideoItem)ht[vid.id.ToString()];

							//add it to the new items
							uip.UpdatedItems.Add(currentItem);

							using (new EditContext(currentItem.videoItem, true, false)) {
								SetVideoFields(ref currentItem.videoItem, vid);
							}
						}
							//else just add it
						else if (!ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW))) {
							//Create new item
							TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Video"];

							currentItem = new VideoItem(account.VideoLib.videoLibraryItem.Add(vid.name.StripInvalidChars(), templateType));

							//add it to the new items
							uip.NewItems.Add(currentItem);

							using (new EditContext(currentItem.videoItem, true, false)) {
								SetVideoFields(ref currentItem.videoItem, vid);
							}
						}
					}
				} catch (System.Exception ex) {
					//HttpContext.Current.Response.Write(vid.name + "<br/>");
					throw new Exception("Failed on video: " + vid.name + ". " + ex.ToString());
				}
			}

			return uip;
		}
Exemple #31
0
 private static CacheServerConfig GetCacheConfiguration(Hashtable settings)
 {
     CacheServerConfig cache = new CacheServerConfig();
     cache.Name = settings["id"].ToString();
     if (settings.ContainsKey("web-cache"))
         GetWebCache(cache, (Hashtable)settings["web-cache"]);
     if (settings.ContainsKey("cache"))
         GetCache(cache, (Hashtable)settings["cache"]);
     return cache;
 }
Exemple #32
0
        public int GetTranslatedNumber(int sourceNum)
        {
            int retVal = -1;

            if (jsFiles.ContainsKey(sourceNum.ToString()))
            {
                retVal = (int)jsFiles[sourceNum.ToString()];
            }
            return(retVal);
        }
        /// <summary>
        /// Get Backup Info
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        BackupInfo GetBackupInfo(string name, Hashtable args)
        {
            var backupInfo = new BackupInfo();

            backupInfo.AllowOverwrite = args.ContainsKey("AllowOverwrite")? Convert.ToBoolean(args["AllowOverwrite"]) : true;
            backupInfo.BackupRemotePartitions = args.ContainsKey("BackupRemotePartitions") ? Convert.ToBoolean(args["BackupRemotePartitions"]) : false;
            backupInfo.File = GetFilePath(name, args["Path"].ToString());

            return backupInfo;
        }
Exemple #34
0
        public override IEnumerable <DTO.WarehouseCIMng.WarehouseCISearch> GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;

            string InvoiceNo = string.Empty;
            string RefNo     = string.Empty;
            string OrderNo   = string.Empty;
            string ClientUD  = string.Empty;
            string ClientNM  = string.Empty;

            if (filters.ContainsKey("InvoiceNo"))
            {
                InvoiceNo = filters["InvoiceNo"].ToString();
            }
            if (filters.ContainsKey("RefNo"))
            {
                RefNo = filters["RefNo"].ToString();
            }
            if (filters.ContainsKey("OrderNo"))
            {
                OrderNo = filters["OrderNo"].ToString();
            }
            if (filters.ContainsKey("ClientUD"))
            {
                ClientUD = filters["ClientUD"].ToString();
            }
            if (filters.ContainsKey("ClientNM"))
            {
                ClientNM = filters["ClientNM"].ToString();
            }

            //try to get data
            try
            {
                using (WarehouseCIMngEntities context = CreateContext())
                {
                    totalRows = context.WarehouseCIMng_function_SearchWarehouseCI(orderBy, orderDirection, InvoiceNo, RefNo, OrderNo, ClientUD, ClientNM).Count();
                    var result = context.WarehouseCIMng_function_SearchWarehouseCI(orderBy, orderDirection, InvoiceNo, RefNo, OrderNo, ClientUD, ClientNM);

                    return(converter.DB2DTO_WarehouseCISearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()));
                }
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Message = ex.Message, Type = Library.DTO.NotificationType.Warning
                };
                return(new List <DTO.WarehouseCIMng.WarehouseCISearch>());
            }
        }
        public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            ReportDataObject ds = new ReportDataObject();

            string ArticleCode = null;
            string Description = null;
            string Season      = null;



            if (filters.ContainsKey("ArticleCode"))
            {
                ArticleCode = filters["ArticleCode"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("Description"))
            {
                Description = filters["Description"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString()))
            {
                Season = filters["Season"].ToString().Replace("'", "''");
            }

            try
            {
                System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter();
                adap.SelectCommand             = new System.Data.SqlClient.SqlCommand("StandardCostPriceOverviewRpt_function_ExportProduct", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString()));
                adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;

                adap.SelectCommand.Parameters.AddWithValue("@Season", Season);
                adap.SelectCommand.Parameters.AddWithValue("@ArticleCode", ArticleCode);
                adap.SelectCommand.Parameters.AddWithValue("@Description", Description);

                adap.TableMappings.Add("Table", "StandardCostPriceOverviewRpt_ProductSearchResult_View");
                adap.Fill(ds);

                ds.AcceptChanges();

                return(Library.Helper.CreateReportFileWithEPPlus(ds, "StandardCostPriceOverviewRpt"));
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
                return(string.Empty);
            }
        }
Exemple #36
0
        public int solution(int[] A)
        {
            // write your code in C# 5.0 with .NET 4.5 (Mono)
            int depth = A.Length;
            Hashtable ht  = new Hashtable();
            for (int i = 0; i < A.Length; i++ )
            {
                Node n;
                if (ht.ContainsKey(A[i]))
                    n = (Node)ht[A[i]];
                else
                {
                    n = new Node(A[i], new List<int>());
                    ht.Add(A[i], n);
                }

                if(i>0)
                    n.childs.Add(A[i-1]);
                if (i < A.Length-1)
                    n.childs.Add(A[i + 1]);
            }

            int lookUp = A[A.Length - 1];
            Queue<int> Q = new Queue<int>();

            int val = 0;
            Q.Enqueue(A[val]);
            ((Node)ht[A[val]]).depth = 1;

            while (Q.Any())
            {
                val = Q.Dequeue();
                if (ht.ContainsKey(val))
                {
                    Node n = (Node) ht[val];

                    if (n.value == lookUp)
                        return n.depth;
                    ht.Remove(val);

                    foreach (int j in n.childs)
                    {
                        if (ht.ContainsKey(j))
                        {
                            Node x = (Node) ht[j];
                            if (x.depth  == 0)
                                x.depth = n.depth + 1;
                            Q.Enqueue(j);
                            //ht.Remove(j);
                        }
                    }
                }
            }
            return depth;
        }
        public override bool EditData(System.Collections.Hashtable table)
        {
            BindDelegate();
            Trace.Assert(table != null);
            Trace.Assert(table.ContainsKey("data"));
            Trace.Assert(table.ContainsKey("prev_data"));
            Trace.Assert(table.ContainsKey("flowchart_name"));
            Trace.Assert(table.ContainsKey("map_name"));

            LuaManager.GetLuaManager().InitOther("flowchart_name", table["flowchart_name"].ToString());
            LuaManager.GetLuaManager().InitOther("map_name", table["map_name"].ToString());
            LuaManager.GetLuaManager().InitOther("client_dir", table["client_dir"].ToString());

            //初始化历史表
            CacheManager.GetCacheManager().Global_Args_Table = table["globe_args"] as Hashtable;

            Hashtable ht_prev_data = table["prev_data"] as Hashtable;

            if (ht_prev_data.Count == 0)
            {
                return(false);
            }
            List <Exp> prev_List = null;

            foreach (object o in ht_prev_data.Values)
            {
                if ((o as DataElement).Data != null)
                {
                    prev_List = (((o as DataElement).Data as ConditionData).datalist as object[])[1] as List <Exp>;
                }
            }
            if (prev_List == null)
            {
                return(false);
            }

            Exp exp = table["data"] as Exp;

            SelectionForm expform = new SelectionForm(exp, prev_List);

            expform.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            if (expform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.data        = expform.ResultExp;
                this.text        = expform.ResultExp.ToString();
                this.TooltipText = this.Text;
                if (this.text.Length > 15)
                {
                    this.text = this.text.Substring(0, 13) + "...";
                }
                ScanConst(table);
                return(true);
            }
            return(false);;
        }
Exemple #38
0
 public Parser(Type argumentSpecification, ErrorReporter reporter)
 {
     this.reporter = reporter;
     arguments = new ArrayList();
     argumentMap = new Hashtable();
     FieldInfo[] fields = argumentSpecification.GetFields();
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo field = fields[i];
         if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
         {
             ArgumentAttribute attribute = GetAttribute(field);
             if (attribute is DefaultArgumentAttribute)
             {
                 Debug.Assert(defaultArgument == null);
                 defaultArgument = new Argument(attribute, field, reporter);
             }
             else
             {
                 arguments.Add(new Argument(attribute, field, reporter));
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         Debug.Assert(!argumentMap.ContainsKey(argument.LongName));
         argumentMap[argument.LongName] = argument;
         if (argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0)
             {
                 Debug.Assert(!argumentMap.ContainsKey(argument.ShortName));
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         if (!argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0 && !argumentMap.ContainsKey(argument.ShortName))
             {
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
 }
Exemple #39
0
		/// <summary>Add a new Word/File pair to the Catalog</summary>
		public bool Add (string word, File infile, int position){
            // ### Make sure the Word object is in the index ONCE only
			if (index.ContainsKey (word) ) {
				Word theword = (Word)index[word];	// add this file reference to the Word
				theword.Add(infile, position);
			} else {
				Word theword = new Word(word, infile, position);	// create a new Word object
				index.Add(word, theword);
			}
			return true;
		}
		public static UpdateInsertPair<PlaylistItem> ImportToSitecore(this AccountItem account, List<BCPlaylist> Playlists, UpdateType utype) {

			UpdateInsertPair<PlaylistItem> uip = new UpdateInsertPair<PlaylistItem>();

			//set all BCVideos into hashtable for quick access
			Hashtable ht = new Hashtable();
			foreach (PlaylistItem exPlay in account.PlaylistLib.Playlists) {
				if (!ht.ContainsKey(exPlay.playlistItem.ToString())) {
					//set as string, Item pair
					ht.Add(exPlay.PlaylistID.ToString(), exPlay);
				}
			}

			//Loop through the data source and add them
			foreach (BCPlaylist play in Playlists) {

				try {
					//remove access filter
					using (new Sitecore.SecurityModel.SecurityDisabler()) {

						PlaylistItem currentItem;

						//if it exists then update it
						if (ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE))) {
							currentItem = (PlaylistItem)ht[play.id.ToString()];

							//add it to the new items
							uip.UpdatedItems.Add(currentItem);

							using (new EditContext(currentItem.playlistItem, true, false)) {
								SetPlaylistFields(ref currentItem.playlistItem, play);
							}
						}
							//else just add it
						else if (!ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW))) {
							//Create new item
							TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Playlist"];
							currentItem = new PlaylistItem(account.PlaylistLib.playlistLibraryItem.Add(play.name.StripInvalidChars(), templateType));

							//add it to the new items
							uip.NewItems.Add(currentItem);

							using (new EditContext(currentItem.playlistItem, true, false)) {
								SetPlaylistFields(ref currentItem.playlistItem, play);
							}
						}
					}
				} catch (System.Exception ex) {
					throw new Exception("Failed on playlist: " + play.name + ". " + ex.ToString());
				}
			}

			return uip;
		}
Exemple #41
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="data"></param>
 private void validate(Hashtable data)
 {
     if (data.ContainsKey("x") && data.ContainsKey("y") &&
         data.ContainsKey("vx") && data.ContainsKey("vy"))
     {
         return;
     }
     else
     {
         throw new FormatException("ball クラスの引数が正しくありません。");
     }
 }
 protected override bool doLoadData(System.Collections.Hashtable data)
 {
     if (data.ContainsKey("TITLES"))
     {
         this.expTitles = (data["TITLES"] as System.Collections.Generic.Dictionary <string, string>);
     }
     if (data.ContainsKey("TABLE"))
     {
         this.dt = (data["TABLE"] as System.Data.DataTable);
     }
     return(true);
 }
        public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
        {
            Hashtable reply = new Hashtable();

            if (keysvals["method"].ToString() != "MapTexture")
                return reply;

            int zoom = 20;
            int x = 0;
            int y = 0;

            if (keysvals.ContainsKey("zoom"))
                zoom = int.Parse(keysvals["zoom"].ToString());
            if (keysvals.ContainsKey("x"))
                x = (int)float.Parse(keysvals["x"].ToString());
            if (keysvals.ContainsKey("y"))
                y = (int)float.Parse(keysvals["y"].ToString());

            m_log.Debug("[WebUI]: Sending map image jpeg");
            int statuscode = 200;
            byte[] jpeg = new byte[0];
            byte[] myMapImageJPEG;
            IAssetService m_AssetService = m_registry.RequestModuleInterface<IAssetService>();

            MemoryStream imgstream = new MemoryStream();
            Bitmap mapTexture = CreateZoomLevel(zoom, x, y);
            EncoderParameters myEncoderParameters = new EncoderParameters();
            myEncoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 75L);

            // Save bitmap to stream
            mapTexture.Save(imgstream, GetEncoderInfo("image/jpeg"), myEncoderParameters);

            // Write the stream to a byte array for output
            jpeg = imgstream.ToArray();
            myMapImageJPEG = jpeg;

            // Reclaim memory, these are unmanaged resources
            // If we encountered an exception, one or more of these will be null
            if (mapTexture != null)
                mapTexture.Dispose();

            if (imgstream != null)
            {
                imgstream.Close();
                imgstream.Dispose();
            }

            reply["str_response_string"] = Convert.ToBase64String(jpeg);
            reply["int_response_code"] = statuscode;
            reply["content_type"] = "image/jpeg";

            return reply;
        }
        public override DTO.SearchFormData GetDataWithFilter(int userID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <AnnualLeaveSearchResultDTO>();

            totalRows = 0;

            string EmployeeNM   = null;
            int?   CompanyID    = null;
            int?   AffectedYear = null;
            bool?  HasLeft      = false;

            if (filters.ContainsKey("employeeNM") && filters["employeeNM"] != null && !string.IsNullOrEmpty(filters["employeeNM"].ToString()))
            {
                EmployeeNM = filters["employeeNM"].ToString();
            }
            if (filters.ContainsKey("companyID") && filters["companyID"] != null && !string.IsNullOrEmpty(filters["companyID"].ToString()))
            {
                CompanyID = Convert.ToInt32(filters["companyID"].ToString());
            }
            if (filters.ContainsKey("affectedYear") && filters["affectedYear"] != null && !string.IsNullOrEmpty(filters["affectedYear"].ToString()))
            {
                AffectedYear = Convert.ToInt32(filters["affectedYear"].ToString());
            }
            if (filters.ContainsKey("HasLeft") && filters["HasLeft"] != null && !string.IsNullOrEmpty(filters["HasLeft"].ToString()))
            {
                HasLeft = (filters["HasLeft"].ToString() == "true") ? true : false;
            }
            //try to get data
            try
            {
                using (AnnualLeaveRptEntities context = CreateContext())
                {
                    int?companyID = fwFactory.GetCompanyID(userID);
                    var result    = context.AnnualLeaveRpt_function_SearchAnnualLeave(EmployeeNM, CompanyID, AffectedYear, HasLeft, orderBy, orderDirection).Where(o => o.CompanyID == companyID).ToList();
                    totalRows = result.Count();

                    data.Data = converter.DB2DTO_AnnualLeaveSearchResultDTO(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
        public DTO.FactorySaleOrderSearchFromData GetFactorySaleOrderData(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.FactorySaleOrderSearchFromData data = new DTO.FactorySaleOrderSearchFromData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                string factorySaleOrderUD   = null;
                string documentDate         = null;
                string productionItemUD     = null;
                string productionItemNM     = null;
                int?   factoryRawMaterialID = null;

                if (filters.ContainsKey("factorySaleOrderUD") && !string.IsNullOrEmpty(filters["factorySaleOrderUD"].ToString()))
                {
                    factorySaleOrderUD = filters["factorySaleOrderUD"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("factorySaleOrderDate") && !string.IsNullOrEmpty(filters["factorySaleOrderDate"].ToString()))
                {
                    documentDate = filters["factorySaleOrderDate"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("productionItemUD") && !string.IsNullOrEmpty(filters["productionItemUD"].ToString()))
                {
                    productionItemUD = filters["productionItemUD"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("productionItemNM") && !string.IsNullOrEmpty(filters["productionItemNM"].ToString()))
                {
                    productionItemNM = filters["productionItemNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("factoryRawMaterialID") && !string.IsNullOrEmpty(filters["factoryRawMaterialID"].ToString()))
                {
                    factoryRawMaterialID = Convert.ToInt32(filters["factoryRawMaterialID"].ToString());
                }
                DateTime?valFactorySaleOrderDate = documentDate.ConvertStringToDateTime();
                using (FactorySaleInvoiceEntities context = CreateContext())
                {
                    totalRows = context.FactorySaleInvoice_function_SearchFactorySaleOrderItem(orderBy, orderDirection, factorySaleOrderUD, valFactorySaleOrderDate, productionItemUD, productionItemNM, factoryRawMaterialID).Count();
                    var result = context.FactorySaleInvoice_function_SearchFactorySaleOrderItem(orderBy, orderDirection, factorySaleOrderUD, valFactorySaleOrderDate, productionItemUD, productionItemNM, factoryRawMaterialID).OrderByDescending(o => o.FactorySaleOrderUD).OrderByDescending(o => o.DocumentDate);
                    data.Data      = converter.DB2DTO_SearchFactorySaleOrderData(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                    data.TotalRows = totalRows;
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }
            return(data);
        }
        public DTO.SearchFormData GetDataWithFilters(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <DTO.EurofarSearchDTO>();
            totalRows = 0;

            string client        = null;
            string season        = null;
            string description   = null;
            string sampleOrderUD = null;

            if (filters.ContainsKey("season") && !string.IsNullOrEmpty(filters["season"].ToString()))
            {
                season = filters["season"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("client") && !string.IsNullOrEmpty(filters["client"].ToString()))
            {
                client = filters["client"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("description") && !string.IsNullOrEmpty(filters["description"].ToString()))
            {
                description = filters["description"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("sampleOrderUD") && !string.IsNullOrEmpty(filters["sampleOrderUD"].ToString()))
            {
                sampleOrderUD = filters["sampleOrderUD"].ToString().Replace("'", "''");
            }

            //try to get data
            try
            {
                using (EurofarSampleCollectionMngEntities context = CreateContext())
                {
                    totalRows = context.EurofarSampleCollectionMng_function_SampleProduct(orderBy, orderDirection, client, season, description, sampleOrderUD).Count();
                    var result = context.EurofarSampleCollectionMng_function_SampleProduct(orderBy, orderDirection, client, season, description, sampleOrderUD);
                    data.Data = converter.DB2DTO_EurofarSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
        public DTO.SearchFormData GetDataWithFilters(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <DTO.TransportationServiceSearchResultData>();
            totalRows = 0;

            string TransportationServiceNM = null;
            string PlateNumber             = null;
            string DriverName   = null;
            string MobileNumber = null;

            if (filters.ContainsKey("TransportationServiceNM") && !string.IsNullOrEmpty(filters["TransportationServiceNM"].ToString()))
            {
                TransportationServiceNM = filters["TransportationServiceNM"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("PlateNumber") && !string.IsNullOrEmpty(filters["PlateNumber"].ToString()))
            {
                PlateNumber = filters["PlateNumber"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("DriverName") && !string.IsNullOrEmpty(filters["DriverName"].ToString()))
            {
                DriverName = filters["DriverName"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("MobileNumber") && !string.IsNullOrEmpty(filters["MobileNumber"].ToString()))
            {
                MobileNumber = filters["MobileNumber"].ToString().Replace("'", "''");
            }

            //try to get data
            try
            {
                using (TransportationServiceMngEntities context = CreateContext())
                {
                    totalRows = context.TransportationServiceMng_function_SearchTransportationService(TransportationServiceNM, PlateNumber, DriverName, MobileNumber, orderBy, orderDirection).Count();
                    var result = context.TransportationServiceMng_function_SearchTransportationService(TransportationServiceNM, PlateNumber, DriverName, MobileNumber, orderBy, orderDirection);
                    data.Data = converter.DB2DTO_TransportationServiceResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Exemple #48
0
        static void Main(string[] args)
        {
            System.Collections.Hashtable table = new System.Collections.Hashtable();
            table["Ryan"] = 22;
            table["Mike"] = 25;
            table["Josh"] = 15;

            Console.WriteLine("Ryan is {0} years old", table["Ryan"]);
            Console.WriteLine("ContainsKey foo? {0}", table.ContainsKey("foo"));
            Console.WriteLine("ContainsKey Ryan? {0}", table.ContainsKey("Ryan"));

            PrintCollections(table.Keys);
            PrintCollections(table.Values);
        }
        public DTO.SearchFormData GetDataWithFilters(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <DTO.SaleOrderMngSearchResult>();
            totalRows = 0;

            string Season   = null;
            string ClientUD = null;
            string ClientNM = null;
            string PINo     = null;

            if (filters.ContainsKey("Season") && !string.IsNullOrEmpty(filters["Season"].ToString()))
            {
                Season = filters["Season"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ClientUD") && !string.IsNullOrEmpty(filters["ClientUD"].ToString()))
            {
                ClientUD = filters["ClientUD"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ClientNM") && !string.IsNullOrEmpty(filters["ClientNM"].ToString()))
            {
                ClientNM = filters["ClientNM"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("PINo") && !string.IsNullOrEmpty(filters["PINo"].ToString()))
            {
                PINo = filters["PINo"].ToString().Replace("'", "''");
            }

            //try to get data
            try
            {
                using (SaleOrderMngEntities context = CreateContext())
                {
                    totalRows = context.SaleOrderMng_function_SearchSaleOrder(orderBy, orderDirection, Season, ClientUD, ClientNM, PINo).Count();
                    var result = context.SaleOrderMng_function_SearchSaleOrder(orderBy, orderDirection, Season, ClientUD, ClientNM, PINo);
                    data.Data = converter.DB2DTO_SaleOrderResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Exemple #50
0
        public override DTO.SearchFormData GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchFormData searchFormData = new DTO.SearchFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                string productionItemUD   = null;
                string productionItemNM   = null;
                string productionItemNMEN = null;
                int?   companyID          = fw_factory.GetCompanyID(userId);

                if (filters.ContainsKey("productionItemUD") && !string.IsNullOrEmpty(filters["productionItemUD"].ToString()))
                {
                    productionItemUD = filters["productionItemUD"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("productionItemNM") && !string.IsNullOrEmpty(filters["productionItemNM"].ToString()))
                {
                    productionItemNM = filters["productionItemNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("productionItemNMEN") && !string.IsNullOrEmpty(filters["productionItemNMEN"].ToString()))
                {
                    productionItemNMEN = filters["productionItemNMEN"].ToString().Replace("'", "''");
                }
                using (BreakdownPriceListMngEntities context = CreateContext())
                {
                    totalRows = context.BreakdownPriceListMng_function_SearchBreakdownPriceList(orderBy, orderDirection, productionItemUD, productionItemNM, productionItemNMEN).Count();
                    var result = context.BreakdownPriceListMng_function_SearchBreakdownPriceList(orderBy, orderDirection, productionItemUD, productionItemNM, productionItemNMEN);
                    searchFormData.Data      = converter.DB2DTO_Search(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                    searchFormData.CompanyID = companyID.Value;

                    //get exchange rate of USD
                    var dbExchangeRate = context.BreakdownPriceListMng_function_GetExchangeRate(DateTime.Now, "USD").FirstOrDefault();
                    if (dbExchangeRate != null)
                    {
                        searchFormData.ExchangeRate = dbExchangeRate.ExchangeRate;
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }
            return(searchFormData);
        }
Exemple #51
0
        public void WriteLog(System.Collections.Hashtable hshParam, string strPosition)
        {
            string strUID = "NULL";
            string strMsg = "NULL";

            if (hshParam.ContainsKey("UID"))
            {
                strUID = hshParam["UID"].ToString();
            }
            if (hshParam.ContainsKey("Error"))
            {
                strMsg = hshParam["Error"].ToString();
            }
            ProcessDataAccess(strUID, strMsg, strPosition);
        }
        public override DTO.SearchFormData GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <DTO.CatalogFileSearchResult>();
            totalRows = 0;

            //try to get data
            try
            {
                using (CatalogFileMngEntities context = CreateContext())
                {
                    string Season         = null;
                    string FriendlyName   = null;
                    string PLFriendlyName = null;
                    string UpdatorName    = null;
                    if (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString()))
                    {
                        Season = filters["Season"].ToString().Replace("'", "''");
                    }
                    if (filters.ContainsKey("FriendlyName") && !string.IsNullOrEmpty(filters["FriendlyName"].ToString()))
                    {
                        FriendlyName = filters["FriendlyName"].ToString().Replace("'", "''");
                    }
                    if (filters.ContainsKey("PLFriendlyName") && !string.IsNullOrEmpty(filters["PLFriendlyName"].ToString()))
                    {
                        PLFriendlyName = filters["PLFriendlyName"].ToString().Replace("'", "''");
                    }
                    if (filters.ContainsKey("UpdatorName") && !string.IsNullOrEmpty(filters["UpdatorName"].ToString()))
                    {
                        UpdatorName = filters["UpdatorName"].ToString().Replace("'", "''");
                    }
                    totalRows = context.CatalogFileMng_function_SearchCatalogFile(Season, FriendlyName, PLFriendlyName, UpdatorName, orderBy, orderDirection).Count();
                    var result = context.CatalogFileMng_function_SearchCatalogFile(Season, FriendlyName, PLFriendlyName, UpdatorName, orderBy, orderDirection);
                    data.Data = converter.DB2DTO_CatalogFileSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Exemple #53
0
        public override bool EditData(System.Collections.Hashtable table)
        {
            BindDelegate();

            Trace.Assert(table != null);
            Trace.Assert(table.ContainsKey("data"));
            Trace.Assert(table.ContainsKey("event_data"));
            Trace.Assert(table.ContainsKey("prev_data"));
            Trace.Assert(table.ContainsKey("flowchart_name"));
            Trace.Assert(table.ContainsKey("map_name"));

            LuaManager.GetLuaManager().InitOther("flowchart_name", table["flowchart_name"].ToString());
            LuaManager.GetLuaManager().InitOther("map_name", table["map_name"].ToString());
            LuaManager.GetLuaManager().InitOther("client_dir", table["client_dir"].ToString());

            //初始化历史表
            CacheManager.GetCacheManager().Global_Args_Table = table["globe_args"] as Hashtable;

            System.Windows.Forms.DialogResult r;
            ActionListForm actionlistform;

            try
            {
                ActionExp[] exps = null;
                if (table["data"] != null)
                {
                    exps = (table["data"] as ActionData).ActionExpArray;
                }
                actionlistform = new ActionListForm(exps, table["event_data"] as GameEvent);
                actionlistform.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                r = actionlistform.ShowDialog();
            }
            catch (LuaInterface.LuaException ex)
            {
                this.printInfo(ex.ToString());
                return(false);
            }

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                this.data        = new ActionData(actionlistform.actionExpList);
                this.text        = actionlistform.actionExpListText;
                this.TooltipText = actionlistform.actionExpListText_Full;
                ScanConst(table);
                return(true);
            }
            return(false);
        }
Exemple #54
0
 private void _mainWidget_Destroyed(object sender, EventArgs e)
 {
     plot1.Model.MouseDown            -= OnChartClick;
     plot1.Model.MouseUp              -= OnChartMouseUp;
     captionEventBox.ButtonPressEvent -= OnCaptionLabelDoubleClick;
     // It's good practice to disconnect the event handlers, as it makes memory leaks
     // less likely. However, we may not "own" the event handlers, so how do we
     // know what to disconnect?
     // We can do this via reflection. Here's how it currently can be done in Gtk#.
     // Windows.Forms would do it differently.
     // This may break if Gtk# changes the way they implement event handlers.
     foreach (Widget w in Popup)
     {
         if (w is ImageMenuItem)
         {
             PropertyInfo pi = w.GetType().GetProperty("AfterSignals", BindingFlags.NonPublic | BindingFlags.Instance);
             if (pi != null)
             {
                 System.Collections.Hashtable handlers = (System.Collections.Hashtable)pi.GetValue(w);
                 if (handlers != null && handlers.ContainsKey("activate"))
                 {
                     EventHandler handler = (EventHandler)handlers["activate"];
                     (w as ImageMenuItem).Activated -= handler;
                 }
             }
         }
     }
     Clear();
 }
Exemple #55
0
        public void processMutiLanguageXmlContent(string tableName, string condition, ref System.Collections.Hashtable htFields)
        {
            string fieldName = "";

            foreach (string key in htFields.Keys)
            {
                fieldName = fieldName + key + ",";
            }

            fieldName = fieldName.Remove(fieldName.Length - 1);

            string _sql = String.Format("Select Top 1 {0} From [{1}] with (nolock) Where {2}", fieldName, tableName, condition);

            ReturnValue _reVal = this.getDataTable(_sql);

            DataTable dt = _reVal.ObjectValue as DataTable;

            foreach (DataRow dr in dt.Rows)
            {
                foreach (DataColumn dc in dr.Table.Columns)
                {
                    string key = dc.ColumnName;
                    if (!htFields.ContainsKey(key))
                    {
                        key = "[" + key + "]";
                    }
                    htFields[key] = Process.GenerateContentXML(Utilities.CurrentLangCode, dr[dc.ColumnName].ToString(), htFields[key] == null ? "" : htFields[key].ToString());
                    htFields[key] = "N'" + htFields[key] + "'";
                }
            }
        }
Exemple #56
0
        public static TRet[] GetArrayOf <TRet>(this System.Collections.Hashtable self, string key, object def = default(object))
        {
            if (!self.ContainsKey(key))
            {
                self.Add(key, def);
            }
            if (self [key] == null)
            {
                self [key] = new ArrayList();
            }
            else if (((self[key] as ArrayList) == null))
            {
                throw new System.Exception("Type us not ArrayList its : " + self[key].GetType().Name);
            }
            var arr = (ArrayList)self[key];
            var ret = new System.Collections.Generic.List <TRet>();

            for (int i = 0; i < arr.Count; i++)
            {
                Debug.Log("" + arr [i].GetType().Name);
                var obj = (Hashtable)arr [i];
                if (obj != null)
                {
                    var inst = System.Activator.CreateInstance(typeof(TRet), new object[] { obj });
                    ret.Add((TRet)(inst));
                }
                else
                {
                    throw new System.Exception("object is null");
                }
            }
            return(ret.ToArray());
        }
Exemple #57
0
        public static TRet[] GetArrayOfSimple <TRet>(this System.Collections.Hashtable self, string key, object def = default(object))
        {
            if (!self.ContainsKey(key))
            {
                self.Add(key, def);
            }
            if (self[key] == null)
            {
                self[key] = new ArrayList();
            }
            else if (((self[key] as ArrayList) == null))
            {
                throw new System.Exception("Type us not ArrayList its : " + self[key].GetType().Name);
            }
            var arr = (ArrayList)self[key];
            var ret = new System.Collections.Generic.List <TRet>();

            for (int i = 0; i < arr.Count; i++)
            {
                //Debug.Log( "" + arr [i].GetType ().Name );
                var obj = (TRet)arr [i];
                ret.Add((TRet)(obj));
            }
            return(ret.ToArray());
        }
Exemple #58
0
 /// <summary>
 /// Add a new Word/File pair to the Catalog
 /// </summary>
 public bool Add(string word, File infile, int position)
 {
     // ### Make sure the Word object is in the index ONCE only
     if (_Index.ContainsKey(word))
     {
         Word theword = (Word)_Index[word];      // add this file reference to the Word
         theword.Add(infile, position);
     }
     else
     {
         Word theword = new Word(word, infile, position);        // create a new Word object
         _Index.Add(word, theword);
     }
     _SerializePreparationDone = false;  // adding to the catalog invalidates 'serialization preparation'
     return(true);
 }
Exemple #59
0
        public object CustomFunction(int userId, string identifier, System.Collections.Hashtable input, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            switch (identifier.Trim().ToLower())
            {
            case "coppyseason":
                if (input.ContainsKey("Season"))
                {
                    return(bll.CoppySeasion(userId, input["Season"].ToString(), out notification));
                }
                else
                {
                    notification.Message = "unknow season";
                    notification.Type    = Library.DTO.NotificationType.Error;
                }
                break;

            default:
                notification.Message = "function identifier do not match";
                notification.Type    = Library.DTO.NotificationType.Error;
                break;
            }
            return(null);
        }
Exemple #60
0
        public void ParseInfo(System.Collections.Hashtable info)
        {
            rawHash               = info;
            this.id               = info.GetValue <string>((int)SPC.Id, string.Empty);
            this.name             = info.GetValue <string>((int)SPC.Name, string.Empty);
            this.level            = info.GetValue <int>((int)SPC.Level, 0);
            this.workshop         = info.GetValue <byte>((int)SPC.Workshop, 0).toEnum <Workshop>();
            this.type             = info.GetValue <byte>((int)SPC.ItemType, 0).toEnum <InventoryObjectType>();
            this.targetTemplateId = info.GetValue <string>((int)SPC.Template, string.Empty);
            this.color            = (ObjectColor)(byte)info.GetValue <int>((int)SPC.Color, 0);

            if (info.ContainsKey((int)SPC.Set))
            {
                set = info.GetValue <string>((int)SPC.Set, string.Empty);
            }
            else
            {
                set = string.Empty;
            }

            Hashtable craftMaterialsHash = info.GetValue <Hashtable>((int)SPC.CraftMaterials, new Hashtable());

            this.craftMaterials = craftMaterialsHash.toDict <string, int>();
            binded = info.GetValue <bool>((int)SPC.Binded, false);
        }