Inheritance: System.Collections.IEnumerable, System.Collections.IList, System.ICloneable
        public void load()
        {
            IEnumerable lines = File.ReadLines(this.filename, Encoding.Default);

            this.words = new ArrayList();

            foreach (string line in lines)
            {
                if (line == null)
                    continue;
                if (line.Trim().Equals(""))
                    continue;

                this.words.Add(line);
            }

            string genRegex = "^";
            for (int i = 0; i < (this.words.Count - 1); i++)
            {
                genRegex += this.words[i] + "|";
            }
            genRegex += this.words[this.words.Count - 1] + "$";

            this.cueWordsRegex = new Regex(genRegex, RegexOptions.Compiled);
        }
 /// <summary>
 /// Inspects the members of the data Table, focusing on the named field.  It calculates
 /// the median of the values in the named field.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public static BoxStatistics GetBoxStatistics(this DataTable self, string fieldName)
 {
     DataColumn dc = self.Columns[fieldName];
     ArrayList lst = new ArrayList();
     foreach (DataRow row in self.Rows)
     {
         lst.Add(row[fieldName]);
     }
     lst.Sort();
     BoxStatistics result = new BoxStatistics();
     if (lst.Count % 2 == 0)
     {
         if (dc.DataType == typeof(string))
         {
         }
         // For an even number of items, the mean is the average of the middle two values (after sorting)
         double high = Convert.ToDouble(lst.Count / 2);
         double low = Convert.ToDouble(lst.Count / 2 - 1);
         result.Median = (high + low) / 2;
     }
     else
     {
         result.Median = lst[(int)Math.Floor(lst.Count / (double)2)];
     }
     return result;
 }
Esempio n. 3
1
        public BaseGame(int id, int roomId, Map map, eRoomType roomType, eGameType gameType, int timeType)
            : base(id, roomType, gameType, timeType)
        {
            m_roomId = roomId;
            m_players = new Dictionary<int, Player>();
            m_turnQueue = new List<TurnedLiving>();
            m_livings = new List<Living>();

            m_random = new Random();

            m_map = map;
            m_actions = new ArrayList();
            PhysicalId = 0;
            BossWarField = "";

            m_tempBox = new List<Box>();
            m_tempPoints = new List<Point>();

            if (roomType == eRoomType.Dungeon)
            {
                Cards = new int[21];
            }
            else
            {
                Cards = new int[8];
            }

            m_gameState = eGameState.Inited;
        }
Esempio n. 4
1
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.VDM_VCMSLevelDBO dbo = new VDM_VCMSLevelDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = dbo.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = dbo.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = dbo.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = dbo.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
1
 public virtual void CollectScintillaNodes(ArrayList list)
 {
     if (_parent == this)
     {
         if (list != null) return;
         list = new ArrayList();
         if (ChildScintilla != null) ChildScintilla.CollectScintillaNodes(list);
     }
     else if (list == null) return;
     ConfigFile cf;
     if (includedFiles != null)
     {
         for (int i = 0 ; i<includedFiles.Length; i++)
         {
             cf = includedFiles[i];
             if (cf == null) continue;
             if (cf.ChildScintilla != null) list.Add(cf.ChildScintilla);
             if( cf.ChildScintilla != null ) cf.ChildScintilla.CollectScintillaNodes(list);
             if( cf.includedFiles != null && cf.includedFiles.Length > 0) cf.CollectScintillaNodes(list);
         }
     }
     if (_parent == this)
     {
         ChildScintilla.includedFiles = new ConfigFile[list.Count];
         list.CopyTo(ChildScintilla.includedFiles);
     }
 }
Esempio n. 6
1
		public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list)
		{
			PartOfSpeech pos = PartOfSpeech.of(p);
			SearchSet ss = WNDB.is_defined(t, pos);
			MorphStr ms = new MorphStr(t, pos);
			bool checkmorphs = false;

			checkmorphs = AddSearchFor(t, pos, list); // do a search

		    if (checkmorphs)
				HasMatch = true;

			if (!HasMatch)
			{
			    // loop through morphs (if there are any)
			    string m;
			    while ((m = ms.next()) != null)
					if (m != t)
					{
						ss = ss + WNDB.is_defined(m, pos);
						AddSearchFor(m, pos, list);
					}
			}
		    b = ss.NonEmpty;
			obj = ss;
		}
Esempio n. 7
1
File: Dnd.cs Progetto: nlhepler/mono
		internal static DataObject DragToDataObject (IntPtr dragref) {
			UInt32 items = 0;
			ArrayList flavorlist = new ArrayList ();

			CountDragItems (dragref, ref items);
			
			for (uint item_counter = 1; item_counter <= items; item_counter++) {
				IntPtr itemref = IntPtr.Zero;
				UInt32 flavors = 0;
				
				GetDragItemReferenceNumber (dragref, item_counter, ref itemref);
				CountDragItemFlavors (dragref, itemref, ref flavors);
				for (uint flavor_counter = 1; flavor_counter <= flavors; flavor_counter++) {
					FlavorHandler flavor = new FlavorHandler (dragref, itemref, flavor_counter);
					if (flavor.Supported)
						flavorlist.Add (flavor);
				}
			}

			if (flavorlist.Count > 0) {
				return ((FlavorHandler) flavorlist [0]).Convert (flavorlist);
			} 

			return new DataObject ();
		}
        public DataSet PRC_PersonasListasDePrecios()
        {
            ArrayList Parameters=new ArrayList(0);

            SqlParameter MODOParameter=new SqlParameter("@MODO",SqlDbType.Int);
            MODOParameter.Size=0;
            MODOParameter.Value=MODO;
            Parameters.Add(MODOParameter);

            SqlParameter PersonasListasDePrecios_IDParameter=new SqlParameter("@PersonasListasDePrecios_ID",SqlDbType.Int);
            PersonasListasDePrecios_IDParameter.Size=0;
            PersonasListasDePrecios_IDParameter.Value=PersonasListasDePrecios_ID;
            Parameters.Add(PersonasListasDePrecios_IDParameter);

            SqlParameter Personas_IDParameter=new SqlParameter("@Personas_ID",SqlDbType.Int);
            Personas_IDParameter.Size=0;
            Personas_IDParameter.Value=Personas_ID;
            Parameters.Add(Personas_IDParameter);

            SqlParameter ListasDePrecios_IDParameter=new SqlParameter("@ListasDePrecios_ID",SqlDbType.Int);
            ListasDePrecios_IDParameter.Size=0;
            ListasDePrecios_IDParameter.Value=ListasDePrecios_ID;
            Parameters.Add(ListasDePrecios_IDParameter);

            SqlParameter PersonasDirecciones_IDParameter=new SqlParameter("@PersonasDirecciones_ID",SqlDbType.Int);
            PersonasDirecciones_IDParameter.Size=0;
            PersonasDirecciones_IDParameter.Value=PersonasDirecciones_ID;
            Parameters.Add(PersonasDirecciones_IDParameter);

             DataSet dsResult=ExecuteStoredProcedure("[Grifo].[PRC_PersonasListasDePrecios]",ref Parameters);

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

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

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
Esempio n. 10
1
 public IList aListOfPoint()
 {
     IList list = new ArrayList();
     list.Add(new System.Drawing.Point(0,0));
     list.Add(new System.Drawing.Point(5,5));
     return list;
 }
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                ArrayList targets = new ArrayList();
                if (player.Group == null)
                    targets.Add(player);
                else
                {
                    foreach (GamePlayer grpplayer in player.Group.GetPlayersInTheGroup())
                    {
                        if (player.IsWithinRadius(grpplayer, SpellRadius) && grpplayer.IsAlive)
                            targets.Add(grpplayer);
                    }
                }
                foreach (GamePlayer target in targets)
                {
                    //send spelleffect
                    if (!target.IsAlive) continue;
                    ValhallasBlessingEffect ValhallasBlessing = target.EffectList.GetOfType<ValhallasBlessingEffect>();
                    if (ValhallasBlessing != null)
                        ValhallasBlessing.Cancel(false);
                    new ValhallasBlessingEffect().Start(target);
                }
            }
            DisableSkill(living);
        }
        /// <summary>
        /// Initializes an instance of the RdfParser class
        /// </summary>
        public OwlXmlParser()
        {
            _owlGraph = null;
            _warnings = new ArrayList();
            _errors = new ArrayList();
            _messages = new ArrayList();
            _newID = 10000;
            _dummyID = 10000;

            string[] rdfXmlAttrs = {"rdf:about", "rdf:resource", "rdf:parseType", "rdf:ID", "rdf:nodeID", "rdf:type", "rdf:datatype", "rdf:value", "xml:lang", "xml:base"};
            _rdfXmlProperties = new Hashtable();
            int len = rdfXmlAttrs.Length;
            for(int i=0;i<len;i++)
                _rdfXmlProperties.Add(rdfXmlAttrs[i],rdfXmlAttrs[i]);

            string[] syntacticElements = {"rdf:RDF", "rdf:ID", "rdf:about", "rdf:resource", "rdf:parseType", "rdf:nodeID"};
            _syntacticElements = new Hashtable();
            len = syntacticElements.Length;
            for(int i=0;i<len;i++)
                _syntacticElements.Add(syntacticElements[i], syntacticElements[i]);

            string[] nonSyntacticElements = {"rdf:type", "rdf:value", "rdf:datatype", "rdf:List", "rdf:first", "rdf:rest", "rdf:nil", "rdfs:comment", "rdfs:subPropertyOf", "rdfs:domain", "rdfs:range", "rdfs:subClassOf", "owl:allValuesFrom", "owl:backwardCompatibleWith", "owl:cardinality", "owl:complementOf", "owl:differentFrom", "owl:disjointWith", "owl:distinctMembers", "owl:equivalentClass", "owl:equivalentProperty", "owl:hasValue", "owl:imports", "owl:incompatibleWith", "owl:intersectionOf", "owl:inverseOf", "owl:maxCardinality", "owl:minCardinality", "owl:oneOf", "owl:onProperty", "owl:priorVersion", "owl:sameAs", "owl:someValuesFrom", "owl:unionOf", "owl:versionInfo"};
            _nonSyntacticElements = new Hashtable();
            len = nonSyntacticElements.Length;
            for(int i=0;i<len;i++)
                _nonSyntacticElements.Add(nonSyntacticElements[i],nonSyntacticElements[i]);

            _declID = new Hashtable();

            StopOnErrors = false;
            StopOnWarnings = false;
        }
 internal ApplicationPartitionCollection(ArrayList values)
 {
     if (values != null)
     {
         InnerList.AddRange(values);
     }
 }
Esempio n. 14
1
        public static void WriteException(System.Exception e)
        {
            ArrayList messages = new ArrayList();
            while (e != null)
            {
                messages.Add(e);
                e = e.InnerException;
            }
            Console.WriteLine(" ");
            Console.WriteLine("------- System.Exception ----------------------------- ");
            messages.Reverse();

            foreach (System.Exception ex in messages)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(" ");
            Console.WriteLine("----- Details -----");
            foreach (System.Exception ex in messages)
            {
                Console.WriteLine("Message..........: " + ex.Message);
                Console.WriteLine("Stact trace......: " + ex.StackTrace);
                Console.WriteLine("TargetSite.......: " + ex.TargetSite.Name);
                Console.WriteLine("Source...........: " + ex.Source);
                Console.WriteLine(" ");
            }
        }
Esempio n. 15
1
 public JsonObject GetDiskInfo()
 {
   try
   {
     var diskinfo = new JsonObject();
     var volumes = new ArrayList();
     foreach (var vi in VolumeInfo.GetVolumes())
     {
       var v = new Hashtable();
       v.Add("root", vi.RootDirectory);
       v.Add("size", vi.TotalSize);
       v.Add("free", vi.TotalFreeSpace);
       v.Add("formatted", vi.IsFormatted);
       v.Add("volumeid", vi.VolumeID);
       v.Add("content", GetRootFolderInfo(vi.RootDirectory));
       volumes.Add(v);
     }
     diskinfo.Add("volumes", volumes);
     return diskinfo;
   }
   catch (Exception ex)
   {
     var error = new JsonObject();
     error.Add("error", ex.ToString());
     error.Add("stacktrace", ex.StackTrace);
     return error;
   }
 }
Esempio n. 16
1
 public override void Map(Channel q, object map_arg) {
   IList retval = new ArrayList();
   IDictionary my_entry = new ListDictionary();
   my_entry["node"] = _node.Address.ToString();
   retval.Add(my_entry);
   q.Enqueue(retval);
 }
		/// <summary>
		/// Creates a NDataReader from a <see cref="IDataReader" />
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader" /> to get the records from the Database.</param>
		/// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="IDataReader" /> in the middle of reading it.</param>
		/// <remarks>
		/// NHibernate attempts to not have to read the contents of an <see cref="IDataReader"/> into memory until it absolutely
		/// has to.  What that means is that it might have processed some records from the <see cref="IDataReader"/> and will
		/// pick up the <see cref="IDataReader"/> midstream so that the underlying <see cref="IDataReader"/> can be closed 
		/// so a new one can be opened.
		/// </remarks>
		public NDataReader(IDataReader reader, bool isMidstream)
		{
			ArrayList resultList = new ArrayList(2);

			try
			{
				// if we are in midstream of processing a DataReader then we are already
				// positioned on the first row (index=0)
				if (isMidstream)
				{
					currentRowIndex = 0;
				}

				// there will be atleast one result 
				resultList.Add(new NResult(reader, isMidstream));

				while (reader.NextResult())
				{
					// the second, third, nth result is not processed midstream
					resultList.Add(new NResult(reader, false));
				}

				results = (NResult[]) resultList.ToArray(typeof(NResult));
			}
			catch (Exception e)
			{
				throw new ADOException("There was a problem converting an IDataReader to NDataReader", e);
			}
			finally
			{
				reader.Close();
			}
		}
Esempio n. 18
0
        static void Main(string[] args)
        {
            ArrayList arrayList = new ArrayList();
            arrayList.Add("agnaldo");
            arrayList.Add(1);
            arrayList.Add(10.1205);

            Console.WriteLine(arrayList.Count);

            foreach (var item in arrayList)
                Console.WriteLine(item);

            Console.WriteLine();

            List<int> list = new List<int>();
            list.Add(1);
            list.Add(11);
            list.Add(11);
            list.Add(11);
            list.Add(11);
            list.Add(111);
            //list.Add(11.11);

            Console.WriteLine(list.Count);

            foreach (var item in list)
                Console.WriteLine(item);

            Console.ReadKey();
        }
Esempio n. 19
0
        /// <summary>
        /// Gets/Sets the specified value
        /// </summary>
        public dynamic this[string key]
        {
            get
              {
            if (!Values.ContainsKey(key))
              return null;

            object result = Values[key];
            if (result is IDictionary<string, object>)
              result = new JsonDataObject(result as IDictionary<string, object>);
            else if (result is ArrayList)
            {
              ArrayList resultList = result as ArrayList;
              ArrayList dataList = new ArrayList();
              foreach (object current in resultList)
              {
            if (current is IDictionary<string, object>)
              dataList.Add(new JsonDataObject(current as IDictionary<string, object>));
            else
              dataList.Add(current);
              }

              result = dataList;
            }

            return result;
              }
              set
              {
            if (Values.ContainsKey(key))
              Values[key] = value;
            else
              Values.Add(key, value);
              }
        }
Esempio n. 20
0
 internal Page(AreaTree areaTree, int height, int width)
 {
     this.areaTree = areaTree;
     this.height = height;
     this.width = width;
     markers = new ArrayList();
 }
Esempio n. 21
0
        /*
          * source code from blog:
          * https://github.com/yinlinglin/LeetCode/blob/master/SudokuSolver.h
          * convert C++ code to C# code
          *
          */
        public static bool solveSudokuRe(char[][]board, int row, int col)
        {
            if (row == 9) return true;

            KeyValuePair<int, int> next = getNextMissing(board, row, col);

            ArrayList possible = new ArrayList();

            getPossibleValues(board, row, col, possible);

            for (int i = 0; i < possible.Count; ++i)
            {
                object o = possible[i];
                int val = Convert.ToInt16(o);

                board[row][col] = (char)val;

                if (solveSudokuRe(board, (int)next.Key, (int)next.Value))
                    return true;

                // back tracking
                board[row][col] = '.';
            }

            return false;
        }
Esempio n. 22
0
		protected virtual void Delete(ITestableReplicationProviderInside provider)
		{
			ArrayList toDelete = new ArrayList();
			IEnumerator rr = provider.GetStoredObjects(typeof(R0)).GetEnumerator();
			while (rr.MoveNext())
			{
				object o = rr.Current;
				IReflectClass claxx = ReplicationReflector().ForObject(o);
				SetFieldsToNull(o, claxx);
				toDelete.Add(o);
			}
			object commitObject = null;
			for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext(); )
			{
				object o = iterator.Current;
				//System.out.println("o = " + o);
				provider.Delete(o);
				commitObject = o;
			}
			if (commitObject != null)
			{
				provider.Commit();
			}
			else
			{
				provider.Commit();
			}
		}
Esempio n. 23
0
        /**
         * cria o HTML necessario para a montagem de uma questao
         */
        public static void criaUmaProva(ArrayList lista, ArrayList topicos, StringBuilder output, int[] ultimas_questoes)
        {
            output.Append("<div style=\"page-break-before: always\">");
            output.Append("<img src='cabecalho_prova.png'><br>" );
            //               + TITULO + "</h2>");
            // output.Append("<b>Nome : _______________________________________________________</b><br>");
            output.Append(ALERTA + "<br>");

            int counter = 1;

            for(int n=0; n < topicos.Count; n++){

                ArrayList inner = (ArrayList)lista[n];
                int max = inner.Count;

                for(int i=0; i< QUESTOES_QUANTIDADE[n]; i++){

                    output.Append( "<p><b>Questao " + counter + "</b> (peso " + QUESTOES_PONTOS[n] + ")");
                    output.Append( "<pre>" + inner[ ultimas_questoes[n] ] + "</pre>");
                    output.Append( "</p><br>\n");

                    // avanca para a proxima questao
                    ultimas_questoes[n] = (ultimas_questoes[n]+1) % max;
                    counter ++;
                }

            }

            output.Append("</div>\n");
        }
 public void InsertUpdateDepartment(ArrayList department)
 {
     Database db = null;
     DbCommand dbCmd = null;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand("INSERT_UPDATE_FOR_COMMON_DEPARTMENT_MASTER");
         db.AddInParameter(dbCmd, "@DEPARTMENT_ID", DbType.Int32, department[2]);
         db.AddInParameter(dbCmd, "@DEPARTMENT_NAME", DbType.String, department[0]);
         db.AddInParameter(dbCmd, "@DEPARTMENT_DESC", DbType.String, department[1]);
         db.AddInParameter(dbCmd, "@USER", DbType.Int32, Convert.ToInt32(department[3]));
         db.ExecuteNonQuery(dbCmd);
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
 }
Esempio n. 25
0
        ///
        public LogRMC(string[] filenames)
        {
            Hashtable methods = new Hashtable();
            methods["StatusInvalid"] = false;
            methods["NullValues"]    = false;
            methods["InvalidCoords"] = false;
            methods["ValidChecksum"] = false;

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

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

            Array.Sort(rmcLogs);

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

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

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

                foreach (Hashtable fields in rmc.rmcData)
                    this.rmcData.Add(this.GetRMCSentence(fields));
            }
        }
 //合并
 public void combine(PropertyTypesManager srcPropertyTypesManager, ArrayList ids)
 {
     for (int i = 0; i < srcPropertyTypesManager.getElementCount(); i++)
     {
         if (ids == null || !ids.Contains(i))
         {
             continue;
         }
         PropertyTypeElement srcPropertyTypeElement = (PropertyTypeElement)srcPropertyTypesManager.getElement(i);
         //寻找相同的属性类型单元
         PropertyTypeElement localPropertyTypeElement = null;
         for (int j = 0; j < getElementCount(); j++)
         {
             PropertyTypeElement tempPropertyTypeElement = (PropertyTypeElement)getElement(j);
             if (tempPropertyTypeElement.name.Equals(srcPropertyTypeElement.name))
             {
                 localPropertyTypeElement = tempPropertyTypeElement;
                 break;
             }
         }
         //找到相同名称的本地单元
         if (localPropertyTypeElement != null)
         {
             localPropertyTypeElement.combine(srcPropertyTypeElement);
         }
         else//并入本容器
         {
             srcPropertyTypeElement.combineTo(this);
         }
     }
 }
Esempio n. 27
0
        public Form3()
        {
            InitializeComponent();
            //counter =  counter.ReadFromFile();
            //string str ;
            //str = counter.ReadTextFile();
            //counter = counter.ConvertToCounter(str);
            buttonClose.Enabled = false;
            buttonProceed.Enabled = false;
            jlist.LoadXmlFile("Joke.xml");
            arrayList = jlist.JokeList();
            jokeText = ReturnJooke(arrayList);
            Text = "Показ шутки " + jokeText.Name;
            richTextBox1.Text = jokeText.Text;

            //foreach (JokeText jt in jokeText.JokeTextArL)
            //{
            //    richTextBox1.Text = jt.Text;
            //    Thread.Sleep(5000);
            //}   
            //for (int i = 0; i < jokeText.JokeTextArL.Count; i++)
            //{
            //    int k = random.Next(jokeText.JokeTextArL.Count);
            //    JokeText jokeText in jokeText.JokeTextArL[k];
              
            //    jokeText.JokeTextArL.RemoveAt(k);
            //}
        }
        /// <summary>
        /// The estimate where violation is using source differce.
        /// </summary>
        /// <param name="sonarLine">
        /// The sonar Line.
        /// </param>
        /// <param name="currentDiffReport">
        /// The current Diff Report.
        /// </param>
        /// <returns>
        /// Returns -1 if violation line is removed or modified locally. &gt; 0 otherwise
        /// </returns>
        public static int EstimateWhereSonarLineIsUsingSourceDifference(int sonarLine, ArrayList currentDiffReport)
        {
            var line = sonarLine;

            try
            {
                var differenceSpan = GetChangeForLine(line, currentDiffReport);
                if (differenceSpan == null)
                {
                    return -1;
                }

                int j = 0;
                for (int i = differenceSpan.SourceIndex; i < differenceSpan.SourceIndex + differenceSpan.Length; i++)
                {
                    if (line - 1 == i)
                    {
                        return differenceSpan.DestIndex + j + 1;
                    }
                    ++j;
                }

                line = -1;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                line = -1;
            }

            return line;
        }
Esempio n. 29
0
        public Data(Mobile m)
        {
            c_Mobile = m;

            c_Friends = new ArrayList();
            c_Ignores = new ArrayList();
            c_Messages = new ArrayList();
            c_GIgnores = new ArrayList();
            c_GListens = new ArrayList();
            c_IrcIgnores = new ArrayList();
            c_Sounds = new Hashtable();
            c_PerPage = 10;
            c_SystemC = 0x161;
            c_GlobalMC = 0x26;
            c_GlobalCC = 0x47E;
            c_GlobalGC = 0x44;
            c_GlobalFC = 0x17;
            c_GlobalWC = 0x3;
            c_StaffC = 0x3B4;
            c_MsgC = 0x480;
            c_AwayMsg = "";
            c_Signature = "";
            c_BannedUntil = DateTime.Now;

            if (m.AccessLevel >= AccessLevel.Administrator)
                c_GlobalAccess = true;

            s_Datas[m] = this;

            foreach (Channel c in Channel.Channels)
                if (c.NewChars)
                    c.Join(m);
        }
Esempio n. 30
0
        public string getPaperReferenceHTML(ArrayList paper_ids)
        {
            if (_AuthCookie == null)
            {
                //Auth Cookie is null
                return null;
            }

            string rs = "|";

            foreach( string p in paper_ids)
            {
                rs = rs + p + "|";
            }

            Cookie rs_cookie = new Cookie("rs", rs, _AuthCookie.Path, _AuthCookie.Domain);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL_2);
            request.CookieContainer = new CookieContainer();

            request.CookieContainer.Add(_AuthCookie);
            request.CookieContainer.Add(rs_cookie);

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());

                return reader.ReadToEnd();
            }

            return null;
        }
Esempio n. 31
0
		/// <summary>
		/// Compares the given resources with the given log entries
		/// -- Might throw a System.ArgumentNullException
		/// -- Might throw a System.ArgumentException
		/// </summary>
		/// <param name="resources">array of resources; [0] contains the file resources, [1] contains the registry resources</param>
		/// <param name="log">a log entry; the first dimension is the row, the second is the column</param>
		/// <returns>an ArrayList containing strings of error messages produced during the comparison</returns>
		public static string[] CompareIncludedResources (Holodeck.Resource[][] resources, Hashtable[] knownResources) {
			Hashtable fileResources = CreateHashtable (resources[0]);
			Hashtable registryResouces = CreateHashtable (resources[1]);

			System.Collections.ArrayList[] diff = new System.Collections.ArrayList[2];
			diff[0] = CompareResourceTables (knownResources[0], fileResources, false);
			diff[1] = CompareResourceTables (knownResources[1], registryResouces, false);

			string[] differences = new string[diff[0].Count + diff[1].Count];
			int i = 0;
			for (int round = 0; round < 2; round++) {
				for (int j = 0; j < diff[round].Count; j++, i++) {
					differences[i] = (string) diff[round][j];
				}
			}

			return differences;
		}
Esempio n. 32
0
        public OffsetTable(OTFixed version, ushort nTables)
        {
            m_buf = new MBOBuffer(12);

            sfntVersion = version;
            numTables   = nTables;

            if (nTables != 0)
            {
                // these values are truly undefined when numTables is zero
                // since there is no power of 2 that is less that or equal to zero
                searchRange   = (ushort)(util.MaxPower2LE(nTables) * 16);
                entrySelector = util.Log2(util.MaxPower2LE(nTables));
                rangeShift    = (ushort)(nTables * 16 - searchRange);
            }

            DirectoryEntries = new System.Collections.ArrayList();
        }
Esempio n. 33
0
        /// <summary>
        /// Cria o registro do Saque caso necessário
        /// </summary>
        /// <returns></returns>
        private bool bCriaRegistroSaque()
        {
            try
            {
                mdlDataBaseAccess.Tabelas.XsdTbSaques.tbSaquesRow dtrwRowTbSaques;
                System.Collections.ArrayList arlCondicaoCampo = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoTipo  = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoValor = new System.Collections.ArrayList();

                arlCondicaoCampo.Add("idExportador");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_nIdExportador);

                arlCondicaoCampo.Add("idPE");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_strIdCodigo);

                m_cls_dba_ConnectionDB.FonteDosDados = mdlDataBaseAccess.FonteDados.DataBase;
                m_typDatSetTbSaques = m_cls_dba_ConnectionDB.GetTbSaques(arlCondicaoCampo, arlCondicaoTipo, arlCondicaoValor, null, null);
                if (m_typDatSetTbSaques.tbSaques.Rows.Count == 0)
                {
                    dtrwRowTbSaques = m_typDatSetTbSaques.tbSaques.NewtbSaquesRow();
                    dtrwRowTbSaques.idExportador  = m_nIdExportador;
                    dtrwRowTbSaques.idPE          = m_strIdCodigo;
                    dtrwRowTbSaques.nIdRelatorio  = 0;
                    dtrwRowTbSaques.dtDataEmissao = System.DateTime.Now.Date;
                    dtrwRowTbSaques.nIdIdioma     = 3;
                    base.Idioma = 3;
                    dtrwRowTbSaques.nImpressoes = 0;
                    m_typDatSetTbSaques.tbSaques.AddtbSaquesRow(dtrwRowTbSaques);
                    m_cls_dba_ConnectionDB.SetTbSaques(m_typDatSetTbSaques);
                    mdlNumero.clsNumero obj = new mdlNumero.Saque.clsSaque(ref m_cls_ter_tratadorErro, ref m_cls_dba_ConnectionDB, m_strEnderecoExecutavel, m_nIdExportador, m_strIdCodigo);
                    obj.salvaDiretoSemMostrarInterface();
                    obj = null;
                    return(true);
                }
            }
            catch (Exception err)
            {
                Object erro = err;
                m_cls_ter_tratadorErro.trataErro(ref erro);
            }
            return(false);
        }
Esempio n. 34
0
        protected override bool bSalvaIdRelatorio()
        {
            try
            {
                mdlDataBaseAccess.Tabelas.XsdTbExportadores.tbExportadoresRow           dtrwTbExportadores;
                mdlDataBaseAccess.Tabelas.XsdTbFaturasComerciais.tbFaturasComerciaisRow dtrwRowTbFaturasComerciais;
                System.Collections.ArrayList arlCondicaoCampo = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoTipo  = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoValor = new System.Collections.ArrayList();

                arlCondicaoCampo.Add("idExportador");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_nIdExportador);

                m_cls_dba_ConnectionDB.FonteDosDados = mdlDataBaseAccess.FonteDados.DataBase;
                m_typDatSetTbExportadores            = m_cls_dba_ConnectionDB.GetTbExportadores(arlCondicaoCampo, arlCondicaoTipo, arlCondicaoValor, null, null);

                if (m_typDatSetTbExportadores.tbExportadores.Rows.Count > 0)
                {
                    dtrwTbExportadores = (mdlDataBaseAccess.Tabelas.XsdTbExportadores.tbExportadoresRow)m_typDatSetTbExportadores.tbExportadores.Rows[0];
                    dtrwTbExportadores.idRelatorioFaturaComercial = m_nIdRelatorio;
                    m_cls_dba_ConnectionDB.SetTbExportadores(m_typDatSetTbExportadores);
                }

                arlCondicaoCampo.Add("idPE");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_strIdCodigo);

                m_typDatSetTbFaturasComerciais = m_cls_dba_ConnectionDB.GetTbFaturasComerciais(arlCondicaoCampo, arlCondicaoTipo, arlCondicaoValor, null, null);
                if (m_typDatSetTbFaturasComerciais.tbFaturasComerciais.Rows.Count > 0)
                {
                    dtrwRowTbFaturasComerciais             = (mdlDataBaseAccess.Tabelas.XsdTbFaturasComerciais.tbFaturasComerciaisRow)m_typDatSetTbFaturasComerciais.tbFaturasComerciais.Rows[0];
                    dtrwRowTbFaturasComerciais.idRelatorio = m_nIdRelatorio;
                    m_cls_dba_ConnectionDB.SetTbFaturasComerciais(m_typDatSetTbFaturasComerciais);
                    return(true);
                }
            }
            catch (Exception err)
            {
                Object erro = err;
                m_cls_ter_tratadorErro.trataErro(ref erro);
            }
            return(false);           //soh para compilar......nao existe!
        }
Esempio n. 35
0
        private void GetRowCount()
        {
            if (oFilter != null)
            {
                //foreach(oFilter.FilterItem oParam in oFilter..FilterItems)
                //{
                //if ( oParam.Type != FilterColumnType.None)
                //{
                //	AppendSqlParam(oParam.GridSourceParameter, oParam.Value);
                //	if ( oParam.Type == FilterColumnType.Range )
                //	{
                //		AppendSqlParam(oParam.GridSourceParameterAlt, oParam.ValueAlt);
                //	}
                //}
                //}
                //oDataSource  = this.DBase.GetDataTable(SqlProcedureName, oParams.ToArray());

                System.Collections.ArrayList oParams = new System.Collections.ArrayList();
                System.Collections.ArrayList oArray  = oFilter.FilterItems;
                for (int i = 0; i < oArray.Count; i++)
                {
                    Common.WebControls.FilterItem oFilterItem = oArray[i] as Common.WebControls.FilterItem;
                    if (oFilterItem.Type != Common.WebControls.FilterColumnType.None && oFilterItem.Visible == true)
                    {
                        oParams.Add(oFilterItem.GridSourceParameter);
                        oParams.Add(oFilterItem.Value);
                        if (oFilterItem.Type == Common.WebControls.FilterColumnType.Range)
                        {
                            oParams.Add(oFilterItem.GridSourceParameterAlt);
                            oParams.Add(oFilterItem.ValueAlt);
                        }
                    }
                }
                oParams.Add(Admin.Config.PageNum);
                oParams.Add(1);
                oParams.Add(Admin.Config.PageSize);
                oParams.Add(-1);

                //oDataSource  = this.DBase.GetDataTable(SqlProcedureName, oParams.ToArray());

                Common.Web.Page oPage = Page as Common.Web.Page;
                rowCount = oPage.DBase.ExecuteReturnInt(oFilter.SqlProcedureName, oParams.ToArray());
            }
        }
Esempio n. 36
0
        /// <summary>
        /// Retrieves an array of strings that contains all the subkey names.
        /// </summary>
        /// <returns>An array of strings that contains the names of the subkeys for the current key.</returns>
        /// <exception cref="System.ObjectDisposedException">The RegistryKey being manipulated is closed (closed keys cannot be accessed).</exception>
        public string[] GetSubKeyNames()
        {
            if (CheckHKey())
            {
                //error/success returned by RegKeyEnumEx
                int result = 0;
                //store the names
                System.Collections.ArrayList subkeynames = new System.Collections.ArrayList();
                int index = 0;

                //buffer to store the name
                char[] buffer     = new char[256];
                int    keynamelen = buffer.Length;

                //enumerate sub keys
                result = RegEnumKeyEx(m_handle, index, buffer, ref keynamelen, 0, null, 0, 0);

                //while there are more key names available
                while (result != ERROR_NO_MORE_ITEMS)
                {
                    //add the name to the arraylist
                    subkeynames.Add(new string(buffer, 0, keynamelen));

                    //increment index
                    index++;

                    //reset length available to max
                    keynamelen = buffer.Length;

                    //retrieve next key name
                    result = RegEnumKeyEx(m_handle, index, buffer, ref keynamelen, 0, null, 0, 0);
                }

                //sort the results
                subkeynames.Sort();

                //return a fixed size string array
                return((string[])subkeynames.ToArray(typeof(string)));
            }
            else
            {
                throw new ObjectDisposedException("The RegistryKey being manipulated is closed (closed keys cannot be accessed).");
            }
        }
Esempio n. 37
0
 private void treeMenuInit()
 {
     this.tvZone.Nodes.Clear();
     System.Collections.ArrayList allZone         = ZoneInfo.getAllZone();
     System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
     for (int i = 0; i < allZone.Count; i++)
     {
         ZoneInfo zoneInfo  = (ZoneInfo)allZone[i];
         string   zoneName  = zoneInfo.ZoneName;
         string   rackInfo  = zoneInfo.RackInfo;
         string   text      = zoneInfo.StartPointX.ToString() + "," + zoneInfo.StartPointY.ToString();
         string   text2     = zoneInfo.EndPointX.ToString() + "," + zoneInfo.EndPointY.ToString();
         string   zoneColor = zoneInfo.ZoneColor;
         TreeNode treeNode  = new TreeNode();
         treeNode.Text = zoneName;
         treeNode.Name = rackInfo;
         treeNode.Tag  = string.Concat(new string[]
         {
             text,
             "|",
             text2,
             "|",
             zoneColor,
             "|",
             zoneInfo.ZoneID.ToString()
         });
         string[] source = rackInfo.Split(new char[]
         {
             ','
         });
         foreach (RackInfo rackInfo2 in allRack_NoEmpty)
         {
             if (source.Contains(rackInfo2.RackID.ToString()) && rackInfo2 != null && !rackInfo2.DeviceInfo.Equals(string.Empty))
             {
                 string   displayRackName = rackInfo2.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
                 TreeNode treeNode2       = new TreeNode();
                 treeNode2.Text = displayRackName;
                 treeNode2.Name = "rack";
                 treeNode.Nodes.Add(treeNode2);
             }
         }
         this.tvZone.Nodes.Add(treeNode);
     }
 }
Esempio n. 38
0
        //CREATES A ROLE LIST BASED ON ROLES SELECTED. NOTE: THERE WILL BE MANY DUPLICATES!
        private ArrayList RoleLogic(ArrayList roles_to_add)
        {
            //IF ADMINISTRATOR, GRANT ALL ROLES
            if (roles_to_add.Contains(UpdateUtils.ROLE_ADMINISTRATOR))
            {
                return(new ArrayList(Roles.GetAllRoles()));
            }

            //IF DATA MANAGER, ALSO MUST BE A CONTIBUTOR
            if (roles_to_add.Contains(UpdateUtils.ROLE_DATA_MANAGER))
            {
                if (!roles_to_add.Contains(UpdateUtils.ROLE_DATA_CONTRIBUTOR))
                {
                    roles_to_add.Add(UpdateUtils.ROLE_DATA_CONTRIBUTOR);
                }
            }

            //IF DATA CONTRIBUTOR, THEN DON'T NEED TO ADD ANYTHIMG

            //IF FULL VIEWER, THEY MUST BE INTERMEDIATE AND PUBLIC
            if (roles_to_add.Contains(UpdateUtils.ROLE_FULL_VIEWER))
            {
                if (!roles_to_add.Contains(UpdateUtils.ROLE_INTERMEDIATE_VIEWER))
                {
                    roles_to_add.Add(UpdateUtils.ROLE_INTERMEDIATE_VIEWER);
                }
                if (!roles_to_add.Contains(UpdateUtils.ROLE_PUBLIC_VIEWER))
                {
                    roles_to_add.Add(UpdateUtils.ROLE_PUBLIC_VIEWER);
                }
            }

            //IF INTERMEDIATE, MUST BE PUBLIC
            if (roles_to_add.Contains(UpdateUtils.ROLE_INTERMEDIATE_VIEWER))
            {
                if (!roles_to_add.Contains(UpdateUtils.ROLE_PUBLIC_VIEWER))
                {
                    roles_to_add.Add(UpdateUtils.ROLE_PUBLIC_VIEWER);
                }
            }

            //RETURN FULL LIST
            return(roles_to_add);
        }
Esempio n. 39
0
        /// <summary>
        /// writes the pixel values from arrayList to grid
        /// </summary>
        /// <param name="gr"></param>
        /// <param name="pxList"></param>
        /// <param name="val"></param>
        /// <param name="cback"></param>
        private void writePxList(MapWinGIS.Grid gr, MapWinGIS.GridDataType grType,
                                 System.Collections.ArrayList pxList, object val, MapWinGIS.ICallback cback)
        {
            switch (grType)
            {
            case GridDataType.ShortDataType:
                short v1 = Convert.ToInt16(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v1);
                }
                break;

            case GridDataType.LongDataType:
                int v2 = Convert.ToInt32(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v2);
                }
                break;

            case GridDataType.FloatDataType:
                float v3 = Convert.ToSingle(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v3);
                }
                break;

            case GridDataType.DoubleDataType:
                double v4 = Convert.ToDouble(val);
                foreach (GridPixel pix in pxList)
                {
                    gr.set_Value(pix.col, pix.row, v4);
                }
                break;

            default:
                reportError("the grid data type " + grType.ToString() + "is not supported.", cback);
                break;
            }

            pxList.Clear();
        }
Esempio n. 40
0
        private System.Collections.ArrayList getQueryArray(string key, string operation, string folderCode, DocsPaVO.documento.SchedaDocumento schedaDoc)
        {
            logger.Debug("Costruzione queries");
            System.Collections.ArrayList queries = new System.Collections.ArrayList();
            TableField[] fields = new TableField[] { TableFieldAgent.getTableFieldInstance(Constants.JOUREC_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOUDOC_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOUCOD_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOUPRO_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOUTYP_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOULEN_FIELD_NAME),
                                                     TableFieldAgent.getTableFieldInstance(Constants.JOUDES_FIELD_NAME), };
            for (int i = 0; i <= Constants.NUM_CODES; i++)
            {
                //COSTRUZIONE DELLA SINGOLA QUERY
                //costruzione insert context
                InsertContext ic = new InsertContext();
                ic.numRow    = i;
                ic.operation = operation;
                ic.schedaDoc = schedaDoc;
                ic.val       = getValue(i, schedaDoc, folderCode, operation);
                string queryString = getQuery(ic, key, fields);
                logger.Debug("Creata query " + i + ": " + queryString);
                queries.Add(queryString);
            }
            //INSERIMENTO DELL'OGGETTO
            logger.Debug("Inserimento oggetto");
            string    oggettoString = schedaDoc.oggetto.descrizione;
            Oggetto   oggetto       = new Oggetto(oggettoString);
            ArrayList oggettoList   = oggetto.split(Constants.OBJECT_ROW_LENGTH);

            for (int i = 0; i < oggettoList.Count; i++)
            {
                InsertContext ic = new InsertContext();
                ic.numRow    = Constants.NUM_CODES + 1 + i;
                ic.operation = operation;
                ic.schedaDoc = schedaDoc;
                ic.val       = (string)oggettoList[i];
                string queryString = getQuery(ic, key, fields);
                logger.Debug("Creata query " + (Constants.NUM_CODES + 1 + i) + ": " + queryString);
                queries.Add(queryString);
            }

            return(queries);
        }
Esempio n. 41
0
        /// <summary>
        /// Cria o registro do Sumário caso necessário
        /// </summary>
        /// <returns></returns>
        private bool bCriaRegistroSumario()
        {
            try
            {
                mdlDataBaseAccess.Tabelas.XsdTbSumarios.tbSumariosRow dtrwRowTbSumarios;
                System.Collections.ArrayList arlCondicaoCampo = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoTipo  = new System.Collections.ArrayList();
                System.Collections.ArrayList arlCondicaoValor = new System.Collections.ArrayList();

                arlCondicaoCampo.Add("idExportador");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_nIdExportador);

                arlCondicaoCampo.Add("idPE");
                arlCondicaoTipo.Add(mdlDataBaseAccess.Comparador.Igual);
                arlCondicaoValor.Add(m_strIdCodigo);

                m_cls_dba_ConnectionDB.FonteDosDados = mdlDataBaseAccess.FonteDados.DataBase;
                m_typDatSetTbSumarios = m_cls_dba_ConnectionDB.GetTbSumarios(arlCondicaoCampo, arlCondicaoTipo, arlCondicaoValor, null, null);
                if (m_typDatSetTbSumarios.tbSumarios.Rows.Count == 0)
                {
                    dtrwRowTbSumarios = m_typDatSetTbSumarios.tbSumarios.NewtbSumariosRow();
                    dtrwRowTbSumarios.idExportador = m_nIdExportador;
                    dtrwRowTbSumarios.idPE         = m_strIdCodigo;
                    dtrwRowTbSumarios.idRelatorio  = m_nIdRelatorio;
                    dtrwRowTbSumarios.dtEmissao    = System.DateTime.Now;
                    dtrwRowTbSumarios.nImpressoes  = 0;
                    m_typDatSetTbSumarios.tbSumarios.AddtbSumariosRow(dtrwRowTbSumarios);
                    m_cls_dba_ConnectionDB.SetTbSumarios(m_typDatSetTbSumarios);
                    if (this.MostrarAssistente)
                    {
                        mdlNotaFiscal.clsNotaFiscal obj = new mdlNotaFiscal.clsNotaFiscal(ref m_cls_ter_tratadorErro, ref m_cls_dba_ConnectionDB, m_strEnderecoExecutavel, m_nIdExportador, m_strIdCodigo);
                        obj.ShowDialog();
                    }
                    return(true);
                }
            }
            catch (Exception err)
            {
                Object erro = err;
                m_cls_ter_tratadorErro.trataErro(ref erro);
            }
            return(false);
        }
Esempio n. 42
0
        public static void VerifyLinq(Workspace workspace, ExpNode q, IQueryable results)
        {
            //verify if the results are ok before building the URI
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            foreach (object element in results)
            {
                list.Add(element);
            }


            //UriQueryBuilder ub = new UriQueryBuilder(workspace, "");
            // string ruri = ub.Build(q);

            //System.Uri uri = new Uri(workspace.ServiceUri);
            // string uriRel = ruri.Substring(ruri.IndexOf("/") + 1);
            // AstoriaTestLog.WriteLineIgnore(uri.ToString() + uriRel);

            AstoriaRequest request = workspace.CreateRequest(q);

            request.Format = SerializationFormatKind.Atom;

            try
            {
                AstoriaResponse response = request.GetResponse();
                //response.VerifyHttpStatusCodeOk(response.StatusCode);

                CommonPayload payload = response.CommonPayload;
                if (payload.Value != null)
                {
                    payload.CompareValue(results, false, false);
                }
                else
                {
                    payload.Compare(results);
                }

                //AstoriaTestLog.AreEqual(response.ContentType, SerializationFormatKinds.ContentTypeFromKind(response.OriginalRequest.SerializationKind),
                //"Content-Type does not match Accept header request");
            }
            catch (Exception e)
            {
                AstoriaTestLog.FailAndContinue(e);
            }
        }
        public void restarproductofinalizado()
        {
            //selecciono el valor actual de productos
            string resta = "select cantidad_producto_finalizado from tbm_producto_finalizado where idtbm_producto_finalizado = " + cmb_insertar_nombre_producto.SelectedValue.ToString() + "";

            System.Collections.ArrayList array = x.consultar(resta);
            foreach (Dictionary <string, string> dic in array)
            {
                guardaproducto = (dic["cantidad"]);
            }

            //capturo y convierto mi cantidad de producto del arreglo a entero
            int cantidadarestar = Convert.ToInt32(guardaproducto);
            //convierto a entero la cantidad del pedido
            int restando = Convert.ToInt32(lbl_cantidad.Text);

            //sumo las dos cantidades para obtener el nuevo valor
            cantidadproductoaactualizar = cantidadarestar + restando;
        }
Esempio n. 44
0
        static void Main(string[] args)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();
            list.Add("World");
            list.Add("Hello");

            Console.WriteLine("Count {0}", list.Count);
            Console.WriteLine("Capacity {0}", list.Capacity);
            //can set capacuty when list is created also

            list.Sort();
            PrintCollections(list);
            Console.WriteLine("list[0] = {0}", list[0]);
            Console.WriteLine("list[1] = {0}", list[1]);

            Console.WriteLine("Contains Hello {0}", list.Contains("Hello")); //must walk through each item in the array to do a comparison

            list.BinarySearch("Hello");                                      //list must be sorted first, much faster than contains search
        }
Esempio n. 45
0
 public override void AddElementToList(System.Collections.ArrayList myList, bool ResetFlag)
 {
     if (myList != null)
     {
         foreach (ZYTextElement myElement in myChildElements)
         {
             if (!ResetFlag)
             {
                 myElement.Visible = false;
                 myElement.Index   = -1;
             }
             if (myOwnerDocument.isVisible(myElement) && myElement is ZYTextContainer)
             {
                 myElement.Visible = true;
                 (myElement as TPTextCell).AddElementToList(myList, ResetFlag);
             }
         }
     }
 }
Esempio n. 46
0
        /// <summary>
        /// populate all the grid cells between two consecutive intersections with shape's value
        /// </summary>
        private bool ScanLine2(System.Collections.ArrayList vettore, double xref,
                               ref System.Collections.ArrayList pixels, ref MapWinGIS.Grid gr, MapWinGIS.GridHeader header,
                               object value, MapWinGIS.ICallback cback)
        {
            bool   result = false;
            bool   control;
            double yll, ystart, yend, ycellstart;
            double pxsize;
            int    c, r, v;

            r = 0;
            GridPixel curPx;

            control = false;
            yll     = header.YllCenter;
            pxsize  = header.dX;

            ystart = 0;
            for (v = vettore.Count - 1; v >= 0; --v)
            {
                if (control == false)
                {
                    ystart  = (double)vettore[v];
                    control = true;
                }
                else
                {
                    yend       = (double)vettore[v];
                    ycellstart = FirstLineXY(ystart, yll, pxsize, -1);

                    do
                    {
                        gr.ProjToCell(xref, ycellstart, out c, out r);
                        curPx.col = c;
                        curPx.row = r;
                        pixels.Add(curPx);
                        ycellstart = ycellstart - pxsize;
                    }while (ycellstart >= yend);
                    control = false;
                }
            }
            return(result);
        }
Esempio n. 47
0
 /// <summary>
 /// Returns all the Objects from an array of files.
 /// </summary>
 /// <param name="Filenames">Array of filesnames to get an IDemo from.</param>
 /// <returns></returns>
 public Object[] GetObjectsFromFiles(String[] Filenames, out string errors)
 {
     errors = "";
     System.Reflection.Assembly   PluginAssembly = null;
     System.Collections.ArrayList Plugins        = new System.Collections.ArrayList();
     try
     {
         foreach (string Filename in Filenames)
         {
             PluginAssembly = System.Reflection.Assembly.LoadFrom(Filename);
             Plugins.Add(GetObjectsFromAssembly(PluginAssembly, out errors));
         }
     }
     catch (Exception ex)
     {
         errors += ex.Message + ex.StackTrace + "\r\n";
     }
     return((Object[])Plugins.ToArray(typeof(Object)));
 }
Esempio n. 48
0
 public object this[int index]
 {
     get
     {
         if (this.value == null)
         {
             this.value = new ArrayList();
         }
         return(this.value[index]);
     }
     set
     {
         if (this.value == null)
         {
             this.value = new ArrayList();
         }
         this.value[index] = value;
     }
 }
        public void MethodArrayList()
        {
            al = new ArrayList();

            al.Add("Hello");

            if (!(al[0].Equals("Hello")))
            {
                Environment.Exit(-1);
            }

            al.Add("Hello");
            al[1] = "World";

            if (!(al[1].Equals("World")))
            {
                Environment.Exit(-1);
            }
        }
Esempio n. 50
0
    public static string Dtb2Json(this DataTable dtb)
    {
        JavaScriptSerializer jss = new JavaScriptSerializer();

        jss.MaxJsonLength = int.MaxValue;
        System.Collections.ArrayList dic = new System.Collections.ArrayList();
        foreach (DataRow dr in dtb.Rows)
        {
            System.Collections.Generic.Dictionary <string, object> drow = new System.Collections.Generic.Dictionary <string, object>();
            foreach (DataColumn dc in dtb.Columns)
            {
                drow.Add(dc.ColumnName, dr[dc.ColumnName]);
            }
            dic.Add(drow);
        }

        //序列化
        return(jss.Serialize(dic));
    }
Esempio n. 51
0
        public void AddLiteralFilter(Variable variable, LiteralFilter filter)
        {
            if (VariableLiteralFilters == null)
            {
                VariableLiteralFilters = new LitFilterMap();
            }
            LitFilterList list = null;

                        #if DOTNET2
            if (VariableLiteralFilters.ContainsKey(variable))
                        #endif
            list = (LitFilterList)VariableLiteralFilters[variable];
            if (list == null)
            {
                list = new LitFilterList();
                VariableLiteralFilters[variable] = list;
            }
            list.Add(filter);
        }
Esempio n. 52
0
        public void Bind()
        {
            System.Collections.ArrayList c = new System.Collections.ArrayList();
            int counter = 0;

            this.totalItems  = this.ds.Count;
            this.startRecord = this.getCurrentPage() * this.pageSize;
            foreach (object o in this.ds)
            {
                if (counter >= this.startRecord && counter < this.startRecord + this.pageSize)
                {
                    c.Add(o);
                }

                counter++;
            }
            this.DataSource = c;
            this.DataBind();
        }
        /// <summary>
        /// Gets all users by email.
        /// </summary>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        public static User[] getAllByEmail(string email)
        {
            List <User> retVal = new List <User>();

            System.Collections.ArrayList tmpContainer = new System.Collections.ArrayList();

            IRecordsReader dr;

            dr = SqlHelper.ExecuteReader(
                "Select id from umbracoUser where userEmail LIKE @email", SqlHelper.CreateParameter("@email", String.Format("%{0}%", email)));

            while (dr.Read())
            {
                retVal.Add(BusinessLogic.User.GetUser(dr.GetInt("id")));
            }
            dr.Close();

            return(retVal.ToArray());
        }
Esempio n. 54
0
        /// <summary>
        /// Create Model
        /// </summary>
        /// <param name="silhouetteTolerance">Silhouette tolerance</param>
        /// <param name="xTolerance">x shift tolerance</param>
        /// <param name="yTolerance">y shift tolerance</param>
        /// <param name="imgTolerance">image tolerance</param>
        /// <param name="color">The ARGB tolerance</param>
        void IModelManager2Unmanaged.CreateModel(double silhouetteTolerance,
                                                 double xTolerance,
                                                 double yTolerance,
                                                 double imgTolerance,
                                                 IColor color)
        {
            System.Diagnostics.Debug.WriteLine("CreateModel() :" + "\n  shapeTolerance = " + silhouetteTolerance.ToString() + "\n  imgTolerance = " + imgTolerance.ToString() + "\n  (x y) tolerance = (" + xTolerance.ToString() + yTolerance.ToString() + ")" + "\n  (a,r,g,b) tolerance = (" + color.ToString() + ")\n");

//logging
            System.Diagnostics.Debug.WriteLine("Analyzing...");
            Analyze();
            System.Diagnostics.Debug.WriteLine("Adding Descriptors...");
            Descriptors.SelectedDescriptors.AddRange(Descriptors.ActiveDescriptors);
            System.Collections.ArrayList descriptors = Descriptors.SelectedDescriptors;
            System.Diagnostics.Debug.WriteLine("Start Looping...");
            for (int t = 0; t < descriptors.Count; t++)
            {
                ArrayList      criteria = new ArrayList();
                DescriptorInfo descr    = (DescriptorInfo)descriptors[t];
                descr.IDescriptor.Name = t.ToString();
                if (silhouetteTolerance >= 0)
                {
                    criteria.Add(new Criteria.SilhouetteCriterion(silhouetteTolerance));
                }
                if (xTolerance >= 0)
                {
                    criteria.Add(new Criteria.XPositionCriterion(xTolerance));
                }
                if (yTolerance >= 0)
                {
                    criteria.Add(new Criteria.YPositionCriterion(yTolerance));
                }
                if (imgTolerance >= 0)
                {
                    criteria.Add(new Criteria.TextureCriterion(imgTolerance));
                }
                if ((ColorByte)color != ColorByte.Empty)
                {
                    criteria.Add(new Criteria.ColorAverageCriterion((ColorDouble)color.ToColor()));
                }
                descr.IDescriptor.Criteria = (Criterion[])criteria.ToArray(typeof(Criterion));
            }
        }
        public override void Execute()
        {
            StartStep();
            //Verify FAS message for RB size
            bool verifyMilestones = CL.EA.UI.Utils.BeginWaitForDebugMessages(Milestone, Constants.waitForMilestones);

            if (!verifyMilestones)
            {
                FailStep(CL, res, "Failed to BeginWaitForMessage TrickModeStopInReviewBuffer");
            }

            res = CL.EA.PVR.SetTrickModeSpeed("RB", 2, false);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to rewind into RB");
            }

            System.Collections.ArrayList ActualLines = new System.Collections.ArrayList();
            bool endVerifyMilestones = CL.EA.UI.Utils.EndWaitForDebugMessages(Milestone, ref ActualLines);

            if (!endVerifyMilestones)
            {
                FailStep(CL, res, "Failed to get EndWaitForMessage TrickModeStopInReviewBuffer");
            }

            CL.IEX.LogComment("obtained Milestone String :" + ActualLines[0].ToString());

            res = CL.EA.GetRBDepthInSec(ActualLines[0].ToString(), ref rbDepthInMin);
            CL.IEX.LogComment("RB Depth is = " + rbDepthInMin);

            if ((((Convert.ToDouble(RB_SIZE) - 1) * 60) > Convert.ToDouble(rbDepthInMin)) || ((Convert.ToDouble(RB_SIZE) + 1) * 60) < (Convert.ToDouble(rbDepthInMin)))
            {
                FailStep(CL, res, "Failed: The Review Buffer Depth Is Bigger Than Max Depth");
            }

            res = CL.EA.PVR.SetTrickModeSpeed("RB", Speed: 30, Verify_EOF_BOF: true, IsReviewBufferFull: true);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, "Failed to verify the EOF and BOF in the RB");
            }

            PassStep();
        }
Esempio n. 56
0
        private void btnGetCategoryProducts_Click(object sender, RoutedEventArgs e)
        {
            ACDB.AmeriCommerceDatabaseIO oWS     = new AmeriCommerceApiExamples.ACDB.AmeriCommerceDatabaseIO();
            ACDB.AmeriCommerceHeaderInfo oHeader = new AmeriCommerceApiExamples.ACDB.AmeriCommerceHeaderInfo();
            oHeader.UserName                 = Properties.Settings.Default.ApiUsername;
            oHeader.Password                 = Properties.Settings.Default.ApiPassword;
            oHeader.SecurityToken            = Properties.Settings.Default.ApiSecurityToken;
            oWS.AmeriCommerceHeaderInfoValue = oHeader;

            this.txtResults.Text  = "";
            this.txtResults.Text += "Grabbing Products from Category\r\n";
            var aryProducts = new System.Collections.ArrayList(oWS.Category_GetProducts(1));

            this.txtResults.Text += "Products Returned: " + aryProducts.Count + "\r\n";
            foreach (ACDB.ProductTrans oProduct in aryProducts)
            {
                this.txtResults.Text += "ID: " + oProduct.itemID.Value + ": " + oProduct.itemName + "\r\n";
            }
        }
        private void pictureBox7_Click(object sender, EventArgs e)
        {
            i3nRiqJson x3    = new i3nRiqJson();
            string     query = "select idtbm_cliente from tbm_cliente where nombre_cliente='" + cmb_eliminar.Text + "'";

            System.Collections.ArrayList array = x3.consultar(query);

            foreach (Dictionary <string, string> dic in array)
            {
                stef2 = (dic["idtbm_cliente"] + "\n");
                // txtR.AppendText(dic["employee_name"] + "\n");
                // Console.WriteLine("VIENEN: "+dic["employee_name"]);
            }



            textBox1.Text = stef2;

            i3nRiqJson x4     = new i3nRiqJson();
            string     query2 = "select idtbm_cliente from tbm_cliente where tbm_descuento_idtbm_descuento='" + textBox1.Text + "'";

            System.Collections.ArrayList array2 = x4.consultar(query2);

            foreach (Dictionary <string, string> dic in array2)
            {
                stef3 = (dic["idtbm_cliente"] + "\n");

                // txtR.AppendText(dic["employee_name"] + "\n");
                // Console.WriteLine("VIENEN: "+dic["employee_name"]);
            }



            string busca = cmb_eliminar.SelectedValue.ToString();

            dataGridView1.DataSource = db.consulta_DataGridView("select *from tbm_cliente where idtbm_cliente =" + stef3 + ";");



            //string busca = cmb_eliminar.SelectedValue.ToString();
            //  dataGridView1.DataSource = db.consulta_DataGridView("SELECT tbm_cliente.nombre_cliente as Nombre,tbm_cliente.nit_cliente as Nit,tbm_cliente.direccion_cliente as Direccion from tbm_cliente   where tbm_descuento_idtbm_descuento =" + busca + ";");
            // dataGridView1.DataSource = db.consulta_DataGridView("SELECT tbm_cliente.nombre_cliente as Nombre,tbm_cliente.nit_cliente as Nit,tbm_cliente.direccion_cliente as Direccion, tbm_descuento.descuento as Descuento from tbm_cliente ,tbm_descuento   where  tbm_cliente.tbm_descuento_idtbm_descuento = tbm_descuento .idtbm_descuento=" + busca + ";   ");
        }
Esempio n. 58
0
        public TCPMail()
        {
            mailObject       = new System.Net.Mail.MailMessage();
            mMailAttachments = new ArrayList();

            Charset         = System.Text.Encoding.GetEncoding(GetSMTPMailConfigValue("Email_MailCharset"));
            mMailFrom       = GetSMTPMailConfigValue("Email_MailFrom");
            mMailDisplyName = GetSMTPMailConfigValue("Email_MailFromName");
            mSMTPServer     = GetSMTPMailConfigValue("Email_MailServer");
            mSMTPUsername   = GetSMTPMailConfigValue("Email_MailUserName");
            mSMTPPassword   = GetSMTPMailConfigValue("Email_MailUserPassword");
            mSMTPPort       = 25;
            mMailTo         = null;
            mMailCc         = "";
            mMailBcc        = "";
            mMailSubject    = null;
            mMailBody       = null;
            mSMTPSSL        = false;
        }
Esempio n. 59
0
        private static string[] GetPinyins(Char c)
        {
            System.Collections.ArrayList alPinyin = new System.Collections.ArrayList();
            alPinyin.Add(c.ToString());
            ChineseChar x = new ChineseChar(c);

            foreach (string s in x.Pinyins)
            {
                if (s != null)
                {
                    string py = s.Substring(0, s.Length - 1);
                    if (alPinyin.IndexOf(py) == -1)
                    {
                        alPinyin.Add(py);
                    }
                }
            }
            return((string[])alPinyin.ToArray(typeof(string)));
        }
        private void btnRemove_Click(object sender, System.EventArgs e)
        {
            System.Collections.ArrayList pks = _gr.SelectedPrimaryKeys;

            foreach (string[] keys in pks)
            {
                decimal log_id          = decimal.Parse(keys[0]);
                decimal distribution_id = decimal.Parse(keys[1]);

                try
                {
                    FI.BusinessObjects.DistributionManager.Instance.CancelQueuedItem(log_id);
                }
                catch (Exception exc)
                {
                    ShowException(exc);
                }
            }
        }