예제 #1
0
        /*
         */
        IDataReadble IDataReadble.Read(IDataReader reader)
        {
            Route x = new Route();
            int   i = 0;

            string DepartureIdentity = ReaderHelper.GetString(reader, i++);

            x.VehicleIdentity = ReaderHelper.GetString(reader, i++);
            Nullable <DateTime> dtm = ReaderHelper.GetDateTime(reader, i++);

            if (dtm != null)
            {
                x.EstimatedTimeOfDeparture = (DateTime)dtm;
            }
            else
            {
                x.EstimatedTimeOfDeparture = DateTime.MinValue;
            }
            x.RouteIdentity = ReaderHelper.GetString(reader, i++);
            x.Name          = ReaderHelper.GetString(reader, i++);
            x.TotalUnloadingTimeInSeconds = ReaderHelper.GetInt32(reader, i++);
            x.TotalDrivingTimeInSeconds   = ReaderHelper.GetInt32(reader, i++);
            x.TotalTimeInSeconds          = ReaderHelper.GetInt32(reader, i++);
            x.TotalDistance = (double?)ReaderHelper.GetDecimal(reader, i++);

            return(x);
        }
예제 #2
0
        public int w02()
        {
            ManagedNodeWriter mn = new ManagedNodeWriter();

            mn.PutPattern("XEA");
            mn.PutAttribute("xml:space", "preserve");
            mn.PutPattern("/PWPWE/WCCCCPPPee");

            CError.WriteLineIgnore(mn.GetNodes());
            XmlReaderSettings rs     = new XmlReaderSettings();
            XmlReader         reader = null;

            rs.IgnoreWhitespace = true;

            reader = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);
            CheckIgnores(reader, true, false, false);
            if (_wsCount != 3)
            {
                CError.WriteLineIgnore("Ws = " + _wsCount);
                return(TEST_FAIL);
            }

            rs.IgnoreWhitespace = false;
            reader = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);
            CheckIgnores(reader, false, false, false);
            if (_wsCount != 3)
            {
                CError.WriteLineIgnore("Ws = " + _wsCount);
                return(TEST_FAIL);
            }

            return(TEST_PASS);
        }
예제 #3
0
        //[Variation("Default Reader, Check Characters On and pass invalid characters", Pri = 0, Params = new object[]{"CoreValidatingReader"})]
        //[Variation("Default Reader, Check Characters On and pass invalid characters", Pri = 0, Params = new object[]{"CoreReader"})]
        public int v2()
        {
            string readerType      = (string)this.CurVariation.Params[0];
            bool   exceptionThrown = false;
            string invalidCharXml  = GetSimpleInvalidXml();

            XmlReaderSettings rs = new XmlReaderSettings();

            rs.CheckCharacters = true;

            XmlReader reader = ReaderHelper.CreateReader(readerType, new StringReader(invalidCharXml), false, null, rs);

            try
            {
                while (reader.Read())
                {
                    ;
                }
            }
            catch (XmlException xe)
            {
                CError.WriteLine(xe.Message);
                exceptionThrown = true;
            }

            reader.Dispose();

            if (!exceptionThrown)
            {
                return(TEST_FAIL);
            }

            return(TEST_PASS);
        }
예제 #4
0
        public string GetCommentById(string type, int id)
        {
            Comment result;
            var     table = ReaderHelper.GetCommentsTable(type);

            if (table == "")
            {
                return("");
            }

            using (var _connection = new SqlConnection(Global.WaifString))
            {
                _connection.Open();
                using (var cmd = new SqlCommand("SELECT * FROM " + table + " WHERE Id=@Id", _connection))
                {
                    cmd.Parameters.AddWithValue("Id", id);
                    using (var rd = cmd.ExecuteReader())
                    {
                        if (rd.Read())
                        {
                            result = new Comment(rd);
                        }
                        else
                        {
                            return("");
                        }
                    }
                }
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
예제 #5
0
        public int w03()
        {
            ManagedNodeWriter mn = new ManagedNodeWriter();

            mn.PutPattern("WXEAA/M");
            CError.WriteLineIgnore(mn.GetNodes());
            XmlReaderSettings rs     = new XmlReaderSettings();
            XmlReader         reader = null;

            rs.IgnoreComments = true;
            reader            = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);
            bool thrown = false;

            try
            {
                CheckIgnores(reader, true, false, false);
            }
            catch (XmlException xe)
            {
                CError.WriteLineIgnore(xe.Message);
                thrown = true;
            }

            if (!thrown)
            {
                return(TEST_FAIL);
            }

            return(TEST_PASS);
        }
예제 #6
0
        public IMenuSection CreateSection(string sectionName)
        {
            IMenuSection menuSection;

            if (sectionName.Contains("5022"))
            {
                menuSection = new OK5022MenuSection(sectionName, ReaderHelper.GetSerialNumber(sectionName));
            }
            else if (sectionName.Contains("5023"))
            {
                menuSection = new OK5023MenuSection(sectionName, ReaderHelper.GetSerialNumber(sectionName));
            }
            else if (sectionName.Contains("5122"))
            {
                menuSection = new Ok5122MenuSection(sectionName, ReaderHelper.GetSerialNumber(sectionName));
            }
            else if (sectionName.Contains("5422"))
            {
                menuSection = new Ok5422MenuSection(sectionName, ReaderHelper.GetSerialNumber(sectionName));
            }
            else
            {
                menuSection = null;
            }
            return(menuSection);
        }
예제 #7
0
        public CustomReader(Stream stream)
        {
            XmlReaderSettings rs = new XmlReaderSettings();

            rs.DtdProcessing = DtdProcessing.Ignore;
            _tr = ReaderHelper.Create(stream, rs, (string)null);
        }
예제 #8
0
        public void Run(string readerName)
        {
            var reader = new SmartCardReader(readerName);

            try
            {
                ConsoleWriter.Instance.PrintSplitter();
                ConsoleWriter.Instance.PrintTask($"Connecting to {reader.PcscReaderName}");

                ReaderHelper.ConnectToReaderWithCard(reader);

                ConsoleWriter.Instance.PrintMessage($"Connected\nConnection Mode: {reader.ConnectionMode}");

                ReaderHelper.GetDataCommand(reader, "Get Historical Bytes", GetDataCommand.Type.Specific);

                ConsoleWriter.Instance.PrintSplitter();
            }
            catch (Exception e)
            {
                ConsoleWriter.Instance.PrintError(e.Message);
            }
            finally
            {
                if (reader.IsConnected)
                {
                    reader.Disconnect(CardDisposition.Unpower);
                    ConsoleWriter.Instance.PrintMessage("Reader connection closed");
                }
                ConsoleWriter.Instance.PrintSplitter();
            }
        }
예제 #9
0
        public CustomReader(string filename)
        {
            XmlReaderSettings rs = new XmlReaderSettings();

            rs.DtdProcessing = DtdProcessing.Ignore;
            _tr = ReaderHelper.Create(filename, rs);
        }
        public void LoadUserControl(ShadowBaseDisplayView view)
        {
            //Init Control
            var companys     = iCompanyService.GetPagerCompany("", 1, 100);
            var products     = iProductBaseService.GetPagerProductBase("", 1, 100);
            var productTypes = iProductTypeService.GetPagerProductType("", 1, 100);
            var productSpecs = iProductSpecService.GetPagerProductSpec("", 1, 100);

            view.cbCompany.ItemsSource       = companys;
            view.cbCompany.SelectedIndex     = -1;
            view.cbProduct.ItemsSource       = products;
            view.cbProduct.SelectedIndex     = -1;
            view.cbProductType.ItemsSource   = productTypes;
            view.cbProductType.SelectedIndex = -1;

            ViewSelf = view;


            ReaderHelper reader = new ReaderHelper();

            var list = reader.GetPortList();

            view.cbPort.ItemsSource       = list;
            view.cbPort.DisplayMemberPath = "PortId";
            view.cbPort.SelectedValuePath = "PortName";
        }
            public void Run(string readerName)
            {
                var reader = new SmartCardReader(readerName);

                try
                {
                    ConsoleWriter.Instance.PrintSplitter();
                    ConsoleWriter.Instance.PrintTask($"Connecting to {reader.PcscReaderName}");

                    ReaderHelper.ConnectToReaderWithCard(reader);

                    ConsoleWriter.Instance.PrintMessage($"Connected\nConnection Mode: {reader.ConnectionMode}");

                    ReaderHelper.ConnectToReaderWithCard(reader);

                    SendUpdateBinaryCommand(reader, UpdateBinaryCommand.Type.Plain, 0x00, "ABCDEF01");

                    ConsoleWriter.Instance.PrintSplitter();
                }
                catch (Exception e)
                {
                    ConsoleWriter.Instance.PrintError(e.Message);
                }
                finally
                {
                    if (reader.IsConnected)
                    {
                        reader.Disconnect(CardDisposition.Unpower);
                        ConsoleWriter.Instance.PrintMessage("Reader connection closed");
                    }
                    ConsoleWriter.Instance.PrintSplitter();
                }
            }
예제 #12
0
            public static bool Create(Stream input)
            {
                XmlReader reader = null;

                try
                {
                    reader = ReaderHelper.Create(input);
                    while (reader.Read())
                    {
                        ;
                    }
                    return(true);
                }
                catch (ArgumentNullException ane)
                {
                    CError.WriteLineIgnore(ane.ToString());
                    return(false);
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                }
            }
예제 #13
0
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A />"})]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A>truck</A>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root><!--\uD812\uDD12--></Root>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root>&#x58341;<Elem>&#xCFE44;</Elem>&#x18022;</Root>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<X>t0<A>truck</A>t00</X>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<a:A xmlns:a='a'><C xmlns:p='nsc' /><B /></a:A>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A xmlns:p='nsc'><p:C xmlns:a='a'><a:S /></p:C><B /></A>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A xmlns='ns0'><![CDATA[tralala]]></A>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A xmlns='ns0'><![CDATA[ja_a_hele]]><?PI?><X />text<Y /></A>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<A attr='1' a2='a2' a3='a3' xmlns='def' xmlns:p='ns' p:a3='pa3' />" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<!DOCTYPE doc [  <!ELEMENT doc ANY>  <!ENTITY book 'a&a'>]><doc>&book;</doc>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<!DOCTYPE doc [  <!ELEMENT doc ANY>  <!ENTITY book 'a%a'>]><doc>&book;</doc>  " })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<?xml version='1.0'?><!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT a ANY> <!ELEMENT b ANY> <!ELEMENT c ANY> <!ENTITY a '<a>&a;</a>'>]><test>&a;</test>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<!DOCTYPE ROOT [<!ENTITY a '&a;'>]><ROOT att='&a;'/>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<!DOCTYPE root [<!ELEMENT root ANY><!ENTITY e '\uD812\uDD12'>]><root>&e;</root>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<!DOCTYPE root[<!ENTITY x 'somevalue'><!ELEMENT root ANY>]><root>value&amp;x;</root>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<root>va&lt;/root&gt;lue</root>" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root a='&amp;' b='&amp;#65;' c='&amp;#x43;' />" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root a='b&quot;c' />" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root a='                                      &#x9;&#xD;&#xA;' />" })]
        //[Variation(Pri = 2, Desc = "MaxEnt = 1, MaxDoc = length - 1", Params = new object[] { "<Root foo='&amp; &lt; &gt; &quot; &apos; &#65;'/>" })]
        public int v20()
        {
            string xml = CurVariation.Params[0] as string;
            int    val = xml.Length - 1;

            XmlReaderSettings rs = new XmlReaderSettings();

            rs.MaxCharactersFromEntities = 1;
            rs.MaxCharactersInDocument   = val;
            try
            {
                XmlReader reader = ReaderHelper.Create(new StringReader(xml), rs);
                if (AsyncUtil.IsAsyncEnabled)
                {
                    reader.Read();
                }
            }
            catch (XmlException)
            {
                CError.Compare((int)rs.MaxCharactersFromEntities, 1, "Error");
                CError.Compare((int)rs.MaxCharactersInDocument, val, "Error");
                return(TEST_PASS);
            }
            return(TEST_FAIL);
        }
예제 #14
0
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "<!DOCTYPE ROOT [<!ENTITY a '&a;'>]><ROOT att='&a;'/>" })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "<?xml version='1.0'?><!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT a ANY> <!ELEMENT b ANY> <!ELEMENT c ANY> <!ENTITY a '<a>&a;</a>'>]><test>&a;</test>" })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "" })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "<?xml version='1.0'?><!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT a ANY> <!ELEMENT b ANY> <!ELEMENT c ANY> <!ENTITY a '<a>&amp;</a>'>]><test>&a;<test>" })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "<q = 'a'/>" })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { string.Format("<!-- http://www.w3.org is bound to n1 and n2 -->{0}<x xmlns:n1=\"http://www.w3.org\"{0}   xmlns:n2=\"http://www.w3.org\" >{0}   <bad n1:a=\"1\"  n2:a=\"2\" /></x>", Environment.NewLine) })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = bigVal, MaxDoc = bigVal", Params = new object[] { "<root><!--comment \uD812><!--comment \uD812>-->--></root>" })]
        public int v260()
        {
            string xml = CurVariation.Params[0] as string;

            XmlReaderSettings rs = new XmlReaderSettings();

            rs.DtdProcessing             = DtdProcessing.Ignore;
            rs.MaxCharactersFromEntities = _bigVal;
            rs.MaxCharactersInDocument   = _bigVal;
            using (XmlReader reader = ReaderHelper.Create(new StringReader(xml), rs))
            {
                try
                {
                    while (reader.Read())
                    {
                        ;
                    }
                }
                catch (XmlException)
                {
                    CError.Compare(reader.Settings.MaxCharactersFromEntities, _bigVal, "Error");
                    CError.Compare(reader.Settings.MaxCharactersInDocument, _bigVal, "Error");
                    return(TEST_PASS);
                }
            }
            return(TEST_FAIL);
        }
예제 #15
0
        public int w01()
        {
            ManagedNodeWriter mn = new ManagedNodeWriter();

            mn.PutPattern("XWEAWA/PWWPWWE/WWCCCCPPPee");
            CError.WriteLineIgnore(mn.GetNodes());
            XmlReaderSettings rs     = new XmlReaderSettings();
            XmlReader         reader = null;

            rs.IgnoreWhitespace = true;
            reader = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);
            if (!CheckIgnores(reader, false, false, true))
            {
                return(TEST_FAIL);
            }

            rs.IgnoreWhitespace = false;
            reader = ReaderHelper.Create(new StringReader(mn.GetNodes()), rs, (string)null);
            if (!CheckIgnores(reader, false, false, false))
            {
                return(TEST_FAIL);
            }

            return(TEST_PASS);
        }
예제 #16
0
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { "<!DOCTYPE ROOT [<!ENTITY a '&a;'>]><ROOT att='&a;'/>", 10 })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { "<?xml version='1.0'?><!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT a ANY> <!ELEMENT b ANY> <!ELEMENT c ANY> <!ENTITY a '<a>&a;</a>'>]><test>&a;</test>", 25 })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { "<?xml version='1.0'?><!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT a ANY> <!ELEMENT b ANY> <!ELEMENT c ANY> <!ENTITY a '<a>&amp;</a>'>]><test>&a;<test>", 26 })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { "<q = 'a'/>", 5 })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { string.Format("<!-- http://www.w3.org is bound to n1 and n2 -->{0}<x xmlns:n1=\"http://www.w3.org\"{0}   xmlns:n2=\"http://www.w3.org\" >{0}   <bad n1:a=\"1\"  n2:a=\"2\" /></x>", Environment.NewLine), 35 })]
        //[Variation(Pri = 2, Desc = "nwf xml: MaxEnt = 1, MaxDoc = val", Params = new object[] { "<root><!--comment \uD812><!--comment \uD812>-->--></root>", 18 })]
        public int v270()
        {
            string xml = CurVariation.Params[0] as string;
            int    val = (int)CurVariation.Params[1];

            XmlReaderSettings rs = new XmlReaderSettings();

            rs.MaxCharactersFromEntities = 1;
            rs.MaxCharactersInDocument   = val;
            try
            {
                using (XmlReader reader = ReaderHelper.Create(new StringReader(xml), rs))
                {
                    while (reader.Read())
                    {
                        ;
                    }
                }
            }
            catch (XmlException)
            {
                CError.Compare((int)rs.MaxCharactersFromEntities, 1, "Error");
                CError.Compare((int)rs.MaxCharactersInDocument, val, "Error");
                return(TEST_PASS);
            }
            return(TEST_FAIL);
        }
            public void Run(string readerName)
            {
                using (var reader = new SmartCardReader(readerName))
                {
                    try
                    {
                        ConsoleWriter.Instance.PrintSplitter();
                        ConsoleWriter.Instance.PrintTask($"Connecting to {reader.PcscReaderName}");

                        ReaderHelper.ConnectToReader(reader);

                        ConsoleWriter.Instance.PrintMessage($"Connected\nConnection Mode: {reader.ConnectionMode}");

                        ExecuteExample(reader);

                        ConsoleWriter.Instance.PrintSplitter();
                    }
                    catch (Exception e)
                    {
                        ConsoleWriter.Instance.PrintError(e.Message);
                    }
                    finally
                    {
                        if (reader.IsConnected)
                        {
                            reader.Disconnect(CardDisposition.Unpower);
                            ConsoleWriter.Instance.PrintMessage("Reader connection closed");
                        }
                        ConsoleWriter.Instance.PrintSplitter();
                    }
                }
            }
예제 #18
0
        private void PopulateChapters()
        {
            cmboChapter.Items.Clear();
            foreach (Chapter chapter in ReaderHelper.SortChapters(title.GetChapters()))
            {
                cmboChapter.Items.Add(chapter.GetNum());
                if (chapter.GetNum().Equals(title.GetCurrentChapter()))
                {
                    currentChapter = chapter;
                }
            }

            if (currentChapter == null)
            {
                currentChapter = ReaderHelper.SortChapters(title.GetChapters())[0];
            }

            try
            {
                cmboChapter.SelectedIndex = cmboChapter.Items.IndexOf(currentChapter.GetNum());
            } catch (Exception)
            {
                MessageBox.Show("An error occured while selecting the current chapter");
                cmboChapter.SelectedIndex = 0;
            }
        }
예제 #19
0
        public void AddChipCode(DataGrid dg)
        {
            var result = MessageBox.Show("是否添加芯片吗", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                ReaderHelper reader   = new ReaderHelper();
                var          portName = portComboBox.Text;
                var          code     = reader.Read(portName);
                var          chip     = iTidService.GetTidByChipCode(code);

                if (chip.IsUse)
                {
                    MessageBox.Show("该芯片已经使用");
                    return;
                }
                var model = (ShadowBaseModel)dg.SelectedItem;

                model.ChipCode = code;
                var message = iShadowBaseService.UpdateSingleShadowBase(model);

                chip.IsUse = true;
                iTidService.UpdateSingleTid(chip);
                if (message.Status == MessageStatus.Success)
                {
                    LoadData(string.Empty);
                }
            }
        }
예제 #20
0
        public int v3()
        {
            string            xml = "<a/>";
            XmlReaderSettings rs  = new XmlReaderSettings();

            try
            {
                rs.MaxCharactersFromEntities = -1;
                return(TEST_FAIL);
            }
            catch (ArgumentOutOfRangeException) { }
            try
            {
                rs.MaxCharactersInDocument = -1;
                return(TEST_FAIL);
            }
            catch (ArgumentOutOfRangeException) { }
            CError.Compare(rs.MaxCharactersFromEntities, _defaultCharsEnt, "Error");
            CError.Compare(rs.MaxCharactersInDocument, _defaultCharsDoc, "Error");

            rs.MaxCharactersFromEntities = 10;
            rs.MaxCharactersInDocument   = 10;
            using (XmlReader r = ReaderHelper.Create(new StringReader(xml), rs))
            {
                while (r.Read())
                {
                    ;
                }
                CError.Compare((int)r.Settings.MaxCharactersFromEntities, 10, "Error");
                CError.Compare((int)r.Settings.MaxCharactersInDocument, 10, "Error");
            }
            return(TEST_PASS);
        }
예제 #21
0
            public static bool Create(String url, XmlReaderSettings settings, XmlParserContext context)
            {
                XmlReader reader = null;

                try
                {
                    reader = ReaderHelper.Create(url, settings, context);
                    while (reader.Read())
                    {
                        ;
                    }
                    return(true);
                }
                catch (ArgumentNullException ane)
                {
                    CError.WriteLineIgnore(ane.ToString());
                    return(false);
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                }
            }
        public orderSearchResult getOpenOrders(ISyncWSParameter dataParam,
                                               System.Nullable <orderType> ot,
                                               string clientId,
                                               string orderNo,
                                               string yourCono,
                                               System.Nullable <System.DateTime> from,
                                               System.Nullable <System.DateTime> to,
                                               string mark,
                                               string ordersFromHistory,
                                               string ordersFromProduction)
        {
            IDataReader       reader = null;
            int               totalRows;
            orderSearchResult res = new orderSearchResult();

            switch (ot)
            {
            case orderType.CO:
                throw new Exception("ordertype CO not supported");

            case orderType.CO3PL:
                Getco(
                    clientId,
                    orderNo,
                    yourCono,
                    from,
                    to,
                    mark,
                    ordersFromHistory,
                    ordersFromProduction,
                    out reader);
                break;

            case orderType.PO:
                Getpo(
                    clientId,
                    orderNo,
                    from,
                    to,
                    ordersFromHistory,
                    ordersFromProduction,
                    out reader);
                break;

            default:
                throw new Exception("unknown ordertype");
            }

            ArrayList list = ReaderHelper.Read(
                reader,
                new order(),
                dataParam.GetSkipNoFirstRows(),
                dataParam.GetMaxRows(),
                out totalRows);

            res.list = list.ToArray(typeof(order)) as order[];
            res.SetTotalRows(totalRows);

            return(res);
        }
예제 #23
0
        public int v2()
        {
            XmlReader r = null;

            Stream s = GetStream();

            r = ReaderHelper.Create(s);
            while (r.Read())
            {
                ;
            }
            r.Dispose();

            r = ReaderHelper.Create(GetUrl());
            while (r.Read())
            {
                ;
            }
            r.Dispose();

            r = ReaderHelper.Create(GetTextReader());
            while (r.Read())
            {
                ;
            }
            r.Dispose();

            return(TEST_PASS);
        }
        public void QueryShadowBase()
        {
            ResetControl();

            if (reader == null)
            {
                reader = new ReaderHelper();
            }
            string portName = ViewSelf.cbPort.Text;
            var    chipCode = reader.Read(portName);

            var shadow = iShadowBaseService.GetShawInfoByChipCode(chipCode);

            if (shadow != null)
            {
                Model = shadow;
                NotifyOfPropertyChange(() => Model);

                ModelCollection = new BindableCollection <ShadowProcessModel>(shadow.ShadowProcess.ToList());
            }
            else
            {
                System.Windows.MessageBox.Show("没有找到对应的农产品");
            }
        }
예제 #25
0
        public bool PostComment(string text, string type, string userFrom, string id)
        {
            if (!IsUser(userFrom))
            {
                return(false);
            }
            var table = ReaderHelper.GetCommentsTable(type);

            if (table == "")
            {
                return(false);
            }
            using (_connection = new SqlConnection(Global.WaifString))
            {
                _connection.Open();
                using (var cmd = new SqlCommand("SELECT Name FROM Users WHERE Id=@Id", _connection))
                {
                    cmd.Parameters.AddWithValue("Id", userFrom);
                    if (String.IsNullOrEmpty(cmd.ExecuteScalar().ToString()))
                    {
                        return(false);
                    }
                }
                var postedId = "";
                using (var cmd = new SqlCommand("INSERT INTO " + table + " VALUES(@UserId, @Id, @Text, " +
                                                "GETDATE()); SELECT TOP 1 Id FROM " + table + " ORDER BY Id DESC;", _connection))
                {
                    cmd.Parameters.AddWithValue("UserId", userFrom);
                    cmd.Parameters.AddWithValue("Id", id);
                    cmd.Parameters.AddWithValue("Text", text);
                    postedId = cmd.ExecuteScalar().ToString();
                }
                /* Comment reply notification section */
                var ind = text.IndexOf("methods.replyHover(");
                if (ind != -1)
                {
                    var tempText = text;
                    ind     += 19;
                    tempText = tempText.Substring(ind);
                    tempText = tempText.Remove(tempText.IndexOf("this"));
                    var parameters = tempText.Split(',');
                    var userToId   = "";
                    using (var cmd = new SqlCommand("SELECT UserFrom FROM " + table + " WHERE Id=@Id", _connection))
                    {
                        cmd.Parameters.AddWithValue("Id", parameters[1]);
                        userToId = cmd.ExecuteScalar().ToString();
                    }
                    UserLight user = new UserLight();

                    user.LoadById(userFrom);

                    var notifyContent = String.Format("Пользователь <a href=\"/profile/{0}\">{0}</a> " +
                                                      "ответил на ваш <a onmouseover=\"notifyCommentHover('{1}',{2}, '{3}',this);\">" +
                                                      "комментарий</a>", user.Login, type, postedId, id);
                    Notification.AddNew(userToId, notifyContent, false, user.Image, "/profile/" + user.Login);
                }
            }
            return(true);
        }
예제 #26
0
            void SendDecrementCommand(ISmartCardReader smartCardReader, string description, int value, byte blockNumber)
            {
                var    decrementCommand = new IncrementDecrementCommand();
                string input            = decrementCommand.GetApdu(IncrementDecrementCommand.OperationType.Decrement, blockNumber, value);
                string output           = ReaderHelper.SendCommand(smartCardReader, input);

                ConsoleWriter.Instance.PrintCommand(description + blockNumber.ToString("X2"), input, output);
            }
예제 #27
0
            private void LoadKeyCommand(ISmartCardReader smartCardReader, string description, byte keySlot, LoadKeyCommand.KeyType keyType, LoadKeyCommand.Persistence persistence, LoadKeyCommand.Transmission transmission, LoadKeyCommand.KeyLength keyLength, string key)
            {
                var loadKeyCommand = new Readers.AViatoR.Components.LoadKeyCommand();

                string input  = loadKeyCommand.GetApdu(keySlot, keyType, persistence, transmission, keyLength, key);
                string output = ReaderHelper.SendCommand(smartCardReader, input);

                ConsoleWriter.Instance.PrintCommand(description + key, input, output);
            }
예제 #28
0
        public ISyncWSResult find(ISyncWSParameter dataParameter)
        {
            warehouseSearchResult res  = new warehouseSearchResult();
            ArrayList             list = ReaderHelper.MakeTestData(10, new warehouse());

            res.list      = list.ToArray(typeof(warehouse)) as warehouse[];
            res.totalHits = res.list.GetLength(0);
            return((searchResult)res);
        }
예제 #29
0
        public ISyncWSResult findProducts(ISyncWSParameter dataParameter)
        {
            productSearchResult res  = new productSearchResult();
            ArrayList           list = ReaderHelper.MakeTestData(10, new product());

            res.list      = list.ToArray(typeof(product)) as product[];
            res.totalHits = res.list.GetLength(0);
            return((searchResult)res);
        }
            private void ReadEepromCommand(ISmartCardReader smartCardReader, string comment, ushort offset, byte dataLength)
            {
                var eepromCommands = new Readers.AViatoR.Components.ReaderEeprom();

                string input  = eepromCommands.ReadCommand(offset, dataLength);
                string output = ReaderHelper.SendCommand(smartCardReader, input);

                PrintCommand(comment, input, output);
            }