public bool UpdatePasswordMember(string email, string password) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_UpdatePasswordMember"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@email", email); pa[1] = new SqlParameter("@password", password); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool CheckExistTransactionBitcoin(string strTransactionID) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_CheckExistTransactionBitcoinFE"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@TransactionBitcoin", strTransactionID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { rs = true; break; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool InsertMemberWallet(Member_WalletBO objMember_WalletBO) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_InsertMemberWallet"; SqlParameter[] pa = new SqlParameter[5]; pa[0] = new SqlParameter("@IndexWallet", objMember_WalletBO.IndexWallet); pa[1] = new SqlParameter("@IsActive", objMember_WalletBO.IsActive); pa[2] = new SqlParameter("@IsDelete", objMember_WalletBO.IsDelete); pa[3] = new SqlParameter("@MemberID", objMember_WalletBO.MemberID); pa[4] = new SqlParameter("@NumberCoin", objMember_WalletBO.NumberCoin); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public Package_CoinBO GetCoinValueByID(int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); Package_CoinBO objPackage_CoinBO = new Package_CoinBO(); try { bool rs = false; string sql = "SP_GetCoinValueByID"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { objPackage_CoinBO = new Package_CoinBO(); objPackage_CoinBO.PackageID = int.Parse(reader["packageid"].ToString()); objPackage_CoinBO.CoinID = int.Parse(reader["coinid"].ToString()); objPackage_CoinBO.PackageValue = double.Parse(reader["packagevalue"].ToString()); } return(objPackage_CoinBO); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception CheckPackageID_CoinIDExist admin : " + ex.Message); return(null); } finally { helper.destroy(); } }
public bool CheckEmailNotActive(string email) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_CheckEmailNotActive"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@email", email); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool UpdateIsDeletePackageCoin(Package_CoinBO package, int packageID, int coinID, int isDelete) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_DeletePackageCoin"; SqlParameter[] pa = new SqlParameter[5]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); pa[2] = new SqlParameter("@isDelete", isDelete); pa[3] = new SqlParameter("@deleteDate", package.DeleteDate); pa[4] = new SqlParameter("@deleteUser", package.DeleteUser); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool CheckPackageID_CoinIDExist(int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_CheckPackageID_CoinIDExist"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception CheckPackageID_CoinIDExist admin : " + ex.Message); return(false); } finally { helper.destroy(); } }
private static List <TransactionReceivedCoins> GetListTransaction(BitcoinSecret sonBitPrivateKey) { List <TransactionReceivedCoins> list = new List <TransactionReceivedCoins>(); try { var address = sonBitPrivateKey.GetAddress(); QBitNinjaClient client = new QBitNinjaClient(Network.TestNet); BalanceModel myBalance = client.GetBalance(address, unspentOnly: true).Result; foreach (BalanceOperation op in myBalance.Operations) { List <Coin> lstCoin = new List <Coin>(); var receivedCoins = op.ReceivedCoins; foreach (Coin e in receivedCoins) { lstCoin.Add(e); } TransactionReceivedCoins objTransactionReceivedCoins = new TransactionReceivedCoins { ListCoins = lstCoin, TransactionID = op.TransactionId, Confirm = op.Confirmations }; list.Add(objTransactionReceivedCoins); } } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); list = null; } return(list); }
public bool UpdateIsActive(int memberID, int isActive) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_UpdateActive"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@isActive", isActive); pa[1] = new SqlParameter("@memberID", memberID); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool UpdatePointsMemberFE(int memberID, double points) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_UpdatePointsMember_FE"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@memberID", memberID); pa[1] = new SqlParameter("@points", points); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public MemberInformationBO LoginAccount(string username, string password) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { MemberInformationBO objMemberBO = null; //string sql = "select UserName,Password,ac.GroupID from admin a left join AccessRight ac on a.AdminID=ac.AdminID where UserName=@userName and Password=@pass and IsActive=1 and IsDelete=0"; string sql = "SP_LoginAccount"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@email", username); pa[1] = new SqlParameter("@pass", password); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { objMemberBO = new MemberInformationBO { Address = reader["Address"].ToString(), Avatar = reader["Avatar"].ToString(), //objMemberBO.Birdthday = DateTime.Parse(reader["Birdthday"].ToString()); //objMemberBO.CreateDate = DateTime.Parse((reader["CreateDate"].ToString())); //objMemberBO.DeleteDate = DateTime.Parse(reader["DeleteDate"].ToString()); DeleteUser = reader["DeleteUser"].ToString(), Email = reader["Email"].ToString(), //objMemberBO.ExpireTimeLink = DateTime.Parse(reader["ExpireTimeLink"].ToString()); FullName = reader["FullName"].ToString(), Gender = int.Parse(reader["Gender"].ToString()), IndexWallet = int.Parse(reader["IndexWallet"].ToString()), IsActive = int.Parse(reader["IsActive"].ToString()), IsDelete = int.Parse(reader["IsDelete"].ToString()), LinkActive = reader["LinkActive"].ToString(), MemberID = int.Parse(reader["MemberID"].ToString()), Mobile = reader["Mobile"].ToString(), NumberCoin = float.Parse(reader["NumberCoin"].ToString()), //objMemberBO.TotalRecord = int.Parse(reader["TotalRecord"].ToString()); //objMemberBO.UpdateDate = DateTime.Parse(reader["UpdateDate"].ToString()); UpdateUser = reader["UpdateUser"].ToString(), WalletID = int.Parse(reader["WalletID"].ToString()) }; } return(objMemberBO); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception login Member : " + ex.Message); return(null); } finally { helper.destroy(); } }
public IEnumerable <MemberBO> GetListMember(int start, int end) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <MemberBO> lstMember = new List <MemberBO>(); string sql = "SP_GetListMember"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@start", start); pa[1] = new SqlParameter("@end", end); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { MemberBO member = new MemberBO { MemberID = int.Parse(reader["MemberID"].ToString()), Password = reader["Password"].ToString(), Email = reader["Email"].ToString(), CreateDate = DateTime.Parse(reader["CreateDate"].ToString()), Address = reader["Address"].ToString(), Avatar = reader["Avatar"].ToString(), Birdthday = DateTime.Parse(reader["Birdthday"].ToString()), DeleteDate = DateTime.Parse(reader["DeleteDate"].ToString()), DeleteUser = reader["DeleteUser"].ToString(), ExpireTimeLink = DateTime.Parse(reader["ExpireTimeLink"].ToString()), FullName = reader["FullName"].ToString(), Gender = int.Parse(reader["Gender"].ToString()), IsActive = int.Parse(reader["IsActive"].ToString()), IsDelete = int.Parse(reader["IsDelete"].ToString()), LinkActive = reader["LinkActive"].ToString(), Mobile = reader["Mobile"].ToString(), UpdateDate = DateTime.Parse(reader["UpdateDate"].ToString()), UpdateUser = reader["UpdateUser"].ToString(), TotalRecord = int.Parse(reader["TOTALROWS"].ToString()) }; lstMember.Add(member); } return(lstMember); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public bool UpdateMember(MemberBO member, int memberID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { SqlParameter[] pa = new SqlParameter[10]; string sql = "SP_UpdateMember"; pa[0] = new SqlParameter("@email", member.Email); pa[1] = new SqlParameter("@password", member.Password); pa[2] = new SqlParameter("@isActive", member.IsActive); pa[3] = new SqlParameter("@createDate", member.CreateDate); pa[4] = new SqlParameter("@fullName", member.FullName); pa[5] = new SqlParameter("@gender", member.Gender); pa[6] = new SqlParameter("@mobile", member.Mobile); //pa[8] = new SqlParameter("@addRess", member.Address); // pa[9] = new SqlParameter("@updateDate", member.UpdateDate); //pa[10] = new SqlParameter("@deleteDate", member.DeleteDate); //pa[9] = new SqlParameter("@linkActive", member.LinkActive); //pa[12] = new SqlParameter("@deleteUser", member.DeleteUser); // pa[10] = new SqlParameter("@expireTimeLink", member.ExpireTimeLink); // pa[11] = new SqlParameter("@birdthday", member.Birdthday); //pa[15] = new SqlParameter("@updateUser", member.UpdateUser); pa[7] = new SqlParameter("@isDelete", member.IsDelete); pa[8] = new SqlParameter("@avatar", member.Avatar); pa[9] = new SqlParameter("@memberID", member.MemberID); SqlCommand command = helper.GetCommand(sql, pa, true); //adminID = Convert.ToInt32(command.ExecuteScalar()); //return adminID; int row = command.ExecuteNonQuery(); bool rs = false; if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception insert admin : " + ex.Message); return(false); } finally { helper.destroy(); } }
public IEnumerable <TransactionCoinBO> ListTransactionWalletBySearch(int memberID, DateTime fromDate, DateTime toDate, int start, int end) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <TransactionCoinBO> lstTransaction = new List <TransactionCoinBO>(); string sql = "SP_ListTransactionWalletBySearchFrontEnd"; SqlParameter[] pa = new SqlParameter[5]; pa[0] = new SqlParameter("@memberID", memberID); pa[1] = new SqlParameter("@start", start); pa[2] = new SqlParameter("@end", end); pa[3] = new SqlParameter("@fromDate", fromDate); pa[4] = new SqlParameter("@toDate", toDate); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { TransactionCoinBO transaction = new TransactionCoinBO { CreateDate = DateTime.Parse(reader["CreateDate"].ToString()), ExpireDate = DateTime.Parse(reader["ExpireDate"].ToString()), MemberID = int.Parse(reader["MemberID"].ToString()), Note = reader["Note"].ToString(), QRCode = reader["QRCode"].ToString(), Status = int.Parse(reader["Status"].ToString()), TransactionBitcoin = reader["TransactionBitcoin"].ToString(), TransactionID = reader["TransactionID"].ToString(), TypeTransactionID = int.Parse(reader["TypeTransactionID"].ToString()), ValueTransaction = double.Parse(reader["ValueTransaction"].ToString()), WalletAddressID = reader["WalletAddressID"].ToString(), WalletID = reader["WalletID"].ToString(), TotalRecord = int.Parse(reader["TOTALROWS"].ToString()) }; lstTransaction.Add(transaction); } return(lstTransaction); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public bool UpdatePackageCoin(Package_CoinBO packageCoin, int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { SqlParameter[] pa = new SqlParameter[4]; string sql = "SP_UpdatePackageCoin"; pa[0] = new SqlParameter("@packageID", packageID); pa[1] = new SqlParameter("@coinID", coinID); pa[2] = new SqlParameter("@packageValue", packageCoin.PackageValue); //pa[3] = new SqlParameter("@createDate", packageCoin.CreateDate); //pa[2] = new SqlParameter("@isDelete", package.IsDelete); //pa[3] = new SqlParameter("@createDate", package.CreateDate); //pa[4] = new SqlParameter("@createUser", package.CreateUser); //pa[3] = new SqlParameter("@updateDate", package.UpdateDate); //pa[4] = new SqlParameter("@updateUser", package.UpdateUser); //pa[7] = new SqlParameter("@deleteDate", package.DeleteDate); //pa[8] = new SqlParameter("@deleteUser", package.DeleteUser); SqlCommand command = helper.GetCommand(sql, pa, true); //adminID = Convert.ToInt32(command.ExecuteScalar()); //return adminID; int row = command.ExecuteNonQuery(); bool rs = false; if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, "Exception update package : " + ex.Message); return(false); } finally { helper.destroy(); } }
public TransactionCoinBO transactionCoinByID(string strTransactionID) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { string sql = "SP_TransactionWalletByID"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@transactionid", strTransactionID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); TransactionCoinBO objTransactionCoinBO = new TransactionCoinBO(); if (reader.Read()) { objTransactionCoinBO = new TransactionCoinBO { CreateDate = DateTime.Parse(reader["CreateDate"].ToString()), ExpireDate = DateTime.Parse(reader["ExpireDate"].ToString()), MemberID = int.Parse(reader["MemberID"].ToString()), Note = reader["Note"].ToString(), QRCode = reader["QRCode"].ToString(), Status = int.Parse(reader["Status"].ToString()), TransactionBitcoin = reader["TransactionBitcoin"].ToString(), TransactionID = reader["TransactionID"].ToString(), TypeTransactionID = int.Parse(reader["TypeTransactionID"].ToString()), ValueTransaction = double.Parse(reader["ValueTransaction"].ToString()), WalletAddressID = reader["WalletAddressID"].ToString(), WalletID = reader["WalletID"].ToString() //TotalRecord = int.Parse(reader["TOTALROWS"].ToString()) }; } return(objTransactionCoinBO); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public IEnumerable <Package_CoinBO> ListAllPackageCoin(int start, int end) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <Package_CoinBO> lstPackage = new List <Package_CoinBO>(); string sql = "SP_ListAllPackageCoin"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@start", start); pa[1] = new SqlParameter("@end", end); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Package_CoinBO packageCoin = new Package_CoinBO(); packageCoin.PackageID = int.Parse(reader["PackageID"].ToString()); packageCoin.CoinID = int.Parse(reader["CoinID"].ToString()); packageCoin.PackageName = reader["PackageName"].ToString(); packageCoin.CoinName = reader["CoinName"].ToString(); packageCoin.PackageValue = double.Parse(reader["PackageValue"].ToString()); packageCoin.CreateDate = DateTime.Parse(reader["CreateDate"].ToString()); packageCoin.TotalRecord = int.Parse(reader["TOTALROWS"].ToString()); lstPackage.Add(packageCoin); } return(lstPackage); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
//public bool LockAndUnlockPackage(int packageID, int isActive) //{ // string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); // Sqlhelper helper = new Sqlhelper("", "ConnectionString"); // try // { // bool rs = false; // string sql = "SP_LockAndUnlockPackage"; // SqlParameter[] pa = new SqlParameter[2]; // pa[0] = new SqlParameter("@isActive", isActive); // pa[1] = new SqlParameter("@packageID", packageID); // SqlCommand command = helper.GetCommand(sql, pa, true); // int row = command.ExecuteNonQuery(); // if (row > 0) // { // rs = true; // } // return rs; // } // catch (Exception ex) // { // Utilitys.WriteLog(fileLog, ex.Message); // return false; // } // finally // { // helper.destroy(); // } //} public IEnumerable <PackageInformationBO> ListAllPackageInformation() { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <PackageInformationBO> lstPackage = new List <PackageInformationBO>(); string sql = "SP_ListAllPackageInformation"; SqlCommand command = helper.GetCommandNonParameter(sql, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { PackageInformationBO package = new PackageInformationBO(); package.PackageID = int.Parse(reader["PackageID"].ToString()); package.CoinID = int.Parse(reader["CoinID"].ToString()); package.PackageName = reader["PackageName"].ToString(); package.PackageValue = double.Parse(reader["PackageValue"].ToString()); //package.CreateDate = DateTime.Parse(reader["CreateDate"].ToString()); package.CoinName = reader["CoinName"].ToString(); package.PackageValue = double.Parse(reader["PackageValue"].ToString()); //package.DeleteUser = reader["DeleteUser"].ToString(); //package.DeleteDate = DateTime.Parse(reader["DeleteDate"].ToString()); //package.TotalRecord = int.Parse(reader["TOTALROWS"].ToString()); package.Price = double.Parse(reader["Price"].ToString()); lstPackage.Add(package); } return(lstPackage); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public TransactionPackageBO DetailTransactionPackage(int memberID, string strTransactionCode) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { TransactionPackageBO transaction = new TransactionPackageBO(); string sql = "SP_ListTransactionPackageByCode"; SqlParameter[] pa = new SqlParameter[2]; pa[0] = new SqlParameter("@memberID", memberID); pa[1] = new SqlParameter("@transactioncode", strTransactionCode); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { transaction.MemberID = int.Parse(reader["MemberID"].ToString()); transaction.Status = int.Parse(reader["Status"].ToString()); transaction.CoinID = int.Parse(reader["CoinID"].ToString()); transaction.CreateDate = DateTime.Parse(reader["CreateDate"].ToString()); transaction.ExpireDate = DateTime.Parse(reader["ExpireDate"].ToString()); transaction.PackageID = int.Parse(reader["PackageID"].ToString()); transaction.PackageName = reader["PackageName"].ToString(); transaction.TransactionCode = reader["TransactionCode"].ToString(); transaction.PackageValue = float.Parse(reader["PackageValue"].ToString()); transaction.CoinValue = float.Parse(reader["CoinValue"].ToString()); transaction.CoinName = reader["CoinName"].ToString(); transaction.Note = reader["Note"].ToString(); } return(transaction); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public IEnumerable <TransactionPackageBO> ListTransactionPackageByMember(int memberID) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <TransactionPackageBO> lstTransaction = new List <TransactionPackageBO>(); string sql = "SP_ListTransactionByMember"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@memberID", memberID); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { TransactionPackageBO transaction = new TransactionPackageBO(); transaction.MemberID = int.Parse(reader["MemberID"].ToString()); transaction.Status = int.Parse(reader["Status"].ToString()); transaction.CoinID = int.Parse(reader["CoinID"].ToString()); transaction.CreateDate = DateTime.Parse(reader["CreateDate"].ToString()); transaction.ExpireDate = DateTime.Parse(reader["ExpireDate"].ToString()); transaction.PackageID = int.Parse(reader["PackageID"].ToString()); transaction.PackageName = reader["PackageName"].ToString(); transaction.PackageValue = float.Parse(reader["PackageValue"].ToString()); transaction.TransactionCode = reader["TransactionCode"].ToString(); transaction.Note = reader["Note"].ToString(); lstTransaction.Add(transaction); } return(lstTransaction); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public bool InsertTransactionCoin(TransactionCoinBO transaction) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_InsertTransactionCoinFE"; SqlParameter[] pa = new SqlParameter[12]; pa[0] = new SqlParameter("@TransactionID", transaction.TransactionID); pa[1] = new SqlParameter("@WalletAddressID", transaction.WalletAddressID); pa[2] = new SqlParameter("@MemberID", transaction.MemberID); pa[3] = new SqlParameter("@ValueTransaction", transaction.ValueTransaction); pa[4] = new SqlParameter("@QRCode", transaction.QRCode); pa[5] = new SqlParameter("@CreateDate", transaction.CreateDate); pa[6] = new SqlParameter("@ExpireDate", transaction.ExpireDate); pa[7] = new SqlParameter("@Status", transaction.Status); pa[8] = new SqlParameter("@Note", transaction.Note); pa[9] = new SqlParameter("@WalletID", transaction.WalletID); pa[10] = new SqlParameter("@TypeTransactionID", transaction.TypeTransactionID); pa[11] = new SqlParameter("@TransactionBitcoin", transaction.TransactionBitcoin); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public bool InsertTransactionPackage(TransactionPackageBO transaction) { Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { bool rs = false; string sql = "SP_InsertTransactionPackageFE"; SqlParameter[] pa = new SqlParameter[10]; pa[0] = new SqlParameter("@memberid", transaction.MemberID); pa[1] = new SqlParameter("@packageid", transaction.PackageID); pa[2] = new SqlParameter("@coinid", transaction.CoinID); pa[3] = new SqlParameter("@createdate", transaction.CreateDate); pa[4] = new SqlParameter("@expiredate", transaction.ExpireDate); pa[5] = new SqlParameter("@status", transaction.Status); pa[6] = new SqlParameter("@transactioncode", transaction.TransactionCode); pa[7] = new SqlParameter("@note", transaction.Note); pa[8] = new SqlParameter("@transactionbitcoin", transaction.TransactionBitcoin); pa[9] = new SqlParameter("@packagevalue", transaction.PackageValue); SqlCommand command = helper.GetCommand(sql, pa, true); int row = command.ExecuteNonQuery(); if (row > 0) { rs = true; } return(rs); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(false); } finally { helper.destroy(); } }
public IEnumerable <CoinBO> ListAllCoin() { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { List <CoinBO> lstPackage = new List <CoinBO>(); string sql = "SP_ListAllCoin"; SqlCommand command = helper.GetCommandNonParameter(sql, true); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { CoinBO packageCoin = new CoinBO(); packageCoin.CoinID = int.Parse(reader["CoinID"].ToString()); packageCoin.CoinName = reader["CoinName"].ToString(); packageCoin.IsDelete = int.Parse(reader["IsDelete"].ToString()); //packageCoin.TotalRecord = int.Parse(reader["TOTALROWS"].ToString()); lstPackage.Add(packageCoin); } return(lstPackage); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public MemberBO GetMemberDetailByEmail(string email) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog, "Logs")); Sqlhelper helper = new Sqlhelper("", "ConnectionString"); try { MemberBO member = null; string sql = "SP_GetMemberByEmail"; SqlParameter[] pa = new SqlParameter[1]; pa[0] = new SqlParameter("@email", email); SqlCommand command = helper.GetCommand(sql, pa, true); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { member = new MemberBO { MemberID = int.Parse(reader["MemberID"].ToString()), Email = reader["Email"].ToString(), IsActive = int.Parse(reader["IsActive"].ToString()), IsDelete = int.Parse(reader["IsDelete"].ToString()) }; } return(member); } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); return(null); } finally { helper.destroy(); } }
public void LoadPoint() { try { string transactionCode = ""; string strClientExtKey = masterKey; RandomUtils.Random = new UnsecureRandom(); ExtKey masterPubKey = new BitcoinExtKey(strClientExtKey, Network.TestNet); MemberInformationBO member = (MemberInformationBO)Session["MemberInfomation"]; bool rs = true; if (member != null) { ExtKey pubkey = masterPubKey.Derive(member.IndexWallet, hardened: true); var clientBitPrivateKey = masterPubKey.PrivateKey; var destination = clientBitPrivateKey.PubKey.GetAddress(Network.TestNet); //check valid amount var userBitPK = pubkey.PrivateKey.GetBitcoinSecret(Network.TestNet); List <TransactionReceivedCoins> LstUserCoin = GetListTransaction(userBitPK); if (LstUserCoin != null && LstUserCoin.Count > 0) { foreach (TransactionReceivedCoins item in LstUserCoin) { if (item.Confirm >= 0) { bool boolCheckExistTransactionID = ObjITransactionWalletService.CheckExistTransactionBitcoin(item.TransactionID.ToString()); if (!boolCheckExistTransactionID) { if (item.ListCoins != null && item.ListCoins.Count > 0) { foreach (var itemListCoins in item.ListCoins) { ////Change bitcoin to point //float pointChange = ((float.Parse(strPoint)) * CoinValue) / PointValue; string strCode = Utility.GenCode(); string tick = DateTime.Now.Ticks.ToString(); transactionCode = Utility.MaHoaMD5(strCode + tick); TransactionCoinBO objTransactionCoinBO = new TransactionCoinBO { CreateDate = DateTime.Now, ExpireDate = DateTime.Now.AddMinutes(double.Parse(TimeExpired)), MemberID = member.MemberID, Note = "Received Coins", QRCode = "", Status = 0, TransactionBitcoin = item.TransactionID.ToString(), TransactionID = transactionCode, TypeTransactionID = 0, ValueTransaction = float.Parse(itemListCoins.Amount.ToString()), WalletAddressID = userBitPK.GetAddress().ToString(), WalletID = destination.ToString() }; //objTransactionCoinBO.WalletID = destination.ToString(); bool rs_ = ObjITransactionWalletService.InsertTransactionCoin(objTransactionCoinBO); if (rs_) { //double pointChange = ((double.Parse(itemListCoins.Amount.ToString())) * PointValue) / CoinValue; rs = ObjITransactionWalletService.UpdatePointsMemberFE(member.MemberID, double.Parse(itemListCoins.Amount.ToString())); if (!rs) { break; } } } } } } } } //if (rs) //{ // double memeberPoints = objMemberRepository.GetPointsMember(member.MemberID); // result = memeberPoints.ToString(); //} MemberInformationBO ọbjMemberInformationBO = new MemberInformationBO(); ọbjMemberInformationBO = ObjIIMemberService.GetInformationMemberByID(member.MemberID); if (ọbjMemberInformationBO != null) { Session["MemberInfomation"] = null; Session["MemberInfomation"] = ọbjMemberInformationBO; } } } catch (Exception ex) { Utilitys.WriteLog(fileLog, ex.Message); } }