Esempio n. 1
0
        //更新
        public static int Update(ReaderType readertype)
        {
            int    rows = 0;
            string sql  = "update ReaderType set"
                          + "rdTypeName=@rdTypeName,"
                          + "CanLendQty=@CanLendQty,"
                          + "CanLendDay=@CanLendDay,"
                          + "ContinueTimes=@ContinueTimes,"
                          + "PunishRate=@PunishRate,"
                          + "DateValid=@DateValid"
                          + "where rdType=@rdType";

            SqlParameter[] parameters =
            {
                new SqlParameter("@rdTypeName",       readertype.rdTypeName),
                new SqlParameter("@CanLendQty",       readertype.CanLendQty),
                new SqlParameter("@CanLendDay",       readertype.CanLendDay),
                new SqlParameter("@CancontinueTimes", readertype.CanContinueTimes),
                new SqlParameter("@PunishRate",       readertype.PunishRate),
                new SqlParameter("@DateValid",        readertype.DateValid),
                new SqlParameter("@rdType",           readertype.rdType)
            };
            try
            {
                rows = SqlHelper.ExecuteNonQuery(sql, parameters);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(rows);
        }
        public ActionResult Create([Bind(Include = "RdrTypeID,RdrTypeName,VendorID")] ReaderType readertype)
        {
            if (string.IsNullOrEmpty(readertype.RdrTypeName))
            {
                ModelState.AddModelError("RdrTypeName", "Reader Type field is required!");
            }
            if (readertype.RdrTypeName != null)
            {
                if (readertype.RdrTypeName.Length > 50)
                {
                    ModelState.AddModelError("RdrTypeName", "String length exceeds!");
                }
                if (!myClass.IsAllLetters(readertype.RdrTypeName))
                {
                    ModelState.AddModelError("RdrTypeName", "This field only contain Alphabets");
                }
            }
            if (ModelState.IsValid)
            {
                db.ReaderTypes.Add(readertype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(readertype));
        }
Esempio n. 3
0
        public bool BorrowBook(Reader reader, ReaderType readerType, Book book, Reader OperatorUser)
        {
            if (reader == null || readerType == null || book == null || OperatorUser == null)
            {
                return(false);
            }
            if (reader.rdStatus != "有效" || (readerType.CanLendQty - reader.rdBorrowQty) <= 0)
            {
                return(false);
            }
            if (book.bkStatus != "在馆")
            {
                return(false);
            }

            reader.rdBorrowQty++;
            readerDAL.Update(reader);

            book.bkStatus = "借出";
            bookDAL.Update(book);

            Borrow borrow = new Borrow();

            borrow.rdID            = reader.rdID;
            borrow.bkID            = book.bkID;
            borrow.ldContinueTimes = 0;
            borrow.ldDateOut       = DateTime.Now;
            borrow.ldDateRetPlan   = DateTime.Now.AddDays(readerType.CanLendDay);
            borrow.lsHasReturn     = false;
            borrow.OperatorLend    = OperatorUser.rdName;
            borrowDAL.Add(borrow);
            return(true);
        }
Esempio n. 4
0
 public OpenReader(ReaderType readerType, ReaderConfig config)
 {
     Type    = readerType;
     Config  = config;
     Status  = OperationStatus.Request;
     _signal = new ManualResetEvent(false);
 }
Esempio n. 5
0
        public static DateTime GetReaderTime(string host, ReaderType reader_type, bool is_async = false)
        {
            int    port = 0;
            string cmd  = "ab00000222";

            if (reader_type == ReaderType.Lite)
            {
                port = 10000;
            }
            else if (reader_type == ReaderType.Elite)
            {
                port = 9999;
            }
            DateTime reader_time = DateTime.Now;

            if (is_async)
            {
                reader_time = ParseReaderTime(AsyncTcpSocketUtil.SendRecieve(host, port, cmd).Trim());
            }
            else
            {
                reader_time = ParseReaderTime(SyncTcpSocketUtil.SendRecieve(host, port, cmd, 36).Trim());
            }
            return(reader_time);
        }
Esempio n. 6
0
        public IFormatReader <IFileOptionsSet> CreateReader(ReaderType type, string path, IOptionsSet baseOptions = null)
        {
            IFormatReader <IFileOptionsSet> result = null;
            FileOptionsSet options = new FileOptionsSet(baseOptions ?? OptionsSet.Empty)
            {
                FilePath = path
            };

            switch (type)
            {
            case ReaderType.Ascii:
                result = new AsciiReader(options);
                break;

            case ReaderType.Excel:
            case ReaderType.Excel2007:
                result = new XlsReader(options);
                break;

            case ReaderType.Dbf:
                result = new DbfReader(options);
                break;

            case ReaderType.Db:
                throw new InvalidOperationException("use CreateDbReader()");

            default:
                throw new UnimplementedReaderTypeException(type);
            }
            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// 修改读者类型
        /// </summary>
        /// <param name="reader_type_record"></param>
        /// <returns></returns>
        public static int Update(ReaderType reader_type_record)
        {
            int rows = 0;

            #region SQL 语句准备
            string         sql        = @"update TB_ReaderType set 
rdTypeName=@rdTypeName,
maxBorrowNum=@maxBorrowNum,
maxBorrowDay=@maxBorrowDay,
maxContinueTimes=@maxContinueTimes 
where rdType=@rdType
";
            SqlParameter[] parameters =
            {
                new SqlParameter("@rdType",           reader_type_record.rdType),
                new SqlParameter("@rdTypeName",       reader_type_record.rdTypeName),
                new SqlParameter("@maxBorrowNum",     reader_type_record.maxBorrowNum),
                new SqlParameter("@maxBorrowDay",     reader_type_record.maxBorrowDay),
                new SqlParameter("@maxContinueTimes", reader_type_record.maxContinueTimes),
            };
            #endregion

            try
            {
                rows = SqlHelper.ExecuteNonQuery(sql, parameters);
            }
            catch (SqlException e)
            {
                throw new Exception(e.Message);
            }
            return(rows);
        }
Esempio n. 8
0
 public ActionResult SelectReader(ReaderType type)
 {
     var factory = new ReaderFactory();
     var reader = factory.CreateReader(type);
     //reader
     return null;
 }
Esempio n. 9
0
        public bool Open(string portName, ReaderType reader)
        {
            try
            {
                var baudRate = 9600;
                if (reader == ReaderType.Honeywell)
                {
                    baudRate = 9600;
                }
                else if (reader == ReaderType.YJ)
                {
                    baudRate = 115200;
                }

                _serialPort = new SerialPort(portName, baudRate, Parity.None, 8, StopBits.One);
                _serialPort.Open();

                ThreadPool.QueueUserWorkItem(ReadComm);
                return(true);
            }
            catch (Exception ex)
            {
                Log("串口打开失败:" + ex.Message);
                return(false);
            }
        }
Esempio n. 10
0
        //插入
        public static int Insert(ReaderType readertype)
        {
            int    rows = 0;
            string sql  = "insert into ReadType(rdType,rdTypeName,CanLendQty,CanLendDay,CanContinueTimes,PunishRate,DateValid)"
                          + "value ((@rdType,@rdTypeName,@CanLendQty,@CanLendDay,@CanContinueTimes,@PunishRate,@DateValid)";

            SqlParameter[] parameters =
            {
                new SqlParameter("@rdType",           readertype.rdType),
                new SqlParameter("@rdTypeName",       readertype.rdTypeName),
                new SqlParameter("@CanLendQty",       readertype.CanLendQty),
                new SqlParameter("@CanLendDay",       readertype.CanLendDay),
                new SqlParameter("@CancontinueTimes", readertype.CanContinueTimes),
                new SqlParameter("@PunishRate",       readertype.PunishRate),
                new SqlParameter("@DateValid",        readertype.DateValid)
            };
            try
            {
                rows = SqlHelper.ExecuteNonQuery(sql, parameters);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(rows);
        }
 public ActionResult Edit([Bind(Include = "RdrTypeID,RdrTypeName,VendorID")] ReaderType readertype)
 {
     if (string.IsNullOrEmpty(readertype.RdrTypeName))
     {
         ModelState.AddModelError("RdrTypeName", "Reader Type field is required!");
     }
     if (readertype.RdrTypeName != null)
     {
         if (readertype.RdrTypeName.Length > 50)
         {
             ModelState.AddModelError("RdrTypeName", "String length exceeds!");
         }
         if (!myClass.IsAllLetters(readertype.RdrTypeName))
         {
             ModelState.AddModelError("RdrTypeName", "This field only contain Alphabets");
         }
     }
     if (ModelState.IsValid)
     {
         db.Entry(readertype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.VendorID = new SelectList(db.ReaderVendors.OrderBy(s => s.VendorName), "VendorID", "VendorName", readertype.VendorID);
     return(View(readertype));
 }
Esempio n. 12
0
        /// <summary>
        /// 添加读者类别
        /// </summary>
        #region Add
        public static int Add(ReaderType readertype)
        {
            int    rows = 0;
            string sql  = "insert into TB_ReaderType(rdType, rdTypeName, CanLendQty, CanLendDay, CanContinueTimes, PunishRate, DateValid)"
                          + " values(?rdType, ?rdTypeName, ?CanLendQty, ?CanLendDay, ?CanContinueTimes, ?PunishRate, ?DateValid)";

            MySqlParameter[] parameters =
            {
                new MySqlParameter("?rdType",           MySqlDbType.Int16),
                new MySqlParameter("?rdTypeName",       MySqlDbType.VarChar, 20),
                new MySqlParameter("?CanLendQty",       MySqlDbType.Int32),
                new MySqlParameter("?CanLendDay",       MySqlDbType.Int32),
                new MySqlParameter("?CanContinueTimes", MySqlDbType.Int32),
                new MySqlParameter("?PunishRate",       MySqlDbType.Float),
                new MySqlParameter("?DateValid",        MySqlDbType.Int16)
            };
            parameters[0].Value = readertype.rdType;
            parameters[1].Value = readertype.rdTypeName;
            parameters[2].Value = readertype.CanLendQty;
            parameters[3].Value = readertype.CanLendDay;
            parameters[4].Value = readertype.CanContinueTimes;
            parameters[5].Value = readertype.PunishRate;
            parameters[6].Value = readertype.DateValid;
            try
            {
                rows = MySqlHelper.ExecuteNonQuery(_strConnection, CommandType.Text, sql, parameters);
            }
            catch (MySqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(rows);
        }
Esempio n. 13
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                // Fallback to ICS if there's no apiKey
                ReaderType readerTypeToCreate = (!String.IsNullOrEmpty(m_apiKey)) ? ReaderType.GoogleApi : ReaderType.GoogleIcs;

                // Get reader and init
                m_planReader = new ReaderFactory().CreateReader(m_calendarId, readerTypeToCreate);
                if (m_planReader is GoogleApiReader)
                {
                    ((GoogleApiReader)m_planReader).ApiKey = m_apiKey;
                }

                bool r = m_planReader.Init().Result;
                Init();

                // load event async (not waiting time for gui)
                new Thread(new ThreadStart(LoadEvents)).Start();

                m_checkDateTimeForNotify = new System.Threading.Timer(CheckDateTimeForNotify, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
            }
            catch (Exception ex)
            {
                if (Event_OnError != null)
                {
                    Event_OnError.Invoke(this, new OnErrorEventArgs(ex));
                }
            }
            bigForm = new BigPlanForm(this);
            this.Hide();
            activeForm = bigForm;
            bigForm.ShowDialog();
        }
        public ActionResult DeleteConfirmed(byte id)
        {
            ReaderType readertype = db.ReaderTypes.Find(id);

            db.ReaderTypes.Remove(readertype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 15
0
 private void ShowData()
 {
     dgvReaderType.DataSource = dt;
     foreach (DataColumn dc in dt.Columns)
     {
         dgvReaderType.Columns[dc.ColumnName].HeaderText = ReaderType.ColumnTitle(dc.ColumnName);
     }
 }
Esempio n. 16
0
        /// <summary>
        /// 添加读者类型
        /// </summary>
        /// <param name="reader_type_record"></param>
        /// <returns></returns>
        public static short Add(ReaderType reader_type_record)
        {
            short rows = 0;

            #region SQL 语句准备
            string         sql        = @"insert into TB_ReaderType(
rdTypeName,
maxBorrowNum,
maxBorrowDay,
maxContinueTimes
)values(
@rdTypeName,
@maxBorrowNum,
@maxBorrowDay,
@maxContinueTimes
)";
            SqlParameter[] parameters =
            {
                new SqlParameter("@rdTypeName",       reader_type_record.rdTypeName),
                new SqlParameter("@maxBorrowNum",     reader_type_record.maxBorrowNum),
                new SqlParameter("@maxBorrowDay",     reader_type_record.maxBorrowDay),
                new SqlParameter("@maxContinueTimes", reader_type_record.maxContinueTimes),
            };
            string         sqlGetId    = @"select rdType from TB_ReaderType where
rdTypeName=@rdTypeName and
maxBorrowNum=@maxBorrowNum and
maxBorrowDay=@maxBorrowDay and
maxContinueTimes=@maxContinueTimes
";
            SqlParameter[] parameters1 =
            {
                new SqlParameter("@rdTypeName",       reader_type_record.rdTypeName),
                new SqlParameter("@maxBorrowNum",     reader_type_record.maxBorrowNum),
                new SqlParameter("@maxBorrowDay",     reader_type_record.maxBorrowDay),
                new SqlParameter("@maxContinueTimes", reader_type_record.maxContinueTimes),
            };
            #endregion

            try {
                rows = (short)SqlHelper.ExecuteNonQuery(sql, parameters);
            }catch (SqlException e) {
                throw new Exception(e.Message);
            }

            if (rows > 0)
            {
                try
                {
                    rows = (short)SqlHelper.ExecuteScalar(sqlGetId, parameters1);
                }
                catch (SqlException e)
                {
                    throw new Exception(e.Message);
                }
            }

            return(rows);
        }
Esempio n. 17
0
        /// <summary>
        /// Requires the ruby file.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="readerType">Type of the reader.</param>
        internal object RequireRubyFile(string path, ReaderType readerType)
        {
            if (readerType == ReaderType.Assembly)
            {
                return(Engine.CreateScriptSource(new AssemblyStreamContentProvider(path, typeof(IRubyEngine).Assembly), null, Encoding.UTF8).Execute());
            }

            return(Engine.CreateScriptSourceFromFile(path, Encoding.UTF8).Execute());
        }
Esempio n. 18
0
 private void dgvReaderType_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvReaderType.CurrentCell == null)
     {
         return;
     }
     readertype = ReaderTypeAdmin.GetReaderType(Convert.ToString(dgvReaderType["rdType", dgvReaderType.CurrentCell.RowIndex].Value));
     SetReaderTypeToText();
 }
Esempio n. 19
0
        /// <summary>
        /// Compare the reader time and the computer system time and return the difference
        /// </summary>
        /// <param name="address"></param>
        /// <param name="reader_type"></param>
        /// <param name="is_async"></param>
        /// <returns>Difference between the computer time and the reader time</returns>
        public static TimeSpan CompareClocks(string address, ReaderType reader_type, bool is_async = false)
        {
            DateTime rdrTime = (DateTime)GetReaderTime(address, reader_type, is_async);
            DateTime pcTime  = DateTime.Now;
            //Must account for rudimentary latency between request and receipt
            TimeSpan latency       = TimeSpan.FromMilliseconds(GetLatency(address));
            TimeSpan rdrDifference = (pcTime.Subtract(rdrTime)).Subtract(latency);

            return(rdrDifference);
        }
Esempio n. 20
0
 private void rdtp2tbox(ReaderType rt)
 {
     tb_rdtp_rdType.Text      = rt.rdType.ToString();
     tb_rdTypeName.Text       = rt.rdTypeName.ToString();
     tb_CanLendQty.Text       = rt.CanLendQty.ToString();
     tb_CanLendDay.Text       = rt.CanLendDay.ToString();
     tb_CanContinueTimes.Text = rt.CanContinueTimes.ToString();
     tb_PunishRate.Text       = rt.PunishRate.ToString();
     tb_DateValid.Text        = rt.DateValid.ToString();
 }
Esempio n. 21
0
 public CreateReaderParams(
     ReaderType type,
     ReadOverload inputType,
     object input,
     XmlReaderSettings readerSettings)
 {
     readerType = type;
     Input      = input;
     InputType  = inputType;
     Settings   = readerSettings;
 }
Esempio n. 22
0
 public virtual void SetReaderType(ReaderType readertype)
 {
     if (IsDirectBinding)
     {
         global::ApiDefinition.Messaging.void_objc_msgSend_UInt32(this.Handle, Selector.GetHandle("setReaderType:"), (UInt32)readertype);
     }
     else
     {
         global::ApiDefinition.Messaging.void_objc_msgSendSuper_UInt32(this.SuperHandle, Selector.GetHandle("setReaderType:"), (UInt32)readertype);
     }
 }
Esempio n. 23
0
        public static List<ReaderDetails> AutoDiscover(ReaderType rdrType)
        {
            List<ReaderDetails> lstReaders;

            if (rdrType == ReaderType.MOTOROLA)
                lstReaders = AutoDiscoverMotorola();
            else
                lstReaders = new List<ReaderDetails>();

            return lstReaders;
        }
Esempio n. 24
0
 public static ICycleDataSubject CreateCycleDataSubject(ReaderType type)    //文件读取
 {
     if (type == ReaderType.Bin)
     {
         return(CreateBinReader());
     }
     else
     {
         return(CreateUdpReader());
     }
 }
        //修改读者类型
        public int updateReaderType(ReaderType r)
        {
            string sql = "update ReaderType set ReaderTypeName=@ReaderTypeName where ReaderTypeId=@ReaderTypeId";

            SqlParameter[] sp =
            {
                new SqlParameter("@ReaderTypeId",   r.ReaderTypeId),
                new SqlParameter("@ReaderTypeName", r.ReaderTypeName)
            };
            return(DBhelp.Create().ExecuteNonQuery(sql, sp: sp));
        }
Esempio n. 26
0
        public IMenuReader CreateReader(ReaderType type)
        {
            switch(type){
                case ReaderType.XML:
                    return new XmlMenuReader();
                case ReaderType.JSON:
                    return new JsonMenuReader();
            }

            return null;
        }
Esempio n. 27
0
        public static ReaderType QueryReaderTypeInfo(int typeID)
        {
            string       sql  = "SELECT * FROM ReaderType WHERE  typeID= @typeID";
            SqlParameter para = new SqlParameter("@typeID", typeID.ToString());

            SQLHelper.CoverToObject cto = new SQLHelper.CoverToObject(ReaderToBorrowRecordClass);
            var list = SQLHelper.Query(sql, cto, para);

            ReaderType Info = list[0] as ReaderType;

            return(Info);
        }
Esempio n. 28
0
        public static bool run_insql(ReaderType rt, int i)
        {
            switch (i)
            {
            case 0: return(ReaderTypeDAL.ex_insert_insql(rt));

            case 1: return(ReaderTypeDAL.ex_update_insql(rt));

            case 2: return(ReaderTypeDAL.ex_delete_insql(rt));

            default: return(false);
            }
        }
        public static Reader GetReader(ReaderType readerType)
        {
            Reader reader = null;

            Readers.TryGetValue(readerType, out reader);

            if (reader == null)
            {
                throw new Exception("Invalid Reader Type");
            }

            return(reader);
        }
Esempio n. 30
0
        public static XmlReader CreateReader(string readerType, XmlReader underlyingReader, bool enableNormalization, object eventHndlr, XmlReaderSettings settings, bool isFragment)
        {
            CError.WriteLineIgnore(readerType);
            ReaderType         type         = (ReaderType)Enum.Parse(typeof(ReaderType), readerType.ToUpperInvariant());
            CreateReaderParams readerParams = new CreateReaderParams(type);

            readerParams.InputType           = ReadOverload.XmlReader;
            readerParams.Input               = underlyingReader;
            readerParams.EnableNormalization = enableNormalization;
            readerParams.IsFragment          = isFragment;
            readerParams.Settings            = settings;

            return(CreateReader(readerParams));
        }
Esempio n. 31
0
        public static Reader CreateReader(ReaderType type)
        {
            switch (type)
            {
            case ReaderType.Polar:
                return(new PolarReader());

            case ReaderType.Generic:
                return(new GenericReader());

            default:
                return(new GenericReader());
            }
        }
Esempio n. 32
0
        public static ReaderType Row2rdtp(DataRow t)
        {
            ReaderType rt = new ReaderType();

            rt.rdType           = t["rdType"].ToString();
            rt.rdTypeName       = t["rdTypeName"].ToString();
            rt.CanLendQty       = t["CanLendQty"].ToString();
            rt.CanLendDay       = t["CanLendDay"].ToString();
            rt.CanContinueTimes = t["CanContinueTimes"].ToString();
            rt.PunishRate       = t["PunishRate"].ToString();
            rt.DateValid        = t["DateValid"].ToString();

            return(rt);
        }
        public ActionResult Details(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReaderType readertype = db.ReaderTypes.Find(id);

            if (readertype == null)
            {
                return(HttpNotFound());
            }
            return(View(readertype));
        }
        /// <summary>
        /// Creates the reader.
        /// </summary>
        /// <param name="readerType">Type of the reader.</param>
        /// <returns></returns>
        public static INewsFeedConsumer CreateReader(ReaderType readerType)
        {
            switch (readerType){
                case ReaderType.Rss:
                    return new RssNewsFeedConsumer();
                case ReaderType.Atom:
                    return new AtomNewsFeedConsumer();
                case ReaderType.CustomNews:
                    return new CustomSiteNewsConsumer();

            }

            throw new ArgumentException("Unknown reader type provided", "readerType");
        }
Esempio n. 35
0
        public IOTReader(int id, int org)
            : base(id, org)
        {
            this.global = (IOTGlobal)Global.getInstance();
            this.orgMonitorMapping = new Dictionary<int, List<int>>();
            this.cachedMonitorNodes = new Dictionary<int, HashSet<int>>();
            this.readerType = ReaderType.NORMAL;
            this.observedPhenomemons = new HashSet<IOTPhenomemon>();
            this.neighborSpeedPhenomemons = new Dictionary<int, IOTPhenomemon>();

            IOTPhenomemon p = new IOTPhenomemon(IOTPhenomemonType.MOVE_FAST, id);
            this.neighborSpeedPhenomemons.Add(id, p);
            this.observedPhenomemons.Add(p);

            CheckRoutine();
        }
Esempio n. 36
0
        public IOTReader(int id, int org)
            : base(id, org)
        {
            this.ReaderCache = new Dictionary<int, RSUEntity>();
            this.wiredNodeCache = new List<int>();
            this.orgMonitorMapping = new Dictionary<int, List<int>>();
            this.cachedMonitorNodes = new Dictionary<int, HashSet<int>>();
            this.readerType = ReaderType.NORMAL;
            this.observedPhenomemons = new HashSet<IOTPhenomemon>();
            this.neighborSpeedPhenomemons = new Dictionary<int, IOTPhenomemon>();

            IOTPhenomemon p = new IOTPhenomemon(IOTPhenomemonType.MOVE_FAST, id);
            this.neighborSpeedPhenomemons.Add(id, p);
            this.observedPhenomemons.Add(p);

            CheckRoutine();
        }
Esempio n. 37
0
 public CreateReaderParams(
     ReaderType type,
     ReadOverload inputType,
     object input,
     string baseUri,
     bool isFragment,
     bool enableNormalization,
     XmlReaderSettings readerSettings)
 {
     readerType = type;
     BaseUri = baseUri;
     Input = input;
     InputType = inputType;
     IsFragment = isFragment;
     EnableNormalization = enableNormalization;
     Settings = readerSettings;
 }
Esempio n. 38
0
        public override int Init(object o)
        {
            int i = base.Init(0);

            if (this.Param != null)
            {
                switch (this.Param.ToString().ToUpperInvariant())
                {
                    case "COREREADER":
                        readerType = ReaderType.CoreReader;
                        break;
                    default:
                        CError.Compare(false, "Unknown reader type: " + readerType);
                        break;
                }
            }

            return i;
        }
Esempio n. 39
0
        public bool Open(string portName, ReaderType reader)
        {
            try
            {
                var baudRate = 9600;
                if (reader == ReaderType.Honeywell)
                    baudRate = 9600;
                else if (reader == ReaderType.YJ)
                    baudRate = 115200;

                _serialPort = new SerialPort(portName, baudRate, Parity.None, 8, StopBits.One);
                _serialPort.Open();

                ThreadPool.QueueUserWorkItem(ReadComm);
                return true;
            }
            catch (Exception ex)
            {
                Log("串口打开失败:" + ex.Message);
                return false;
            }
        }
Esempio n. 40
0
        public void Init(object objParam)
        {
            // Get input and transform type from attribute
            _nInputXsl = GetXslInputType(String.Empty);
            _nOutput = GetOutputType(String.Empty);

            // Get parameter info from runtime variables passed to LTM
            _fTrace = false;
            _navType = GetDocType(InitStringValue("doctype"));
            _readerType = GetReaderType(InitStringValue("readertype"));

            //This is a temporary fix to restore the baselines. Refer to Test bug #
            _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApiV2\");
            _httpPath = FilePathUtil.GetHttpTestDataPath() + @"/XsltApiV2/";
            _standardTests = Path.Combine(@"TestFiles\", FilePathUtil.GetHttpStandardPath() + @"/xslt10/Current/");

            return;
        }
Esempio n. 41
0
 public static XmlReader CreateReader(ReaderType readerType, XmlReader underlyingReader, bool enableNormalization)
 {
     return CreateReader(readerType.ToString(), underlyingReader, enableNormalization, null, null);
 }
Esempio n. 42
0
 //This API attaches a default validation event handler.
 public static XmlReader CreateReader(ReaderType readerType, string url, bool enableNormalization)
 {
     return CreateReader(readerType.ToString(), url, enableNormalization, null, null);
 }
Esempio n. 43
0
        public void Init(object objParam)
        {
            // Get input and transform type from attribute
            _nInput = GetInputType(String.Empty);
            _nTransform = GetTransformType(String.Empty);

            // Get parameter info from runtime variables passed to LTM
            _fTrace = (InitStringValue("trace").ToUpper() == "TRUE");
            _docType = GetDocType(InitStringValue("doctype"));
            _readerType = GetReaderType(InitStringValue("readertype"));

            // FullFilePath and FullHttpPath attempt to normalize file paths, however
            // as an extra step we can normalize them here, when they are first read
            // from the LTM file.
            _strPath = Path.Combine(@"TestFiles\", FilePathUtil.GetTestDataPath(), @"XsltApi\");
            _httpPath = FilePathUtil.GetHttpTestDataPath() + @"/XsltApi/";

            return;
        }
Esempio n. 44
0
 public bool Init(string configParam)
 {
     if (configParam.ToUpper().StartsWith("COM"))
     {
         string[] strParam = configParam.Split(new char[] { ',' });
         PortName = strParam[0];
         if (strParam.LongLength > 1) BaudRate = Convert.ToInt32(strParam[1]);
         _readerType = ReaderType.COM;
     }
     else
     {
         _ip = configParam;
         _readerType = ReaderType.NET;
     }
     return true;
 }
Esempio n. 45
0
 public CreateReaderParams(ReaderType type)
 {
     readerType = type;
 }
Esempio n. 46
0
 public CreateReaderParams(
     ReaderType type,
     ReadOverload inputType,
     object input,
     XmlReaderSettings readerSettings)
 {
     readerType = type;
     Input = input;
     InputType = inputType;
     Settings = readerSettings;
 }
Esempio n. 47
0
 //This API doesnt attach a default validation event handler.
 public static XmlReader CreateReader(ReaderType readerType, Stream stream, string baseUri, bool enableNormalization)
 {
     return CreateReader(readerType.ToString(), stream, baseUri, enableNormalization, null, null, false);
 }