コード例 #1
0
ファイル: ExtraMethods.cs プロジェクト: brinq-africa/kaedc
        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();
        }
コード例 #2
0
 public LoginModel(SignInManager <Kaedcuser> signInManager, ILogger <LoginModel> logger, UserManager <Kaedcuser> userManager, Kaedc context)
 {
     _signInManager = signInManager;
     _logger        = logger;
     _context       = context;
     _userManager   = userManager;
 }
コード例 #3
0
ファイル: ExtraMethods.cs プロジェクト: brinq-africa/kaedc
        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);
        }
コード例 #4
0
ファイル: ExtraMethods.cs プロジェクト: brinq-africa/kaedc
        public static int GenerateId()
        {
            Kaedc db     = new Kaedc();
            var   lastId = db.Transaction.LastOrDefault().Id + 1;

            return(lastId);
        }
コード例 #5
0
        public IActionResult addcustomer()
        {
            Kaedc db = new Kaedc();

            ViewBag.ROLES = db.Roles.ToList();
            return(View());
        }
コード例 #6
0
        public IActionResult customerList()
        {
            Kaedc db = new Kaedc();

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