コード例 #1
0
 public GameConnection(Session session)
 {
     _session    = session;
     Characters  = new Dictionary <uint, Character>();
     Subscribers = new List <IDisposable>();
     Payment     = new AccountPayment(this);
 }
コード例 #2
0
        public ActionResult RegisterPayment(double?accountNumber, string accountName, string phone)
        {
            var res = _db.AccountPayments.Where(x => x.accountNumber == accountNumber).ToList();

            if (res.Count > 0)
            {
                return(Redirect("/loi-dang-ky"));
            }
            else
            {
                List <BigInteger> khoa = sig.TaoKhoa();

                var acc = new AccountPayment();
                acc.accountNumber  = accountNumber;
                acc.accountName    = accountName;
                acc.accountBalance = 100000000;//Cho số dư tài khoản là 100tr
                acc.phone          = phone;
                //Tạo khóa công khai
                acc.so_p = khoa[1].ToString();
                acc.so_t = khoa[2].ToString();
                acc.so_q = khoa[3].ToString();

                //Tạo khóa bí mật và mã hóa
                acc.pri_key = sig.Encrypt_MD5(khoa[0].ToString());

                acc.status = true;
                _db.AccountPayments.Add(acc);
                _db.SaveChanges();
                return(Redirect("/dang-ky-thanh-cong"));
            }
        }
コード例 #3
0
        public AccountPayment AddAccountPayment(AccountPayment Value)
        {
            try
            {
                //get latest account payment expiration
                var LatestAccountPayment = db.AccountPayments.Where(x => x.UserId == Value.UserId).OrderByDescending(x => x.ExpirationDate).FirstOrDefault();

                //set expiration date based on user
                if (LatestAccountPayment != null && LatestAccountPayment.ExpirationDate > DateTime.Now)
                {
                    Value.ExpirationDate = LatestAccountPayment.ExpirationDate.AddMonths(1);
                }
                else
                {
                    //if latestaccount payment doesn't exist
                    Value.ExpirationDate = DateTime.Now.AddMonths(1);
                }

                db.AccountPayments.Add(Value);
                db.SaveChanges();

                return(Value);
            }
            catch (Exception ex)
            {
                throw Utility.ThrowException(ex);
            }
        }
コード例 #4
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DateTime dt = DateTime.Parse(txtDate.Text);

        if(dt.CompareTo(System.DateTime.Today) > 0)
        {
            ErrorMessage.Text = "Received date should not be greater than today.";
            return;
        }

        AccountAdmin accountAdmin = new AccountAdmin();
        AccountPayment entity = new AccountPayment();

        if(ItemId > 0)
            entity = accountAdmin.GetByAccountPaymentId(ItemId);

        entity.AccountID = AccountId;
        entity.Amount = decimal.Parse(txtAmount.Text.Trim());
        entity.Description = txtDescription.Text.Trim();
        entity.ReceivedDate = dt;

        bool status = accountAdmin.AddAffiliatePayment(entity);

        if (status)
        {
            Response.Redirect(_ViewPageLink + AccountId);
        }
        else
        {
            ErrorMessage.Text = "";
        }
    }
コード例 #5
0
ファイル: SPAccountPayment.cs プロジェクト: sun2dar/MKCRMApi
        public KeyValuePair <int, String> AccountPayment_Delete(AccountPayment model)
        {
            var param = new SqlParameter[] {
                new SqlParameter("@AccountPaymentID", SqlDbType.UniqueIdentifier)
                {
                    Value = model.AccountPaymentID
                },
                new SqlParameter("@ModifiedBy", SqlDbType.UniqueIdentifier)
                {
                    Value = model.ModifiedBy
                },
                new SqlParameter("@RetVal", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@Message", SqlDbType.NVarChar, 100)
                {
                    Direction = ParameterDirection.Output
                }
            };

            int rc = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("exec [CRM].[AccountPayment_Delete] @AccountPaymentID, @ModifiedBy, @RetVal out, @Message out", param);

            int    retVal   = (int)param[2].Value;
            string valueRes = param[3].Value.ToString();

            return(new KeyValuePair <int, string>(retVal, valueRes));
        }
コード例 #6
0
        public ActionResult formSubmit(AccountPayment model, string actionType)
        {
            List <string> errorMessage   = new List <string>();
            SessionForSP  sessionParam   = new SessionForSP();
            string        successMessage = Resources.NotifResource.RequestSuccess;

            if (ModelState.IsValid)
            {
                KeyValuePair <int, string> results = new KeyValuePair <int, string>(1, "");
                model.ModifiedBy = new Guid(Session["CurrentUserID"].ToString());

                if (actionType == "Create")
                {
                    model.AccountPaymentID      = Guid.NewGuid();
                    sessionParam.OrganizationID = new Guid(Session["OrganizationID"].ToString());
                    results = db.AccountPayment_Insert(model, sessionParam);
                }
                else if (actionType == "Edit")
                {
                    results = db.AccountPayment_Update(model);
                }
                else if (actionType == "ChangeStatus")
                {
                    results = db.AccountPayment_ChangeStatus(model);
                }
                else if (actionType == "Delete")
                {
                    results = db.AccountPayment_Delete(model);
                }

                if (results.Key == 0 || results.Key == 16 || results.Key == 6)
                {
                    UrlHelper u      = new UrlHelper(this.ControllerContext.RequestContext);
                    string    url    = u.Action("Edit", "AccountPayment", new { id = model.AccountPaymentID, success = successMessage });
                    string    urlNew = u.Action("Create", "AccountPayment");

                    var jsonData = new { flag = true, Message = url, urlNew = urlNew };
                    return(Json(jsonData));
                }
                else
                {
                    var jsonData = new { flag = false, Message = results.Value.ToString() };
                    return(Json(jsonData));
                }
            }
            else
            {
                foreach (var key in ModelState.Keys)
                {
                    var error = ModelState[key].Errors.FirstOrDefault();
                    if (error != null)
                    {
                        errorMessage.Add(error.ErrorMessage);
                    }
                }
                var jsonData = new { flag = false, Message = errorMessage.First() };
                return(Json(jsonData));
            }
        }
コード例 #7
0
 public void Insert(AccountPayment t)
 {
     using (RestoranDBEntities db = new RestoranDBEntities())
     {
         db.AccountPayments.Add(t);
         db.SaveChanges();
     }
 }
コード例 #8
0
 public void Update(AccountPayment t)
 {
     using (RestoranDBEntities db = new RestoranDBEntities())
     {
         db.AccountPayments.Attach(t);
         db.Entry(t).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
コード例 #9
0
        public ActionResult DangKy(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                var us = new User();
                if (us.CheckUserName(model.username))
                {
                    ViewBag.Success = "Tên đăng nhập đã tồn tại!";
                }
                //else if (us.CheckEmail(model.email))
                //{
                //    ViewBag.Success = "Email đã tồn tại!";
                //}
                else
                {
                    var user = new DangNhap();
                    user.username      = model.username;
                    user.password      = model.password;
                    user.name          = model.name;
                    user.accountNumber = model.accountNumber;
                    user.countOrder    = 0;
                    user.amountSpent   = 0;
                    user.status        = true;

                    var acc = new AccountPayment();
                    acc.accountNumber  = model.accountNumber;
                    acc.accountName    = model.name.ToUpper();
                    acc.accountBalance = 100000000;

                    //Tạo khóa công khai
                    List <BigInteger> khoa = sig.TaoKhoa();
                    acc.so_p = khoa[1].ToString().Trim();
                    acc.so_t = khoa[2].ToString().Trim();
                    acc.so_q = khoa[3].ToString().Trim();

                    //Tạo khóa bí mật và mã hóa
                    acc.pri_key = sig.Encrypt_MD5(khoa[0].ToString());

                    acc.status = true;
                    _db.AccountPayments.Add(acc);
                    _db.SaveChanges();

                    var result = us.Insert(user);
                    if (result)
                    {
                        ViewBag.Success = "Đăng ký thành công";
                        model           = new RegisterModel();
                        return(Redirect("/dang-nhap"));
                    }
                    else
                    {
                        ViewBag.Success = "Đăng ký không thành công!";
                    }
                }
            }
            return(View(model));
        }
コード例 #10
0
        private AccountPayment CreateORetrieveStripeAccount(IlevusUser professionalUser)
        {
            AccountPayment accountStripe = null;

            if (professionalUser.Professional.AccountPayment == null)
            {
                accountStripe = CreateAccount(professionalUser);
                professionalUser.Professional.AccountPayment = accountStripe;
                UserManager.Update(professionalUser);
            }

            return(professionalUser.Professional.AccountPayment);
        }
コード例 #11
0
        public void MakePayment(HireServiceModel model, IlevusUserManager userManager)
        {
            UserManager = userManager;
            IlevusUser professionalUser = RetrieveUserByService(model.service.Id);

            UserService servicoToHire = professionalUser.Professional.Services.FirstOrDefault(x => x.Id == model.service.Id);

            BuyAService(servicoToHire, model);

            // Verificando se o profissional ja tem conta no stripe. se nao tem se cria.
            AccountPayment accountStripe = CreateORetrieveStripeAccount(professionalUser);

            TransferToProfessional(servicoToHire.Price, accountStripe);
        }
コード例 #12
0
        public GameConnection(Session session)
        {
            _session    = session;
            Subscribers = new List <IDisposable>();

            Characters = new Dictionary <uint, Character>();
            Houses     = new Dictionary <uint, House>();
            Payment    = new AccountPayment(this);

            //шифрация пакетов
            CryptRsa       = new CryptRSA();
            DecryptCs      = new DecryptCs();
            EncryptSc      = new EncryptSc();
            EncryptSc.MNum = 0;
        }
コード例 #13
0
        private static void TransferToProfessional(double priceService, AccountPayment accountStripe)
        {
            var valueIlevus = Math.Round(priceService, 2);
            // Faco a transferencia para o professional.
            var transferOptions = new StripeTransferCreateOptions()
            {
                Amount = Int32.Parse(valueIlevus.ToString()
                                     .Replace(",", string.Empty)
                                     .Replace(".", string.Empty)),
                Currency      = "brl",
                Destination   = accountStripe.Id,
                TransferGroup = "{ORDER10}",
            };

            var transferService = new StripeTransferService();

            transferService.Create(transferOptions);
        }
コード例 #14
0
        public HttpResponseMessage SubmitAccountPayment(string AuthToken, int UserId, int AccountTypeId, string Nonce, string DiscountCode = null)
        {
            try
            {
                //authenticate user
                var User = UserRepository.RefreshAuthToken(AuthToken);

                if (UserId != User.Id)
                {
                    throw new Exception("Unauthorized");
                }

                decimal Amount = AccountPaymentsRepository.GetAmount(AccountTypeId, DiscountCode);

                //create new account payment entity
                AccountPayment AccountPayment = new AccountPayment();
                AccountPayment.UserId         = UserId;
                AccountPayment.Amount         = Amount;
                AccountPayment.IdempotencyKey = Guid.NewGuid().ToString();
                AccountPayment.Nonce          = Nonce;

                //bill
                AccountPayment.SquarePaymentId = Payments.Bill(AccountPayment.IdempotencyKey, Nonce, (long)Amount * 100);

                //successful billing
                AccountPayment.PaymentDate = DateTime.Now;

                //set expiratin date
                //AccountPayment.ExpirationDate = DateTime.Today.AddMonths(1).AddDays(1);

                //add to database
                AccountPaymentsRepository.AddAccountPayment(AccountPayment);

                //change account type
                UserRepository.ChangeAccountType(UserId, AccountTypeId);

                return(OKResponse(true));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }
コード例 #15
0
        public ActionResult Create()
        {
            AccountPayment model = new AccountPayment();

            return(View(model));
        }
コード例 #16
0
ファイル: SPAccountPayment.cs プロジェクト: sun2dar/MKCRMApi
        public KeyValuePair <int, String> AccountPayment_Update(AccountPayment model)
        {
            var param = new SqlParameter[] {
                new SqlParameter("@AccountPaymentID", SqlDbType.UniqueIdentifier)
                {
                    Value = CheckForDbNull(model.AccountPaymentID)
                },
                new SqlParameter("@ModifiedBy", SqlDbType.UniqueIdentifier)
                {
                    Value = model.ModifiedBy
                },
                new SqlParameter("@NamaPerusahaan", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.NamaPerusahaan)
                },
                new SqlParameter("@JenisPembayaran", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.JenisPembayaran)
                },
                new SqlParameter("@KodePerusahaan", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.KodePerusahaan)
                },
                new SqlParameter("@NoRekPerusahaan", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.NoRekPerusahaan)
                },
                new SqlParameter("@CabangKoordinator", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.CabangKoordinator)
                },
                new SqlParameter("@JenisKerjasama", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.JenisKerjasama)
                },
                new SqlParameter("@AlurTransaksiATM", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.AlurTransaksiATM)
                },
                new SqlParameter("@EBanking", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.EBanking)
                },
                new SqlParameter("@SandiPerusahaanMBCA", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.SandiPerusahaanMBCA)
                },
                new SqlParameter("@Limit", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.Limit)
                },
                new SqlParameter("@DenominasiVoucher", SqlDbType.NVarChar, 200)
                {
                    Value = CheckForDbNull(model.DenominasiVoucher)
                },
                new SqlParameter("@RetVal", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                },
                new SqlParameter("@Message", SqlDbType.NVarChar, 100)
                {
                    Direction = ParameterDirection.Output
                }
            };

            int rc = ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreCommand("exec [CRM].[AccountPayment_Update] @AccountPaymentID, @ModifiedBy, @NamaPerusahaan, @JenisPembayaran, @KodePerusahaan, @NoRekPerusahaan, @CabangKoordinator, @JenisKerjasama, @AlurTransaksiATM, @EBanking, @SandiPerusahaanMBCA, @Limit, @DenominasiVoucher, @RetVal out, @Message out", param);

            int    retVal   = (int)param[13].Value;
            string valueRes = param[14].Value.ToString();

            return(new KeyValuePair <int, string>(retVal, valueRes));
        }
コード例 #17
0
        public ActionResult Edit(Guid id)
        {
            AccountPayment model = db.accountPayment.Find(id);

            return(View(model));
        }
コード例 #18
0
 public ActionResult Edit(AccountPayment model)
 {
     return(formSubmit(model, "Edit"));
 }
コード例 #19
0
 public ActionResult ChangeStatus(AccountPayment model)
 {
     return(formSubmit(model, "ChangeStatus"));
 }
コード例 #20
0
 public ActionResult Delete(AccountPayment model)
 {
     return(formSubmit(model, "Delete"));
 }
コード例 #21
0
 public void Delete(AccountPayment t)
 {
     throw new NotImplementedException();
 }