public static void DebitUser(string brinqaccountNumber, double Amount) { Transaction transaction = new Transaction(); var db = new Kaedc(); var user = db.Kaedcuser.Where(k => k.BrinqaccountNumber == brinqaccountNumber).FirstOrDefault(); //update user's balance var amount = Convert.ToInt64(Amount); user.MainBalance = user.MainBalance - amount; //update DB transaction.Id = GenerateId(); transaction.ServiceId = 3; transaction.Amount = Amount; transaction.PayersName = user.UserName; transaction.PaymentMethodId = 1; transaction.transactionsStatus = "completed"; transaction.Datetime = DateTime.Now; transaction.KaedcUserNavigation = user; transaction.Service = db.Service.Where(s => s.Id == 4).FirstOrDefault(); db.Add(transaction); db.SaveChanges(); }
public LoginModel(SignInManager <Kaedcuser> signInManager, ILogger <LoginModel> logger, UserManager <Kaedcuser> userManager, Kaedc context) { _signInManager = signInManager; _logger = logger; _context = context; _userManager = userManager; }
public static void AddProfit(Kaedcuser user, Transaction transaction) { Transaction profitTransacton = new Transaction(); Kaedc db = new Kaedc(); var amount = transaction.Amount; const double commission = 0.005; double profit = 0.0; if (transaction.ServiceId == 1) { profit = transaction.Amount * commission; } user.MainBalance += Convert.ToDecimal(profit); profitTransacton.Id = GenerateId(); profitTransacton.ServiceId = 6; profitTransacton.AgentProfit = Convert.ToDecimal(profit); profitTransacton.Amount = profit; profitTransacton.PayersName = user.UserName; profitTransacton.PaymentMethodId = 1; profitTransacton.transactionsStatus = "completed"; profitTransacton.Datetime = DateTime.Now; profitTransacton.KaedcUserNavigation = user; //profitTransacton.Service = db.Service.Where(s => s.Id == 6).FirstOrDefault(); db.Add(profitTransacton); }
public static int GenerateId() { Kaedc db = new Kaedc(); var lastId = db.Transaction.LastOrDefault().Id + 1; return(lastId); }
public IActionResult addcustomer() { Kaedc db = new Kaedc(); ViewBag.ROLES = db.Roles.ToList(); return(View()); }
public IActionResult customerList() { Kaedc db = new Kaedc(); ViewBag.CUSTOMERS = db.Kaedcuser.ToList(); return(View()); }
public AccountController(UserManager <Kaedcuser> userManager, SignInManager <Kaedcuser> signInManager, ILogger <RegisterBindingModel> logger, IEmailSender emailSender, IConfiguration configuration, Kaedc _db) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _emailSender = emailSender; Configuration = configuration; db = _db; }
public RegisterModel( UserManager <Kaedcuser> userManager, SignInManager <Kaedcuser> signInManager, ILogger <RegisterModel> logger, IEmailSender emailSender, Kaedc _db) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _emailSender = emailSender; db = _db; }
public UtilityController(Kaedc context) { _context = context; }
public TransactionService(IHostingEnvironment hostingEnvironment, Kaedc context) { _hostingEnvironment = hostingEnvironment; _context = context; }
public TransactionsController(Kaedc context, ITransaction transaction) { _context = context; _transaction = transaction; }
public ReportController(Kaedc context) { _context = context; }
public CustomerController(Kaedc _db) { db = _db; }
//static string baseUri_MeterInfo = "https://irecharge.com.ng/pwr_api_sandbox/v2/get_meter_info.php"; //TODO: Parameterize //static string baseUri_VendPower = "https://irecharge.com.ng/pwr_api_sandbox/v2/vend_power.php"; //TODO: Parameterize //static string pubkey = "c5165ff3eab458e89425bad8c4f0908c"; //TODO: Parameterize //static string privKey = "66a7b282a044c656f037230200a3f53ea6e25227b8977c15e91822505bedc0319fbb69338f565c2e834382e62d2ebf8dddd35c5b14b44d07750b0597bdf106c5"; //TODO: Parameterize //static string vendor_code = "1901E58329"; //TODO: Parameterize public ElectricityController(Kaedc db, IConfiguration configuration, UserManager <Kaedcuser> userManager) { _db = db; _configuration = configuration; _userManager = userManager; }
public ServicesController(Kaedc context) { _context = context; }
public TransactionController(UserManager <Kaedcuser> userManager, Kaedc _db) { _userManager = userManager; db = _db; }