コード例 #1
0
        public async Task <bool> IsWithdrawalRequestSendByThisUser(int userId)
        {
            bool isSend = false;
            AdminApprovalNotificationModel adminApprovalNotificationModel = new AdminApprovalNotificationModel();

            Console.WriteLine("Connect to SQL Server and demo Create, Read, Update and Delete operations.");
            Console.Write("Connecting to SQL Server ... ");
            using (SqlConnection connection = new SqlConnection(this._connectionString))
            {
                connection.Open();
                Console.WriteLine("Done.");
                using (SqlCommand command = new SqlCommand("wallet_withdrawal_request_finder", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@user_id", SqlDbType.Int).Value = userId;
                    try
                    {
                        int tt = (int)await command.ExecuteScalarAsync();

                        if (tt == 1)
                        {
                            isSend = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(isSend);
        }
コード例 #2
0
        public async Task <AdminApprovalNotificationModel> AdminApprovalNotification(int userId)
        {
            AdminApprovalNotificationModel response = new AdminApprovalNotificationModel();

            response = await _common.AdminApprovalNotification(userId);

            return(response);
        }
コード例 #3
0
        public async Task <AdminApprovalNotificationModel> AdminApprovalNotification(int userId)
        {
            AdminApprovalNotificationModel adminApprovalNotificationModel = new AdminApprovalNotificationModel();

            Console.WriteLine("Connect to SQL Server and demo Create, Read, Update and Delete operations.");
            Console.Write("Connecting to SQL Server ... ");
            using (SqlConnection connection = new SqlConnection(this._connectionString))
            {
                connection.Open();
                Console.WriteLine("Done.");
                using (SqlCommand command = new SqlCommand("admin_approval_notification", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@user_id", SqlDbType.Int).Value = userId;
                    try
                    {
                        using (SqlDataReader reader = await command.ExecuteReaderAsync())
                        {
                            List <WithdrawalWalletModel> withdrawals = new List <WithdrawalWalletModel>();
                            while (reader.Read())
                            {
                                adminApprovalNotificationModel.withdrawalRequestCount = Convert.ToInt32(reader["withdrawal_request_count"]);
                            }
                            ;
                            if (reader.NextResult())
                            {
                                while (reader.Read())
                                {
                                    WithdrawalWalletModel pp = new WithdrawalWalletModel();
                                    pp.withdrawalid         = Convert.ToInt32(reader["withdrawal_id"]);
                                    pp.firstname            = Convert.ToString(reader["first_name"]);
                                    pp.middlename           = Convert.ToString(reader["middle_name"]);
                                    pp.lastname             = Convert.ToString(reader["last_name"]);
                                    pp.comment              = Convert.ToString(reader["comment"]);
                                    pp.createdon            = Convert.ToDateTime(reader["created_on"]);
                                    pp.request_initiator_id = Convert.ToInt32(reader["request_initiator_id"]);
                                    pp.wallet_balance       = Convert.ToDecimal(reader["wallet_balance"]);
                                    //pp.balance_request_type = Convert.ToString(reader["balance_request_type"]);
                                    withdrawals.Add(pp);
                                }
                            }
                            adminApprovalNotificationModel.withdrawalWalletModels = withdrawals;
                            adminApprovalNotificationModel.message = "success";
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(adminApprovalNotificationModel);
        }
コード例 #4
0
        public async Task <ActionResult> AdminApprovalNotification(int userId)
        {
            AdminApprovalNotificationModel response = await rs.AdminApprovalNotification(userId);

            return(Ok(response));
        }