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 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 string UpdateIsDeletePackageCoin(Package_CoinBO packageCoin, int packageID, int coinID, int isDelete) { string result = ""; int statusNew = -1; if (isDelete == 0) { statusNew = 1; } else { statusNew = 0; } packageCoin.IsDelete = statusNew; packageCoin.DeleteDate = DateTime.Now; packageCoin.DeleteUser = (string)Session["FullName"]; bool rs = packageCoinRepository.UpdateIsDeletePackageCoin(packageCoin, packageID, coinID, statusNew); if (rs) { result = "success"; } return(result); }
public string InsertTransactionPackage(string packageId, string coinId) { MemberInformationBO member = new MemberInformationBO(); Package_CoinBO objPackage_CoinBO = new Package_CoinBO(); double NumberCoin = 0; double PackageValue = 0; string result = "Fail"; if (Session["MemberInfomation"] != null) { member = (MemberInformationBO)Session["MemberInfomation"]; NumberCoin = member.NumberCoin; } else { Response.Redirect("/"); } objPackage_CoinBO = IPackage_CoinServices.GetCoinValueByID(int.Parse(packageId), int.Parse(coinId)); if (objPackage_CoinBO != null) { PackageValue = objPackage_CoinBO.PackageValue; } if (NumberCoin > 0) { if (NumberCoin >= PackageValue) { string strCode = Utility.GenCode(); string tick = DateTime.Now.Ticks.ToString(); string transactionCode = Utility.MaHoaMD5(strCode + tick); bool rs = TransactionPackageRepository.InsertTransactionPackage(new TransactionPackageBO { CoinID = int.Parse(coinId), CreateDate = DateTime.Now, ExpireDate = DateTime.Now.AddDays(30), ExchangeRateID = -1, MemberID = member.MemberID, Note = "Buy package", PackageID = int.Parse(packageId), Status = 1, TransactionCode = transactionCode, TransactionBitcoin = "", PackageValue = PackageValue }); if (rs) { result = "success"; } } else { result = "You do not enough coin."; } } else { result = "Please recharge your wallet."; } return(result); }
public bool UpdateIsDeletePackageCoin(Package_CoinBO package, int packageID, int coinID, int isDelete) { bool row = false; string fileLog = Path.GetDirectoryName(Path.Combine(pathLog)); try { row = Proxy.UpdateIsDeletePackageCoin(package, packageID, coinID, isDelete); } catch (Exception ex) { Utility.WriteLog(fileLog, ex.Message); } return(row); }
public bool InsertPackageCoin(Package_CoinBO packageCoin) { bool row = false; string fileLog = Path.GetDirectoryName(Path.Combine(pathLog)); try { row = Proxy.InsertPackageCoin(packageCoin); } catch (Exception ex) { Utility.WriteLog(fileLog, ex.Message); } return(row); }
public Package_CoinBO GetCoinValueByID(int packageID, int coinID) { string fileLog = Path.GetDirectoryName(Path.Combine(pathLog)); try { Package_CoinBO packageCoin = Proxy.GetCoinValueByID(packageID, coinID); return(packageCoin); } catch (Exception ex) { Utility.WriteLog(fileLog, ex.Message); return(null); } }
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 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 string UpdatePackageCoin(int packageID, int coinID, double packageValue) { string result = ""; Package_CoinBO packageCoin = new Package_CoinBO(); //if (Session["Emailmember"] == null) //{ // Response.Redirect("/login"); //} try { packageCoin.PackageValue = packageValue; packageCoin.PackageID = packageID; packageCoin.CoinID = coinID; bool CheckPackageID_CoinIDExist = packageCoinRepository.CheckPackageID_CoinIDExist(packageID, coinID); if (CheckPackageID_CoinIDExist) { result = "PackageCoinIDExist"; } else { bool updatePackage = packageCoinRepository.UpdatePackageCoin(packageCoin, packageID, coinID); if (updatePackage) { result = "Updatesuccess"; } else { result = "Updatefaile"; } } } catch { result = "Erorr"; } return(result); }
public string SavePackageCoin(int hdPackageID, int hdCoinID, int packageID, int coinID, double packageValue) { string result = ""; Package_CoinBO packageCoin = new Package_CoinBO(); if (Session["Emailmember"] == null) { Response.Redirect("/login"); } //int hdPackageID = 0; //int hdCoin = 0; if (hdPackageID == 0 && hdCoinID == 0) //if(packageID>0) { try { packageCoin.PackageID = packageID; packageCoin.CoinID = coinID; packageCoin.PackageValue = packageValue; packageCoin.IsDelete = 0; packageCoin.CreateDate = DateTime.Now; bool CheckPackageID_CoinIDExist = packageCoinRepository.CheckPackageID_CoinIDExist(packageID, coinID); if (CheckPackageID_CoinIDExist) { result = "PackageCoinIDExist"; } else { bool insert = packageCoinRepository.InsertPackageCoin(packageCoin); if (insert) { result = "Updatesuccess"; } else { result = "Updatefaile"; } } } catch { result = "Erorr"; } } else if (hdPackageID > 0 && hdCoinID > 0) { try { packageCoin.PackageValue = packageValue; packageCoin.PackageID = packageID; packageCoin.CoinID = coinID; //bool CheckPackageID_CoinIDExist = packageCoinRepository.CheckPackageID_CoinIDExist(packageID, coinID); //if (CheckPackageID_CoinIDExist) //{ // result = "PackageCoinIDExist"; //} //else //{ bool updatePackage = packageCoinRepository.UpdatePackageCoin(packageCoin, packageID, coinID); if (updatePackage) { result = "Updatesuccess"; } else { result = "Updatefaile"; } //} } catch { result = "Erorr"; } } return(result); }