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


C# System.Collections.Hashtable.ContainsKey方法代码示例

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


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

示例1: ContainsDuplicate

        public bool ContainsDuplicate(int[] nums)
        {
            if (nums == null || nums.Length < 2)
            {
                return false;
            }

            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            bool result = false;

            for (int i = 0; i < nums.Length; i++)
            {
                if (!ht.ContainsKey(nums[i]))
                {
                    ht.Add(nums[i], i);
                }
                else
                {
                    result = true;
                    break;
                }
            }

            return result;
        }
开发者ID:sametdumankaya,项目名称:LeetCode,代码行数:25,代码来源:Problem217.cs

示例2: GetTableAlias

        public static string GetTableAlias(string tableName)
        {
            if (__tableNames == null)
            {
                DataSet _data = new DataSet();
                _data.ReadXml(System.Configuration.ConfigurationManager.AppSettings["PathXMLAlias"]);

                __tableNames = new System.Collections.Hashtable();
                foreach (DataRow row in _data.Tables[0].Rows)
                {
                    if (!__tableNames.ContainsKey(row["name"].ToString().ToLower().Trim()))
                    {
                        __tableNames.Add(row["name"].ToString().ToLower().Trim(), row["alias"].ToString());
                    }
                }
            }


            if (__tableNames.ContainsKey(tableName))
            {
                return __tableNames[tableName].ToString();
            }

            return tableName;
        }
开发者ID:odairkreuzberg,项目名称:simetrica,代码行数:25,代码来源:LoadConf.cs

示例3: MajorityElement

        public int MajorityElement(int[] nums)
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();

            for (int i = 0; i < nums.Length; i++)
            {
                if (!ht.ContainsKey(nums[i]))
                {
                    ht.Add(nums[i], 1);
                }
                else
                {
                    ht[nums[i]] = (int)ht[nums[i]] + 1;
                }
            }

            foreach (System.Collections.DictionaryEntry item in ht)
            {
                if ((int)item.Value > nums.Length / 2)
                {
                    return (int)item.Key;
                }
            }

            return 0;
        }
开发者ID:sametdumankaya,项目名称:LeetCode,代码行数:26,代码来源:Problem169.cs

示例4: CheckHits_

		public static void  CheckHits_(Query query, System.String defaultFieldName, Searcher searcher, int[] results, TestCase testCase)
		{
            Hits hits = searcher.Search(query);
			
            System.Collections.Hashtable correct = new System.Collections.Hashtable();
            for (int i = 0; i < results.Length; i++)
            {
                correct.Add((System.Int32) results[i], null);
            }
			
            System.Collections.Hashtable actual = new System.Collections.Hashtable();
            for (int i = 0; i < hits.Length(); i++)
            {
                actual.Add((System.Int32) hits.Id(i), null);
            }
			
            //Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
            if (correct.Count != 0)
            {
                System.Collections.IDictionaryEnumerator iter = correct.GetEnumerator();
                bool status = false;
                while (iter.MoveNext())
                {
                    status = actual.ContainsKey(iter.Key);
                    if (status == false)
                        break;
                }
                Assert.IsTrue(status, query.ToString(defaultFieldName));
            }
        }
开发者ID:emtees,项目名称:old-code,代码行数:30,代码来源:CheckHits.cs

示例5: setDisplay

 protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
 {
     System.Collections.Hashtable displayht = new System.Collections.Hashtable();
     foreach (RemoteInterface.HC.FetchDeviceData dev in devNames)
     {
         if (!displayht.ContainsKey(dev.DevName))
         {
             displayht.Add(dev.DevName, null);
         }
     }
     return displayht;
 }
开发者ID:ufjl0683,项目名称:Center,代码行数:12,代码来源:CCTV.cs

示例6: PerformWhois

        public static string PerformWhois(string WhoisServerHost, int WhoisServerPort, string Host)
        {
            string result="";
            try {
                String strDomain = Host;
                char[] chSplit = {'.'};
                string[] arrDomain = strDomain.Split(chSplit);
                // There may only be exactly one domain name and one suffix
                if (arrDomain.Length != 2) {
                    return "";
                }

                // The suffix may only be 2 or 3 characters long
                int nLength = arrDomain[1].Length;
                if (nLength != 2 && nLength != 3) {
                    return "";
                }

                System.Collections.Hashtable table = new System.Collections.Hashtable();
                table.Add("de", "whois.denic.de");
                table.Add("be", "whois.dns.be");
                table.Add("gov", "whois.nic.gov");
                table.Add("mil", "whois.nic.mil");

                String strServer = WhoisServerHost;
                if (table.ContainsKey(arrDomain[1])) {
                    strServer = table[arrDomain[1]].ToString();
                }
                else if (nLength == 2) {
                    // 2-letter TLD's always default to RIPE in Europe
                    strServer = "whois.ripe.net";
                }

                System.Net.Sockets.TcpClient tcpc = new System.Net.Sockets.TcpClient ();
                tcpc.Connect(strServer, WhoisServerPort);
                String strDomain1 = Host+"\r\n";
                Byte[] arrDomain1 = System.Text.Encoding.ASCII.GetBytes(strDomain1.ToCharArray());
                System.IO.Stream s = tcpc.GetStream();
                s.Write(arrDomain1, 0, strDomain1.Length);
                System.IO.StreamReader sr = new System.IO.StreamReader(tcpc.GetStream(), System.Text.Encoding.ASCII);
                System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
                string strLine = null;
                while (null != (strLine = sr.ReadLine())) {
                    strBuilder.Append(strLine+"\r\n");
                }
                result = strBuilder.ToString();
                tcpc.Close();
            }catch(Exception exc) {
                result="Could not connect to WHOIS server!\r\n"+exc.ToString();
            }
            return result;
        }
开发者ID:nothingmn,项目名称:robchartier-classlibrary,代码行数:52,代码来源:Whois.cs

示例7: Index

        //-------------------------------------------------------------------
        public void Index(MemManager.Log.Log lg)
        {
            System.Collections.Hashtable cache = new System.Collections.Hashtable(4096);
            int processed = 0;

            System.Text.StringBuilder addresses = new System.Text.StringBuilder();
            addresses.EnsureCapacity(32768);

            // Work out all unique addresses
            for (int i = 0; i < lg.Count; i++)
            {
                int index = lg[i].stackTraceString;
                if (index <= processed)
                    continue;

                processed = index;
                string callstack = lg.GetString(index);
                string[] addrarray = callstack.Split(' ');
                foreach (string s in addrarray)
                {
                    if (!cache.ContainsKey(s))
                    {
                        cache[s] = s;
                        addresses.Append(s);
                        addresses.Append(' ');

                        // Fix issue with nasty command line length issue on win32.
                        if (addresses.Length >= 32000)
                        {
                            Index(addresses.ToString());

                            // Wipe addresses
                            addresses = new System.Text.StringBuilder();
                            addresses.EnsureCapacity(32768);
                        }
                    }
                }
            }

            // Index unique addresses
            if (addresses.Length > 0)
                Index(addresses.ToString());
        }
开发者ID:arjangcore,项目名称:MemoryCompare,代码行数:44,代码来源:CallStackLookup.cs

示例8: com_GetReaderData

 object com_GetReaderData(DBConnect.DataType type, object reader)
 {
     if (type == DBConnect.DataType.Decorators)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         System.Collections.Hashtable decHT = new System.Collections.Hashtable();
         for (int i = 0; i < dr.FieldCount; i++)
         {
             if (!decHT.ContainsKey(dr.GetName(i))) decHT.Add(dr.GetName(i), dr[i]);
         }
         return decHT;
     }
     else if (type == DBConnect.DataType.LaneCount)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         System.Collections.Hashtable laneCount = new System.Collections.Hashtable();
         laneCount.Add(0, Convert.ToString(dr[2]));
         laneCount.Add(1, Convert.ToString(dr[3]));
         laneCount.Add(2, Convert.ToString(dr[4]));
         laneCount.Add(3, Convert.ToString(dr[5]));
         laneCount.Add(4, Convert.ToString(dr[6]));
         laneCount.Add(5, Convert.ToString(dr[7]));
         laneCount.Add(6, Convert.ToString(dr[8]));
         laneCount.Add(7, Convert.ToString(dr[9]));
         laneCount.Add(8, Convert.ToString(dr[10]));
         laneCount.Add(9, Convert.ToString(dr[11]));
         laneCount.Add(10, Convert.ToString(dr[12]));
         laneCount.Add(11, Convert.ToString(dr[13]));
         laneCount.Add(12, Convert.ToString(dr[14]));
         laneCount.Add(13, Convert.ToString(dr[15]));
         laneCount.Add(14, Convert.ToString(dr[16]));
         return laneCount;
     }
     else
         return null;
 }
开发者ID:ufjl0683,项目名称:Center,代码行数:36,代码来源:ParkEvent.cs

示例9: LoadViews

        /// <summary>
        /// Method LoadViews()
        /// </summary>
        //protected override void LoadViews()
        public void LoadViews()
        {
            this.views = new Collection<View>();
            System.Collections.Hashtable RelatedViews = new System.Collections.Hashtable();

            DataTable viewsTable = GetViewsAsDataTable();
            foreach (DataRow viewRow in viewsTable.Rows)
            {
                View V = new Epi2000.View(viewRow, this);

                // set the is related view attribute
                IDataReader R = this.collectedData.GetTableDataReader(V.Name);
                while(R.Read())
                {

                    if (R["Name"].ToString().ToUpper().StartsWith("RELVIEW"))
                    {
                        if(! RelatedViews.ContainsKey(R["DataTable"].ToString()))
                        {
                            RelatedViews.Add(R["DataTable"].ToString(), R["DataTable"].ToString());
                        }
                    }
                }
                R.Close();

                this.views.Add(V);
            }

            foreach(Epi2000.View V in this.views)
            {
                if (RelatedViews.ContainsKey(V.Name))
                {
                    V.IsRelatedView = true;
                }
            }
        }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:40,代码来源:Project.cs

示例10: updateMysql

        private static void updateMysql(StringBuilder str, Assembly assembly, Type baseEntityType)
        {
            foreach (Type entityType in assembly.GetTypes())
            {
                bool Table = true;
                if (entityType.GetCustomAttributes(typeof(EntityDefinitionAttribute), false).Length > 0)
                {
                    object obje = (EntityDefinitionAttribute)entityType.GetCustomAttributes(typeof(EntityDefinitionAttribute), false)[0];
                    Table = ((EntityDefinitionAttribute)obje).IsTable;
                }

                if (!entityType.IsClass
                    || !entityType.IsSubclassOf(baseEntityType)
                    || entityType.IsGenericType
                    || entityType.Name.Contains("<") || !Table) continue;

                PropertyInfo[] props =
                    PersistenceStrategyProvider.FindStrategyFor(entityType)
                    .GetPersistentProperties(entityType);

                object[] memberinfo=entityType.GetCustomAttributes(typeof(EntityDefinitionAttribute), true);

                string className = entityType.Name;
                if (TableExistMy(className, Transaction.Instance.GetSchema()))
                {
                    DataTable table = executeSql("select * from " + className + " where Id=-1");
                    DataTable metaTable = Transaction.Instance.MetaTableColumns(className);
                    Dictionary<string, int> metaLengths = new Dictionary<string, int>();
                    foreach (DataRow row in metaTable.Rows)
                    {
                        if ((string)row["DATA_TYPE"] != "varchar") continue;
                        metaLengths[(string)row["COLUMN_NAME"]] = Convert.ToInt32(row["CHARACTER_MAXIMUM_LENGTH"]);
                    }

                    System.Collections.Hashtable fieldDictionary = new System.Collections.Hashtable();
                    foreach (PropertyInfo property in props)
                    {
                        //Derviş Aygün
                        FieldDefinitionAttribute fielddefinition = ReflectionHelper.GetAttribute<FieldDefinitionAttribute>(property);
                        if (fielddefinition != null && fielddefinition.MappingType == FieldMappingType.No)
                            continue;
                        //Derviş aygün
                        FieldDefinitionAttribute definition = DataDictionary.Instance.GetFieldDefinition(className + "." + property.Name);
                        string fieldname = (property.PropertyType.IsSubclassOf(baseEntityType)) ?
                            definition.Name + "_Id" : definition.Name;

                        fieldDictionary[fieldname] = 1;
                        if (!table.Columns.Contains(fieldname))
                        {
                            string sql = "alter table " + className + " add " + fieldname + " " + MapTypeMysql(definition);
                            executeNonQuery(sql);
                            str.Append("New Field: " + fieldname + ", Table: " + className + "<br/>");
                        }
                        else if (!fieldname.EndsWith("_Id")
                            && definition.TypeName != "Boolean"
                            && table.Columns[fieldname].DataType.Name != definition.TypeName)
                        {
                            string sql = "alter table " + className + " modify column " + fieldname + " " + MapTypeMysql(definition);
                            executeNonQuery(sql);
                            str.Append("Alter Field: " + fieldname + ", Table: " + className + "<br/>");
                        }
                        else if (!fieldname.EndsWith("_Id")
                            && definition.TypeName == "Boolean"
                            && table.Columns[fieldname].DataType.Name != "SByte")
                        {
                            string sql = "alter table " + className + " modify column " + fieldname + " " + MapTypeMysql(definition);
                            executeNonQuery(sql);
                            str.Append("Alter Field: " + fieldname + ", Table: " + className + "<br/>");
                        }
                        else if (metaLengths.ContainsKey(fieldname)
                            && definition.Length != metaLengths[fieldname])
                        {
                            string sql = "alter table " + className + " modify column " + fieldname + " " + MapTypeMysql(definition);
                            executeNonQuery(sql);
                            str.Append("Resize Field: " + fieldname + ", Table: " + className + ", Length: " + definition.Length + "<br/>");
                        }
                    }
                    foreach (DataColumn column in table.Columns)
                    {
                        if (!fieldDictionary.ContainsKey(column.ColumnName))
                        {
                            string sql = "alter table " + className + " drop column " + column.ColumnName;
                            executeNonQuery(sql);
                            str.Append("Drop Field: " + column.ColumnName + ", Table: " + className + "<br/>");
                        }
                    }
                }
                else
                {
                    //Hiç özelliği olmayan class lar olabilir
                    if (props.Length == 0)
                    {
                        continue;
                    }

                    StringBuilder s = new System.Text.StringBuilder();
                    s.Append("CREATE TABLE " + className + " (");
                    string pkstr = "";
                    foreach (PropertyInfo property in props)
                    {
//.........这里部分代码省略.........
开发者ID:noseii,项目名称:powerscada2011,代码行数:101,代码来源:SchemaHelper.cs

示例11: trimFileList

		/// <summary> Walk the file list looking for name collisions.
		/// If we find one, then we remove it
		/// </summary>
		internal virtual System.Collections.ArrayList trimFileList(System.Collections.ArrayList files)
		{
			System.Collections.Hashtable names = new System.Collections.Hashtable();
			System.Collections.ArrayList list = new System.Collections.ArrayList();
			
			int size = files.Count;
			for (int i = 0; i < size; i++)
			{
				bool addIt = false;
				
				SourceFile fi = (SourceFile) files[i];
				// no filter currently in place so we add the file as long
				// as no duplicates exist.  We use the original Swd full
				// name for matching.
				String fName = fi.RawName;
				if (m_swfFilter == null)
				{
					// If it exists, then we don't add it!
					if (!names.ContainsKey(fName))
						addIt = true;
				}
				else
				{
					// we have a filter in place so, see
					// if the source file is in our currently
					// selected swf.
					addIt = m_swfFilter.containsSource(fi);
				}
				
				// did we mark this one to add?
				if (addIt)
				{
					names[fName] = fName;
					list.Add(fi);
				}
			}
			return list;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:41,代码来源:FileInfoCache.cs

示例12: dbCmd_GetReaderData

 object dbCmd_GetReaderData(DataType type, object reader)
 {
     if (type == DataType.SysAlarmLog)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         try
         {
             InsertCommand cmd = GetInsertCmd.setIIPEventCmd(dr);
             dbCmd.insert(cmd);
             //ServerMeg.setServerMeg("�[�J�@���۰ʩΥb�۰ʨƥ��tblIIPEvent");
             //if (InsertEvent != null)
             //{
             //    InsertEvent(cmd.RspID);
             //}
         }
         catch //(System.Exception ex)
         {
             //ServerMeg.setAlarmMeg("�[�J�@���۰ʩΥb�۰ʨƥ��tblIIPEvent���~!!");
             throw new Exception("�[�J�@���۰ʩΥb�۰ʨƥ��tblIIPEvent���~!!");
         }
     }
     else if (type == DataType.IIPEvent)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         //if (InsertEvent != null)
         //{
         //    InsertEvent(dr[0].ToString());
         //}
     }
     else if (type == DataType.EventID)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         return dr[0];
     }
     else if (type == DataType.Renew)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         System.Collections.Hashtable ht = new System.Collections.Hashtable();
         for (int i = 0; i < dr.FieldCount; i++)
         {
             if (!ht.ContainsKey(dr.GetName(i))) ht.Add(dr.GetName(i), dr[i]);
         }
         return ht;
     }
     else if (type == DataType.AllMoveEvent)
     {
         System.Data.Odbc.OdbcDataReader dr = (System.Data.Odbc.OdbcDataReader)reader;
         return new MoveData(Convert.ToInt32(dr[39]), dr[16].ToString(), DateTime.Parse(dr[13].ToString()), dr[6].ToString(), dr[7].ToString(), Convert.ToInt32(dr[10]), Convert.ToInt32(dr[11]), dr[25].ToString());
     }
     return null;
 }
开发者ID:ufjl0683,项目名称:Center,代码行数:51,代码来源:EvenInput.cs

示例13: partial1

        private String partial1(String c)
        {
            System.Collections.Hashtable h = new System.Collections.Hashtable();
            h.Add(" ", "11011001100");
            h.Add("!", "11001101100");
            h.Add("\"", "11001100110");
            h.Add("#", "10010011000");
            h.Add("$", "10010001100");
            h.Add("%", "10001001100");
            h.Add("&", "10011001000");
            h.Add("'", "10011000100");
            h.Add("(", "10001100100");
            h.Add(")", "11001001000");
            h.Add("*", "11001000100");
            h.Add("+", "11000100100");
            h.Add(",", "10110011100");
            h.Add("-", "10011011100");
            h.Add(".", "10011001110");
            h.Add("/", "10111001100");
            h.Add("0", "10011101100");
            h.Add("1", "10011100110");
            h.Add("2", "11001110010");
            h.Add("3", "11001011100");
            h.Add("4", "11001001110");
            h.Add("5", "11011100100");
            h.Add("6", "11001110100");
            h.Add("7", "11101101110");
            h.Add("8", "11101001100");
            h.Add("9", "11100101100");
            h.Add(":", "11100100110");
            h.Add(";", "11101100100");
            h.Add("<", "11100110100");
            h.Add("=", "11100110010");
            h.Add(">", "11011011000");
            h.Add("?", "11011000110");
            h.Add("@", "11000110110");
            h.Add("A", "10100011000");
            h.Add("B", "10001011000");
            h.Add("C", "10001000110");
            h.Add("D", "10110001000");
            h.Add("E", "10001101000");
            h.Add("F", "10001100010");
            h.Add("G", "11010001000");
            h.Add("H", "11000101000");
            h.Add("I", "11000100010");
            h.Add("J", "10110111000");
            h.Add("K", "10110001110");
            h.Add("L", "10001101110");
            h.Add("M", "10111011000");
            h.Add("N", "10111000110");
            h.Add("O", "10001110110");
            h.Add("P", "11101110110");
            h.Add("Q", "11010001110");
            h.Add("R", "11000101110");
            h.Add("S", "11011101000");
            h.Add("T", "11011100010");
            h.Add("U", "11011101110");
            h.Add("V", "11101011000");
            h.Add("W", "11101000110");
            h.Add("X", "11100010110");
            h.Add("Y", "11101101000");
            h.Add("Z", "11101100010");
            h.Add("[", "11100011010");
            h.Add(@"\", "11101111010");
            h.Add("]", "11001000010");
            h.Add("^", "11110001010");
            h.Add("_", "10100110000");
            h.Add("`", "10100001100");
            h.Add("a", "10010110000");
            h.Add("b", "10010000110");
            h.Add("c", "10000101100");
            h.Add("d", "10000100110");
            h.Add("e", "10110010000");
            h.Add("f", "10110000100");
            h.Add("g", "10011010000");
            h.Add("h", "10011000010");
            h.Add("i", "10000110100");
            h.Add("j", "10000110010");
            h.Add("k", "11000010010");
            h.Add("l", "11001010000");
            h.Add("m", "11110111010");
            h.Add("n", "11000010100");
            h.Add("o", "10001111010");
            h.Add("p", "10100111100");
            h.Add("q", "10010111100");
            h.Add("r", "10010011110");
            h.Add("s", "10111100100");
            h.Add("t", "10011110100");
            h.Add("u", "10011110010");
            h.Add("v", "11110100100");
            h.Add("w", "11110010100");
            h.Add("x", "11110010010");
            h.Add("y", "11011011110");
            h.Add("z", "11011110110");
            h.Add("{", "11110110110");
            h.Add("|", "10101111000");
            h.Add("}", "10100011110");
            h.Add("~", "10001011110");

            if (h.ContainsKey(c) == true)
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:Barcodes-1,代码行数:101,代码来源:Class1.cs

示例14: RecalculateParameterSet

    private void RecalculateParameterSet()
    {
      // save old values
      System.Collections.Hashtable byName = new System.Collections.Hashtable();
      for(int i=0;i<_currentParameters.Count;i++)
        byName.Add(_currentParameters[i].Name,_currentParameters[i]);

      // now restore the values
      _currentParameters.Clear();

      for(int i=0;i<_fitEnsemble.NumberOfParameters;i++)
      {
        string name = _fitEnsemble.ParameterName(i);
        if(byName.ContainsKey(name))
          _currentParameters.Add((ParameterSetElement)byName[name]);
        else
          _currentParameters.Add(new ParameterSetElement(name));

      }

      _currentParameters.OnInitializationFinished();
    }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:22,代码来源:NonlinearFitDocument.cs

示例15: AddColBalance

		/// <summary>
		/// This expects that the last column will be Amount.  If not It will do nothing.
		/// RunDetialReport(Guarantor) query first.  // Adds Provider's abbreviations to Table as well
		/// 
		/// Adds a column to report.TableQ
		/// </summary>
		private static void AddColBalance(ReportSimpleGrid report) //to report.TableQ
		{
			if (report.TableQ != null && report.TableQ.Columns.Count == 10)
				if (report.TableQ.Columns[8].ColumnName == "Amount")
				{

					decimal RunningBalance = 0;
					// Find Provider Abbreviations
					System.Collections.Hashtable htProvs = new System.Collections.Hashtable();
					try
					{
						DataTable dt = Db.GetTableOld("SELECT ProvNum, Abbr FROM Provider");

						if (dt.Rows.Count != 0)
							foreach (DataRow dr in dt.Rows)
								if (!htProvs.ContainsKey(dr[0].ToString()))
									htProvs[dr[0].ToString()] = dr[1].ToString();
						if (!htProvs.ContainsKey("0"))
							htProvs["0"] = "UnEarned";

					}
					catch
					{
					}

					for (int i = 0; i < report.TableQ.Rows.Count; i++)
					{
						try
						{

							decimal amount = 0;
							try
							{
								amount = decimal.Parse(report.TableQ.Rows[i][8].ToString());
							}
							catch { }

							RunningBalance += amount;

							if (amount > 0)
							{
								report.TableQ.Rows[i][5] = amount.ToString("F2");
								report.TableQ.Rows[i][6] = "";
							}
							else
							{
								report.TableQ.Rows[i][5] = "";
								report.TableQ.Rows[i][6] = amount.ToString("F2");
							}
							report.TableQ.Rows[i][7] = RunningBalance.ToString("F2");
							// Fix Provider Column From # to Abreviation,  Need to do it here
							// because Prov# = 0 is undefined
							if (htProvs.Count != 0)
								if (htProvs.ContainsKey(report.TableQ.Rows[i][9].ToString()))
									report.TableQ.Rows[i][4] = htProvs[report.TableQ.Rows[i][9].ToString()].ToString();
							// Change Column 0 Date Display if Date on previous row has been displayed
							if (i > 0)
								if (report.TableQ.Rows[i][0].ToString() == report.TableQ.Rows[i - 1][0].ToString())
									report.TableQ.Rows[i][0] = ""; // makes Dates more readable if not redundant.
						}
						catch
						{
							report.TableQ.Rows[i][7] = "ERROR";
						}
					}


					report.TableQ.Columns.RemoveAt(8);// Remove Amount
					report.TableQ.Columns.RemoveAt(8); // Remove ProvNums
					DataRow dr2 = report.TableQ.NewRow();
					report.TableQ.Rows.Add(dr2); // add blank row
					dr2 = report.TableQ.NewRow();
					dr2[6] = "Total";
					dr2[7] = RunningBalance.ToString("F");
					report.TableQ.Rows.Add(dr2);
				}

		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:84,代码来源:Report1_GuarantorAllocation.cs


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