public async Task <Tuple <bool, string> > UpdateFundsTransfer(FundRequest fundRequestModel)
        {
            int requestStatus = -1;
            Tuple <bool, string> updateFundsTransferResult = null;

            try
            {
                using (SqlConnection con = new SqlConnection(_dcDb))
                {
                    var parameters = new DynamicParameters();

                    parameters.Add("@FromUserID", UserID, DbType.Int32);
                    parameters.Add("@Amount", fundRequestModel.ApprovedAmount, DbType.Decimal);
                    parameters.Add("@ToUserID", fundRequestModel.RequestToUserID, DbType.Int32);
                    parameters.Add("@CreatedBy", UserID, DbType.Int32);
                    requestStatus = await con.ExecuteScalarAsync <int>("dbo.Update_FundTransfer", parameters, commandType : CommandType.StoredProcedure);

                    if (requestStatus == 0)
                    {
                        updateFundsTransferResult = Tuple.Create(true, "Transfer funds successfully.");
                    }
                    else
                    {
                        updateFundsTransferResult = Tuple.Create(false, "Transfer funds failed.Please try again.");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                updateFundsTransferResult = Tuple.Create(false, "Oops! Transfer funds failed.Please try again.");
            }
            return(updateFundsTransferResult);
        }
        public async Task <Tuple <bool, string> > RequestFunds(FundRequest fundRequestModel)
        {
            int requestStatus = -1;
            Tuple <bool, string> requestFundsResult = null;

            try
            {
                using (SqlConnection con = new SqlConnection(_dcDb))
                {
                    var parameters = new DynamicParameters();

                    parameters.Add("@UserID", UserID, DbType.Int32);
                    parameters.Add("@RequestedAmount", fundRequestModel.RequestedAmount, DbType.Decimal);
                    parameters.Add("@RequestToUserID", fundRequestModel.RequestToUserID, DbType.Int32);
                    parameters.Add("@RequestStatusID", fundRequestModel.RequestStatusID, DbType.Int32);
                    parameters.Add("@CreatedBy", UserID, DbType.Int32);
                    requestStatus = await con.ExecuteScalarAsync <int>("dbo.Insert_FundRequest", parameters, commandType : CommandType.StoredProcedure);

                    if (requestStatus == 0)
                    {
                        requestFundsResult = Tuple.Create(true, "Your funds request successfully.");
                    }
                    else
                    {
                        requestFundsResult = Tuple.Create(false, "Your funds request failed.");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                requestFundsResult = Tuple.Create(false, "Oops! Your funds request failed.");
            }
            return(requestFundsResult);
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string      itemName = textBox1.Text;
            int         total    = int.Parse(textBox2.Text);
            FundRequest fr       = new FundRequest();

            fr.ItemName = itemName;
            fr.Total    = total;
            db.FundRequest.Add(fr);
            db.SaveChanges();
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int count = (from x in db.PurchaseRequest where x.Deleted == 0 select x).Count();

            for (int i = 0; i < count; i++)
            {
                FundRequest fr = new FundRequest();
                fr.ItemName = dataGridView1.SelectedRows[i].Cells[1].Value.ToString();
                fr.Total    = int.Parse(dataGridView1.SelectedRows[i].Cells[4].Value.ToString());
                fr.Deleted  = 0;
            }
            MessageBox.Show("Success");
        }
        public static FundRequest create(int departmentID, string information, int money)
        {
            FundRequest f = new FundRequest();

            f.DepartmentId = departmentID;
            f.Information  = information;
            f.AmountMoney  = money;
            f.Date         = DateTime.Now;
            f.Note         = "";
            f.Status       = "Pending";

            return(f);
        }
        public async Task <Tuple <bool, string> > UpdateFundsTransfer(FundRequest fundRequestModel)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _repo.UpdateFundsTransfer(fundRequestModel);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }
            return(result);
        }
        public async Task <Tuple <bool, string> > ApproveFundsRequest(FundRequest fundRequestModel)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _repo.ApproveFundsRequest(fundRequestModel);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }
            return(result);
        }
Exemplo n.º 8
0
        public void update(int staffId, int raiseTotal)
        {
            FundRequest fr = new FundRequest();

            fr.ItemName = "Raise Salary";
            fr.Total    = raiseTotal;
            fr.Deleted  = 2;

            var req = (from x in db.RaiseRequest where x.StaffId == staffId select x).FirstOrDefault();

            req.Deleted = 3;
            db.SaveChanges();

            var obj = (from x in db.Staff where x.StaffId == staffId select x).FirstOrDefault();

            obj.StaffSalary += raiseTotal;
            db.SaveChanges();
        }
Exemplo n.º 9
0
        public async Task <FundResponse> FundIn(FundRequest request)
        {
            ValidateAccountFrozenStatus();

            var transferFundRequest = new TransferFundRequest
            {
                PlayerId     = PlayerId,
                Amount       = request.Amount,
                TransferType = Mapper.Map <Core.Common.Data.TransferFundType>(request.TransferFundType),
                WalletId     = request.WalletId.ToString(),
                BonusCode    = request.BonusCode
            };

            return(new FundResponse
            {
                TransferId = await _transferFundCommands.AddFund(transferFundRequest)
            });
        }
Exemplo n.º 10
0
        /// <summary>
        /// 查询用户竞猜列表
        /// author:陶林辉
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="type">1000 全部、1001 收入、1002 支出、1010 中奖、1012 充值、1014 退款、1016 兑换、1017 投注</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页面大小</param>
        /// <returns></returns>
        public OrderList AcquireOrder(long userId, int type, int pageIndex, int pageSize)
        {
            FundRequest Fund = new FundRequest
            {
                FuserId = userId,
                Type    = type
            };
            ZhangYuRequest Request = new ZhangYuRequest();

            Request.Page = new pagerequest
            {
                PageIndex = pageIndex == 0 ? 1 : pageIndex,
                PageSize  = pageSize == 0 ? 20 : pageSize,
            };
            Request.AppKey = _options.Value.AppKey;
            Request.Data   = _sys.Base64Encode(Encoding.UTF8, JsonHelper.SerializeObject(Fund));
            Request.Sign   = _sys.Sha512Encode($"{Request.AppKey}{_options.Value.AppSecret}{Request.Data}{Request.Nonce}{Request.Timestamp}");
            string strUrl  = string.Format(_options.Value.Url, "v1", "orderList");
            string strJson = JsonHelper.SerializeObject(Request);

            _log.Info($"查询用户竞猜列表请求参数{strJson}");
            var response = JsonHelper.DeserializeJsonToObject <ZhangYuResponse>(_sys.PostJsonData(strUrl, strJson, Encoding.UTF8));

            _log.Info($"查询用户竞猜列表返回值{JsonHelper.SerializeObject(response)}");
            if (response.Code == "0")
            {
                var vResult = JsonHelper.DeserializeJsonToObject <OrderList>(_sys.Base64Decode(response.Data));
                if (vResult != null)
                {
                    vResult.Page = new PageInfo()
                    {
                        Count      = response.Page.Count,
                        PageIndex  = response.Page.PageIndex,
                        PageSize   = response.Page.PageSize,
                        PageTotal  = response.Page.PageTotal,
                        Totaltotal = response.Page.Totaltotal,
                    };
                }
                return(vResult);
            }
            return(null);
        }
 public static void add(FundRequest f)
 {
     db.FundRequests.Add(f);
     db.SaveChanges();
 }
 public void WithdrawFunds([FromBody] FundRequest fundRequest)
 {
 }
 public void AddFunds([FromBody] FundRequest fundRequest)
 {
 }
        public void add(int departmentId, string information, int money)
        {
            FundRequest f = FundRequestFactory.create(departmentId, information, money);

            FundRequestRepository.add(f);
        }
 public static void CreateFundRequest(FundRequest newFundRequest)
 {
     newFundRequest.FundStatus = "Pending Request";
     DatabaseSingleton.GetInstance().FundRequests.Add(newFundRequest);
     DatabaseSingleton.GetInstance().SaveChanges();
 }
Exemplo n.º 16
0
 public async Task <FundResponse> FundIn(FundRequest request)
 {
     return(await _memberApiProxy.FundInAsync(request));
 }
Exemplo n.º 17
0
        public async Task <FundResponse> FundInAsync(FundRequest request)
        {
            var result = await HttpClient.SecurePostAsJsonAsync(Token, "api/Payment/FundIn", request);

            return(await EnsureApiResult <FundResponse>(result));
        }