Пример #1
0
        private void OrderScanMain(object obj)
        {
            string table        = @"order_updates.dbf";
            int    lastOrderNum = 0;

            while (true)
            {
                try
                {
                    var dt = OledbAdapter.GetDataTable("select * from " + table);
                    if (dtOrderNewst == null || dtOrderNewst.Rows.Count < dt.Rows.Count)
                    {
                        dtOrderNewst     = dt;
                        needRefreshOrder = true;
                        isUpdatingOrder  = true;
                    }
                    for (int i = lastOrderNum; i < dt.Rows.Count; i++)
                    {
                        UpdateOrderRow(dt.Rows[i]);
                    }
                    lastOrderNum    = dt.Rows.Count;
                    isUpdatingOrder = false;
                }
                catch (Exception ex)
                {
                    Utils.logger.LogInfo("OrderScanMain Exception, Message:{0}", ex.Message);
                }

                Thread.Sleep(100);
            }
        }
Пример #2
0
        public bool ExistDBFData()
        {
            var insTable = OledbAdapter.GetInstruction("select * from instructions.dbf");

            if (insTable != null && insTable.Rows.Count > 0)
            {
                return(true);
            }
            var ordTable = OledbAdapter.GetDataTable("select * from order_updates.dbf");

            if (ordTable != null && ordTable.Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
        private void ASSetScanMain()
        {
            string table = @"asset.dbf";

            while (true)
            {
                try
                {
                    OledbAdapter o  = new OledbAdapter();
                    var          dt = OledbAdapter.GetDataTable("select * from " + table);
                    if (FSetTable == null)
                    {
                        FSetTable = dt.Copy();
                    }
                    if (PSetTable == null)
                    {
                        PSetTable = dt.Copy();
                    }

                    PSetTable.Clear();
                    FSetTable.Clear();

                    if (dt.Rows.Count > 0)
                    {
                        //将两种数据分别记录到两个表中
                        foreach (DataRow row in dt.Rows)
                        {
                            var type = row["a_type"].ToString();
                            if (type == "F")
                            {
                                FSetTable.ImportRow(row);
                            }
                            else if (type == "P")
                            {
                                PSetTable.ImportRow(row);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Utils.logger.LogInfo("ASSetScanMain Exception, Message:{0}", ex.Message);
                }

                Thread.Sleep(1000);
            }
        }