Esempio n. 1
0
        public CStock get_Stock(string cmd_str)
        {
            CStock stock = null;
            SqlConnection sqlCn = null;

            try
            {
                sqlCn = new SqlConnection(_con_str);
                sqlCn.Open();

                //cmd_str = "Select * from [Stock] where (" + cmd_str + ")";
                SqlCommand cmdSelect = new SqlCommand(cmd_str, sqlCn);
                using (SqlDataReader dr = cmdSelect.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        stock = new CStock();
                        stock.id = (int)dr["id"];

                        break;
                    }
                }

            }
            catch (System.Exception e)
            {
                IOUtil.insert_file("time=" + DateTime.Now.ToString() + ",cmd_str=" + cmd_str);
                IOUtil.insert_file("\n");
                BathClass.printErrorMsg(e.Message);
            }
            finally
            {
                close_connection(sqlCn);
            }

            return stock;
        }
Esempio n. 2
0
        //对话框载入
        private void OrderForm_Load(object sender, EventArgs e)
        {
            dao = new DAO(m_con_str);
            if (!dao.execute_command("update [Seat] set ordering='True' where text='" + m_Seat.text + "'"))
            {
                BathClass.printErrorMsg("手牌状态更新失败!");
                return;
            }
            m_options = dao.get_options();
            if (typeList.Count == 0)
                typeList = dao.get_catgories(null);
                //typeList = db.Catgory.Select(x => x.name).ToList();

            dgvExpense.Columns[11].Visible = MConvert<bool>.ToTypeOrDefault(m_options.启用客房面板, false);
            inputBillId = MConvert<bool>.ToTypeOrDefault(m_options.录单输入单据编号, false);
            inputTechType = MConvert<bool>.ToTypeOrDefault(m_options.录单区分点钟轮钟, false);
            string local_ip = BathClass.get_local_ip();
            stock = dao.get_Stock("select * from [Stock] where ips='"+local_ip+"'");

            this.Invoke(new no_par_delegate(initial_ui), null);

            //MessageBox.Show((DateTime.Now - st).TotalMilliseconds.ToString());
        }