Example #1
0
        public async Task <AddDeductWallet> UpdateWalletAddDeduct(AddDeductWallet withdrawalWalletModel)
        {
            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_add_deduct_update", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@balance_request_id", SqlDbType.Int).Value     = withdrawalWalletModel.addwalletid;
                    command.Parameters.Add("@is_approve", SqlDbType.Bit).Value             = withdrawalWalletModel.approved;
                    command.Parameters.Add("@is_rejected", SqlDbType.Bit).Value            = withdrawalWalletModel.rejected;
                    command.Parameters.Add("@approver_comment", SqlDbType.NVarChar).Value  = withdrawalWalletModel.admin_comment;
                    command.Parameters.Add("@mode_of_operation", SqlDbType.NVarChar).Value = withdrawalWalletModel.balance_request_type;
                    command.Parameters.Add("@return_message", SqlDbType.NVarChar, 1233232);
                    command.Parameters["@return_message"].Direction = ParameterDirection.Output;
                    try
                    {
                        await command.ExecuteNonQueryAsync();

                        {
                            var message = (string)command.Parameters["@return_message"].Value;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(withdrawalWalletModel);
        }
        public async Task <List <AddDeductWallet> > UpdateWalletAddDeduct(List <AddDeductWallet> withdrawalWalletModels)
        {
            foreach (AddDeductWallet withdrawalWalletModel in withdrawalWalletModels)
            {
                AddDeductWallet response = await _common.UpdateWalletAddDeduct(withdrawalWalletModel);
            }


            return(withdrawalWalletModels);
        }
Example #3
0
        public async Task <AdminWalletAddDeductApprovalNotificationModel> AdminAddDeductWalletApprovalNotification(int userId)
        {
            AdminWalletAddDeductApprovalNotificationModel adminApprovalNotificationModel = new AdminWalletAddDeductApprovalNotificationModel();

            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_wallet_add_deduct_approval_notification", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@user_id", SqlDbType.Int).Value = userId;
                    try
                    {
                        using (SqlDataReader reader = await command.ExecuteReaderAsync())
                        {
                            List <AddDeductWallet> withdrawals = new List <AddDeductWallet>();
                            while (reader.Read())
                            {
                                adminApprovalNotificationModel.addRequestCount = Convert.ToInt32(reader["withdrawal_request_count"]);
                            }
                            ;
                            if (reader.NextResult())
                            {
                                while (reader.Read())
                                {
                                    AddDeductWallet pp = new AddDeductWallet();
                                    pp.addwalletid          = Convert.ToInt32(reader["balance_request_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["amount"]);
                                    pp.balance_request_type = Convert.ToString(reader["balance_request_type"]);
                                    withdrawals.Add(pp);
                                }
                            }
                            adminApprovalNotificationModel.addDeductWalletModels = withdrawals;
                            adminApprovalNotificationModel.message = "success";
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(adminApprovalNotificationModel);
        }