Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public LoginModel(SignInManager <Kaedcuser> signInManager, ILogger <LoginModel> logger, UserManager <Kaedcuser> userManager, Kaedc context)
 {
     _signInManager = signInManager;
     _logger        = logger;
     _context       = context;
     _userManager   = userManager;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public static int GenerateId()
        {
            Kaedc db     = new Kaedc();
            var   lastId = db.Transaction.LastOrDefault().Id + 1;

            return(lastId);
        }
Esempio n. 5
0
        public IActionResult addcustomer()
        {
            Kaedc db = new Kaedc();

            ViewBag.ROLES = db.Roles.ToList();
            return(View());
        }
Esempio n. 6
0
        public IActionResult customerList()
        {
            Kaedc db = new Kaedc();

            ViewBag.CUSTOMERS = db.Kaedcuser.ToList();
            return(View());
        }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
 public UtilityController(Kaedc context)
 {
     _context = context;
 }
Esempio n. 10
0
 public TransactionService(IHostingEnvironment hostingEnvironment, Kaedc context)
 {
     _hostingEnvironment = hostingEnvironment;
     _context            = context;
 }
Esempio n. 11
0
 public TransactionsController(Kaedc context, ITransaction transaction)
 {
     _context     = context;
     _transaction = transaction;
 }
Esempio n. 12
0
 public ReportController(Kaedc context)
 {
     _context = context;
 }
Esempio n. 13
0
 public CustomerController(Kaedc _db)
 {
     db = _db;
 }
Esempio n. 14
0
        //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;
        }
Esempio n. 15
0
 public ServicesController(Kaedc context)
 {
     _context = context;
 }
Esempio n. 16
0
 public TransactionController(UserManager <Kaedcuser> userManager, Kaedc _db)
 {
     _userManager = userManager;
     db           = _db;
 }