public bool GetNext() {
            Constraint candidate;
            currentObject = null;
            while (tables != null) {
                if (constraints == null) {
                    if (!tables.MoveNext()) {
                        tables = null;
                        return false;
                    }
                    constraints = ((DataTable)tables.Current).Constraints.GetEnumerator();
                }

                if (!constraints.MoveNext()) {
                    constraints = null;
                    continue;
                }

                Debug.Assert(constraints.Current is Constraint, "ConstraintEnumerator, contains object which is not constraint");
                candidate = (Constraint)constraints.Current;
                if (IsValidCandidate(candidate)) {
                    currentObject = candidate;
                    return true;
                }

            }
            return false;
        }
Example #2
0
    protected void btnBindRes_Click(object sender, System.EventArgs e)
    {
        System.Collections.Generic.List <BudModifyTask> outModifyTaskGV = this.GetOutModifyTaskGV();
        System.Collections.Generic.List <BudModifyTask> inModifyTaskGV  = this.GetInModifyTaskGV();
        this.BindGv(outModifyTaskGV, inModifyTaskGV);
        string text = string.Empty;

        if (this.hfldSpType.Value == "out")
        {
            text = this.hfldCheckedTaskIdOut.Value;
        }
        else
        {
            text = this.hfldCheckedTaskIdIn.Value;
        }
        HttpCookie httpCookie = base.Request.Cookies[text];

        System.Collections.Generic.List <BudModifyTaskRes> list = new System.Collections.Generic.List <BudModifyTaskRes>();
        if (httpCookie != null)
        {
            string value = httpCookie.Value;
            if (!string.IsNullOrEmpty(value))
            {
                list = JsonConvert.DeserializeObject <System.Collections.Generic.List <BudModifyTaskRes> >(value);
            }
        }
        decimal d = 0m;

        foreach (BudModifyTaskRes current in list)
        {
            d += current.ResourcePrice * current.ResourceQuantity;
        }
        if (this.hfldSpType.Value == "out")
        {
            System.Collections.IEnumerator enumerator2 = this.gvOutTask.Rows.GetEnumerator();
            try
            {
                while (enumerator2.MoveNext())
                {
                    GridViewRow gridViewRow = (GridViewRow)enumerator2.Current;
                    string      value2      = ((HiddenField)gridViewRow.FindControl("hfldOutModifyTaskId")).Value;
                    if (!string.IsNullOrEmpty(value2) && value2 == text)
                    {
                        ((TextBox)gridViewRow.FindControl("txtOutTotal")).Text = d.ToString("0.000");
                        string value3 = ((TextBox)gridViewRow.FindControl("txtOutQuantity")).Text.Trim();
                        if (string.IsNullOrEmpty(value3))
                        {
                            break;
                        }
                        decimal num = System.Convert.ToDecimal(value3);
                        if (num != 0m)
                        {
                            ((TextBox)gridViewRow.FindControl("txtOutUnitPrice")).Text = (d / num).ToString("0.000");
                            break;
                        }
                        ((TextBox)gridViewRow.FindControl("txtOutUnitPrice")).Text = "0.000";
                        break;
                    }
                }
                goto IL_34C;
            }
            finally
            {
                System.IDisposable disposable = enumerator2 as System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
        foreach (GridViewRow gridViewRow2 in this.gvInTask.Rows)
        {
            string value4 = ((HiddenField)gridViewRow2.FindControl("hfldInModifyTaskId")).Value;
            if (value4 == text)
            {
                ((TextBox)gridViewRow2.FindControl("txtInTotal")).Text = d.ToString("0.000");
                string value5 = ((TextBox)gridViewRow2.FindControl("txtInQuantity")).Text.Trim();
                if (string.IsNullOrEmpty(value5))
                {
                    ((TextBox)gridViewRow2.FindControl("txtInUnitPrice")).Text = "0.000";
                    break;
                }
                decimal num2 = System.Convert.ToDecimal(value5);
                if (num2 != 0m)
                {
                    ((TextBox)gridViewRow2.FindControl("txtInUnitPrice")).Text = (d / num2).ToString("0.000");
                    break;
                }
                ((TextBox)gridViewRow2.FindControl("txtInUnitPrice")).Text = "0.000";
                break;
            }
        }
IL_34C:
        System.Collections.Generic.List <BudModifyTask> outModifyTaskGV2 = this.GetOutModifyTaskGV();
        System.Collections.Generic.List <BudModifyTask> inModifyTaskGV2  = this.GetInModifyTaskGV();
        decimal d2 = 0m;

        d2 += outModifyTaskGV2.Sum((BudModifyTask omt) => omt.Total);
        d2 += inModifyTaskGV2.Sum((BudModifyTask imt) => imt.Total);
        this.txtBudAmount.Value = d2.ToString("0.000");
    }
			/// <summary>
			/// 
			/// </summary>
			/// <param name="collection"></param>
			public Enumerator(ContentBaseCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(LayoutRendererCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(DatabaseParameterInfoCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #6
0
 public Enumerator(RunInvokerCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(RuleList collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #8
0
 public Enumerator(WindowsTimeZoneCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #9
0
 public TableRecordFieldStylesEnumerator(TableRecordFieldStylesCollection tabMappings)
 {
     this.iEnLocal = ((System.Collections.IEnumerable)(tabMappings));
     this.iEnBase  = iEnLocal.GetEnumerator();
 }
Example #10
0
 public FieldStyleEnumerator(FieldStyleCollection fieMappings)
 {
     this.iEnLocal = ((System.Collections.IEnumerable)(fieMappings));
     this.iEnBase  = iEnLocal.GetEnumerator();
 }
Example #11
0
    /// <summary>
    /// Search a given path for an XML file.
    /// </summary>
    /// <param name="currentPathIndex"> index into the 'paths' Vector that
    ///        indicates what 1-Wire path to search for XML files </param>
    /// <returns> true if the current path provided has been
    ///         completely checked for XML files.  false if
    ///         if this current path should be searched further </returns>
    public static bool pathXMLSearchComplete(int currentPathIndex)
    {
        OneWireContainer  owd = null, check_owd = null;
        ParseContainer    pc = null, check_pc = null;
        OWFileInputStream file_stream = null;
        bool rslt       = true;
        bool xml_parsed = false;

        try
        {
            main_Renamed.Status = "Waiting for 1-Wire available";

            // get exclusive use of adapter
            adapter.beginExclusive(true);

            main_Renamed.Status = "Exclusive 1-Wire aquired";

            // open the current path to the device
            OWPath owpath = (OWPath)paths[currentPathIndex];
            owpath.open();

            main_Renamed.Status = "Path opened: " + owpath.ToString();

            // setup search
            adapter.setSearchAllDevices();
            adapter.targetAllFamilies();
            adapter.Speed = DSPortAdapter.SPEED_REGULAR;

            // find all devices, update parseLog and get a device filesystem to check
            for (System.Collections.IEnumerator owd_enum = adapter.AllDeviceContainers; owd_enum.MoveNext();)
            {
                owd = (OneWireContainer)owd_enum.Current;
                long key = owd.AddressAsLong;

                main_Renamed.Status = "Device Found: " + owd.AddressAsString;

                // check to see if this is in the parseLog, add if not there
                pc = null;
                parseLog.TryGetValue(key, out pc);
                if (pc == null)
                {
                    main_Renamed.Status = "Device is new to parse: " + owd.AddressAsString;
                    pc = new ParseContainer(owd);
                    parseLog.Add(key, pc);
                }
                else
                {
                    main_Renamed.Status = "Device " + owd.AddressAsString + " with count " + pc.attemptCount;
                }

                // if attemptCount is low then check it later for XML files
                if (pc.attemptCount < ParseContainer.MAX_ATTEMPT)
                {
                    check_owd = owd;
                    check_pc  = pc;
                }
            }

            // check if there is anything to open
            if (check_owd != null)
            {
                // result is false because found something to try and open
                rslt = false;

                main_Renamed.Status = "Attempt to open file TAGX.000";

                // attempt to open a 'TAGX.000' file, (if fail update parse_log)
                try
                {
                    file_stream         = new OWFileInputStream(check_owd, "TAGX.0");
                    main_Renamed.Status = "Success file TAGX.000 opened";
                }
                catch (OWFileNotFoundException)
                {
                    file_stream = null;
                    check_pc.attemptCount++;
                    main_Renamed.Status = "Could not open TAGX.000 file";
                }
            }

            // try to parse the file, (if fail update parse_log)
            if (file_stream != null)
            {
                // create the tagParser
                // (this should not be necessary but the parser currently holds state)
                parser = new TAGParser(adapter);

                // attempt to parse it, on success max out the attempt
                if (parseStream(parser, file_stream, owpath, true))
                {
                    xml_parsed            = true;
                    check_pc.attemptCount = ParseContainer.MAX_ATTEMPT;
                }
                else
                {
                    check_pc.attemptCount++;
                }

                // close the file
                try
                {
                    file_stream.close();
                }
                catch (IOException)
                {
                    main_Renamed.Status = "Could not close TAGX.000 file";
                }
            }

            // close the path
            owpath.close();
            main_Renamed.Status = "Path closed";

            // update the main paths listbox if XML file found
            if (xml_parsed)
            {
                // add the paths to the main window
                main_Renamed.clearPathList();
                for (int p = 0; p < paths.Count; p++)
                {
                    main_Renamed.addToPathList(((OWPath)paths[p]).ToString());
                }
            }
        }
        catch (OneWireException e)
        {
            Debug.WriteLine(e);
            main_Renamed.Status = e.ToString();
        }
        finally
        {
            // end exclusive use of adapter
            adapter.endExclusive();
            main_Renamed.Status = "Exclusive 1-Wire aquired released";
        }

        return(rslt);
    }
Example #12
0
        /// <summary>
        /// Display the supplied imaging tasks
        /// </summary>
        /// <param name="tasks"></param>
        private void displayImagingTasks(IImagingTask[] tasks, DateTime currentDateToImage)
        {
            // Clear rows
            dt.Rows.Clear();

            // If we got some tasks
            if (tasks != null)
            {
                // Declare a DataRow
                DataRow dr;

                // Get an enumerator
                System.Collections.IEnumerator enumerator = tasks.GetEnumerator();

                // While we have more tasks
                while (enumerator.MoveNext())
                {
                    // Get this task
                    IImagingTask task = (IImagingTask)enumerator.Current;

                    // Get a new row
                    dr = dt.NewRow();

                    // Populate the row
                    dr[0] = task.DateToImage;
                    dr[1] = task.Priority;
                    dr[2] = task.InQueue;
                    dr[3] = task.State;
                    dr[4] = task.DateImaged.ToUniversalTime();
                    dr[5] = task.DateToImage.ToUniversalTime();
                    dr[6] = task.DateImaged.ToLocalTime();
                    dr[7] = task.DateToImage.ToLocalTime();

                    // Add the row to the table
                    dt.Rows.Add(dr);
                }
            }

            // Use currentDateToImage to reselect current row
            if (DateTime.MinValue.Equals(currentDateToImage))
            {
                dgImagingTasks.CurrentRowIndex = 0;
            }
            else
            {
                DataView dv = (DataView)dgImagingTasks.DataSource;
                System.Collections.IEnumerator enumerator = dv.GetEnumerator();
                int i = 0;
                while (enumerator.MoveNext())
                {
                    DataRowView drv = (DataRowView)enumerator.Current;
                    if (currentDateToImage.Equals(drv.Row.ItemArray[0]))
                    {
                        dgImagingTasks.CurrentRowIndex = i;
                        break;
                    }
                    i++;
                }
            }

            // Update radio button labels
            rdbScheduled.Text   = "Scheduled imaging tasks for " + barcode;
            rdbUnscheduled.Text = "Unscheduled imaging task for " + barcode;

            if (dgImagingTasks.CurrentRowIndex > -1)
            {
                rdbUnscheduled.Checked = false;
                rdbScheduled.Checked   = true;
            }
            else
            {
                rdbScheduled.Checked   = false;
                rdbUnscheduled.Checked = true;
            }

            updateActionButtonState();
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(MethodCallParameterCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #14
0
        /// <summary> We're going to examine rows from the middle outward, searching alternately above and below the
        /// middle, and farther out each time. rowStep is the number of rows between each successive
        /// attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
        /// middle + rowStep, then middle - (2 * rowStep), etc.
        /// rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
        /// decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
        /// image if "trying harder".
        ///
        /// </summary>
        /// <param name="image">The image to decode
        /// </param>
        /// <param name="hints">Any hints that were requested
        /// </param>
        /// <returns> The contents of the decoded barcode
        /// </returns>
        /// <throws>  ReaderException Any spontaneous errors which occur </throws>
        private Result doDecode(BinaryBitmap image, System.Collections.Hashtable hints)
        {
            int      width  = image.Width;
            int      height = image.Height;
            BitArray row    = new BitArray(width);

            int  middle    = height >> 1;
            bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);
            int  rowStep   = System.Math.Max(1, height >> (tryHarder?7:4));
            int  maxLines;

            if (tryHarder)
            {
                maxLines = height;                 // Look at the whole image, not just the center
            }
            else
            {
                maxLines = 9;                 // Nine rows spaced 1/16 apart is roughly the middle half of the image
            }

            for (int x = 0; x < maxLines; x++)
            {
                // Scanning from the middle out. Determine which row we're looking at next:
                int  rowStepsAboveOrBelow = (x + 1) >> 1;
                bool isAbove   = (x & 0x01) == 0;               // i.e. is x even?
                int  rowNumber = middle + rowStep * (isAbove?rowStepsAboveOrBelow:-rowStepsAboveOrBelow);
                if (rowNumber < 0 || rowNumber >= height)
                {
                    // Oops, if we run off the top or bottom, stop
                    break;
                }

                // Estimate black point for this row and load it:
                try
                {
                    row = image.getBlackRow(rowNumber, row);
                }
                catch (ReaderException)
                {
                    continue;
                }

                // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
                // handle decoding upside down barcodes.
                for (int attempt = 0; attempt < 2; attempt++)
                {
                    if (attempt == 1)
                    {
                        // trying again?
                        row.reverse(); // reverse the row and continue
                        // This means we will only ever draw result points *once* in the life of this method
                        // since we want to avoid drawing the wrong points after flipping the row, and,
                        // don't want to clutter with noise from every single row scan -- just the scans
                        // that start on the center line.
                        if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
                        {
                            System.Collections.Hashtable   newHints = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable()); // Can't use clone() in J2ME
                            System.Collections.IEnumerator hintEnum = hints.Keys.GetEnumerator();
                            //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
                            while (hintEnum.MoveNext())
                            {
                                //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                                System.Object key = hintEnum.Current;
                                if (!key.Equals(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
                                {
                                    newHints[key] = hints[key];
                                }
                            }
                            hints = newHints;
                        }
                    }

                    // Look for a barcode
                    Result result = decodeRow(rowNumber, row, hints);

                    // We found our barcode
                    if (attempt == 1 && result.HasValue())
                    {
                        // But it was upside down, so note that
                        result.putMetadata(ResultMetadataType.ORIENTATION, (System.Object) 180);
                        // And remember to flip the result points horizontally.
                        ResultPoint[] points = result.ResultPoints;
                        points[0] = new ResultPoint(width - points[0].X - 1, points[0].Y);
                        points[1] = new ResultPoint(width - points[1].X - 1, points[1].Y);
                    }
                    if (result.HasValue())
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
Example #15
0
        /// <summary>
        /// 从Excel中读取一个工作薄,生成Datatable对象。
        /// </summary>
        /// <param name="xlsFile"></param>
        /// <param name="sheetIndex"></param>
        /// <returns></returns>
        private DataTable SheetToDatatable(string xlsFile, int sheetIndex)
        {
            DataTable dt = new DataTable();
            //创建工作薄对象
            IWorkbook workbook = createWorkbook(xlsFile);
            ISheet    sheet    = workbook.GetSheetAt(sheetIndex);

            System.Collections.IEnumerator rows = sheet.GetRowEnumerator();
            try
            {
                rows.MoveNext();
                //创建Datatable结构
                IRow firsRow = createRow(xlsFile, rows.Current);
                for (int i = 0; i < firsRow.LastCellNum; i++)
                {
                    ICell cell = firsRow.GetCell(i);
                    if (cell == null || string.IsNullOrWhiteSpace(cell.ToString()))
                    {
                        continue;
                    }
                    dt.Columns.Add(new DataColumn(cell.ToString(), getColumnType(cell.ToString())));
                }
                //导入工作薄的数据
                while (rows.MoveNext())
                {
                    IRow    row = createRow(xlsFile, rows.Current);
                    DataRow dr  = dt.NewRow();
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        ICell cell = row.GetCell(i);
                        if (cell == null)
                        {
                            continue;
                        }
                        string value = cell.ToString();
                        //读取Excel格式,根据格式读取数据类型
                        switch (dt.Columns[i].DataType.FullName)
                        {
                        case "System.DateTime":     //日期类型
                            if (DateUtil.IsValidExcelDate(cell.NumericCellValue))
                            {
                                try
                                {
                                    value = cell.DateCellValue.ToString();
                                }
                                catch
                                {
                                    value = cell.ToString();
                                }
                            }
                            else
                            {
                                value = cell.NumericCellValue.ToString();
                            }
                            break;

                        default:
                            value = cell.ToString();
                            break;
                        }
                        dr[i] = WeiSha.Common.Param.Method.ConvertToAnyValue.Get(value).ChangeType(dt.Columns[i].DataType);
                    }
                    dt.Rows.Add(dr);
                }
            }
            catch (Exception ex)
            {
                return(dt);
            }
            return(dt);
        }
 /// <summary> Creates a new iteratorwrapper instance for the specified
 /// Enumeration.
 /// *
 /// </summary>
 /// <param name="enum"> The Enumeration to wrap.
 ///
 /// </param>
 public EnumerationIterator(System.Collections.IEnumerator enum_Renamed)
 {
     this.enum_Renamed = enum_Renamed;
 }
Example #17
0
 public Enumerator(RunInvokerCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #18
0
 internal StringEnumerator(StringCollection mappings)
 {
     _temp = (IEnumerable)(mappings);
     _baseEnumerator = _temp.GetEnumerator();
 }
Example #19
0
 public static void WaitFor(System.Collections.IEnumerator routine)
 {
     SocialSystem.instance.StartCoroutine(routine);
 }
 /// <summary>
 ///     Enumerator constructor
 /// </summary>
 public IPluginEnumerator(PluginCollection pluMappings)
 {
     this.iEnLocal = ((System.Collections.IEnumerable)(pluMappings));
     this.iEnBase = iEnLocal.GetEnumerator();
 }
Example #21
0
    /// <summary>
    /// Method main
    ///
    /// </summary>
    /// <param name="args">
    /// </param>
    /// <exception cref="OneWireException"> </exception>
    /// <exception cref="OneWireIOException">
    ///  </exception>
    public static void Main1(string[] args)
    {
        bool          usedefault   = false;
        DSPortAdapter access       = null;
        string        adapter_name = null;
        string        port_name    = null;

        if ((args == null) || (args.Length < 1))
        {
            try
            {
                access = OneWireAccessProvider.DefaultAdapter;

                if (access == null)
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Couldn't get default adapter!");
                printUsageString();

                return;
            }

            usedefault = true;
        }

        if (!usedefault)
        {
            string[] st = args[0].Split(new char[] { '_' });


            if (st.Length != 2)
            {
                printUsageString();

                return;
            }

            adapter_name = st[0];
            port_name    = st[1];

            Debug.WriteLine("Adapter Name: " + adapter_name);
            Debug.WriteLine("Port Name: " + port_name);
        }

        if (access == null)
        {
            try
            {
                access = OneWireAccessProvider.getAdapter(adapter_name, port_name);
            }
            catch (Exception)
            {
                Debug.WriteLine("That is not a valid adapter/port combination.");

                System.Collections.IEnumerator en = OneWireAccessProvider.enumerateAllAdapters();

                while (en.MoveNext())
                {
                    DSPortAdapter temp = (DSPortAdapter)en.Current;

                    Debug.WriteLine("Adapter: " + temp.AdapterName);

                    System.Collections.IEnumerator f = temp.PortNames;

                    while (f.MoveNext())
                    {
                        Debug.WriteLine("   Port name : " + ((string)f.Current));
                    }
                }

                return;
            }
        }

        access.adapterDetected();
        access.targetAllFamilies();
        access.beginExclusive(true);
        access.reset();
        access.setSearchAllDevices();

        bool next = access.findFirstDevice();

        if (!next)
        {
            Debug.WriteLine("Could not find any iButtons!");

            return;
        }

        while (next)
        {
            OneWireContainer owc = access.DeviceContainer;

            Debug.WriteLine("====================================================");
            Debug.WriteLine("= Found One Wire Device: " + owc.AddressAsString + "          =");
            Debug.WriteLine("====================================================");
            Debug.WriteLine("=");

            bool            isSwitchContainer = false;
            SwitchContainer sc = null;

            try
            {
                sc = (SwitchContainer)owc;
                isSwitchContainer = true;
            }
            catch (InvalidCastException)
            {
                sc = null;
                isSwitchContainer = false;         //just to reiterate
            }

            if (isSwitchContainer)
            {
                Debug.WriteLine("= This device is a " + owc.Name);
                Debug.WriteLine("= Also known as a " + owc.AlternateNames);
                Debug.WriteLine("=");
                Debug.WriteLine("= It is a Switch Container");
                if (sc.hasActivitySensing())
                {
                    sc.clearActivity();
                }

                byte[] state    = sc.readDevice();
                int    channels = sc.getNumberChannels(state);
                bool   activity = sc.hasActivitySensing();
                bool   level    = sc.hasLevelSensing();
                bool   smart    = sc.hasSmartOn();

                Debug.WriteLine("= This device has " + channels + " channel" + (channels > 1 ? "s" : ""));
                Debug.WriteLine("= It " + (activity ? "has" : "does not have") + " activity sensing abilities");
                Debug.WriteLine("= It " + (level ? "has" : "does not have") + " level sensing abilities");
                Debug.WriteLine("= It " + (smart ? "is" : "is not") + " smart-on capable");

                for (int ch = 0; ch < channels; ch++)
                {
                    Debug.WriteLine("======================");
                    Debug.WriteLine("=   Channel " + ch + "        =");
                    Debug.WriteLine("=--------------------=");

                    bool latchstate = sc.getLatchState(ch, state);

                    Debug.WriteLine("= State " + (latchstate ? "ON " : "OFF") + "          =");

                    if (level)
                    {
                        bool sensedLevel = sc.getLevel(ch, state);

                        Debug.WriteLine("= Level " + (sensedLevel ? "HIGH" : "LOW ") + "         =");
                    }

                    if (activity)
                    {
                        bool sensedActivity = sc.getSensedActivity(ch, state);

                        Debug.WriteLine("= Activity " + (sensedActivity ? "YES" : "NO ") + "       =");
                    }

                    Debug.WriteLine("= Toggling switch... =");

                    try
                    {
                        Thread.Sleep(500);
                    }
                    catch (Exception)
                    {
                        /*drain it*/
                    }

                    sc.setLatchState(ch, !latchstate, smart, state);
                    sc.writeDevice(state);

                    state = sc.readDevice();

                    if (latchstate == sc.getLatchState(ch, state))
                    {
                        Debug.WriteLine("= Toggle Failed      =");
                    }
                    else
                    {
                        try
                        {
                            Thread.Sleep(500);
                        }
                        catch (Exception)
                        {
                            /*drain it*/
                        }

                        Debug.WriteLine("= Toggling back...   =");
                        sc.setLatchState(ch, latchstate, smart, state);
                        sc.writeDevice(state);
                    }
                }
            }
            else
            {
                Debug.WriteLine("= This device is not a Switch device.");
                Debug.WriteLine("=");
                Debug.WriteLine("=");
            }

            next = access.findNextDevice();
        }
    }
Example #22
0
 private void Select_ListaZadan_ExecuteCode(object sender, EventArgs e)
 {
     bool withAttachements = true;
     zadania = BLL.tabZadania.Get_ZakonczoneDoArchiwizacji(workflowProperties.Web, withAttachements);
     myEnum = zadania.GetEnumerator();
 }
Example #23
0
            //和客户端进行数据通信包括接收客户端的请求
            //根据同的请求命令执行相应的操作并将操作结果返回给客户端
            public void ClientService()
            {
                string[]      acceptStr     = null;           //保存消息字符
                byte[]        buff          = new byte[1024]; //缓冲区
                bool          keepConnected = true;
                NetworkStream stream        = currentClient.GetStream();

                //用循环不断地与客户端进行交互,直到其发出EXIT或者QUIT命令
                //将keepConnected设置为false,退出循环关闭当前连接,中止当前线程
                while (keepConnected && ServerForm.ServerFlag)
                {
                    acceptStr = null;
                    try
                    {
                        //if (currentSocket == null || currentSocket.Available < 1)
                        if (currentClient == null || currentClient.Available < 1)
                        {
                            Thread.Sleep(300);
                            continue;
                        }


                        //接收信息存入buff数组中
                        //int length = currentSocket.Receive(buff);
                        int length = stream.Read(buff, 0, 1024);


                        string Command = Encoding.Default.GetString(buff, 0, length);


                        acceptStr = Command.Split(new char[] { '|' });

                        if (acceptStr == null)
                        {
                            Thread.Sleep(200);
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        server.UpdateMsg("程序发生异常,异常信息:" + ex.Message);
                    }
                    if (acceptStr[0] == "CONNECT")
                    {
                        this.name = acceptStr[1];

                        if (ServerForm.clients.Contains(this.name))
                        {
                            SendToClient(this, "ERORR|User" + this.name + "已经存在");
                        }
                        else
                        {
                            Hashtable synClients = Hashtable.Synchronized(ServerForm.clients);
                            synClients.Add(this.name, this);

                            server.AddUser(this.name);


                            IEnumerator myIEnumerator = ServerForm.clients.Values.GetEnumerator();
                            while (myIEnumerator.MoveNext())
                            {
                                ChatClient cClient = (ChatClient)myIEnumerator.Current;
                                SendToClient(cClient, "JOIN|" + this.name + "|");
                                Thread.Sleep(100);
                            }


                            connState = "connected";
                            SendToClient(this, "OK");


                            string msgUsers = "LIST|" + server.GetUserList();
                            SendToClient(this, msgUsers);
                        }
                    }
                    else if (acceptStr[0] == "LIST")
                    {
                        if (connState == "CONNECTED")
                        {
                            string msgUsers = "LIST|" + server.GetUserList();
                            SendToClient(this, msgUsers);
                        }
                        else
                        {
                            SendToClient(this, "ERROR|服务器未连接,请重新登录");
                        }
                    }
                    else if (acceptStr[0] == "CHAT")
                    {
                        if (connState == "connected")
                        {
                            IEnumerator myEnumerator = ServerForm.clients.Values.GetEnumerator();
                            while (myEnumerator.MoveNext())
                            {
                                ChatClient client = (ChatClient)myEnumerator.Current;

                                SendToClient(client, acceptStr[1]);
                            }
                            server.UpdateMsg(acceptStr[1]);
                        }
                        else
                        {
                            SendToClient(this, "ERROR|服务器未连接,请重新登录");
                        }
                    }
                    else if (acceptStr[0] == "PRIV")
                    {
                        if (connState == "connected")
                        {
                            string sender = acceptStr[1];

                            string receiver = acceptStr[2];

                            string content = acceptStr[3];
                            string message = sender + " ---> " + receiver + ":  " + content;


                            if (ServerForm.clients.Contains(sender))
                            {
                                SendToClient(
                                    (ChatClient)ServerForm.clients[sender], message);
                            }
                            if (ServerForm.clients.Contains(receiver))
                            {
                                SendToClient(
                                    (ChatClient)ServerForm.clients[receiver], message);
                            }
                            server.UpdateMsg(message);
                        }
                        else
                        {
                            SendToClient(this, "ERROR|服务器未连接,请重新登录");
                        }
                    }
                    else if (acceptStr[0] == "EXIT")
                    {
                        if (ServerForm.clients.Contains(acceptStr[1]))
                        {
                            ChatClient client = (ChatClient)ServerForm.clients[acceptStr[1]];


                            Hashtable syncClients = Hashtable.Synchronized(
                                ServerForm.clients);
                            syncClients.Remove(client.name);
                            server.RemoveUser(client.name);


                            string message = "QUIT|" + acceptStr[1];

                            System.Collections.IEnumerator myEnumerator =
                                ServerForm.clients.Values.GetEnumerator();
                            while (myEnumerator.MoveNext())
                            {
                                ChatClient newClient = (ChatClient)myEnumerator.Current;
                                SendToClient(newClient, message);
                            }
                            server.UpdateMsg("QUIT");
                        }


                        break;
                    }
                    Thread.Sleep(200);
                }
            }
Example #24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(CsvColumnCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #25
0
 public Enumerator(GenomeCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #26
0
        /// <summary>
        /// Method main
        ///
        /// </summary>
        /// <param name="args">
        /// </param>
        /// <exception cref="OneWireException"> </exception>
        /// <exception cref="OneWireIOException">
        ///  </exception>

        public static void Main1([ReadOnlyArray()] string[] args)
        {
            bool          usedefault   = false;
            DSPortAdapter access       = null;
            string        adapter_name = null;
            string        port_name    = null;

            if ((args == null) || (args.Length < 1))
            {
                try
                {
                    access = OneWireAccessProvider.DefaultAdapter;

                    if (access == null)
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    Debug.WriteLine("Couldn't get default adapter!");
                    printUsageString();

                    return;
                }

                usedefault = true;
            }

            if (!usedefault)
            {
                //parse device instance

                //string[] st = args[0].Split(new char[] { '_' });

                if (args.Length != 2)
                {
                    printUsageString();

                    return;
                }

                adapter_name = args[0];
                port_name    = args[1];

                Debug.WriteLine("Adapter Name: " + adapter_name);
                Debug.WriteLine("Port Name: " + port_name);
            }

            if (access == null)
            {
                try
                {
                    access = OneWireAccessProvider.getAdapter(adapter_name, port_name);
                }
                catch (Exception)
                {
                    Debug.WriteLine("That is not a valid adapter/port combination.");

                    System.Collections.IEnumerator en = OneWireAccessProvider.enumerateAllAdapters();

                    while (en.MoveNext())
                    {
                        DSPortAdapter temp = (DSPortAdapter)en.Current;

                        Debug.WriteLine("Adapter: " + temp.AdapterName);

                        System.Collections.IEnumerator f = temp.PortNames;

                        while (f.MoveNext())
                        {
                            Debug.WriteLine("   Port name : " + ((DeviceInformation)f.Current).Id);
                        }
                    }

                    return;
                }
            }

            access.adapterDetected();
            access.targetAllFamilies();
            access.beginExclusive(true);
            access.reset();
            access.setSearchAllDevices();

            bool next = access.findFirstDevice();

            if (!next)
            {
                Debug.WriteLine("Could not find any iButtons!");

                return;
            }

            while (next)
            {
                OneWireContainer owc = access.DeviceContainer;

                Debug.WriteLine("====================================================");
                Debug.WriteLine("= Found One Wire Device: " + owc.AddressAsString + "          =");
                Debug.WriteLine("====================================================");
                Debug.WriteLine("=");

                bool isTempContainer    = false;
                TemperatureContainer tc = null;

                try
                {
                    tc = (TemperatureContainer)owc;
                    isTempContainer = true;
                }
                catch (System.InvalidCastException)
                {
                    tc = null;
                    isTempContainer = false; //just to reiterate
                }

                if (isTempContainer)
                {
                    Debug.WriteLine("= This device is a " + owc.Name);
                    Debug.WriteLine("= Also known as a " + owc.AlternateNames);
                    Debug.WriteLine("=");
                    Debug.WriteLine("= It is a Temperature Container");

                    double max       = tc.MaxTemperature;
                    double min       = tc.MinTemperature;
                    bool   hasAlarms = tc.hasTemperatureAlarms();

                    Debug.WriteLine("= This device " + (hasAlarms ? "has" : "does not have") + " alarms");
                    Debug.WriteLine("= Maximum temperature: " + max);
                    Debug.WriteLine("= Minimum temperature: " + min);

                    double high  = 0.0;
                    double low   = 0.0;
                    byte[] state = tc.readDevice();

                    if (hasAlarms)
                    {
                        high = tc.getTemperatureAlarm(TemperatureContainer_Fields.ALARM_HIGH, state);
                        low  = tc.getTemperatureAlarm(TemperatureContainer_Fields.ALARM_LOW, state);

                        Debug.WriteLine("= High temperature alarm set to : " + high);
                        Debug.WriteLine("= Low temperature alarm set to  : " + low);
                    }

                    double resol      = 0.0;
                    bool   selectable = tc.hasSelectableTemperatureResolution();

                    if (hasAlarms)
                    {
                        resol = tc.TemperatureAlarmResolution;

                        Debug.WriteLine("= Temperature alarm resolution  : " + resol);
                    }

                    double   tempres    = tc.getTemperatureResolution(state);
                    double[] resolution = null;

                    Debug.WriteLine("= Temperature resolution        : " + tempres);
                    Debug.WriteLine("= Resolution is selectable      : " + selectable);

                    if (selectable)
                    {
                        try
                        {
                            resolution = tc.TemperatureResolutions;

                            for (int i = 0; i < resolution.Length; i++)
                            {
                                Debug.WriteLine("= Available resolution " + i + "        : " + resolution[i]);
                            }
                        }
                        catch (Exception e)
                        {
                            Debug.WriteLine("= Could not get available resolutions : " + e.ToString());
                        }
                    }

                    if (hasAlarms)
                    {
                        Debug.WriteLine("= Setting high temperature alarm to 28.0 C...");
                        tc.setTemperatureAlarm(TemperatureContainer_Fields.ALARM_HIGH, 28.0, state);
                        Debug.WriteLine("= Setting low temperature alarm to 23.0 C...");
                        tc.setTemperatureAlarm(TemperatureContainer_Fields.ALARM_LOW, 23.0, state);
                    }

                    if (selectable)
                    {
                        try
                        {
                            Debug.WriteLine("= Setting temperature resolution to " + resolution[0] + "...");
                            tc.setTemperatureResolution(resolution[0], state);
                        }
                        catch (Exception e)
                        {
                            Debug.WriteLine("= Could not set resolution: " + e.ToString());
                        }
                    }

                    try
                    {
                        tc.writeDevice(state);
                        Debug.WriteLine("= Device state written.");
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine("= Could not write device state, all changes lost.");
                        Debug.WriteLine("= Exception occurred: " + e.ToString());
                    }

                    Debug.WriteLine("= Doing temperature conversion...");

                    try
                    {
                        tc.doTemperatureConvert(state);
                    }
                    catch (Exception)
                    {
                        Debug.WriteLine("= Could not complete temperature conversion...");
                    }

                    state = tc.readDevice();

                    if (hasAlarms)
                    {
                        high = tc.getTemperatureAlarm(TemperatureContainer_Fields.ALARM_HIGH, state);
                        low  = tc.getTemperatureAlarm(TemperatureContainer_Fields.ALARM_LOW, state);

                        Debug.WriteLine("= High temperature alarm set to : " + high);
                        Debug.WriteLine("= Low temperature alarm set to  : " + low);
                    }

                    double temp = tc.getTemperature(state);

                    Debug.WriteLine("= Reported temperature: " + temp);
                }
                else
                {
                    Debug.WriteLine("= This device is not a temperature device.");
                    Debug.WriteLine("=");
                    Debug.WriteLine("=");
                }

                next = access.findNextDevice();
            }
        }
        public void Exportar_a_Excel(System.Data.DataRow DR)
        {
            checked { ++this.NFilas; }
            this.i = 0;
            int num = 0;

            checked { ++this.PrimerFila; }
            this.NFilas_Ocultas = 0;
            try
            {
                foreach (System.Data.DataColumn column in (System.Data.InternalDataCollectionBase) this.DT.Columns)
                {
                    if (column.ColumnName.ToString().Contains("AgruparTitulo") && Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DR[this.i].ToString().Trim(), "1", false) == 0)
                    {
                        this.Rango = this.nombreColumna(checked (this.i + 1 - this.NFilas_Ocultas)) + checked ((int)this.PrimerFilaRegistros - 1).ToString() + ":" + this.nombreColumna(checked (this.i + 1 - this.NFilas_Ocultas + Conversions.ToInteger(DR[this.i + 1]) - 1)) + checked ((int)this.PrimerFilaRegistros - 1).ToString();
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).Font.ColorIndex = (object)0;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).Font.Bold = (object)true;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).Font.Size = (object)10;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).HorizontalAlignment = (object)XlHAlign.xlHAlignCenter;
                        // ISSUE: reference to a compiler-generated method
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).Merge((object)Missing.Value);
                        // ISSUE: reference to a compiler-generated method
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).set_Value((object)Missing.Value, (object)DR[checked (this.i + 2)].ToString());
                        // ISSUE: reference to a compiler-generated method
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).BorderAround((object)8, XlBorderWeight.xlThin, XlColorIndex.xlColorIndexAutomatic, (object)Missing.Value);
                        column.ColumnName = Strings.Replace(column.ColumnName, "AgruparTitulo", "AgruparYATitulo", 1, -1, CompareMethod.Binary);
                    }
                    if (column.ColumnName.ToString().Contains("EECIIS"))
                    {
                        checked { ++this.NFilas_Ocultas; }
                    }
                    this.Rango = this.nombreColumna(checked (num + 1)) + this.PrimerFila.ToString();
                    // ISSUE: reference to a compiler-generated method
                    // ISSUE: reference to a compiler-generated method
                    if (!column.ColumnName.ToString().Contains("EECIIS") && Information.IsNothing(RuntimeHelpers.GetObjectValue(this.osheet.get_Range((object)this.Rango, (object)Missing.Value).get_Value((object)Missing.Value))))
                    {
                        // ISSUE: reference to a compiler-generated method
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).set_Value((object)Missing.Value, (object)DR[this.i].ToString().Trim());
                    }
                    if (this.i == 0 & (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DR[this.i].ToString(), "1", false) == 0 | Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DR[this.i].ToString(), "2", false) == 0) & column.ColumnName.ToString().Contains("EECIIS"))
                    {
                        // ISSUE: reference to a compiler-generated method
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.Rango, (object)Missing.Value).set_Value((object)Missing.Value, (object)DR[checked (this.i + 1)].ToString());
                    }
                    if (((num >= this.Ncm || Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DR[this.i].ToString(), "1", false) != 0 || this.i != 0 ? 0 : 1) & (column.ColumnName.ToString().Contains("EECIIS") ? 1 : 0)) != 0)
                    {
                        this.RangoCategorias = this.nombreColumna(checked (this.i + 1)) + this.PrimerFila.ToString() + ":" + this.nombreColumna(this.Ncm).ToString() + this.PrimerFila.ToString();
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.ColorIndex = (object)11;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.Bold = (object)true;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.Size = (object)10;
                    }
                    if (((num >= this.Ncm || Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DR[this.i].ToString(), "2", false) != 0 || this.i != 0 ? 0 : 1) & (column.ColumnName.ToString().Contains("EECIIS") ? 1 : 0)) != 0)
                    {
                        this.RangoCategorias = this.nombreColumna(checked (this.i + 1)) + this.PrimerFila.ToString() + ":" + this.nombreColumna(this.Ncm).ToString() + this.PrimerFila.ToString();
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.ColorIndex = (object)30;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.Bold = (object)true;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.Size = (object)10;
                        // ISSUE: reference to a compiler-generated method
                        this.osheet.get_Range((object)this.RangoCategorias, (object)Missing.Value).Font.Italic = (object)true;
                    }
                    if (!column.ColumnName.ToString().Contains("EECIIS"))
                    {
                        checked { ++num; }
                    }
                    checked { ++this.i; }
                }
            }
            finally
            {
                System.Collections.IEnumerator enumerator = null;
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        }
Example #28
0
        /// <summary>
        ///	This is the main execution logic for the ForEach Activity.  The activity and its
        /// child is executed once for each item in the collection.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext context)
        {
            if (context == null)
                throw new ArgumentNullException("activity execution context is null.");

            if (this.Items != null)
            {
                this.Enumerator = this.Items.GetEnumerator();

                // Then, execute the child activity once for each item contained in the Items collection.
                // If the return value is false, we're at the end of the collection, activity is closed,
                // otherwise, activity is executing.
                if (ExecuteNext(context))
                    return ActivityExecutionStatus.Executing;
            }

            return ActivityExecutionStatus.Closed;
        }
Example #29
0
 public Enumerator(AppointmentCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(LoggingRuleCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
        }//main()

        /// <summary>The dictionary text file.</summary>
        /// <param name="directorynameSource">The directory name, source, for example, ..\\ProjectGutenberg.</param>
        /// <param name="fileSearchPattern">The file search pattern, for example. *.txt.</param>
        public static void DictionaryTextFile
        (
            string directorynameSource,
            string fileSearchPattern
        )
        {
            int indexEntryStart    = -1;
            int indexEntryEnd      = -1;
            int indexParagraphPage = -1;
            int indexPoint26       = -1;
            int indexWordEnd       = -1;

            string filenameDictionary = null;
            string dictionaryFile     = null;
            string exceptionMessage   = null;
            string indexEntry         = null;
            string indexWord          = null;

            StringBuilder sbDictionary           = null;
            StringBuilder SQLStatement           = null;
            ArrayList     arrayListDirectoryname = null;
            ArrayList     arrayListFilename      = null;

            System.Collections.IEnumerator enumeratorFilename = null;

            OleDbConnection oleDbConnection = null;

            oleDbConnection = UtilityDatabase.DatabaseConnectionInitialize
                              (
                DatabaseConnectionString,
                ref exceptionMessage
                              );

            UtilityDatabase.DatabaseNonQuery
            (
                oleDbConnection,
                ref exceptionMessage,
                SQLStatementDictionaryTruncate
            );

            UtilityDirectory.Dir
            (
                ref DirectorynameSource,
                ref fileSearchPattern,
                ref arrayListDirectoryname,
                ref arrayListFilename
            );//UtilityDirectory.Dir

            enumeratorFilename = arrayListFilename.GetEnumerator();

            while (enumeratorFilename.MoveNext())
            {
                filenameDictionary = (string)enumeratorFilename.Current;
                System.Console.WriteLine("{0}", filenameDictionary);
                sbDictionary = new StringBuilder();

                try
                {
                    // Create an instance of StreamReader to read from a file.
                    // The using statement also closes the StreamReader.
                    using (StreamReader sr = new StreamReader(filenameDictionary))
                    {
                        String line;
                        // Read and display lines from the file until the end of
                        // the file is reached.
                        while ((line = sr.ReadLine()) != null)
                        {
                            sbDictionary.Append(line);
                            //System.Console.WriteLine(line);
                        } //while ((line = sr.ReadLine()) != null)
                    }     //using (StreamReader sr = new StreamReader("TestFile.txt"))

                    dictionaryFile = sbDictionary.ToString();
                    indexPoint26   = dictionaryFile.IndexOf(ParagraphPoint26);
     #if (DEBUG)
                    System.Console.WriteLine("ParagraphPoint26: {0}", indexPoint26);
     #endif

                    indexEntryStart = dictionaryFile.IndexOf(ParagraphHW, indexPoint26);

                    while (indexEntryStart > 0)
                    {
                        indexEntryEnd = dictionaryFile.IndexOf(ParagraphHW, indexEntryStart + 1);

                        if (indexEntryEnd > 0)
                        {
                            indexEntry = dictionaryFile.Substring(indexEntryStart, indexEntryEnd - indexEntryStart);
                        }
                        else
                        {
                            indexEntry         = dictionaryFile.Substring(indexEntryStart);
                            indexParagraphPage = indexEntry.LastIndexOf(ParagraphPage);
                            if (indexParagraphPage >= 0)
                            {
                                indexEntry = indexEntry.Substring(indexEntry.Length - indexParagraphPage);
                            }
                            break;
                        }//if ( indexEntryEnd <= 0 )

                        indexWordEnd = indexEntry.IndexOf(AnchorEndHW);
                        if (indexWordEnd < 0)
                        {
                            indexEntryStart = indexEntryEnd;
                            continue;
                        }
                        indexWord = indexEntry.Substring(IndexHWWordStart, indexWordEnd - IndexHWWordStart);
                        for (int indexReplace = 0; indexReplace < DictionaryWordReplace.Length; ++indexReplace)
                        {
                            indexWord = indexWord.Replace
                                        (
                                DictionaryWordReplace[indexReplace][0],
                                DictionaryWordReplace[indexReplace][1]
                                        );
                            indexEntry = indexEntry.Replace
                                         (
                                DictionaryWordReplace[indexReplace][0],
                                DictionaryWordReplace[indexReplace][1]
                                         );
                        }

      #if (DEBUG)
                        System.Console.WriteLine
                        (
                            "Index Entry Start: {0} | End: {1} | Word: {2} | Entry: {3}",
                            indexEntryStart,
                            indexEntryEnd,
                            indexWord,
                            indexEntry
                        );
      #endif

                        SQLStatement = new StringBuilder();
                        SQLStatement.AppendFormat
                        (
                            SQLStatementDictionaryInsert,
                            indexWord,
                            indexEntry
                        );

      #if (DEBUG)
                        System.Console.WriteLine("SQL Statement: {0}", SQLStatement.ToString());
      #endif

                        UtilityDatabase.DatabaseNonQuery
                        (
                            oleDbConnection,
                            ref exceptionMessage,
                            SQLStatement.ToString()
                        );

                        indexEntryStart = indexEntryEnd;
                    } //while ( indexEntryStart > 0 )
                }     //try
                catch (Exception e)
                {
                    System.Console.WriteLine(e.Message);
                }
            }//while ( enumeratorFilename.MoveNext() )

            UtilityDatabase.DatabaseConnectionHouseKeeping
            (
                oleDbConnection,
                ref exceptionMessage
            );
        }//DictionaryTextFile()
			/// <summary>
			/// 
			/// </summary>
			/// <param name="collection"></param>
			public Enumerator(SqlConstantCollection collection)
			{
				wrapped = ((System.Collections.CollectionBase) collection).GetEnumerator();
			}
Example #33
0
        static void unzipFileThread()
        {
            //LogManager.GetInstance().LogMessage("unzip begin outpath="+_targetDirectory, LogManager.ModuleFilter.RES);
            _callback(0, 0);
            bool ret = false;

            using (ZipFile zipFile_ = new ZipFile(_inputStream))
            {
                int       totalBytes = (int)zipFile_.unzipSize;
                UnzipCach cach       = new UnzipCach();
                cach.start(totalBytes, _callback);

                INameTransform extractNameTransform_      = new WindowsNameTransform(_tmpDirectory);
                System.Collections.IEnumerator enumerator = zipFile_.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    try
                    {
                        ZipEntry entry = (ZipEntry)enumerator.Current;
                        if (entry.IsFile)
                        {
                            string fileName = extractNameTransform_.TransformFile(entry.Name);
                            string dirName  = Path.GetDirectoryName(Path.GetFullPath(fileName));
                            if (!Directory.Exists(dirName))
                            {
                                Directory.CreateDirectory(dirName);
                            }
                            Stream source = zipFile_.GetInputStream(entry);
                            cach.addFile(fileName, (int)entry.Size, source);
                            source.Close();
                        }
                        else
                        {
                            string dirName = extractNameTransform_.TransformDirectory(entry.Name);
                            if (!Directory.Exists(dirName))
                            {
                                Directory.CreateDirectory(dirName);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        cach.setState(UnzipCach.State.Error);
                        //LogManager.GetInstance().LogException(e.Message, e, LogManager.ModuleFilter.RES);
                    }

                    if (cach.isError())
                    {
                        break;
                    }
                }

                cach.setState(UnzipCach.State.Ok);
                if (cach.stop())
                {
                    try
                    {
                        Directory.Move(_tmpDirectory, _targetDirectory);
                        ret = true;
                    }
                    catch (Exception e)
                    {
                        //LogManager.GetInstance().LogException("unzip rename dir error.", e);
                    }
                }
                _callback(1, ret?0:1);
                //LogManager.GetInstance().LogMessage("unzip end", LogManager.ModuleFilter.RES);
                _inputStream = null;
                _callback    = null;
            }
        }
 public Enumerator(TestTreeNodeCollection collection)
 {
     this.wrapped = collection.List.GetEnumerator();
 }
Example #35
0
 public void StartCoroutineSimple(System.Collections.IEnumerator enumerator)
 {
     m_enumerators.Add(enumerator);
 }
Example #36
0
 public FilterExpressionList()
 {
     alItems = new ArrayList();
     ienum = alItems.GetEnumerator();
 }
Example #37
0
 internal StringEnumerator(StringCollection mappings)
 {
     this.temp           = (IEnumerable)(mappings);
     this.baseEnumerator = temp.GetEnumerator();
 }
		/// <summary> Creates a new iterator for the specified graph. Iteration will start at
		/// the specified start vertex. If the specified start vertex is
		/// <code>null</code>, Iteration will start at an arbitrary graph vertex.
		/// 
		/// </summary>
		/// <param name="g">the graph to be iterated.
		/// </param>
		/// <param name="startVertex">the vertex iteration to be started.
		/// 
		/// </param>
		/// <throws>  NullPointerException </throws>
		/// <throws>  IllegalArgumentException </throws>
		public CrossComponentIterator(Graph g, System.Object startVertex)
		{
			InitBlock();
			
			if (g == null)
			{
				throw new System.NullReferenceException("graph must not be null");
			}
			
			m_specifics = createGraphSpecifics(g);
			m_vertexIterator = g.vertexSet().GetEnumerator();
			setCrossComponentTraversal(startVertex == null);
			
			m_reusableEdgeEvent = new FlyweightEdgeEvent(this, null);
			m_reusableVertexEvent = new FlyweightVertexEvent(this, (System.Object) null);
			
			if (startVertex == null)
			{
				// pick a start vertex if graph not empty 
				//UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
				if (m_vertexIterator.MoveNext())
				{
					//UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
					m_startVertex = ((DictionaryEntry)m_vertexIterator.Current).Value;
				}
				else
				{
					m_startVertex = null;
				}
			}
			else if (g.containsVertex(startVertex))
			{
				m_startVertex = startVertex;
			}
			else
			{
				throw new System.ArgumentException("graph must contain the start vertex");
			}
		}
Example #39
0
 public Enumerator(RssServiceCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #40
0
 internal StringEnumerator(StringCollection mappings) {
     this.temp = (IEnumerable)(mappings);
     this.baseEnumerator = temp.GetEnumerator();
 }
 public Enumerator(TestTreeNodeCollection collection)
 {
     this.wrapped = collection.List.GetEnumerator();
 }
Example #42
0
        private void Create_TargetList_ExecuteCode(object sender, EventArgs e)
        {
            Debug.WriteLine("Create_TargetList");

            klienci = BLL.tabKlienci.Get_AktywniKlienci(workflowProperties.Web);
            Debug.WriteLine("#klienci: " + klienci.Length.ToString());

            myEnum = klienci.GetEnumerator();
        }
Example #43
0
 public NodeAsncFunc(System.Collections.IEnumerator enumerator)
 {
     this.enumerator = enumerator;
 }
Example #44
0
 private void Select_ListaWiadomosci_ExecuteCode(object sender, EventArgs e)
 {
     wiadomosci = BLL.tabWiadomosci.Get_GotoweDoArchiwizacji(workflowProperties.Web);
     myEnum = wiadomosci.GetEnumerator();
 }
Example #45
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(DatabaseParameterInfoCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(MethodCallParameterCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #47
0
 public Coroutine StartCoroutine(System.Collections.IEnumerator routine)
 {
     return(this.system.StartCoroutine(routine));
 }
Example #48
0
 public TaskState(System.Collections.IEnumerator c)
 {
     coroutine = c;
 }
        private System.Collections.IList lazyFindBiconnectedSets()
        {
            if (biconnectedSets_Renamed_Field == null)
            {
                biconnectedSets_Renamed_Field = new System.Collections.ArrayList();

                IList inspector = new ConnectivityInspector(graph).connectedSets();
                System.Collections.IEnumerator connectedSets = inspector.GetEnumerator();

                while (connectedSets.MoveNext())
                {
                    object obj = ((DictionaryEntry)connectedSets.Current).Value;
                    if (!(obj is CSGraphT.SupportClass.HashSetSupport))
                    {
                        continue;
                    }
                    CSGraphT.SupportClass.SetSupport connectedSet = (CSGraphT.SupportClass.SetSupport)obj;
                    if (connectedSet.Count == 1)
                    {
                        continue;
                    }

                    org._3pq.jgrapht.Graph subgraph = new Subgraph(graph, connectedSet, null);

                    // do DFS

                    // Stack for the DFS
                    System.Collections.ArrayList vertexStack = new System.Collections.ArrayList();

                    CSGraphT.SupportClass.SetSupport visitedVertices = new CSGraphT.SupportClass.HashSetSupport();
                    IDictionary parent      = new System.Collections.Hashtable();
                    IList       dfsVertices = new System.Collections.ArrayList();

                    CSGraphT.SupportClass.SetSupport treeEdges = new CSGraphT.SupportClass.HashSetSupport();

                    System.Object currentVertex = subgraph.vertexSet()[0];//.ToArray()[0];

                    vertexStack.Add(currentVertex);
                    visitedVertices.Add(currentVertex);

                    while (!(vertexStack.Count == 0))
                    {
                        currentVertex = SupportClass.StackSupport.Pop(vertexStack);

                        System.Object parentVertex = parent[currentVertex];

                        if (parentVertex != null)
                        {
                            Edge edge = subgraph.getEdge(parentVertex, currentVertex);

                            // tree edge
                            treeEdges.Add(edge);
                        }

                        visitedVertices.Add(currentVertex);

                        dfsVertices.Add(currentVertex);

                        System.Collections.IEnumerator edges = subgraph.edgesOf(currentVertex).GetEnumerator();
                        while (edges.MoveNext())
                        {
                            // find a neighbour vertex of the current vertex
                            Edge edge = (Edge)edges.Current;

                            if (!treeEdges.Contains(edge))
                            {
                                System.Object nextVertex = edge.oppositeVertex(currentVertex);

                                if (!visitedVertices.Contains(nextVertex))
                                {
                                    vertexStack.Add(nextVertex);

                                    parent[nextVertex] = currentVertex;
                                }
                                else
                                {
                                    // non-tree edge
                                }
                            }
                        }
                    }

                    // DFS is finished. Now create the auxiliary graph h
                    // Add all the tree edges as vertices in h
                    SimpleGraph h = new SimpleGraph();

                    h.addAllVertices(treeEdges);

                    visitedVertices.Clear();

                    CSGraphT.SupportClass.SetSupport connected = new CSGraphT.SupportClass.HashSetSupport();

                    for (System.Collections.IEnumerator it = dfsVertices.GetEnumerator(); it.MoveNext();)
                    {
                        System.Object v = it.Current;

                        visitedVertices.Add(v);

                        // find all adjacent non-tree edges
                        for (System.Collections.IEnumerator adjacentEdges = subgraph.edgesOf(v).GetEnumerator(); adjacentEdges.MoveNext();)
                        {
                            Edge l = (Edge)adjacentEdges.Current;
                            if (!treeEdges.Contains(l))
                            {
                                h.addVertex(l);
                                System.Object u = l.oppositeVertex(v);

                                // we need to check if (u,v) is a back-edge
                                if (!visitedVertices.Contains(u))
                                {
                                    while (u != v)
                                    {
                                        System.Object pu = parent[u];
                                        Edge          f  = subgraph.getEdge(u, pu);

                                        h.addEdge(f, l);

                                        if (!connected.Contains(f))
                                        {
                                            connected.Add(f);
                                            u = pu;
                                        }
                                        else
                                        {
                                            u = v;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    ConnectivityInspector connectivityInspector = new ConnectivityInspector(h);

                    biconnectedSets_Renamed_Field.Add(connectivityInspector.connectedSets());
                }
            }

            return(biconnectedSets_Renamed_Field);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(ConditionExpressionCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #51
0
 public Enumerator(ChartBarCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
 public ConstraintEnumerator(DataSet dataSet) {
     tables = (dataSet != null) ? dataSet.Tables.GetEnumerator() : null;
     currentObject = null;
 }
Example #53
0
        /// <summary>
        /// 读取模版中的数据
        /// </summary>
        private void DoMapList()
        {
            try
            {
                Template.InitExcelData();
                Template.InitCustomFormat();
                TemplateData = new List <T>();
                hssfworkbook = new HSSFWorkbook();
                if (UploadFileId == null)
                {
                    ErrorListVM.EntityList.Add(new ErrorMessage {
                        Message = "请上传模板文件"
                    });
                    return;
                }
                var fa = DC.Set <FileAttachment>().Where(x => x.ID == UploadFileId).SingleOrDefault();
                hssfworkbook = FileHelper.GetHSSWorkbook(hssfworkbook, (FileAttachment)fa, ConfigInfo);

                if (ValidityTemplateType && hssfworkbook.GetSheetAt(1).GetRow(0).Cells[2].ToString() != typeof(T).Name)
                {
                    ErrorListVM.EntityList.Add(new ErrorMessage {
                        Message = "错误的模板"
                    });
                    return;
                }
                ISheet sheet = hssfworkbook.GetSheetAt(0);
                System.Collections.IEnumerator rows = sheet.GetRowEnumerator();
                var propetys = Template.GetType().GetFields().Where(x => x.FieldType == typeof(ExcelPropety)).ToList();

                //所有ExcelPropety属性
                List <ExcelPropety> excelPropetys = new List <ExcelPropety>();

                for (int porpetyIndex = 0; porpetyIndex < propetys.Count(); porpetyIndex++)
                {
                    ExcelPropety ep = (ExcelPropety)propetys[porpetyIndex].GetValue(Template);
                    excelPropetys.Add(ep);
                }

                #region 验证模版正确性 add by dufei

                //取得列数
                int columnCount = excelPropetys.Count;
                //int excelPropetyCount = excelPropetys.Count;
                var dynamicColumn = excelPropetys.Where(x => x.DataType == ColumnDataType.Dynamic).FirstOrDefault();
                if (dynamicColumn != null)
                {
                    columnCount = columnCount + dynamicColumn.DynamicColumns.Count - 1;
                    //excelPropetyCount = excelPropetyCount + dynamicColumn.DynamicColumns.Count - 1;
                }

                int pIndex = 0;
                var cells  = sheet.GetRow(0).Cells;
                if (columnCount != cells.Count)
                {
                    ErrorListVM.EntityList.Add(new ErrorMessage {
                        Message = "请下载新模板或上传符合当前功能的模板"
                    });
                    return;
                }
                else
                {
                    bool hassubtable = false;
                    for (int i = 0; i < cells.Count; i++)
                    {
                        if (excelPropetys[pIndex].SubTableType != null)
                        {
                            hassubtable = true;
                        }
                        if (excelPropetys[pIndex].DataType != ColumnDataType.Dynamic)
                        {
                            if (cells[i].ToString().Trim('*') != excelPropetys[pIndex].ColumnName)
                            {
                                ErrorListVM.EntityList.Add(new ErrorMessage {
                                    Message = "请下载新模板或上传符合当前功能的模板"
                                });
                                return;
                            }
                            pIndex++;
                        }
                        else
                        {
                            var listDynamicColumns = excelPropetys[i].DynamicColumns;
                            int dcCount            = listDynamicColumns.Count;
                            for (int dclIndex = 0; dclIndex < dcCount; dclIndex++)
                            {
                                if (cells[i].ToString().Trim('*') != listDynamicColumns[dclIndex].ColumnName)
                                {
                                    ErrorListVM.EntityList.Add(new ErrorMessage {
                                        Message = "请下载新模板或上传符合当前功能的模板"
                                    });
                                    break;
                                }
                                i = i + 1;
                            }
                            i = i - 1;
                            pIndex++;
                        }
                    }

                    //如果有子表,则设置主表字段非必填
                    if (hassubtable == true)
                    {
                        for (int i = 0; i < cells.Count; i++)
                        {
                            if (excelPropetys[i].SubTableType == null)
                            {
                                excelPropetys[i].IsNullAble = true;
                            }
                        }
                    }
                }
                #endregion

                int rowIndex = 2;
                rows.MoveNext();
                while (rows.MoveNext())
                {
                    HSSFRow row = (HSSFRow)rows.Current;
                    if (IsEmptyRow(row, columnCount))
                    {
                        return;
                    }
                    T   result       = new T();
                    int propetyIndex = 0;
                    for (int i = 0; i < columnCount; i++)
                    {
                        ExcelPropety excelPropety = CopyExcelPropety(excelPropetys[propetyIndex]); //excelPropetys[propetyIndex];
                        var          pts          = propetys[propetyIndex];
                        string       value        = row.GetCell(i, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();

                        if (excelPropety.DataType == ColumnDataType.Dynamic)
                        {
                            int dynamicColCount = excelPropety.DynamicColumns.Count();
                            for (int dynamicColIndex = 0; dynamicColIndex < dynamicColCount; dynamicColIndex++)
                            {
                                //验证数据类型并添加错误信息
                                excelPropety.DynamicColumns[dynamicColIndex].ValueValidity(row.GetCell(i + dynamicColIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString(), ErrorListVM.EntityList, rowIndex);
                            }
                            i = i + dynamicColCount - 1;
                        }
                        else
                        {
                            excelPropety.ValueValidity(value, ErrorListVM.EntityList, rowIndex);
                        }

                        if (ErrorListVM.EntityList.Count == 0)
                        {
                            pts.SetValue(result, excelPropety);
                        }
                        propetyIndex++;
                    }
                    result.ExcelIndex = rowIndex;
                    TemplateData.Add(result);
                    rowIndex++;
                }
                return;
            }
            catch
            {
                ErrorListVM.EntityList.Add(new ErrorMessage {
                    Message = "请下载新模板或上传符合当前功能的模板"
                });
                //ErrorListVM.ErrorList.Add(new ErrorMessage { Message = ex.Message });
            }
            return;
        }
Example #54
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(FilteringRuleCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
			public Enumerator(SubButtonItemCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}
Example #56
0
 public Enumerator(StringCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Example #57
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strFileName"></param>
        /// <param name="SheetName"></param>
        /// <returns></returns>
        public static DataTable ImportBySheetName(string strFileName, string SheetName)
        {
            int _r = 0;
            int _c = 0;

            try
            {
                DataTable dt = new DataTable();

                //HSSFWorkbook hssfworkbook;
                IWorkbook workbook;
                ISheet    sheet;
                using (FileStream file = new FileStream(strFileName, FileMode.Open, FileAccess.Read))
                {
                    //hssfworkbook = new HSSFWorkbook(file);
                    workbook = WorkbookFactory.Create(file);//使用接口,自动识别excel2003/2007格式
                }
                //using (FileStream stream = new FileStream(@strFileName, FileMode.Open, FileAccess.Read))
                //{
                //    IWorkbook workbook = WorkbookFactory.Create(stream);//使用接口,自动识别excel2003/2007格式
                //    //for (int k = 0; k < 14; k++)
                //    //{
                //    ISheet sheet = workbook.GetSheetAt(0);//得到里面第一个sheet
                //}

                //NPOI.SS.UserModel.ISheet sheet = hssfworkbook.GetSheetAt(0);
                sheet = workbook.GetSheet(SheetName);//得到里面sheet

                //HSSFSheet sheet = hssfworkbook.GetSheetAt(0);
                System.Collections.IEnumerator rows = sheet.GetRowEnumerator();



                NPOI.SS.UserModel.IRow headerRow  = sheet.GetRow(0);
                NPOI.SS.UserModel.IRow headerRow1 = sheet.GetRow(1);

                int cellCount  = headerRow.LastCellNum;
                int cellCount1 = headerRow1.LastCellNum;
                if (cellCount1 > cellCount)
                {
                    cellCount = cellCount1;
                }

                for (int j = 0; j < cellCount; j++)
                {
                    //NPOI.SS.UserModel.ICell cell = headerRow.GetCell(j);
                    //dt.Columns.Add(cell.ToString());
                    dt.Columns.Add("F" + (j + 1));
                }
                int row1 = sheet.PhysicalNumberOfRows;
                int row2 = sheet.LastRowNum;
                int ROW  = row2 + 1;
                if (row1 > row2)
                {
                    ROW = row1;
                }
                for (int i = (sheet.FirstRowNum); i < ROW; i++)
                {
                    NPOI.SS.UserModel.IRow row = sheet.GetRow(i);
                    DataRow dataRow            = dt.NewRow();
                    if (row != null)
                    {
                        for (int j = row.FirstCellNum; j < cellCount; j++)
                        {
                            _r = i;
                            _c = j;
                            if (row.GetCell(j) != null)
                            {
                                //dataRow[j] = row.GetCell(j).ToString();
                                dataRow[j] = GetCellData(row, j);//主要读取格式或公式
                            }
                        }

                        dt.Rows.Add(dataRow);
                    }
                }
                return(dt);
            }
            catch (Exception ee)
            {
                return(null);
            }
        }
			/// <summary>
			/// 
			/// </summary>
			/// <param name="collection"></param>
			public Enumerator(AbsoluteTopicNameCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}
Example #59
0
        protected static string GetComparisonStatement(StandardProviderParameters std, tgDynamicQuerySerializable query, List <tgComparison> items, string prefix)
        {
            string sql   = String.Empty;
            string comma = String.Empty;

            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            //=======================================
            // WHERE
            //=======================================
            if (items != null)
            {
                sql += prefix;

                string compareTo = String.Empty;
                foreach (tgComparison comparisonItem in items)
                {
                    tgComparison.tgComparisonData comparisonData = (tgComparison.tgComparisonData)comparisonItem;
                    tgDynamicQuerySerializable    subQuery       = null;

                    bool requiresParam        = true;
                    bool needsStringParameter = false;
                    std.needsIntegerParameter = false;

                    if (comparisonData.IsParenthesis)
                    {
                        if (comparisonData.Parenthesis == tgParenthesis.Open)
                        {
                            sql += "(";
                        }
                        else
                        {
                            sql += ")";
                        }

                        continue;
                    }

                    if (comparisonData.IsConjunction)
                    {
                        switch (comparisonData.Conjunction)
                        {
                        case tgConjunction.And: sql += " AND "; break;

                        case tgConjunction.Or: sql += " OR "; break;

                        case tgConjunction.AndNot: sql += " AND NOT "; break;

                        case tgConjunction.OrNot: sql += " OR NOT "; break;
                        }
                        continue;
                    }

                    Dictionary <string, SAParameter> types = null;
                    if (comparisonData.Column.Query != null)
                    {
                        IDynamicQuerySerializableInternal iLocalQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                        types = Cache.GetParameters(iLocalQuery.DataID, (tgProviderSpecificMetadata)iLocalQuery.ProviderMetadata, (tgColumnMetadataCollection)iLocalQuery.Columns);
                    }

                    if (comparisonData.IsLiteral)
                    {
                        if (comparisonData.Column.Name[0] == '<')
                        {
                            sql += comparisonData.Column.Name.Substring(1, comparisonData.Column.Name.Length - 2);
                        }
                        else
                        {
                            sql += comparisonData.Column.Name;
                        }
                        continue;
                    }

                    if (comparisonData.ComparisonColumn.Name == null)
                    {
                        subQuery = comparisonData.Value as tgDynamicQuerySerializable;

                        if (subQuery == null)
                        {
                            if (comparisonData.Column.Name != null)
                            {
                                IDynamicQuerySerializableInternal iColQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                                tgColumnMetadataCollection        columns   = (tgColumnMetadataCollection)iColQuery.Columns;
                                compareTo = Delimiters.Param + columns[comparisonData.Column.Name].PropertyName + (++std.pindex).ToString();
                            }
                            else
                            {
                                compareTo = Delimiters.Param + "Expr" + (++std.pindex).ToString();
                            }
                        }
                        else
                        {
                            // It's a sub query
                            compareTo     = GetSubquerySearchCondition(subQuery) + " (" + BuildQuery(std, subQuery) + ") ";
                            requiresParam = false;
                        }
                    }
                    else
                    {
                        compareTo     = GetColumnName(comparisonData.ComparisonColumn);
                        requiresParam = false;
                    }

                    switch (comparisonData.Operand)
                    {
                    case tgComparisonOperand.Exists:
                        sql += " EXISTS" + compareTo;
                        break;

                    case tgComparisonOperand.NotExists:
                        sql += " NOT EXISTS" + compareTo;
                        break;

                    //-----------------------------------------------------------
                    // Comparison operators, left side vs right side
                    //-----------------------------------------------------------
                    case tgComparisonOperand.Equal:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " = " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " = " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.NotEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " <> " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " <> " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.GreaterThan:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " > " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " > " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.LessThan:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " < " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " < " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.LessThanOrEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " <= " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " <= " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.GreaterThanOrEqual:
                        if (comparisonData.ItemFirst)
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " >= " + compareTo;
                        }
                        else
                        {
                            sql += compareTo + " >= " + ApplyWhereSubOperations(std, query, comparisonData);
                        }
                        break;

                    case tgComparisonOperand.Like:
                        string esc = comparisonData.LikeEscape.ToString();
                        if (String.IsNullOrEmpty(esc) || esc == "\0")
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " LIKE " + compareTo;
                            needsStringParameter = true;
                        }
                        else
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " LIKE " + compareTo;
                            sql += " ESCAPE '" + esc + "'";
                            needsStringParameter = true;
                        }
                        break;

                    case tgComparisonOperand.NotLike:
                        esc = comparisonData.LikeEscape.ToString();
                        if (String.IsNullOrEmpty(esc) || esc == "\0")
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT LIKE " + compareTo;
                            needsStringParameter = true;
                        }
                        else
                        {
                            sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT LIKE " + compareTo;
                            sql += " ESCAPE '" + esc + "'";
                            needsStringParameter = true;
                        }
                        break;

                    case tgComparisonOperand.Contains:
                        sql += " CONTAINS(" + GetColumnName(comparisonData.Column) + ", '" + comparisonData.Value + "')";     // + compareTo + ")";
                        //needsStringParameter = true;
                        requiresParam = false;
                        break;

                    case tgComparisonOperand.IsNull:
                        sql          += ApplyWhereSubOperations(std, query, comparisonData) + " IS NULL";
                        requiresParam = false;
                        break;

                    case tgComparisonOperand.IsNotNull:
                        sql          += ApplyWhereSubOperations(std, query, comparisonData) + " IS NOT NULL";
                        requiresParam = false;
                        break;

                    case tgComparisonOperand.In:
                    case tgComparisonOperand.NotIn:
                    {
                        if (subQuery != null)
                        {
                            // They used a subquery for In or Not
                            sql += ApplyWhereSubOperations(std, query, comparisonData);
                            sql += (comparisonData.Operand == tgComparisonOperand.In) ? " IN" : " NOT IN";
                            sql += compareTo;
                        }
                        else
                        {
                            comma = String.Empty;
                            if (comparisonData.Operand == tgComparisonOperand.In)
                            {
                                sql += ApplyWhereSubOperations(std, query, comparisonData) + " IN (";
                            }
                            else
                            {
                                sql += ApplyWhereSubOperations(std, query, comparisonData) + " NOT IN (";
                            }

                            foreach (object oin in comparisonData.Values)
                            {
                                string str = oin as string;
                                if (str != null)
                                {
                                    // STRING
                                    sql  += comma + Delimiters.StringOpen + str + Delimiters.StringClose;
                                    comma = ",";
                                }
                                else if (null != oin as System.Collections.IEnumerable)
                                {
                                    // LIST OR COLLECTION OF SOME SORT
                                    System.Collections.IEnumerable enumer = oin as System.Collections.IEnumerable;
                                    if (enumer != null)
                                    {
                                        System.Collections.IEnumerator iter = enumer.GetEnumerator();

                                        while (iter.MoveNext())
                                        {
                                            object o = iter.Current;

                                            string soin = o as string;

                                            if (soin != null)
                                            {
                                                sql += comma + Delimiters.StringOpen + soin + Delimiters.StringClose;
                                            }
                                            else
                                            {
                                                sql += comma + Convert.ToString(o);
                                            }

                                            comma = ",";
                                        }
                                    }
                                }
                                else
                                {
                                    // NON STRING OR LIST
                                    sql  += comma + Convert.ToString(oin);
                                    comma = ",";
                                }
                            }
                            sql          += ")";
                            requiresParam = false;
                        }
                    }
                    break;

                    case tgComparisonOperand.Between:

                        SACommand sqlCommand = std.cmd as SACommand;

                        sql += ApplyWhereSubOperations(std, query, comparisonData) + " BETWEEN ";
                        sql += compareTo;
                        if (comparisonData.ComparisonColumn.Name == null)
                        {
                            sqlCommand.Parameters.AddWithValue(compareTo, comparisonData.BetweenBegin);
                        }

                        if (comparisonData.ComparisonColumn2.Name == null)
                        {
                            IDynamicQuerySerializableInternal iColQuery = comparisonData.Column.Query as IDynamicQuerySerializableInternal;
                            tgColumnMetadataCollection        columns   = (tgColumnMetadataCollection)iColQuery.Columns;
                            compareTo = Delimiters.Param + columns[comparisonData.Column.Name].PropertyName + (++std.pindex).ToString();

                            sql += " AND " + compareTo;
                            sqlCommand.Parameters.AddWithValue(compareTo, comparisonData.BetweenEnd);
                        }
                        else
                        {
                            sql += " AND " + Delimiters.ColumnOpen + comparisonData.ComparisonColumn2 + Delimiters.ColumnClose;
                        }

                        requiresParam = false;
                        break;
                    }

                    if (requiresParam)
                    {
                        SAParameter p;

                        if (comparisonData.Column.Name != null)
                        {
                            p = types[comparisonData.Column.Name];

                            p       = Cache.CloneParameter(p);
                            p.Value = comparisonData.Value;
                            if (needsStringParameter)
                            {
                                p.DbType = DbType.String;
                            }
                            else if (std.needsIntegerParameter)
                            {
                                p.DbType = DbType.Int32;
                            }
                        }
                        else
                        {
                            p = new SAParameter(compareTo, comparisonData.Value);
                        }

                        std.cmd.Parameters.Add(p);
                    }
                }
            }

            return(sql);
        }
 internal X509Certificate2Enumerator(X509Certificate2Collection mappings) {
     this.baseEnumerator = ((IEnumerable) mappings).GetEnumerator();
 }