public RegisterUserConfig ToDBObject() { RegisterUserConfig uiConfig = new RegisterUserConfig() { GiveToNewUserExp = this.GiveToNewUserExp, GiveToNewUserGoldCoin = this.GiveToNewUserGoldCoin, GiveToNewUserMiners = this.GiveToNewUserMiners, GiveToNewUserMines = this.GiveToNewUserMines, GiveToNewUserStones = this.GiveToNewUserStones, UserCountCreateByOneIP = this.UserCountCreateByOneIP, FirstAlipayRechargeGoldCoinAwardMultiple = this.FirstAlipayRechargeGoldCoinAwardMultiple }; return(uiConfig); }
//public IncomeMoneyAccount GetIncomeMoneyAccountConfig() //{ // IncomeMoneyAccount config = null; // MySqlConnection myconn = null; // try // { // myconn = MyDBHelper.Instance.CreateConnection(); // myconn.Open(); // DataTable table = new DataTable(); // string cmdText = "SELECT * FROM incomemoneyaccount"; // MySqlCommand mycmd = new MySqlCommand(cmdText, myconn); // MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); // adapter.Fill(table); // if (table.Rows.Count != 0) // { // config = new IncomeMoneyAccount(); // config.IncomeMoneyAlipay = Convert.ToString(table.Rows[0]["IncomeMoneyAlipay"]); // config.IncomeMoneyAlipayRealName = Convert.ToString(table.Rows[0]["IncomeMoneyAlipayRealName"]); // config.Alipay2DCode = (byte[])table.Rows[0]["Alipay2DCode"]; // } // table.Clear(); // table.Dispose(); // adapter.Dispose(); // mycmd.Dispose(); // return config; // } // catch (Exception exc) // { // throw exc; // } // finally // { // MyDBHelper.Instance.DisposeConnection(myconn); // } //} //public bool SaveIncomeMoneyAccountConfig(IncomeMoneyAccount config) //{ // MySqlConnection myconn = null; // try // { // myconn = MyDBHelper.Instance.CreateConnection(); // myconn.Open(); // string cmdText = "delete from incomemoneyaccount; " + // "insert into incomemoneyaccount (IncomeMoneyAlipay, IncomeMoneyAlipayRealName, Alipay2DCode) values " + // " (@IncomeMoneyAlipay, @IncomeMoneyAlipayRealName, @Alipay2DCode)"; // MySqlCommand mycmd = new MySqlCommand(cmdText, myconn); // mycmd.Parameters.AddWithValue("@IncomeMoneyAlipay", config.IncomeMoneyAlipay); // mycmd.Parameters.AddWithValue("@IncomeMoneyAlipayRealName", config.IncomeMoneyAlipayRealName); // mycmd.Parameters.AddWithValue("@Alipay2DCode", config.Alipay2DCode); // mycmd.ExecuteNonQuery(); // mycmd.Dispose(); // return true; // } // catch (Exception exc) // { // throw exc; // } // finally // { // MyDBHelper.Instance.DisposeConnection(myconn); // } //} #endregion #region RegisterUserConfig public RegisterUserConfig GetRegisterUserConfig() { RegisterUserConfig config = null; MySqlConnection myconn = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); DataTable table = new DataTable(); string cmdText = "SELECT * FROM registeruserconfig"; MySqlCommand mycmd = new MySqlCommand(cmdText, myconn); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(table); if (table.Rows.Count != 0) { config = new RegisterUserConfig(); config.UserCountCreateByOneIP = Convert.ToInt32(table.Rows[0]["UserCountCreateByOneIP"]); config.GiveToNewUserExp = Convert.ToDecimal(table.Rows[0]["GiveToNewUserExp"]); config.GiveToNewUserGoldCoin = Convert.ToDecimal(table.Rows[0]["GiveToNewUserGoldCoin"]); config.GiveToNewUserMines = Convert.ToDecimal(table.Rows[0]["GiveToNewUserMines"]); config.GiveToNewUserMiners = Convert.ToInt32(table.Rows[0]["GiveToNewUserMiners"]); config.GiveToNewUserStones = Convert.ToDecimal(table.Rows[0]["GiveToNewUserStones"]); config.FirstAlipayRechargeGoldCoinAwardMultiple = Convert.ToSingle(table.Rows[0]["FirstAlipayRechargeGoldCoinAwardMultiple"]); } table.Clear(); table.Dispose(); adapter.Dispose(); mycmd.Dispose(); return(config); } catch (Exception exc) { throw exc; } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }
public static RegisterUserConfigUIModel CreateFromDBObject(RegisterUserConfig parent) { if (parent == null) { return(new RegisterUserConfigUIModel()); } RegisterUserConfigUIModel uiConfig = new RegisterUserConfigUIModel() { GiveToNewUserExp = parent.GiveToNewUserExp, GiveToNewUserGoldCoin = parent.GiveToNewUserGoldCoin, GiveToNewUserMiners = parent.GiveToNewUserMiners, GiveToNewUserMines = parent.GiveToNewUserMines, GiveToNewUserStones = parent.GiveToNewUserStones, UserCountCreateByOneIP = parent.UserCountCreateByOneIP, FirstAlipayRechargeGoldCoinAwardMultiple = parent.FirstAlipayRechargeGoldCoinAwardMultiple }; return(uiConfig); }
public bool SaveRegisterUserConfig(RegisterUserConfig config, CustomerMySqlTransaction trans) { MySqlCommand mycmd = trans.CreateCommand(); string cmdText = "delete from registeruserconfig; " + "insert into registeruserconfig (UserCountCreateByOneIP, GiveToNewUserExp, GiveToNewUserGoldCoin, GiveToNewUserMines, GiveToNewUserMiners, GiveToNewUserStones, FirstAlipayRechargeGoldCoinAwardMultiple ) values " + " (@UserCountCreateByOneIP, @GiveToNewUserExp, @GiveToNewUserGoldCoin, @GiveToNewUserMines, @GiveToNewUserMiners, @GiveToNewUserStones, @FirstAlipayRechargeGoldCoinAwardMultiple )"; mycmd.CommandText = cmdText; mycmd.Parameters.AddWithValue("@UserCountCreateByOneIP", config.UserCountCreateByOneIP); mycmd.Parameters.AddWithValue("@GiveToNewUserExp", config.GiveToNewUserExp); mycmd.Parameters.AddWithValue("@GiveToNewUserGoldCoin", config.GiveToNewUserGoldCoin); mycmd.Parameters.AddWithValue("@GiveToNewUserMines", config.GiveToNewUserMines); mycmd.Parameters.AddWithValue("@GiveToNewUserMiners", config.GiveToNewUserMiners); mycmd.Parameters.AddWithValue("@GiveToNewUserStones", config.GiveToNewUserStones); mycmd.Parameters.AddWithValue("@FirstAlipayRechargeGoldCoinAwardMultiple", config.FirstAlipayRechargeGoldCoinAwardMultiple); mycmd.ExecuteNonQuery(); //mycmd.Dispose(); return(true); }