void init()
        {
            string sql = "select table_id,tablename from tables order by table_id";

            dt = OdbcTool.ExecuteDataTable(sql);
            list.ItemsSource = dt.DefaultView;
        }
Beispiel #2
0
        /// <summary>
        /// 获取班次
        /// </summary>
        /// <returns></returns>
        public static String GetShift()
        {
            DateTime serverTime;

            serverTime = GetServerTime();
            string sql = "";

            sql = "SELECT shift_id,shift,time_start FROM shift Where time_start <= ? And time_end >= ?";
            DataTable dt = OdbcTool.ExecuteDataTable(sql, serverTime, serverTime);

            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][1].ToString());
            }

            sql = "SELECT shift_id,shift,time_start "
                  + " FROM shift Where (SELECT Max(time_start) From shift ) <= ? And "
                  + " time_start = (SELECT Max(time_start) From shift )";

            dt = OdbcTool.ExecuteDataTable(sql, serverTime);
            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][1].ToString());
            }
            sql = "SELECT shift_id,shift,time_start "
                  + " FROM shift Where (SELECT Min(time_end) From shift ) >= ? And "
                  + " time_end = (SELECT Min(time_end) From shift)";
            dt = OdbcTool.ExecuteDataTable(sql, serverTime);
            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][1].ToString());
            }
            return("");
        }
Beispiel #3
0
        public List <Dish> GetListByTypeId(string typeid)
        {
            string      sql  = "select * from dish where dishtype_id = ?";
            DataTable   dt   = OdbcTool.ExecuteDataTable(sql, typeid);
            List <Dish> list = dt.ToEntityList <Dish>();

            return(list);
        }
Beispiel #4
0
        public List <Dish> GetList()
        {
            string      sql  = "select * from dish";
            DataTable   dt   = OdbcTool.ExecuteDataTable(sql);
            List <Dish> list = dt.ToEntityList <Dish>();

            return(list);
        }
Beispiel #5
0
        public List <Bill> GetByHisorderId(string id)
        {
            string      sql  = "select * from bill where hisorder_id = ?";
            DataTable   dt   = OdbcTool.ExecuteDataTable(sql, id);
            List <Bill> list = dt.ToEntityList <Bill>();

            return(list);
        }
Beispiel #6
0
        public Dish GetById(string id)
        {
            Dish      o   = new Dish();
            string    sql = "select * from dish where dish_id = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            o = dt.ToEntity <Dish>();
            return(o);
        }
Beispiel #7
0
        public Bill GetByBillId(string id)
        {
            Bill      o   = new Bill();
            string    sql = "select * from bill where bill_id = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            o = dt.ToEntity <Bill>();
            return(o);
        }
Beispiel #8
0
        public List <Operator> GetList()
        {
            string    sql = "select * from operator";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql);

            dt.TableName = "operator";
            List <Operator> list = dt.ToEntityList <Operator>();

            return(list);
        }
Beispiel #9
0
        public Hisorder GetByTablename(string tablename)
        {
            string    sql = "select * from hisorder where tablename = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, tablename);

            dt.TableName = "hisorder";
            Hisorder o = dt.ToEntity <Hisorder>();

            return(o);
        }
Beispiel #10
0
        public Hisorder GetByHisorderId(string id)
        {
            Hisorder  o   = new Hisorder();
            string    sql = "select * from hisorder where hisorder_id = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            dt.TableName = "hisorder";
            o            = dt.ToEntity <Hisorder>();
            return(o);
        }
Beispiel #11
0
        public List <Hisorder> GetList()
        {
            string    sql = "select * from hisorder";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql);

            dt.TableName = "hisorder";
            List <Hisorder> list = dt.ToEntityList <Hisorder>();

            return(list);
        }
Beispiel #12
0
        public Curorder GetByCurorderId(string id)
        {
            Curorder  o   = new Curorder();
            string    sql = "select * from curorder where curorder_id = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            dt.TableName = "curorder";
            o            = dt.ToEntity <Curorder>();
            return(o);
        }
Beispiel #13
0
        public DishType GetByName(string name)
        {
            DishType  o   = new DishType();
            string    sql = "select * from dishtype where dishtype = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, name);

            dt.TableName = "dishtype";
            o            = dt.ToEntity <DishType>();
            return(o);
        }
Beispiel #14
0
        public List <DishType> GetList()
        {
            string    sql = "select * from dishtype";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql);

            dt.TableName = "dishtype";
            List <DishType> list = dt.ToEntityList <DishType>();

            return(list);
        }
Beispiel #15
0
        public Operator GetById(string id)
        {
            Operator  o   = new Operator();
            string    sql = "select * from operator where operator_id=?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            dt.TableName = "operator";
            o            = dt.ToEntity <Operator>();
            return(o);
        }
Beispiel #16
0
        public List <Hisorder> GetListByDateRange(DateTime start, DateTime end)
        {
            string    sql = "select * from hisorder where date(bill_date) between ? and ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, start, end);

            dt.TableName = "hisorder";
            List <Hisorder> list = dt.ToEntityList <Hisorder>();

            return(list);
        }
Beispiel #17
0
        public List <HisorderDetail> GetListByHisorderId(string id)
        {
            List <HisorderDetail> list = new List <HisorderDetail>();
            string    sql = "select * from hisorderdetail where hisorder_id = ?";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql, id);

            dt.TableName = "hisorderdetail";
            list         = dt.ToEntityList <HisorderDetail>();
            return(list);
        }
Beispiel #18
0
        public List <Bill> GetList()
        {
            string    sql = "select * from bill";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql);

            dt.TableName = "bill";
            List <Bill> list = dt.ToEntityList <Bill>();

            return(list);
        }
Beispiel #19
0
        public static void testODBCDataSet()
        {
            String      sql = "select * from uoption where opt_id = ?";
            OdbcCommand cmd;
            DataTable   table = OdbcTool.ExecuteDataTable(sql, out cmd, "900002");

            table.Rows[0][3] = table.Rows[0][3].ToString() + "c";
            int rtn = OdbcTool.UpdateDataTable(table, cmd);

            Console.WriteLine(rtn.ToString());
        }
Beispiel #20
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            sql = "select * from uoption where opt_id = ?";
            OdbcCommand cmd;
            DataTable   dr = OdbcTool.ExecuteDataTable(sql, out cmd, "900002");

            dr.Rows[0]["note"] = "csj1";
            int rtn = OdbcTool.UpdateDataTable(dr, cmd);

            MessageBox.Show(rtn.ToString());
        }
Beispiel #21
0
        /// <summary>
        /// 初始化检测
        /// </summary>
        private bool Init()
        {
            string tableName = Tools.IniRead(App.MainIni, "App", "posname", "");

            if (string.IsNullOrEmpty(tableName))
            {
                SelectTableWindow w = new SelectTableWindow();
                w.OKCallback += (sender, parm) =>
                {
                    if (parm == null)
                    {
                        return(null);
                    }
                    tableName = parm.ToString();
                    Tools.IniWrite(App.MainIni, "App", "posname", tableName);
                    return(null);
                };
                w.ShowDialog();
            }
            if (string.IsNullOrEmpty(tableName))
            {
                MessageBox.Show("必须选择收银机才能继续使用系统!");
                return(false);
            }
            App.TableName = tableName;
            var o = OdbcTool.ExecuteScalar("select hme_id from tables where tablename = ?", tableName);

            if (o == null)
            {
                Tools.IniWrite(App.MainIni, "App", "posname", "");
                MessageBox.Show("未找到与服务器对应的台位ID\r\n" + "本地台位名称:" + tableName);
                return(false);
            }
            App.HmeTableId = int.Parse(o.ToString());

            string    sql = "select top 1 dinnername,dinnneraddress,dinnertel from dinner";
            DataTable dt  = OdbcTool.ExecuteDataTable(sql);

            if (dt.Rows.Count > 0)
            {
                App.DinnerName = dt.Rows[0][0] == null ? string.Empty : dt.Rows[0][0].ToString();
                App.DinnerAddr = dt.Rows[0][1] == null ? string.Empty : dt.Rows[0][1].ToString();
                App.DinnerTel  = dt.Rows[0][2] == null ? string.Empty : dt.Rows[0][2].ToString();
            }
            return(true);
        }