예제 #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Update_Click(object sender, EventArgs e)
        {
            try
            {
                bool b_mustMore      = System.Text.RegularExpressions.Regex.IsMatch(mustMore.Text, @"^\+?[1-9][0-9]*$");
                bool b_OtherMore     = System.Text.RegularExpressions.Regex.IsMatch(OtherMore.Text, @"^\+?[1-9][0-9]*$");
                bool b_minPrice      = System.Text.RegularExpressions.Regex.IsMatch(minPrice.Text, @"^\d+(\.\d+)?$");
                bool b_timerGrade    = System.Text.RegularExpressions.Regex.IsMatch(timerGrade.Text, @"^\+?[1-9][0-9]*$");
                bool b_mustToSell    = System.Text.RegularExpressions.Regex.IsMatch(mustToSell.Text, @"^\+?[1-9][0-9]*$");
                bool b_mustToBuy     = System.Text.RegularExpressions.Regex.IsMatch(mustToBuy.Text, @"^\+?[1-9][0-9]*$");
                bool b_otherToBuy    = System.Text.RegularExpressions.Regex.IsMatch(otherToBuy.Text, @"^\+?[1-9][0-9]*$");
                bool b_otherToSell   = System.Text.RegularExpressions.Regex.IsMatch(otherToSell.Text, @"^\+?[1-9][0-9]*$");
                bool b_maxOrderCount = System.Text.RegularExpressions.Regex.IsMatch(maxOrderCount.Text, @"^\+?[1-9][0-9]*$");

                if (!b_mustMore ||
                    !b_OtherMore ||
                    !b_minPrice ||
                    !b_timerGrade ||
                    !b_mustToSell ||
                    !b_mustToBuy ||
                    !b_otherToBuy ||
                    !b_otherToSell ||
                    !b_maxOrderCount)
                {
                    MessageBox.Show("输入的值不合法");
                }

                string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                string sql  = "UPDATE attrbute SET " +
                              "mustMore=" + mustMore.Text +
                              ",OtherMore=" + OtherMore.Text +
                              ",minPrice=" + minPrice.Text +
                              ",timerGrade=" + timerGrade.Text +
                              ",mustToSell=" + mustToSell.Text +
                              ",mustToBuy=" + mustToBuy.Text +
                              ",otherToBuy=" + otherToBuy.Text +
                              ",otherToSell=" + otherToSell.Text +
                              ",maxOrderCount=" + maxOrderCount.Text +
                              ",updateDate='" + time + "'" +
                              " WHERE fk_uid=" + uid;

                SqLiteHelper sqlHelper = new SqLiteHelper();
                sqlHelper.SqliteOpen();

                SQLiteDataReader srd = sqlHelper.Execute(sql);
                if (srd != null)
                {
                    MessageBox.Show("修改成功");
                    sqlHelper.SqliteClose();
                    Close();
                    return;
                }
                sqlHelper.SqliteClose();
            }
            catch
            {
                return;
            }
        }
예제 #2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (nullString(new string[] { txt_coinSymbol.Text, txt_password.Text, txt_uid.Text, txt_username.Text }))
            {
                MessageBox.Show("值不能为空");
                return;
            }
            bool nub = System.Text.RegularExpressions.Regex.IsMatch(txt_uid.Text, "^[0-9]*$");

            if (!nub)
            {
                MessageBox.Show("uid,只能是数字");
                return;
            }

            SqLiteHelper sqlHelp = new SqLiteHelper();

            try
            {
                sqlHelp.SqliteOpen();
                SQLiteDataReader reader = null;

                string sqluid = "SELECT * FROM user WHERE uid=" + txt_uid.Text + " or username='******' or coinSymbol='" + txt_coinSymbol.Text + "'";
                reader = sqlHelp.Execute(sqluid);
                if (reader.Read())
                {
                    MessageBox.Show("uid,账户,产品编码,不能重复插入");
                    sqlHelp.SqliteClose();
                    return;
                }
                string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                sqlHelp.InsertValuesNoKey("user", new string[] { txt_uid.Text, txt_username.Text,
                                                                 txt_password.Text, txt_coinSymbol.Text, txtRemarks.Text, time });

                string[] vaes = new string[] { txt_uid.Text, "1", "1", "0.001", "1", "30", "30", "80", "80", "100", time, time };
                sqlHelp.InsertValuesNoKey("attrbute", vaes);
                sqlHelp.SqliteClose();

                Close();
            }
            catch (Exception ex)
            {
                sqlHelp.SqliteClose();
                MessageBox.Show(ex.ToString());
            }
        }
예제 #3
0
파일: SYAttrbute.cs 프로젝트: jutao023/Wes
        private void LoadConfig()
        {
            SqLiteHelper sqlHelper = new SqLiteHelper();

            sqlHelper.SqliteOpen();
            try
            {
                string sql = "SELECT * FROM attrbute WHERE fk_uid=" + userId;
                //读取整张表
                SQLiteDataReader reader = sqlHelper.Execute(sql);
                if (reader != null)
                {
                    reader.Read();
                    mustMore      = reader.GetInt32(reader.GetOrdinal("mustMore"));
                    OtherMore     = reader.GetInt32(reader.GetOrdinal("OtherMore"));
                    minPrice      = reader.GetDouble(reader.GetOrdinal("minPrice"));
                    timerGrade    = reader.GetInt32(reader.GetOrdinal("timerGrade"));
                    mustToSell    = reader.GetInt32(reader.GetOrdinal("mustToSell"));
                    mustToBuy     = reader.GetInt32(reader.GetOrdinal("mustToBuy"));
                    otherToBuy    = reader.GetInt32(reader.GetOrdinal("otherToBuy"));
                    otherToSell   = reader.GetInt32(reader.GetOrdinal("otherToSell"));
                    maxOrderCount = reader.GetInt32(reader.GetOrdinal("maxOrderCount"));
                }
                else
                {
                    Print("加载配置信息异常即将交易停止!");
                    sqlHelper.SqliteClose();
                    closeTrade();
                    return;
                }
                sqlHelper.SqliteClose();
            }
            catch (Exception ex)
            {
                sqlHelper.SqliteClose();
                OnError(EnumExceptionCode.交易异常, "加载配置信息异常即将交易停止!\r\n" + ex.ToString());
                return;
            }
        }
예제 #4
0
        private void Setting_Load(object sender, EventArgs e)
        {
            this.Location = (Point) new Size(Control.MousePosition.X - 50, Control.MousePosition.Y - 80);

            SqLiteHelper sqlHelper = new SqLiteHelper();

            sqlHelper.SqliteOpen();
            try
            {
                string sql = "SELECT * FROM attrbute WHERE fk_uid=" + uid;
                //读取整张表
                SQLiteDataReader reader = sqlHelper.Execute(sql);
                if (reader != null)
                {
                    reader.Read();

                    reader.GetInt32(reader.GetOrdinal("attrbute_id"));
                    fk_uid.Text        = reader.GetInt32(reader.GetOrdinal("fk_uid")) + "";
                    mustMore.Text      = reader.GetInt32(reader.GetOrdinal("mustMore")) + "";
                    OtherMore.Text     = reader.GetInt32(reader.GetOrdinal("OtherMore")) + "";
                    minPrice.Text      = reader.GetDouble(reader.GetOrdinal("minPrice")) + "";
                    timerGrade.Text    = reader.GetInt32(reader.GetOrdinal("timerGrade")) + "";
                    mustToSell.Text    = reader.GetInt32(reader.GetOrdinal("mustToSell")) + "";
                    mustToBuy.Text     = reader.GetInt32(reader.GetOrdinal("mustToBuy")) + "";
                    otherToBuy.Text    = reader.GetInt32(reader.GetOrdinal("otherToBuy")) + "";
                    otherToSell.Text   = reader.GetInt32(reader.GetOrdinal("otherToSell")) + "";
                    maxOrderCount.Text = reader.GetInt32(reader.GetOrdinal("maxOrderCount")) + "";

                    reader.GetString(reader.GetOrdinal("updateDate"));
                    reader.GetString(reader.GetOrdinal("createDate"));
                }
                sqlHelper.SqliteClose();
            }
            catch
            {
                sqlHelper.SqliteClose();
            }
        }